common/tools/lib/DBD/mysql.pm
author Brendan Donegan <brendand@symbian.org>
Thu, 22 Jul 2010 16:52:28 +0100
changeset 1189 94d03733c245
parent 1174 ead96bc104ea
permissions -rw-r--r--
Added j and k switches to smoketest build
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1174
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     1
#   -*- cperl -*-
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     2
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     3
package DBD::mysql;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     4
use strict;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     5
use vars qw(@ISA $VERSION $err $errstr $drh);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     6
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     7
use DBI ();
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     8
use DynaLoader();
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     9
use Carp ();
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    10
@ISA = qw(DynaLoader);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    11
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    12
$VERSION = '4.014';
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    13
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    14
bootstrap DBD::mysql $VERSION;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    15
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    16
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    17
$err = 0;	# holds error code   for DBI::err
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    18
$errstr = "";	# holds error string for DBI::errstr
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    19
$drh = undef;	# holds driver handle once initialised
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    20
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    21
sub driver{
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    22
    return $drh if $drh;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    23
    my($class, $attr) = @_;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    24
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    25
    $class .= "::dr";
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    26
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    27
    # not a 'my' since we use it above to prevent multiple drivers
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    28
    $drh = DBI::_new_drh($class, { 'Name' => 'mysql',
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    29
				   'Version' => $VERSION,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    30
				   'Err'    => \$DBD::mysql::err,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    31
				   'Errstr' => \$DBD::mysql::errstr,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    32
				   'Attribution' => 'DBD::mysql by Patrick Galbraith'
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    33
				 });
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    34
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    35
    $drh;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    36
}
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    37
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    38
sub CLONE {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    39
  undef $drh;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    40
}
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    41
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    42
sub _OdbcParse($$$) {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    43
    my($class, $dsn, $hash, $args) = @_;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    44
    my($var, $val);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    45
    if (!defined($dsn)) {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    46
	return;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    47
    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    48
    while (length($dsn)) {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    49
	if ($dsn =~ /([^:;]*)[:;](.*)/) {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    50
	    $val = $1;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    51
	    $dsn = $2;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    52
	} else {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    53
	    $val = $dsn;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    54
	    $dsn = '';
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    55
	}
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    56
	if ($val =~ /([^=]*)=(.*)/) {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    57
	    $var = $1;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    58
	    $val = $2;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    59
	    if ($var eq 'hostname'  ||  $var eq 'host') {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    60
		$hash->{'host'} = $val;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    61
	    } elsif ($var eq 'db'  ||  $var eq 'dbname') {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    62
		$hash->{'database'} = $val;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    63
	    } else {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    64
		$hash->{$var} = $val;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    65
	    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    66
	} else {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    67
	    foreach $var (@$args) {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    68
		if (!defined($hash->{$var})) {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    69
		    $hash->{$var} = $val;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    70
		    last;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    71
		}
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    72
	    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    73
	}
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    74
    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    75
}
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    76
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    77
sub _OdbcParseHost ($$) {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    78
    my($class, $dsn) = @_;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    79
    my($hash) = {};
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    80
    $class->_OdbcParse($dsn, $hash, ['host', 'port']);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    81
    ($hash->{'host'}, $hash->{'port'});
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    82
}
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    83
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    84
sub AUTOLOAD {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    85
    my ($meth) = $DBD::mysql::AUTOLOAD;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    86
    my ($smeth) = $meth;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    87
    $smeth =~ s/(.*)\:\://;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    88
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    89
    my $val = constant($smeth, @_ ? $_[0] : 0);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    90
    if ($! == 0) { eval "sub $meth { $val }"; return $val; }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    91
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    92
    Carp::croak "$meth: Not defined";
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    93
}
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    94
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    95
1;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    96
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    97
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    98
package DBD::mysql::dr; # ====== DRIVER ======
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    99
use strict;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   100
use DBI qw(:sql_types);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   101
use DBI::Const::GetInfoType;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   102
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   103
sub connect {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   104
    my($drh, $dsn, $username, $password, $attrhash) = @_;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   105
    my($port);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   106
    my($cWarn);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   107
    my $connect_ref= { 'Name' => $dsn };
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   108
    my $dbi_imp_data;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   109
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   110
    # Avoid warnings for undefined values
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   111
    $username ||= '';
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   112
    $password ||= '';
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   113
    $attrhash ||= {};
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   114
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   115
    # create a 'blank' dbh
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   116
    my($this, $privateAttrHash) = (undef, $attrhash);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   117
    $privateAttrHash = { %$privateAttrHash,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   118
	'Name' => $dsn,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   119
	'user' => $username,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   120
	'password' => $password
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   121
    };
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   122
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   123
    DBD::mysql->_OdbcParse($dsn, $privateAttrHash,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   124
				    ['database', 'host', 'port']);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   125
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   126
    
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   127
    if ($DBI::VERSION >= 1.49)
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   128
    {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   129
      $dbi_imp_data = delete $attrhash->{dbi_imp_data};
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   130
      $connect_ref->{'dbi_imp_data'} = $dbi_imp_data;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   131
    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   132
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   133
    if (!defined($this = DBI::_new_dbh($drh,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   134
            $connect_ref,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   135
            $privateAttrHash)))
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   136
    {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   137
      return undef;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   138
    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   139
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   140
    # Call msqlConnect func in mSQL.xs file
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   141
    # and populate internal handle data.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   142
    DBD::mysql::db::_login($this, $dsn, $username, $password)
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   143
	  or $this = undef;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   144
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   145
    if ($this && ($ENV{MOD_PERL} || $ENV{GATEWAY_INTERFACE})) {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   146
        $this->{mysql_auto_reconnect} = 1;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   147
    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   148
    $this;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   149
}
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   150
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   151
sub data_sources {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   152
    my($self) = shift;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   153
    my($attributes) = shift;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   154
    my($host, $port, $user, $password) = ('', '', '', '');
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   155
    if ($attributes) {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   156
      $host = $attributes->{host} || '';
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   157
      $port = $attributes->{port} || '';
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   158
      $user = $attributes->{user} || '';
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   159
      $password = $attributes->{password} || '';
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   160
    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   161
    my(@dsn) = $self->func($host, $port, $user, $password, '_ListDBs');
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   162
    my($i);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   163
    for ($i = 0;  $i < @dsn;  $i++) {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   164
	$dsn[$i] = "DBI:mysql:$dsn[$i]";
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   165
    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   166
    @dsn;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   167
}
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   168
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   169
sub admin {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   170
    my($drh) = shift;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   171
    my($command) = shift;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   172
    my($dbname) = ($command eq 'createdb'  ||  $command eq 'dropdb') ?
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   173
	shift : '';
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   174
    my($host, $port) = DBD::mysql->_OdbcParseHost(shift(@_) || '');
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   175
    my($user) = shift || '';
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   176
    my($password) = shift || '';
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   177
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   178
    $drh->func(undef, $command,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   179
	       $dbname || '',
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   180
	       $host || '',
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   181
	       $port || '',
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   182
	       $user, $password, '_admin_internal');
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   183
}
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   184
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   185
package DBD::mysql::db; # ====== DATABASE ======
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   186
use strict;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   187
use DBI qw(:sql_types);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   188
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   189
%DBD::mysql::db::db2ANSI = ("INT"   =>  "INTEGER",
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   190
			   "CHAR"  =>  "CHAR",
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   191
			   "REAL"  =>  "REAL",
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   192
			   "IDENT" =>  "DECIMAL"
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   193
                          );
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   194
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   195
### ANSI datatype mapping to mSQL datatypes
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   196
%DBD::mysql::db::ANSI2db = ("CHAR"          => "CHAR",
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   197
			   "VARCHAR"       => "CHAR",
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   198
			   "LONGVARCHAR"   => "CHAR",
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   199
			   "NUMERIC"       => "INTEGER",
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   200
			   "DECIMAL"       => "INTEGER",
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   201
			   "BIT"           => "INTEGER",
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   202
			   "TINYINT"       => "INTEGER",
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   203
			   "SMALLINT"      => "INTEGER",
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   204
			   "INTEGER"       => "INTEGER",
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   205
			   "BIGINT"        => "INTEGER",
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   206
			   "REAL"          => "REAL",
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   207
			   "FLOAT"         => "REAL",
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   208
			   "DOUBLE"        => "REAL",
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   209
			   "BINARY"        => "CHAR",
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   210
			   "VARBINARY"     => "CHAR",
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   211
			   "LONGVARBINARY" => "CHAR",
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   212
			   "DATE"          => "CHAR",
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   213
			   "TIME"          => "CHAR",
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   214
			   "TIMESTAMP"     => "CHAR"
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   215
			  );
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   216
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   217
sub prepare {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   218
    my($dbh, $statement, $attribs)= @_;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   219
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   220
    # create a 'blank' dbh
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   221
    my $sth = DBI::_new_sth($dbh, {'Statement' => $statement});
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   222
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   223
    # Populate internal handle data.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   224
    if (!DBD::mysql::st::_prepare($sth, $statement, $attribs)) {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   225
	$sth = undef;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   226
    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   227
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   228
    $sth;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   229
}
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   230
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   231
sub db2ANSI {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   232
    my $self = shift;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   233
    my $type = shift;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   234
    return $DBD::mysql::db::db2ANSI{"$type"};
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   235
}
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   236
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   237
sub ANSI2db {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   238
    my $self = shift;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   239
    my $type = shift;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   240
    return $DBD::mysql::db::ANSI2db{"$type"};
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   241
}
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   242
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   243
sub admin {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   244
    my($dbh) = shift;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   245
    my($command) = shift;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   246
    my($dbname) = ($command eq 'createdb'  ||  $command eq 'dropdb') ?
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   247
	shift : '';
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   248
    $dbh->{'Driver'}->func($dbh, $command, $dbname, '', '', '',
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   249
			   '_admin_internal');
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   250
}
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   251
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   252
sub _SelectDB ($$) {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   253
    die "_SelectDB is removed from this module; use DBI->connect instead.";
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   254
}
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   255
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   256
sub table_info ($) {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   257
  my ($dbh, $catalog, $schema, $table, $type, $attr) = @_;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   258
  $dbh->{mysql_server_prepare}||= 0;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   259
  my $mysql_server_prepare_save= $dbh->{mysql_server_prepare};
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   260
  $dbh->{mysql_server_prepare}= 0;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   261
  my @names = qw(TABLE_CAT TABLE_SCHEM TABLE_NAME TABLE_TYPE REMARKS);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   262
  my @rows;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   263
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   264
  my $sponge = DBI->connect("DBI:Sponge:", '','')
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   265
    or return $dbh->DBI::set_err($DBI::err, "DBI::Sponge: $DBI::errstr");
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   266
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   267
# Return the list of catalogs
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   268
  if (defined $catalog && $catalog eq "%" &&
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   269
      (!defined($schema) || $schema eq "") &&
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   270
      (!defined($table) || $table eq ""))
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   271
  {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   272
    @rows = (); # Empty, because MySQL doesn't support catalogs (yet)
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   273
  }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   274
  # Return the list of schemas
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   275
  elsif (defined $schema && $schema eq "%" &&
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   276
      (!defined($catalog) || $catalog eq "") &&
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   277
      (!defined($table) || $table eq ""))
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   278
  {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   279
    my $sth = $dbh->prepare("SHOW DATABASES")
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   280
      or ($dbh->{mysql_server_prepare}= $mysql_server_prepare_save && 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   281
          return undef);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   282
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   283
    $sth->execute()
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   284
      or ($dbh->{mysql_server_prepare}= $mysql_server_prepare_save && 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   285
        return DBI::set_err($dbh, $sth->err(), $sth->errstr()));
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   286
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   287
    while (my $ref = $sth->fetchrow_arrayref())
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   288
    {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   289
      push(@rows, [ undef, $ref->[0], undef, undef, undef ]);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   290
    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   291
  }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   292
  # Return the list of table types
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   293
  elsif (defined $type && $type eq "%" &&
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   294
      (!defined($catalog) || $catalog eq "") &&
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   295
      (!defined($schema) || $schema eq "") &&
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   296
      (!defined($table) || $table eq ""))
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   297
  {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   298
    @rows = (
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   299
        [ undef, undef, undef, "TABLE", undef ],
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   300
        [ undef, undef, undef, "VIEW",  undef ],
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   301
        );
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   302
  }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   303
  # Special case: a catalog other than undef, "", or "%"
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   304
  elsif (defined $catalog && $catalog ne "" && $catalog ne "%")
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   305
  {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   306
    @rows = (); # Nothing, because MySQL doesn't support catalogs yet.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   307
  }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   308
  # Uh oh, we actually have a meaty table_info call. Work is required!
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   309
  else
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   310
  {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   311
    my @schemas;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   312
    # If no table was specified, we want them all
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   313
    $table ||= "%";
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   314
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   315
    # If something was given for the schema, we need to expand it to
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   316
    # a list of schemas, since it may be a wildcard.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   317
    if (defined $schema && $schema ne "")
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   318
    {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   319
      my $sth = $dbh->prepare("SHOW DATABASES LIKE " .
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   320
          $dbh->quote($schema))
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   321
        or ($dbh->{mysql_server_prepare}= $mysql_server_prepare_save && 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   322
        return undef);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   323
      $sth->execute()
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   324
        or ($dbh->{mysql_server_prepare}= $mysql_server_prepare_save && 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   325
        return DBI::set_err($dbh, $sth->err(), $sth->errstr()));
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   326
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   327
      while (my $ref = $sth->fetchrow_arrayref())
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   328
      {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   329
        push @schemas, $ref->[0];
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   330
      }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   331
    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   332
    # Otherwise we want the current database
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   333
    else
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   334
    {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   335
      push @schemas, $dbh->selectrow_array("SELECT DATABASE()");
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   336
    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   337
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   338
    # Figure out which table types are desired
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   339
    my ($want_tables, $want_views);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   340
    if (defined $type && $type ne "")
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   341
    {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   342
      $want_tables = ($type =~ m/table/i);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   343
      $want_views  = ($type =~ m/view/i);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   344
    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   345
    else
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   346
    {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   347
      $want_tables = $want_views = 1;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   348
    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   349
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   350
    for my $database (@schemas)
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   351
    {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   352
      my $sth = $dbh->prepare("SHOW /*!50002 FULL*/ TABLES FROM " .
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   353
          $dbh->quote_identifier($database) .
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   354
          " LIKE " .  $dbh->quote($table))
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   355
          or ($dbh->{mysql_server_prepare}= $mysql_server_prepare_save && 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   356
          return undef);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   357
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   358
      $sth->execute() or
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   359
          ($dbh->{mysql_server_prepare}= $mysql_server_prepare_save &&
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   360
          return DBI::set_err($dbh, $sth->err(), $sth->errstr()));
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   361
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   362
      while (my $ref = $sth->fetchrow_arrayref())
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   363
      {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   364
        my $type = (defined $ref->[1] &&
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   365
            $ref->[1] =~ /view/i) ? 'VIEW' : 'TABLE';
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   366
        next if $type eq 'TABLE' && not $want_tables;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   367
        next if $type eq 'VIEW'  && not $want_views;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   368
        push @rows, [ undef, $database, $ref->[0], $type, undef ];
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   369
      }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   370
    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   371
  }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   372
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   373
  my $sth = $sponge->prepare("table_info",
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   374
  {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   375
    rows          => \@rows,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   376
    NUM_OF_FIELDS => scalar @names,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   377
    NAME          => \@names,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   378
  }) 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   379
    or ($dbh->{mysql_server_prepare}= $mysql_server_prepare_save && 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   380
      return $dbh->DBI::set_err($sponge->err(), $sponge->errstr()));
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   381
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   382
  $dbh->{mysql_server_prepare}= $mysql_server_prepare_save;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   383
  return $sth;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   384
}
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   385
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   386
sub _ListTables {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   387
  my $dbh = shift;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   388
  if (!$DBD::mysql::QUIET) {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   389
    warn "_ListTables is deprecated, use \$dbh->tables()";
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   390
  }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   391
  return map { $_ =~ s/.*\.//; $_ } $dbh->tables();
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   392
}
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   393
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   394
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   395
sub column_info {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   396
  my ($dbh, $catalog, $schema, $table, $column) = @_;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   397
  $dbh->{mysql_server_prepare}||= 0;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   398
  my $mysql_server_prepare_save= $dbh->{mysql_server_prepare};
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   399
  $dbh->{mysql_server_prepare}= 0;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   400
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   401
  # ODBC allows a NULL to mean all columns, so we'll accept undef
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   402
  $column = '%' unless defined $column;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   403
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   404
  my $ER_NO_SUCH_TABLE= 1146;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   405
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   406
  my $table_id = $dbh->quote_identifier($catalog, $schema, $table);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   407
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   408
  my @names = qw(
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   409
      TABLE_CAT TABLE_SCHEM TABLE_NAME COLUMN_NAME
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   410
      DATA_TYPE TYPE_NAME COLUMN_SIZE BUFFER_LENGTH DECIMAL_DIGITS
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   411
      NUM_PREC_RADIX NULLABLE REMARKS COLUMN_DEF
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   412
      SQL_DATA_TYPE SQL_DATETIME_SUB CHAR_OCTET_LENGTH
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   413
      ORDINAL_POSITION IS_NULLABLE CHAR_SET_CAT
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   414
      CHAR_SET_SCHEM CHAR_SET_NAME COLLATION_CAT COLLATION_SCHEM COLLATION_NAME
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   415
      UDT_CAT UDT_SCHEM UDT_NAME DOMAIN_CAT DOMAIN_SCHEM DOMAIN_NAME
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   416
      SCOPE_CAT SCOPE_SCHEM SCOPE_NAME MAX_CARDINALITY
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   417
      DTD_IDENTIFIER IS_SELF_REF
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   418
      mysql_is_pri_key mysql_type_name mysql_values
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   419
      mysql_is_auto_increment
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   420
      );
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   421
  my %col_info;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   422
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   423
  local $dbh->{FetchHashKeyName} = 'NAME_lc';
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   424
  # only ignore ER_NO_SUCH_TABLE in internal_execute if issued from here
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   425
  my $desc_sth = $dbh->prepare("DESCRIBE $table_id " . $dbh->quote($column));
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   426
  my $desc = $dbh->selectall_arrayref($desc_sth, { Columns=>{} });
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   427
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   428
  #return $desc_sth if $desc_sth->err();
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   429
  if (my $err = $desc_sth->err())
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   430
  {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   431
    # return the error, unless it is due to the table not 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   432
    # existing per DBI spec
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   433
    if ($err != $ER_NO_SUCH_TABLE)
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   434
    {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   435
      $dbh->{mysql_server_prepare}= $mysql_server_prepare_save;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   436
      return undef;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   437
    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   438
    $dbh->set_err(undef,undef);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   439
    $desc = [];
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   440
  }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   441
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   442
  my $ordinal_pos = 0;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   443
  for my $row (@$desc)
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   444
  {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   445
    my $type = $row->{type};
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   446
    $type =~ m/^(\w+)(?:\((.*?)\))?\s*(.*)/;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   447
    my $basetype  = lc($1);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   448
    my $typemod   = $2;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   449
    my $attr      = $3;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   450
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   451
    my $info = $col_info{ $row->{field} }= {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   452
	    TABLE_CAT               => $catalog,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   453
	    TABLE_SCHEM             => $schema,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   454
	    TABLE_NAME              => $table,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   455
	    COLUMN_NAME             => $row->{field},
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   456
	    NULLABLE                => ($row->{null} eq 'YES') ? 1 : 0,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   457
	    IS_NULLABLE             => ($row->{null} eq 'YES') ? "YES" : "NO",
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   458
	    TYPE_NAME               => uc($basetype),
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   459
	    COLUMN_DEF              => $row->{default},
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   460
	    ORDINAL_POSITION        => ++$ordinal_pos,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   461
	    mysql_is_pri_key        => ($row->{key}  eq 'PRI'),
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   462
	    mysql_type_name         => $row->{type},
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   463
      mysql_is_auto_increment => ($row->{extra} =~ /auto_increment/i ? 1 : 0),
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   464
    };
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   465
    #
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   466
	  # This code won't deal with a pathalogical case where a value
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   467
	  # contains a single quote followed by a comma, and doesn't unescape
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   468
	  # any escaped values. But who would use those in an enum or set?
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   469
    #
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   470
	  my @type_params= ($typemod && index($typemod,"'")>=0) ?
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   471
      ("$typemod," =~ /'(.*?)',/g)  # assume all are quoted
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   472
			: split /,/, $typemod||'';      # no quotes, plain list
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   473
	  s/''/'/g for @type_params;                # undo doubling of quotes
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   474
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   475
	  my @type_attr= split / /, $attr||'';
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   476
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   477
  	$info->{DATA_TYPE}= SQL_VARCHAR();
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   478
    if ($basetype =~ /^(char|varchar|\w*text|\w*blob)/)
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   479
    {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   480
      $info->{DATA_TYPE}= SQL_CHAR() if $basetype eq 'char';
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   481
      if ($type_params[0])
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   482
      {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   483
        $info->{COLUMN_SIZE} = $type_params[0];
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   484
      }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   485
      else
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   486
      {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   487
        $info->{COLUMN_SIZE} = 65535;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   488
        $info->{COLUMN_SIZE} = 255        if $basetype =~ /^tiny/;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   489
        $info->{COLUMN_SIZE} = 16777215   if $basetype =~ /^medium/;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   490
        $info->{COLUMN_SIZE} = 4294967295 if $basetype =~ /^long/;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   491
      }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   492
    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   493
	  elsif ($basetype =~ /^(binary|varbinary)/)
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   494
    {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   495
      $info->{COLUMN_SIZE} = $type_params[0];
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   496
	    # SQL_BINARY & SQL_VARBINARY are tempting here but don't match the
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   497
	    # semantics for mysql (not hex). SQL_CHAR &  SQL_VARCHAR are correct here.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   498
	    $info->{DATA_TYPE} = ($basetype eq 'binary') ? SQL_CHAR() : SQL_VARCHAR();
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   499
    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   500
    elsif ($basetype =~ /^(enum|set)/)
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   501
    {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   502
	    if ($basetype eq 'set')
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   503
      {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   504
		    $info->{COLUMN_SIZE} = length(join ",", @type_params);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   505
	    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   506
	    else
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   507
      {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   508
        my $max_len = 0;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   509
        length($_) > $max_len and $max_len = length($_) for @type_params;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   510
        $info->{COLUMN_SIZE} = $max_len;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   511
	    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   512
	    $info->{"mysql_values"} = \@type_params;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   513
    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   514
    elsif ($basetype =~ /int/)
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   515
    { 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   516
      # big/medium/small/tiny etc + unsigned?
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   517
	    $info->{DATA_TYPE} = SQL_INTEGER();
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   518
	    $info->{NUM_PREC_RADIX} = 10;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   519
	    $info->{COLUMN_SIZE} = $type_params[0];
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   520
    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   521
    elsif ($basetype =~ /^decimal/)
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   522
    {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   523
      $info->{DATA_TYPE} = SQL_DECIMAL();
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   524
      $info->{NUM_PREC_RADIX} = 10;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   525
      $info->{COLUMN_SIZE}    = $type_params[0];
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   526
      $info->{DECIMAL_DIGITS} = $type_params[1];
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   527
    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   528
    elsif ($basetype =~ /^(float|double)/)
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   529
    {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   530
	    $info->{DATA_TYPE} = ($basetype eq 'float') ? SQL_FLOAT() : SQL_DOUBLE();
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   531
	    $info->{NUM_PREC_RADIX} = 2;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   532
	    $info->{COLUMN_SIZE} = ($basetype eq 'float') ? 32 : 64;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   533
    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   534
    elsif ($basetype =~ /date|time/)
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   535
    { 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   536
      # date/datetime/time/timestamp
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   537
	    if ($basetype eq 'time' or $basetype eq 'date')
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   538
      {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   539
		    #$info->{DATA_TYPE}   = ($basetype eq 'time') ? SQL_TYPE_TIME() : SQL_TYPE_DATE();
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   540
        $info->{DATA_TYPE}   = ($basetype eq 'time') ? SQL_TIME() : SQL_DATE(); 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   541
        $info->{COLUMN_SIZE} = ($basetype eq 'time') ? 8 : 10;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   542
      }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   543
	    else
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   544
      {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   545
        # datetime/timestamp
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   546
        #$info->{DATA_TYPE}     = SQL_TYPE_TIMESTAMP();
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   547
		    $info->{DATA_TYPE}        = SQL_TIMESTAMP();
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   548
		    $info->{SQL_DATA_TYPE}    = SQL_DATETIME();
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   549
        $info->{SQL_DATETIME_SUB} = $info->{DATA_TYPE} - ($info->{SQL_DATA_TYPE} * 10);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   550
        $info->{COLUMN_SIZE}      = ($basetype eq 'datetime') ? 19 : $type_params[0] || 14;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   551
	    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   552
	    $info->{DECIMAL_DIGITS}= 0; # no fractional seconds
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   553
    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   554
    elsif ($basetype eq 'year')
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   555
    {	
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   556
      # no close standard so treat as int
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   557
	    $info->{DATA_TYPE}      = SQL_INTEGER();
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   558
	    $info->{NUM_PREC_RADIX} = 10;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   559
	    $info->{COLUMN_SIZE}    = 4;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   560
	  }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   561
	  else
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   562
    {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   563
	    Carp::carp("column_info: unrecognized column type '$basetype' of $table_id.$row->{field} treated as varchar");
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   564
    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   565
    $info->{SQL_DATA_TYPE} ||= $info->{DATA_TYPE};
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   566
    #warn Dumper($info);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   567
  }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   568
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   569
  my $sponge = DBI->connect("DBI:Sponge:", '','')
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   570
    or (  $dbh->{mysql_server_prepare}= $mysql_server_prepare_save &&
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   571
          return $dbh->DBI::set_err($DBI::err, "DBI::Sponge: $DBI::errstr"));
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   572
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   573
  my $sth = $sponge->prepare("column_info $table", {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   574
      rows          => [ map { [ @{$_}{@names} ] } values %col_info ],
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   575
      NUM_OF_FIELDS => scalar @names,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   576
      NAME          => \@names,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   577
      }) or
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   578
  return ($dbh->{mysql_server_prepare}= $mysql_server_prepare_save &&
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   579
          $dbh->DBI::set_err($sponge->err(), $sponge->errstr()));
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   580
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   581
  $dbh->{mysql_server_prepare}= $mysql_server_prepare_save;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   582
  return $sth;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   583
}
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   584
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   585
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   586
sub primary_key_info {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   587
  my ($dbh, $catalog, $schema, $table) = @_;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   588
  $dbh->{mysql_server_prepare}||= 0;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   589
  my $mysql_server_prepare_save= $dbh->{mysql_server_prepare};
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   590
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   591
  my $table_id = $dbh->quote_identifier($catalog, $schema, $table);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   592
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   593
  my @names = qw(
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   594
      TABLE_CAT TABLE_SCHEM TABLE_NAME COLUMN_NAME KEY_SEQ PK_NAME
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   595
      );
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   596
  my %col_info;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   597
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   598
  local $dbh->{FetchHashKeyName} = 'NAME_lc';
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   599
  my $desc_sth = $dbh->prepare("SHOW KEYS FROM $table_id");
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   600
  my $desc= $dbh->selectall_arrayref($desc_sth, { Columns=>{} });
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   601
  my $ordinal_pos = 0;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   602
  for my $row (grep { $_->{key_name} eq 'PRIMARY'} @$desc)
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   603
  {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   604
    $col_info{ $row->{column_name} }= {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   605
      TABLE_CAT   => $catalog,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   606
      TABLE_SCHEM => $schema,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   607
      TABLE_NAME  => $table,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   608
      COLUMN_NAME => $row->{column_name},
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   609
      KEY_SEQ     => $row->{seq_in_index},
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   610
      PK_NAME     => $row->{key_name},
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   611
    };
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   612
  }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   613
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   614
  my $sponge = DBI->connect("DBI:Sponge:", '','')
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   615
    or 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   616
     ($dbh->{mysql_server_prepare}= $mysql_server_prepare_save &&
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   617
      return $dbh->DBI::set_err($DBI::err, "DBI::Sponge: $DBI::errstr"));
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   618
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   619
  my $sth= $sponge->prepare("primary_key_info $table", {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   620
      rows          => [ map { [ @{$_}{@names} ] } values %col_info ],
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   621
      NUM_OF_FIELDS => scalar @names,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   622
      NAME          => \@names,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   623
      }) or 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   624
       ($dbh->{mysql_server_prepare}= $mysql_server_prepare_save &&
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   625
        return $dbh->DBI::set_err($sponge->err(), $sponge->errstr()));
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   626
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   627
  $dbh->{mysql_server_prepare}= $mysql_server_prepare_save;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   628
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   629
  return $sth;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   630
}
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   631
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   632
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   633
sub foreign_key_info {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   634
    my ($dbh,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   635
        $pk_catalog, $pk_schema, $pk_table,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   636
        $fk_catalog, $fk_schema, $fk_table,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   637
       ) = @_;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   638
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   639
    # INFORMATION_SCHEMA.KEY_COLUMN_USAGE was added in 5.0.6
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   640
    my ($maj, $min, $point) = _version($dbh);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   641
    return if $maj < 5 || ($maj == 5 && $point < 6);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   642
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   643
    my $sql = <<'EOF';
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   644
SELECT NULL AS PKTABLE_CAT,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   645
       A.REFERENCED_TABLE_SCHEMA AS PKTABLE_SCHEM,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   646
       A.REFERENCED_TABLE_NAME AS PKTABLE_NAME,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   647
       A.REFERENCED_COLUMN_NAME AS PKCOLUMN_NAME,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   648
       A.TABLE_CATALOG AS FKTABLE_CAT,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   649
       A.TABLE_SCHEMA AS FKTABLE_SCHEM,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   650
       A.TABLE_NAME AS FKTABLE_NAME,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   651
       A.COLUMN_NAME AS FKCOLUMN_NAME,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   652
       A.ORDINAL_POSITION AS KEY_SEQ,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   653
       NULL AS UPDATE_RULE,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   654
       NULL AS DELETE_RULE,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   655
       A.CONSTRAINT_NAME AS FK_NAME,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   656
       NULL AS PK_NAME,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   657
       NULL AS DEFERABILITY,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   658
       NULL AS UNIQUE_OR_PRIMARY
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   659
  FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE A,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   660
       INFORMATION_SCHEMA.TABLE_CONSTRAINTS B
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   661
 WHERE A.TABLE_SCHEMA = B.TABLE_SCHEMA AND A.TABLE_NAME = B.TABLE_NAME
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   662
   AND A.CONSTRAINT_NAME = B.CONSTRAINT_NAME AND B.CONSTRAINT_TYPE IS NOT NULL
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   663
EOF
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   664
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   665
    my @where;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   666
    my @bind;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   667
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   668
    # catalogs are not yet supported by MySQL
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   669
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   670
#    if (defined $pk_catalog) {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   671
#        push @where, 'A.REFERENCED_TABLE_CATALOG = ?';
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   672
#        push @bind, $pk_catalog;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   673
#    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   674
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   675
    if (defined $pk_schema) {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   676
        push @where, 'A.REFERENCED_TABLE_SCHEMA = ?';
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   677
        push @bind, $pk_schema;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   678
    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   679
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   680
    if (defined $pk_table) {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   681
        push @where, 'A.REFERENCED_TABLE_NAME = ?';
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   682
        push @bind, $pk_table;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   683
    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   684
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   685
#    if (defined $fk_catalog) {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   686
#        push @where, 'A.TABLE_CATALOG = ?';
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   687
#        push @bind,  $fk_schema;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   688
#    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   689
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   690
    if (defined $fk_schema) {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   691
        push @where, 'A.TABLE_SCHEMA = ?';
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   692
        push @bind,  $fk_schema;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   693
    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   694
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   695
    if (defined $fk_table) {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   696
        push @where, 'A.TABLE_NAME = ?';
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   697
        push @bind,  $fk_table;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   698
    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   699
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   700
    if (@where) {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   701
        $sql .= ' AND ';
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   702
        $sql .= join ' AND ', @where;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   703
    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   704
    $sql .= " ORDER BY A.TABLE_SCHEMA, A.TABLE_NAME, A.ORDINAL_POSITION";
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   705
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   706
    local $dbh->{FetchHashKeyName} = 'NAME_uc';
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   707
    my $sth = $dbh->prepare($sql);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   708
    $sth->execute(@bind);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   709
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   710
    return $sth;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   711
}
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   712
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   713
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   714
sub _version {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   715
    my $dbh = shift;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   716
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   717
    return
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   718
        $dbh->get_info($DBI::Const::GetInfoType::GetInfoType{SQL_DBMS_VER})
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   719
            =~ /(\d+)\.(\d+)\.(\d+)/;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   720
}
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   721
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   722
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   723
####################
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   724
# get_info()
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   725
# Generated by DBI::DBD::Metadata
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   726
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   727
sub get_info {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   728
    my($dbh, $info_type) = @_;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   729
    require DBD::mysql::GetInfo;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   730
    my $v = $DBD::mysql::GetInfo::info{int($info_type)};
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   731
    $v = $v->($dbh) if ref $v eq 'CODE';
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   732
    return $v;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   733
}
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   734
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   735
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   736
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   737
package DBD::mysql::st; # ====== STATEMENT ======
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   738
use strict;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   739
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   740
1;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   741
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   742
__END__
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   743
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   744
=pod
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   745
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   746
=head1 NAME
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   747
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   748
DBD::mysql - MySQL driver for the Perl5 Database Interface (DBI)
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   749
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   750
=head1 SYNOPSIS
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   751
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   752
    use DBI;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   753
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   754
    $dsn = "DBI:mysql:database=$database;host=$hostname;port=$port";
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   755
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   756
    $dbh = DBI->connect($dsn, $user, $password);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   757
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   758
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   759
    $drh = DBI->install_driver("mysql");
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   760
    @databases = DBI->data_sources("mysql");
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   761
       or
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   762
    @databases = DBI->data_sources("mysql",
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   763
      {"host" => $host, "port" => $port, "user" => $user, password => $pass});
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   764
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   765
    $sth = $dbh->prepare("SELECT * FROM foo WHERE bla");
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   766
       or
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   767
    $sth = $dbh->prepare("LISTFIELDS $table");
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   768
       or
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   769
    $sth = $dbh->prepare("LISTINDEX $table $index");
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   770
    $sth->execute;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   771
    $numRows = $sth->rows;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   772
    $numFields = $sth->{'NUM_OF_FIELDS'};
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   773
    $sth->finish;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   774
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   775
    $rc = $drh->func('createdb', $database, $host, $user, $password, 'admin');
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   776
    $rc = $drh->func('dropdb', $database, $host, $user, $password, 'admin');
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   777
    $rc = $drh->func('shutdown', $host, $user, $password, 'admin');
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   778
    $rc = $drh->func('reload', $host, $user, $password, 'admin');
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   779
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   780
    $rc = $dbh->func('createdb', $database, 'admin');
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   781
    $rc = $dbh->func('dropdb', $database, 'admin');
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   782
    $rc = $dbh->func('shutdown', 'admin');
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   783
    $rc = $dbh->func('reload', 'admin');
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   784
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   785
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   786
=head1 EXAMPLE
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   787
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   788
  #!/usr/bin/perl
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   789
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   790
  use strict;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   791
  use DBI();
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   792
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   793
  # Connect to the database.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   794
  my $dbh = DBI->connect("DBI:mysql:database=test;host=localhost",
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   795
                         "joe", "joe's password",
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   796
                         {'RaiseError' => 1});
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   797
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   798
  # Drop table 'foo'. This may fail, if 'foo' doesn't exist.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   799
  # Thus we put an eval around it.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   800
  eval { $dbh->do("DROP TABLE foo") };
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   801
  print "Dropping foo failed: $@\n" if $@;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   802
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   803
  # Create a new table 'foo'. This must not fail, thus we don't
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   804
  # catch errors.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   805
  $dbh->do("CREATE TABLE foo (id INTEGER, name VARCHAR(20))");
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   806
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   807
  # INSERT some data into 'foo'. We are using $dbh->quote() for
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   808
  # quoting the name.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   809
  $dbh->do("INSERT INTO foo VALUES (1, " . $dbh->quote("Tim") . ")");
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   810
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   811
  # Same thing, but using placeholders
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   812
  $dbh->do("INSERT INTO foo VALUES (?, ?)", undef, 2, "Jochen");
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   813
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   814
  # Now retrieve data from the table.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   815
  my $sth = $dbh->prepare("SELECT * FROM foo");
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   816
  $sth->execute();
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   817
  while (my $ref = $sth->fetchrow_hashref()) {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   818
    print "Found a row: id = $ref->{'id'}, name = $ref->{'name'}\n";
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   819
  }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   820
  $sth->finish();
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   821
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   822
  # Disconnect from the database.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   823
  $dbh->disconnect();
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   824
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   825
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   826
=head1 DESCRIPTION
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   827
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   828
B<DBD::mysql> is the Perl5 Database Interface driver for the MySQL
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   829
database. In other words: DBD::mysql is an interface between the Perl
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   830
programming language and the MySQL programming API that comes with
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   831
the MySQL relational database management system. Most functions
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   832
provided by this programming API are supported. Some rarely used
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   833
functions are missing, mainly because noone ever requested
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   834
them. :-)
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   835
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   836
In what follows we first discuss the use of DBD::mysql,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   837
because this is what you will need the most. For installation, see the
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   838
sections on L<INSTALLATION>, and L<WIN32 INSTALLATION>
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   839
below. See L<EXAMPLE> for a simple example above.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   840
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   841
From perl you activate the interface with the statement
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   842
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   843
    use DBI;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   844
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   845
After that you can connect to multiple MySQL database servers
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   846
and send multiple queries to any of them via a simple object oriented
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   847
interface. Two types of objects are available: database handles and
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   848
statement handles. Perl returns a database handle to the connect
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   849
method like so:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   850
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   851
  $dbh = DBI->connect("DBI:mysql:database=$db;host=$host",
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   852
		      $user, $password, {RaiseError => 1});
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   853
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   854
Once you have connected to a database, you can can execute SQL
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   855
statements with:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   856
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   857
  my $query = sprintf("INSERT INTO foo VALUES (%d, %s)",
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   858
		      $number, $dbh->quote("name"));
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   859
  $dbh->do($query);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   860
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   861
See L<DBI(3)> for details on the quote and do methods. An alternative
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   862
approach is
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   863
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   864
  $dbh->do("INSERT INTO foo VALUES (?, ?)", undef,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   865
	   $number, $name);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   866
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   867
in which case the quote method is executed automatically. See also
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   868
the bind_param method in L<DBI(3)>. See L<DATABASE HANDLES> below
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   869
for more details on database handles.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   870
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   871
If you want to retrieve results, you need to create a so-called
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   872
statement handle with:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   873
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   874
  $sth = $dbh->prepare("SELECT * FROM $table");
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   875
  $sth->execute();
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   876
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   877
This statement handle can be used for multiple things. First of all
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   878
you can retreive a row of data:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   879
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   880
  my $row = $sth->fetchrow_hashref();
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   881
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   882
If your table has columns ID and NAME, then $row will be hash ref with
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   883
keys ID and NAME. See L<STATEMENT HANDLES> below for more details on
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   884
statement handles.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   885
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   886
But now for a more formal approach:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   887
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   888
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   889
=head2 Class Methods
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   890
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   891
=over
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   892
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   893
=item B<connect>
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   894
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   895
    use DBI;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   896
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   897
    $dsn = "DBI:mysql:$database";
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   898
    $dsn = "DBI:mysql:database=$database;host=$hostname";
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   899
    $dsn = "DBI:mysql:database=$database;host=$hostname;port=$port";
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   900
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   901
    $dbh = DBI->connect($dsn, $user, $password);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   902
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   903
A C<database> must always be specified.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   904
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   905
=over
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   906
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   907
=item host
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   908
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   909
=item port
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   910
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   911
The hostname, if not specified or specified as '' or 'localhost', will
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   912
default to a MySQL server running on the local machine using the default for
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   913
the UNIX socket. To connect to a MySQL server on the local machine via TCP,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   914
you must specify the loopback IP address (127.0.0.1) as the host.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   915
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   916
Should the MySQL server be running on a non-standard port number,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   917
you may explicitly state the port number to connect to in the C<hostname>
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   918
argument, by concatenating the I<hostname> and I<port number> together
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   919
separated by a colon ( C<:> ) character or by using the  C<port> argument.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   920
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   921
To connect to a MySQL server on localhost using TCP/IP, you must specify the
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   922
hostname as 127.0.0.1 (with the optional port).
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   923
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   924
=item mysql_client_found_rows
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   925
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   926
Enables (TRUE value) or disables (FALSE value) the flag CLIENT_FOUND_ROWS
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   927
while connecting to the MySQL server. This has a somewhat funny effect:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   928
Without mysql_client_found_rows, if you perform a query like
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   929
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   930
  UPDATE $table SET id = 1 WHERE id = 1
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   931
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   932
then the MySQL engine will always return 0, because no rows have changed.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   933
With mysql_client_found_rows however, it will return the number of rows
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   934
that have an id 1, as some people are expecting. (At least for compatibility
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   935
to other engines.)
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   936
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   937
=item mysql_compression
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   938
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   939
As of MySQL 3.22.3, a new feature is supported: If your DSN contains
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   940
the option "mysql_compression=1", then the communication between client
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   941
and server will be compressed.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   942
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   943
=item mysql_connect_timeout
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   944
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   945
If your DSN contains the option "mysql_connect_timeout=##", the connect
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   946
request to the server will timeout if it has not been successful after
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   947
the given number of seconds.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   948
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   949
 =item mysql_init_command
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   950
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   951
 If your DSN contains the option "mysql_init_command_timeout=##", then
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   952
 this SQL statement is executed when connecting to the MySQL server.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   953
 It is automatically re-executed if reconnection occurs.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   954
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   955
=item mysql_read_default_file
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   956
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   957
=item mysql_read_default_group
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   958
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   959
These options can be used to read a config file like /etc/my.cnf or
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   960
~/.my.cnf. By default MySQL's C client library doesn't use any config
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   961
files unlike the client programs (mysql, mysqladmin, ...) that do, but
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   962
outside of the C client library. Thus you need to explicitly request
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   963
reading a config file, as in
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   964
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   965
    $dsn = "DBI:mysql:test;mysql_read_default_file=/home/joe/my.cnf";
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   966
    $dbh = DBI->connect($dsn, $user, $password)
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   967
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   968
The option mysql_read_default_group can be used to specify the default
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   969
group in the config file: Usually this is the I<client> group, but
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   970
see the following example:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   971
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   972
    [client]
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   973
    host=localhost
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   974
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   975
    [perl]
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   976
    host=perlhost
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   977
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   978
(Note the order of the entries! The example won't work, if you reverse
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   979
the [client] and [perl] sections!)
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   980
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   981
If you read this config file, then you'll be typically connected to
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   982
I<localhost>. However, by using
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   983
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   984
    $dsn = "DBI:mysql:test;mysql_read_default_group=perl;"
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   985
        . "mysql_read_default_file=/home/joe/my.cnf";
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   986
    $dbh = DBI->connect($dsn, $user, $password);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   987
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   988
you'll be connected to I<perlhost>. Note that if you specify a
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   989
default group and do not specify a file, then the default config
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   990
files will all be read.  See the documentation of
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   991
the C function mysql_options() for details.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   992
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   993
=item mysql_socket
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   994
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   995
As of MySQL 3.21.15, it is possible to choose the Unix socket that is
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   996
used for connecting to the server. This is done, for example, with
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   997
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   998
    mysql_socket=/dev/mysql
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   999
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1000
Usually there's no need for this option, unless you are using another
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1001
location for the socket than that built into the client.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1002
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1003
=item mysql_ssl
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1004
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1005
A true value turns on the CLIENT_SSL flag when connecting to the MySQL
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1006
database:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1007
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1008
  mysql_ssl=1
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1009
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1010
This means that your communication with the server will be encrypted.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1011
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1012
If you turn mysql_ssl on, you might also wish to use the following
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1013
flags:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1014
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1015
=item mysql_ssl_client_key
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1016
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1017
=item mysql_ssl_client_cert
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1018
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1019
=item mysql_ssl_ca_file
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1020
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1021
=item mysql_ssl_ca_path
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1022
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1023
=item mysql_ssl_cipher
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1024
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1025
These are used to specify the respective parameters of a call
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1026
to mysql_ssl_set, if mysql_ssl is turned on.  
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1027
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1028
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1029
=item mysql_local_infile
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1030
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1031
As of MySQL 3.23.49, the LOCAL capability for LOAD DATA may be disabled
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1032
in the MySQL client library by default. If your DSN contains the option
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1033
"mysql_local_infile=1", LOAD DATA LOCAL will be enabled.  (However,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1034
this option is *ineffective* if the server has also been configured to
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1035
disallow LOCAL.)
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1036
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1037
=item mysql_multi_statements
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1038
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1039
As of MySQL 4.1, support for multiple statements seperated by a semicolon
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1040
(;) may be enabled by using this option. Enabling this option may cause
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1041
problems if server-side prepared statements are also enabled.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1042
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1043
=item Prepared statement support (server side prepare)
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1044
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1045
As of 3.0002_1, server side prepare statements were on by default (if your
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1046
server was >= 4.1.3). As of 3.0009, they were off by default again due to 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1047
issues with the prepared statement API (all other mysql connectors are
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1048
set this way until C API issues are resolved). The requirement to use
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1049
prepared statements still remains that you have a server >= 4.1.3
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1050
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1051
To use server side prepared statements, all you need to do is set the variable 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1052
mysql_server_prepare in the connect:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1053
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1054
$dbh = DBI->connect(
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1055
                    "DBI:mysql:database=test;host=localhost;mysql_server_prepare=1",
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1056
                    "",
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1057
                    "",
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1058
                    { RaiseError => 1, AutoCommit => 1 }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1059
                    );
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1060
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1061
* Note: delimiter for this param is ';'
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1062
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1063
There are many benefits to using server side prepare statements, mostly if you are 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1064
performing many inserts because of that fact that a single statement is prepared 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1065
to accept multiple insert values.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1066
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1067
To make sure that the 'make test' step tests whether server prepare works, you just
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1068
need to export the env variable MYSQL_SERVER_PREPARE:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1069
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1070
export MYSQL_SERVER_PREPARE=1
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1071
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1072
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1073
=item mysql_embedded_options
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1074
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1075
The option <mysql_embedded_options> can be used to pass 'command-line' 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1076
options to embedded server.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1077
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1078
Example:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1079
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1080
use DBI;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1081
$testdsn="DBI:mysqlEmb:database=test;mysql_embedded_options=--help,--verbose";
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1082
$dbh = DBI->connect($testdsn,"a","b");
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1083
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1084
This would cause the command line help to the embedded MySQL server library
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1085
to be printed.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1086
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1087
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1088
=item mysql_embedded_groups
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1089
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1090
The option <mysql_embedded_groups> can be used to specify the groups in the 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1091
config file(I<my.cnf>) which will be used to get options for embedded server. 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1092
If not specified [server] and [embedded] groups will be used.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1093
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1094
Example:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1095
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1096
$testdsn="DBI:mysqlEmb:database=test;mysql_embedded_groups=embedded_server,common";
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1097
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1098
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1099
=back
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1100
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1101
=back
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1102
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1103
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1104
=head2 Private MetaData Methods
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1105
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1106
=over
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1107
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1108
=item B<ListDBs>
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1109
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1110
    my $drh = DBI->install_driver("mysql");
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1111
    @dbs = $drh->func("$hostname:$port", '_ListDBs');
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1112
    @dbs = $drh->func($hostname, $port, '_ListDBs');
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1113
    @dbs = $dbh->func('_ListDBs');
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1114
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1115
Returns a list of all databases managed by the MySQL server
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1116
running on C<$hostname>, port C<$port>. This is a legacy
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1117
method.  Instead, you should use the portable method
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1118
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1119
    @dbs = DBI->data_sources("mysql");
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1120
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1121
=back
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1122
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1123
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1124
=head2 Server Administration
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1125
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1126
=over
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1127
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1128
=item admin
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1129
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1130
    $rc = $drh->func("createdb", $dbname, [host, user, password,], 'admin');
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1131
    $rc = $drh->func("dropdb", $dbname, [host, user, password,], 'admin');
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1132
    $rc = $drh->func("shutdown", [host, user, password,], 'admin');
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1133
    $rc = $drh->func("reload", [host, user, password,], 'admin');
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1134
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1135
      or
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1136
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1137
    $rc = $dbh->func("createdb", $dbname, 'admin');
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1138
    $rc = $dbh->func("dropdb", $dbname, 'admin');
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1139
    $rc = $dbh->func("shutdown", 'admin');
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1140
    $rc = $dbh->func("reload", 'admin');
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1141
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1142
For server administration you need a server connection. For obtaining
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1143
this connection you have two options: Either use a driver handle (drh)
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1144
and supply the appropriate arguments (host, defaults localhost, user,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1145
defaults to '' and password, defaults to ''). A driver handle can be
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1146
obtained with
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1147
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1148
    $drh = DBI->install_driver('mysql');
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1149
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1150
Otherwise reuse the existing connection of a database handle (dbh).
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1151
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1152
There's only one function available for administrative purposes, comparable
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1153
to the m(y)sqladmin programs. The command being execute depends on the
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1154
first argument:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1155
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1156
=over
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1157
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1158
=item createdb
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1159
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1160
Creates the database $dbname. Equivalent to "m(y)sqladmin create $dbname".
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1161
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1162
=item dropdb
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1163
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1164
Drops the database $dbname. Equivalent to "m(y)sqladmin drop $dbname".
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1165
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1166
It should be noted that database deletion is
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1167
I<not prompted for> in any way.  Nor is it undo-able from DBI.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1168
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1169
    Once you issue the dropDB() method, the database will be gone!
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1170
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1171
These method should be used at your own risk.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1172
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1173
=item shutdown
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1174
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1175
Silently shuts down the database engine. (Without prompting!)
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1176
Equivalent to "m(y)sqladmin shutdown".
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1177
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1178
=item reload
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1179
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1180
Reloads the servers configuration files and/or tables. This can be particularly
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1181
important if you modify access privileges or create new users.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1182
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1183
=back
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1184
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1185
=back
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1186
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1187
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1188
=head1 DATABASE HANDLES
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1189
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1190
The DBD::mysql driver supports the following attributes of database
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1191
handles (read only):
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1192
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1193
  $errno = $dbh->{'mysql_errno'};
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1194
  $error = $dbh->{'mysql_error'};
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1195
  $info = $dbh->{'mysql_hostinfo'};
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1196
  $info = $dbh->{'mysql_info'};
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1197
  $insertid = $dbh->{'mysql_insertid'};
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1198
  $info = $dbh->{'mysql_protoinfo'};
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1199
  $info = $dbh->{'mysql_serverinfo'};
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1200
  $info = $dbh->{'mysql_stat'};
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1201
  $threadId = $dbh->{'mysql_thread_id'};
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1202
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1203
These correspond to mysql_errno(), mysql_error(), mysql_get_host_info(),
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1204
mysql_info(), mysql_insert_id(), mysql_get_proto_info(),
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1205
mysql_get_server_info(), mysql_stat() and mysql_thread_id(),
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1206
respectively.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1207
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1208
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1209
 $info_hashref = $dhb->{mysql_dbd_stats}
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1210
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1211
DBD::mysql keeps track of some statistics in the mysql_dbd_stats attribute.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1212
The following stats are being maintained:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1213
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1214
=over
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1215
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1216
=item auto_reconnects_ok
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1217
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1218
The number of times that DBD::mysql successfully reconnected to the mysql 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1219
server.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1220
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1221
=item auto_reconnects_failed
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1222
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1223
The number of times that DBD::mysql tried to reconnect to mysql but failed.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1224
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1225
=back
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1226
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1227
The DBD::mysql driver also supports the following attribute(s) of database
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1228
handles (read/write):
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1229
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1230
 $bool_value = $dbh->{mysql_auto_reconnect};
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1231
 $dbh->{mysql_auto_reconnect} = $AutoReconnect ? 1 : 0;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1232
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1233
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1234
=item mysql_auto_reconnect
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1235
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1236
This attribute determines whether DBD::mysql will automatically reconnect
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1237
to mysql if the connection be lost. This feature defaults to off; however,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1238
if either the GATEWAY_INTERFACE or MOD_PERL envionment variable is set, 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1239
DBD::mysql will turn mysql_auto_reconnect on.  Setting mysql_auto_reconnect 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1240
to on is not advised if 'lock tables' is used because if DBD::mysql reconnect 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1241
to mysql all table locks will be lost.  This attribute is ignored when
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1242
AutoCommit is turned off, and when AutoCommit is turned off, DBD::mysql will
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1243
not automatically reconnect to the server.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1244
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1245
=item mysql_use_result
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1246
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1247
This attribute forces the driver to use mysql_use_result rather than
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1248
mysql_store_result. The former is faster and less memory consuming, but
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1249
tends to block other processes. (That's why mysql_store_result is the
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1250
default.)
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1251
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1252
It is possible to set default value of the C<mysql_use_result> attribute 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1253
for $dbh using several ways:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1254
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1255
 - through DSN 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1256
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1257
   $dbh= DBI->connect("DBI:mysql:test;mysql_use_result=1", "root", "");
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1258
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1259
 - after creation of database handle
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1260
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1261
   $dbh->{'mysql_use_result'}=0; #disable
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1262
   $dbh->{'mysql_use_result'}=1; #enable
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1263
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1264
It is possible to set/unset the C<mysql_use_result> attribute after 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1265
creation of statement handle. See below.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1266
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1267
=item mysql_enable_utf8
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1268
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1269
This attribute determines whether DBD::mysql should assume strings
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1270
stored in the database are utf8.  This feature defaults to off.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1271
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1272
When set, a data retrieved from a textual column type (char, varchar,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1273
etc) will have the UTF-8 flag turned on if necessary.  This enables
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1274
character semantics on that string.  You will also need to ensure that
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1275
your database / table / column is configured to use UTF8.  See Chapter
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1276
10 of the mysql manual for details.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1277
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1278
Additionally, turning on this flag tells MySQL that incoming data should
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1279
be treated as UTF-8.  This will only take effect if used as part of the
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1280
call to connect().  If you turn the flag on after connecting, you will
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1281
need to issue the command C<SET NAMES utf8> to get the same effect.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1282
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1283
This option is experimental and may change in future versions.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1284
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1285
=item mysql_bind_type_guessing
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1286
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1287
This attribute causes the driver (emulated prepare statements) 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1288
to attempt to guess if a value being bound is a numeric value,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1289
and if so, doesn't quote the value.  This was created by 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1290
Dragonchild and is one way to deal with the performance issue 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1291
of using quotes in a statement that is inserting or updating a
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1292
large numeric value. This was previously called 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1293
C<unsafe_bind_type_guessing> because it is experimental. I have 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1294
successfully run the full test suite with this option turned on,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1295
the name can now be simply C<mysql_bind_type_guessing>. 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1296
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1297
See bug: https://rt.cpan.org/Ticket/Display.html?id=43822
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1298
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1299
C<mysql_bind_type_guessing> can be turned on via 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1300
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1301
 - through DSN 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1302
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1303
  my $dbh= DBI->connect('DBI:mysql:test', 'username', 'pass',
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1304
  { mysql_bind_type_guessing => 1})
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1305
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1306
  - OR after handle creation
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1307
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1308
  $dbh->{mysql_bind_type_guessing} = 1;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1309
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1310
=item mysql_no_autocommit_cmd
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1311
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1312
This attribute causes the driver to not issue 'set autocommit'
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1313
either through explicit or using mysql_autocommit(). This is 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1314
particularly useful in the case of using MySQL Proxy.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1315
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1316
See the bug report:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1317
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1318
https://rt.cpan.org/Public/Bug/Display.html?id=46308
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1319
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1320
As well as:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1321
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1322
http://bugs.mysql.com/bug.php?id=32464
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1323
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1324
C<mysql_no_autocommit_cmd> can be turned on via 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1325
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1326
 - through DSN 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1327
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1328
  my $dbh= DBI->connect('DBI:mysql:test', 'username', 'pass',
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1329
  { mysql_no_autocommit_cmd => 1})
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1330
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1331
  - OR after handle creation
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1332
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1333
  $dbh->{mysql_no_autocommit_cmd} = 1;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1334
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1335
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1336
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1337
=head1 STATEMENT HANDLES
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1338
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1339
The statement handles of DBD::mysql support a number
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1340
of attributes. You access these by using, for example,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1341
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1342
  my $numFields = $sth->{'NUM_OF_FIELDS'};
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1343
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1344
Note, that most attributes are valid only after a successfull I<execute>.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1345
An C<undef> value will returned in that case. The most important exception
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1346
is the C<mysql_use_result> attribute: This forces the driver to use
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1347
mysql_use_result rather than mysql_store_result. The former is faster
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1348
and less memory consuming, but tends to block other processes. (That's why
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1349
mysql_store_result is the default.)
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1350
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1351
To set the C<mysql_use_result> attribute, use either of the following:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1352
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1353
  my $sth = $dbh->prepare("QUERY", { "mysql_use_result" => 1});
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1354
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1355
or
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1356
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1357
  my $sth = $dbh->prepare("QUERY");
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1358
  $sth->{"mysql_use_result"} = 1;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1359
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1360
Column dependent attributes, for example I<NAME>, the column names,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1361
are returned as a reference to an array. The array indices are
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1362
corresponding to the indices of the arrays returned by I<fetchrow>
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1363
and similar methods. For example the following code will print a
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1364
header of table names together with all rows:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1365
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1366
  my $sth = $dbh->prepare("SELECT * FROM $table");
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1367
  if (!$sth) {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1368
      die "Error:" . $dbh->errstr . "\n";
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1369
  }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1370
  if (!$sth->execute) {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1371
      die "Error:" . $sth->errstr . "\n";
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1372
  }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1373
  my $names = $sth->{'NAME'};
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1374
  my $numFields = $sth->{'NUM_OF_FIELDS'};
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1375
  for (my $i = 0;  $i < $numFields;  $i++) {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1376
      printf("%s%s", $i ? "," : "", $$names[$i]);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1377
  }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1378
  print "\n";
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1379
  while (my $ref = $sth->fetchrow_arrayref) {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1380
      for (my $i = 0;  $i < $numFields;  $i++) {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1381
	  printf("%s%s", $i ? "," : "", $$ref[$i]);
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1382
      }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1383
      print "\n";
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1384
  }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1385
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1386
For portable applications you should restrict yourself to attributes with
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1387
capitalized or mixed case names. Lower case attribute names are private
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1388
to DBD::mysql. The attribute list includes:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1389
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1390
=over
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1391
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1392
=item ChopBlanks
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1393
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1394
this attribute determines whether a I<fetchrow> will chop preceding
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1395
and trailing blanks off the column values. Chopping blanks does not
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1396
have impact on the I<max_length> attribute.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1397
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1398
=item mysql_insertid
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1399
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1400
MySQL has the ability to choose unique key values automatically. If this
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1401
happened, the new ID will be stored in this attribute. An alternative
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1402
way for accessing this attribute is via $dbh->{'mysql_insertid'}.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1403
(Note we are using the $dbh in this case!)
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1404
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1405
=item mysql_is_blob
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1406
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1407
Reference to an array of boolean values; TRUE indicates, that the
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1408
respective column is a blob. This attribute is valid for MySQL only.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1409
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1410
=item mysql_is_key
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1411
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1412
Reference to an array of boolean values; TRUE indicates, that the
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1413
respective column is a key. This is valid for MySQL only.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1414
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1415
=item mysql_is_num
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1416
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1417
Reference to an array of boolean values; TRUE indicates, that the
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1418
respective column contains numeric values.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1419
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1420
=item mysql_is_pri_key
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1421
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1422
Reference to an array of boolean values; TRUE indicates, that the
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1423
respective column is a primary key.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1424
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1425
=item mysql_is_auto_increment
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1426
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1427
Reference to an array of boolean values; TRUE indicates that the
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1428
respective column is an AUTO_INCREMENT column.  This is only valid
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1429
for MySQL.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1430
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1431
=item mysql_length
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1432
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1433
=item mysql_max_length
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1434
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1435
A reference to an array of maximum column sizes. The I<max_length> is
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1436
the maximum physically present in the result table, I<length> gives
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1437
the theoretically possible maximum. I<max_length> is valid for MySQL
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1438
only.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1439
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1440
=item NAME
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1441
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1442
A reference to an array of column names.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1443
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1444
=item NULLABLE
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1445
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1446
A reference to an array of boolean values; TRUE indicates that this column
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1447
may contain NULL's.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1448
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1449
=item NUM_OF_FIELDS
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1450
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1451
Number of fields returned by a I<SELECT> or I<LISTFIELDS> statement.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1452
You may use this for checking whether a statement returned a result:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1453
A zero value indicates a non-SELECT statement like I<INSERT>,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1454
I<DELETE> or I<UPDATE>.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1455
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1456
=item mysql_table
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1457
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1458
A reference to an array of table names, useful in a I<JOIN> result.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1459
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1460
=item TYPE
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1461
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1462
A reference to an array of column types. The engine's native column
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1463
types are mapped to portable types like DBI::SQL_INTEGER() or
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1464
DBI::SQL_VARCHAR(), as good as possible. Not all native types have
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1465
a meaningfull equivalent, for example DBD::mysql::FIELD_TYPE_INTERVAL
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1466
is mapped to DBI::SQL_VARCHAR().
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1467
If you need the native column types, use I<mysql_type>. See below.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1468
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1469
=item mysql_type
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1470
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1471
A reference to an array of MySQL's native column types, for example
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1472
DBD::mysql::FIELD_TYPE_SHORT() or DBD::mysql::FIELD_TYPE_STRING().
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1473
Use the I<TYPE> attribute, if you want portable types like
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1474
DBI::SQL_SMALLINT() or DBI::SQL_VARCHAR().
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1475
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1476
=item mysql_type_name
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1477
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1478
Similar to mysql, but type names and not numbers are returned.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1479
Whenever possible, the ANSI SQL name is preferred.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1480
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1481
=item mysql_warning_count
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1482
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1483
The number of warnings generated during execution of the SQL statement.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1484
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1485
=back
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1486
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1487
=head1 TRANSACTION SUPPORT
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1488
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1489
Beginning with DBD::mysql 2.0416, transactions are supported.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1490
The transaction support works as follows:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1491
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1492
=over
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1493
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1494
=item *
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1495
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1496
By default AutoCommit mode is on, following the DBI specifications.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1497
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1498
=item *
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1499
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1500
If you execute
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1501
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1502
    $dbh->{'AutoCommit'} = 0;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1503
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1504
or
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1505
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1506
    $dbh->{'AutoCommit'} = 1;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1507
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1508
then the driver will set the MySQL server variable autocommit to 0 or
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1509
1, respectively. Switching from 0 to 1 will also issue a COMMIT,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1510
following the DBI specifications.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1511
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1512
=item *
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1513
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1514
The methods
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1515
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1516
    $dbh->rollback();
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1517
    $dbh->commit();
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1518
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1519
will issue the commands COMMIT and ROLLBACK, respectively. A
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1520
ROLLBACK will also be issued if AutoCommit mode is off and the
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1521
database handles DESTROY method is called. Again, this is following
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1522
the DBI specifications.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1523
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1524
=back
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1525
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1526
Given the above, you should note the following:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1527
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1528
=over
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1529
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1530
=item *
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1531
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1532
You should never change the server variable autocommit manually,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1533
unless you are ignoring DBI's transaction support.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1534
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1535
=item *
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1536
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1537
Switching AutoCommit mode from on to off or vice versa may fail.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1538
You should always check for errors, when changing AutoCommit mode.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1539
The suggested way of doing so is using the DBI flag RaiseError.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1540
If you don't like RaiseError, you have to use code like the
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1541
following:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1542
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1543
  $dbh->{'AutoCommit'} = 0;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1544
  if ($dbh->{'AutoCommit'}) {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1545
    # An error occurred!
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1546
  }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1547
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1548
=item *
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1549
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1550
If you detect an error while changing the AutoCommit mode, you
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1551
should no longer use the database handle. In other words, you
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1552
should disconnect and reconnect again, because the transaction
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1553
mode is unpredictable. Alternatively you may verify the transaction
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1554
mode by checking the value of the server variable autocommit.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1555
However, such behaviour isn't portable.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1556
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1557
=item *
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1558
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1559
DBD::mysql has a "reconnect" feature that handles the so-called
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1560
MySQL "morning bug": If the server has disconnected, most probably
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1561
due to a timeout, then by default the driver will reconnect and
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1562
attempt to execute the same SQL statement again. However, this
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1563
behaviour is disabled when AutoCommit is off: Otherwise the
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1564
transaction state would be completely unpredictable after a
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1565
reconnect.  
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1566
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1567
=item *
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1568
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1569
The "reconnect" feature of DBD::mysql can be toggled by using the
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1570
L<mysql_auto_reconnect> attribute. This behaviour should be turned off
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1571
in code that uses LOCK TABLE because if the database server time out
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1572
and DBD::mysql reconnect, table locks will be lost without any 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1573
indication of such loss.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1574
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1575
=back
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1576
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1577
=over
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1578
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1579
=head1 MULTIPLE RESULT SETS
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1580
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1581
As of version 3.0002_5, DBD::mysql supports multiple result sets (Thanks
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1582
to Guy Harrison!). This is the first release of this functionality, so 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1583
there may be issues. Please report bugs if you run into them!
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1584
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1585
The basic usage of multiple result sets is
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1586
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1587
  do 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1588
  {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1589
    while (@row= $sth->fetchrow_array())
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1590
    {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1591
      do stuff;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1592
    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1593
  } while ($sth->more_results)
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1594
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1595
An example would be:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1596
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1597
  $dbh->do("drop procedure if exists someproc") or print $DBI::errstr;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1598
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1599
  $dbh->do("create procedure somproc() deterministic
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1600
   begin
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1601
   declare a,b,c,d int;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1602
   set a=1;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1603
   set b=2;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1604
   set c=3;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1605
   set d=4;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1606
   select a, b, c, d;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1607
   select d, c, b, a;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1608
   select b, a, c, d;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1609
   select c, b, d, a;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1610
  end") or print $DBI::errstr;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1611
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1612
  $sth=$dbh->prepare('call someproc()') || 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1613
  die $DBI::err.": ".$DBI::errstr;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1614
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1615
  $sth->execute || die DBI::err.": ".$DBI::errstr; $rowset=0;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1616
  do {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1617
    print "\nRowset ".++$i."\n---------------------------------------\n\n";
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1618
    foreach $colno (0..$sth->{NUM_OF_FIELDS}) {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1619
      print $sth->{NAME}->[$colno]."\t";
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1620
    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1621
    print "\n";
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1622
    while (@row= $sth->fetchrow_array())  {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1623
      foreach $field (0..$#row) {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1624
        print $row[$field]."\t";
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1625
      }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1626
      print "\n";
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1627
    }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1628
  } until (!$sth->more_results)
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1629
 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1630
For more examples, please see the eg/ directory. This is where helpful
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1631
DBD::mysql code snippits will be added in the future.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1632
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1633
=head2 Issues with Multiple result sets
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1634
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1635
So far, the main issue is if your result sets are "jagged", meaning, the
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1636
number of columns of your results vary. Varying numbers of columns could
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1637
result in your script crashing. This is something that will be fixed soon.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1638
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1639
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1640
=head1 MULTITHREADING
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1641
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1642
The multithreading capabilities of DBD::mysql depend completely
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1643
on the underlying C libraries: The modules are working with handle data
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1644
only, no global variables are accessed or (to the best of my knowledge)
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1645
thread unsafe functions are called. Thus DBD::mysql is believed
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1646
to be completely thread safe, if the C libraries are thread safe
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1647
and you don't share handles among threads.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1648
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1649
The obvious question is: Are the C libraries thread safe?
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1650
In the case of MySQL the answer is "mostly" and, in theory, you should
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1651
be able to get a "yes", if the C library is compiled for being thread
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1652
safe (By default it isn't.) by passing the option -with-thread-safe-client
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1653
to configure. See the section on I<How to make a threadsafe client> in
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1654
the manual.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1655
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1656
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1657
=head1 INSTALLATION
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1658
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1659
Windows users may skip this section and pass over to L<WIN32
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1660
INSTALLATION> below. Others, go on reading.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1661
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1662
First of all, you do not need an installed MySQL server for installing
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1663
DBD::mysql. However, you need at least the client
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1664
libraries and possibly the header files, if you are compiling DBD::mysql
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1665
from source. In the case of MySQL you can create a
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1666
client-only version by using the configure option --without-server.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1667
If you are using precompiled binaries, then it may be possible to
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1668
use just selected RPM's like MySQL-client and MySQL-devel or something
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1669
similar, depending on the distribution.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1670
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1671
First you need to install the DBI module. For using I<dbimon>, a
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1672
simple DBI shell it is recommended to install Data::ShowTable another
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1673
Perl module.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1674
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1675
I recommend trying automatic installation via the CPAN module. Try
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1676
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1677
  perl -MCPAN -e shell
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1678
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1679
If you are using the CPAN module for the first time, it will prompt
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1680
you a lot of questions. If you finally receive the CPAN prompt, enter
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1681
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1682
  install Bundle::DBD::mysql
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1683
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1684
If this fails (which may be the case for a number of reasons, for
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1685
example because you are behind a firewall or don't have network
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1686
access), you need to do a manual installation. First of all you
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1687
need to fetch the modules from CPAN search
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1688
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1689
   http://search.cpan.org/ 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1690
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1691
The following modules are required
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1692
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1693
  DBI
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1694
  Data::ShowTable
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1695
  DBD::mysql
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1696
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1697
Then enter the following commands (note - versions are just examples):
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1698
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1699
  gzip -cd DBI-(version).tar.gz | tar xf -
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1700
  cd DBI-(version)
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1701
  perl Makefile.PL
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1702
  make
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1703
  make test
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1704
  make install
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1705
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1706
  cd ..
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1707
  gzip -cd Data-ShowTable-(version).tar.gz | tar xf -
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1708
  cd Data-ShowTable-3.3
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1709
  perl Makefile.PL
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1710
  make
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1711
  make install
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1712
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1713
  cd ..
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1714
  gzip -cd DBD-mysql-(version)-tar.gz | tar xf -
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1715
  cd DBD-mysql-(version)
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1716
  perl Makefile.PL
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1717
  make
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1718
  make test
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1719
  make install
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1720
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1721
During "perl Makefile.PL" you will be prompted some questions.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1722
Other questions are the directories with header files and libraries.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1723
For example, of your file F<mysql.h> is in F</usr/include/mysql/mysql.h>,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1724
then enter the header directory F</usr>, likewise for
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1725
F</usr/lib/mysql/libmysqlclient.a> or F</usr/lib/libmysqlclient.so>.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1726
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1727
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1728
=head1 WIN32 INSTALLATION
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1729
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1730
If you are using ActivePerl, you may use ppm to install DBD-mysql.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1731
For Perl 5.6, upgrade to Build 623 or later, then it is sufficient
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1732
to run
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1733
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1734
  ppm install DBI
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1735
  ppm install DBD::mysql
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1736
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1737
If you need an HTTP proxy, you might need to set the environment
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1738
variable http_proxy, for example like this:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1739
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1740
  set http_proxy=http://myproxy.com:8080/
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1741
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1742
As of this writing, DBD::mysql is missing in the ActivePerl 5.8.0
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1743
repository. However, Randy Kobes has kindly donated an own
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1744
distribution and the following might succeed:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1745
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1746
  ppm install http://theoryx5.uwinnipeg.ca/ppms/DBD-mysql.ppd
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1747
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1748
Otherwise you definitely *need* a C compiler. And it *must* be the same
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1749
compiler that was being used for compiling Perl itself. If you don't
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1750
have a C compiler, the file README.win32 from the Perl source
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1751
distribution tells you where to obtain freely distributable C compilers
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1752
like egcs or gcc. The Perl sources are available via CPAN search
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1753
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1754
  http://search.cpan.org
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1755
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1756
I recommend using the win32clients package for installing DBD::mysql
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1757
under Win32, available for download on www.tcx.se. The following steps
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1758
have been required for me:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1759
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1760
=over
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1761
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1762
=item -
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1763
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1764
The current Perl versions (5.6, as of this writing) do have a problem
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1765
with detecting the C libraries. I recommend to apply the following
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1766
patch:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1767
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1768
  *** c:\Perl\lib\ExtUtils\Liblist.pm.orig Sat Apr 15 20:03:40 2000
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1769
  --- c:\Perl\lib\ExtUtils\Liblist.pm      Sat Apr 15 20:03:45 2000
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1770
  ***************
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1771
  *** 230,235 ****
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1772
  --- 230,239 ----
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1773
      # add "$Config{installarchlib}/CORE" to default search path
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1774
      push @libpath, "$Config{installarchlib}/CORE";
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1775
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1776
  +     if ($VC  and  exists($ENV{LIB})  and  defined($ENV{LIB})) {
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1777
  +       push(@libpath, split(/;/, $ENV{LIB}));
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1778
  +     }
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1779
  +
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1780
      foreach (Text::ParseWords::quotewords('\s+', 0, $potential_libs)){
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1781
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1782
        $thislib = $_;
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1783
                                                                       
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1784
=item -
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1785
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1786
Extract sources into F<C:\>. This will create a directory F<C:\mysql>
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1787
with subdirectories include and lib.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1788
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1789
IMPORTANT: Make sure this subdirectory is not shared by other TCX
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1790
files! In particular do *not* store the MySQL server in the same
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1791
directory. If the server is already installed in F<C:\mysql>,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1792
choose a location like F<C:\tmp>, extract the win32clients there.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1793
Note that you can remove this directory entirely once you have
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1794
installed DBD::mysql.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1795
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1796
=item -
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1797
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1798
Extract the DBD::mysql sources into another directory, for
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1799
example F<C:\src\siteperl>
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1800
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1801
=item -
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1802
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1803
Open a DOS shell and change directory to F<C:\src\siteperl>.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1804
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1805
=item -
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1806
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1807
The next step is only required if you repeat building the modules: Make
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1808
sure that you have a clean build tree by running
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1809
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1810
  nmake realclean
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1811
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1812
If you don't have VC++, replace nmake with your flavour of make. If
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1813
error messages are reported in this step, you may safely ignore them.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1814
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1815
=item -
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1816
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1817
Run
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1818
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1819
  perl Makefile.PL
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1820
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1821
which will prompt you for some settings. The really important ones are:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1822
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1823
  Which DBMS do you want to use?
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1824
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1825
enter a 1 here (MySQL only), and
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1826
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1827
  Where is your mysql installed? Please tell me the directory that
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1828
  contains the subdir include.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1829
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1830
where you have to enter the win32clients directory, for example
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1831
F<C:\mysql> or F<C:\tmp\mysql>.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1832
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1833
=item -
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1834
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1835
Continued in the usual way:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1836
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1837
  nmake
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1838
  nmake install
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1839
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1840
=back
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1841
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1842
If you want to create a PPM package for the ActiveState Perl version, then
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1843
modify the above steps as follows: Run
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1844
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1845
  perl Makefile.PL NAME=DBD-mysql BINARY_LOCATION=DBD-mysql.tar.gz
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1846
  nmake ppd
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1847
  nmake
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1848
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1849
Once that is done, use tar and gzip (for example those from the CygWin32
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1850
distribution) to create an archive:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1851
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1852
  mkdir x86
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1853
  tar cf x86/DBD-mysql.tar blib
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1854
  gzip x86/DBD-mysql.tar
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1855
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1856
Put the files x86/DBD-mysql.tar.gz and DBD-mysql.ppd onto some WWW server
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1857
and install them by typing
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1858
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1859
  install http://your.server.name/your/directory/DBD-mysql.ppd
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1860
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1861
in the PPM program.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1862
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1863
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1864
=head1 AUTHORS
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1865
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1866
The current version of B<DBD::mysql> is almost completely written
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1867
by Jochen Wiedmann, and is now being maintained by
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1868
Patrick Galbraith (I<patg@mysql.com>). 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1869
The first version's author was Alligator Descartes, who was aided
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1870
and abetted by Gary Shea, Andreas König and Tim Bunce amongst others.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1871
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1872
The B<Mysql> module was originally written by Andreas König
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1873
<koenig@kulturbox.de>. The current version, mainly an emulation
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1874
layer, is from Jochen Wiedmann.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1875
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1876
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1877
=head1 COPYRIGHT
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1878
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1879
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1880
This module is 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1881
Large Portions Copyright (c) 2004-2006 MySQL Patrick Galbraith, Alexey Stroganov,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1882
Large Portions Copyright (c) 2003-2005 Rudolf Lippan; Large Portions 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1883
Copyright (c) 1997-2003 Jochen Wiedmann, with code portions 
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1884
Copyright (c)1994-1997 their original authors This module is
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1885
released under the same license as Perl itself. See the Perl README
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1886
for details.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1887
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1888
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1889
=head1 MAILING LIST SUPPORT
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1890
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1891
This module is maintained and supported on a mailing list,
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1892
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1893
    perl@lists.mysql.com
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1894
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1895
To subscribe to this list, go to
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1896
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1897
http://lists.mysql.com/perl?sub=1
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1898
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1899
Mailing list archives are available at
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1900
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1901
http://lists.mysql.com/perl
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1902
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1903
Additionally you might try the dbi-user mailing list for questions about
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1904
DBI and its modules in general. Subscribe via
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1905
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1906
dbi-users-subscribe@perl.org
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1907
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1908
Mailing list archives are at
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1909
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1910
http://groups.google.com/group/perl.dbi.users?hl=en&lr=
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1911
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1912
Also, the main DBI site is at
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1913
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1914
http://dbi.perl.org/
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1915
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1916
=head1 ADDITIONAL DBI INFORMATION
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1917
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1918
Additional information on the DBI project can be found on the World
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1919
Wide Web at the following URL:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1920
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1921
    http://dbi.perl.org
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1922
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1923
where documentation, pointers to the mailing lists and mailing list
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1924
archives and pointers to the most current versions of the modules can
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1925
be used.
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1926
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1927
Information on the DBI interface itself can be gained by typing:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1928
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1929
    perldoc DBI
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1930
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1931
right now!
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1932
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1933
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1934
=head1 BUG REPORTING, ENHANCEMENT/FEATURE REQUESTS
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1935
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1936
Please report bugs, including all the information needed
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1937
such as DBD::mysql version, MySQL version, OS type/version, etc
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1938
to this link:
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1939
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1940
http://bugs.mysql.com/
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1941
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1942
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1943
=cut
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1944
ead96bc104ea Add DBD-mysql module (needed by bitops.pl)
Dario Sestito <darios@symbian.org>
parents:
diff changeset
  1945