DBD-MariaDB

 view release on metacpan or  search on metacpan

lib/DBD/MariaDB.pod  view on Meta::CPAN

          'ORDINAL_POSITION' => '4',
          'PROCESSLIST_ID'   => '3',
      },
      'foo' => {
          'ATTR_NAME'        => 'foo',
          'ATTR_VALUE'       => 'bar',
          'ORDINAL_POSITION' => '6',
          'PROCESSLIST_ID'   => '3',
      },
      'program_name' => {
          'ATTR_VALUE'       => './foo.pl',
          'ATTR_NAME'        => 'program_name',
          'ORDINAL_POSITION' => '5',
          'PROCESSLIST_ID'   => '3',
      },
      'wiz' => {
          'ATTR_VALUE'       => 'bang',
          'ATTR_NAME'        => 'wiz',
          'ORDINAL_POSITION' => '3',
          'PROCESSLIST_ID'   => '3',
      },
  };

=back

=item data_sources

  use DBI;
  my @dsns = DBI->data_sources('MariaDB', {
      host => $hostname,
      port => $port,
      user => $username,
      password => $password,
      ...
  });

Returns a list of all databases in dsn format suitable for L<connect|/connect>
method, managed by the MariaDB or MySQL server. It accepts all attributes from
L<connect|/connect> method.

=back

=head1 DATABASE HANDLES

The DBD::MariaDB driver supports the following attributes of database handles
(read only):

  my $errno = $dbh->{'mariadb_errno'};
  my $error = $dbh->{'mariadb_error'};
  my $hostinfo = $dbh->{'mariadb_hostinfo'};
  my $info = $dbh->{'mariadb_info'};
  my $insertid = $dbh->{'mariadb_insertid'};
  my $protoinfo = $dbh->{'mariadb_protoinfo'};
  my $serverinfo = $dbh->{'mariadb_serverinfo'};
  my $ssl_cipher = $dbh->{'mariadb_ssl_cipher'};
  my $stat = $dbh->{'mariadb_stat'};
  my $thread_id = $dbh->{'mariadb_thread_id'};

These correspond to C<mysql_errno()>, C<mysql_error()>,
C<mysql_get_host_info()>, C<mysql_info()>, C<mysql_insert_id()>,
C<mysql_get_proto_info()>, C<mysql_get_server_info()>, C<mysql_stat()>,
C<mysql_get_ssl_cipher()> and C<mysql_thread_id()> respectively.

Portable DBI applications should not use them. Instead they should use standard
DBI methods: L<C<< $dbh->err() >>|DBI/err> and
L<C<< $dbh->errstr() >>|DBI/errstr> for error number and string,
C<< $dbh->get_info($GetInfoType{SQL_SERVER_NAME}) >> for server host name,
C<< $dbh->get_info($GetInfoType{SQL_DBMS_NAME}) >> and
C<< $dbh->get_info($GetInfoType{SQL_DBMS_VER}) >> for server database name and
version, L<C<< $dbh->last_insert_id() >>|DBI/last_insert_id> or
C<< $sth->last_insert_id() >> for insert id.

=over 2

=item mariadb_clientinfo

=item mariadb_clientversion

List information of the MariaDB or MySQL client library that DBD::MariaDB was
built against:

  print "$dbh->{mariadb_clientinfo}\n";

  5.2.0-MariaDB

  print "$dbh->{mariadb_clientversion}\n";

  50200

Portable DBI applications should not be interested in version of underlying
client library. DBD::MariaDB is there to hide any possible incompatibility and
works correctly with any available version.

=item mariadb_serverversion

  print "$dbh->{mariadb_serverversion}\n";

  50200

Portable DBI applications should use
C<< $dbh->get_info($GetInfoType{SQL_DBMS_NAME}) >> and
C<< $dbh->get_info($GetInfoType{SQL_DBMS_VER}) >> for server database name and
version instead.

=item mariadb_ssl_cipher

Returns the SSL encryption cipher used for the given connection to the server.
In case SSL encryption was not enabled with L<I<mariadb_ssl>|/mariadb_ssl> or
was not established returns C<undef>.

  my $ssl_cipher = $dbh->{mariadb_ssl_cipher};
  if (defined $ssl_cipher) {
      print "Connection with server is encrypted with cipher: $ssl_cipher\n";
  } else {
      print "Connection with server is not encrypted\n";
  }

=item mariadb_dbd_stats

  my $info_hashref = $dbh->{mariadb_dbd_stats};



( run in 0.582 second using v1.01-cache-2.11-cpan-39bf76dae61 )