SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG

BotDetect - Real-Time Bot Detection API
 
 

MAN page from Trustix perl-dbd-mysql-3.00.07-1tr.i586.rpm

DBD::mysql

Section: User Contributed Perl Documentation (3)
Updated: 2006-09-08
Index 

NAME

DBD::mysql - MySQL driver for the Perl5 Database Interface (DBI) 

SYNOPSIS

    use DBI;

    $dsn = "DBI:mysql:database=$database;host=$hostname;port=$port";

    $dbh = DBI->connect($dsn, $user, $password);

    $drh = DBI->install_driver("mysql");    @databases = DBI->data_sources("mysql");       or    @databases = DBI->data_sources("mysql",                                   {"host" => $host, "port" => $port});

    $sth = $dbh->prepare("SELECT * FROM foo WHERE bla");       or    $sth = $dbh->prepare("LISTFIELDS $table");       or    $sth = $dbh->prepare("LISTINDEX $table $index");    $sth->execute;    $numRows = $sth->rows;    $numFields = $sth->{'NUM_OF_FIELDS'};    $sth->finish;

    $rc = $drh->func('createdb', $database, $host, $user, $password, 'admin');    $rc = $drh->func('dropdb', $database, $host, $user, $password, 'admin');    $rc = $drh->func('shutdown', $host, $user, $password, 'admin');    $rc = $drh->func('reload', $host, $user, $password, 'admin');

    $rc = $dbh->func('createdb', $database, 'admin');    $rc = $dbh->func('dropdb', $database, 'admin');    $rc = $dbh->func('shutdown', 'admin');    $rc = $dbh->func('reload', 'admin');
 

EXAMPLE

  #!/usr/bin/perl

  use strict;  use DBI();

  # Connect to the database.  my $dbh = DBI->connect("DBI:mysql:database=test;host=localhost",                         "joe", "joe's password",                         {'RaiseError' => 1});

  # Drop table 'foo'. This may fail, if 'foo' doesn't exist.  # Thus we put an eval around it.  eval { $dbh->do("DROP TABLE foo") };  print "Dropping foo failed: $@\n" if $@;

  # Create a new table 'foo'. This must not fail, thus we don't  # catch errors.  $dbh->do("CREATE TABLE foo (id INTEGER, name VARCHAR(20))");

  # INSERT some data into 'foo'. We are using $dbh->quote() for  # quoting the name.  $dbh->do("INSERT INTO foo VALUES (1, " . $dbh->quote("Tim") . ")");

  # Same thing, but using placeholders  $dbh->do("INSERT INTO foo VALUES (?, ?)", undef, 2, "Jochen");

  # Now retrieve data from the table.  my $sth = $dbh->prepare("SELECT * FROM foo");  $sth->execute();  while (my $ref = $sth->fetchrow_hashref()) {    print "Found a row: id = $ref->{'id'}, name = $ref->{'name'}\n";  }  $sth->finish();

  # Disconnect from the database.  $dbh->disconnect();
 

DESCRIPTION

DBD::mysql is the Perl5 Database Interface driver for the MySQLdatabase. In other words: DBD::mysql is an interface between the Perlprogramming language and the MySQL programming API that comes withthe MySQL relational database management system. Most functionsprovided by this programming API are supported. Some rarely usedfunctions are missing, mainly because noone ever requestedthem. :-)

In what follows we first discuss the use of DBD::mysql,because this is what you will need the most. For installation, see thesections on INSTALLATION, and ``WIN32 INSTALLATION''below. See EXAMPLE for a simple example above.

From perl you activate the interface with the statement

    use DBI;

After that you can connect to multiple MySQL database serversand send multiple queries to any of them via a simple object orientedinterface. Two types of objects are available: database handles andstatement handles. Perl returns a database handle to the connectmethod like so:

  $dbh = DBI->connect("DBI:mysql:database=$db;host=$host",                      $user, $password, {RaiseError => 1});

Once you have connected to a database, you can can execute SQLstatements with:

  my $query = sprintf("INSERT INTO foo VALUES (%d, %s)",                      $number, $dbh->quote("name"));  $dbh->do($query);

See DBI(3) for details on the quote and do methods. An alternativeapproach is

  $dbh->do("INSERT INTO foo VALUES (?, ?)", undef,           $number, $name);

in which case the quote method is executed automatically. See alsothe bind_param method in DBI(3). See ``DATABASE HANDLES'' belowfor more details on database handles.

If you want to retrieve results, you need to create a so-calledstatement handle with:

  $sth = $dbh->prepare("SELECT * FROM $table");  $sth->execute();

This statement handle can be used for multiple things. First of allyou can retreive a row of data:

  my $row = $sth->fetchow_hashref();

If your table has columns ID and NAME, then $row will be hash ref withkeys ID and NAME. See ``STATEMENT HANDLES'' below for more details onstatement handles.

But now for a more formal approach: 

Class Methods

connect
    use DBI;

    $dsn = "DBI:mysql:$database";    $dsn = "DBI:mysql:database=$database;host=$hostname";    $dsn = "DBI:mysql:database=$database;host=$hostname;port=$port";

    $dbh = DBI->connect($dsn, $user, $password);

A "database" must always be specified.

host
port
The hostname, if not specified or specified as '', will default to anMySQL daemon running on the local machine on the default portfor the UNIX socket.

Should the MySQL daemon be running on a non-standard port number,you may explicitly state the port number to connect to in the "hostname"argument, by concatenating the hostname and port number togetherseparated by a colon ( ":" ) character or by using the "port" argument.

mysql_client_found_rows
Enables (TRUE value) or disables (FALSE value) the flag CLIENT_FOUND_ROWSwhile connecting to the MySQL server. This has a somewhat funny effect:Without mysql_client_found_rows, if you perform a query like

  UPDATE $table SET id = 1 WHERE id = 1

then the MySQL engine will always return 0, because no rows have changed.With mysql_client_found_rows however, it will return the number of rowsthat have an id 1, as some people are expecting. (At least for compatibilityto other engines.)

mysql_compression
As of MySQL 3.22.3, a new feature is supported: If your DSN containsthe option ``mysql_compression=1'', then the communication between clientand server will be compressed.
mysql_connect_timeout
If your DSN contains the option ``mysql_connect_timeout=##'', the connectrequest to the server will timeout if it has not been successful afterthe given number of seconds.
mysql_read_default_file
mysql_read_default_group
These options can be used to read a config file like /etc/my.cnf or~/.my.cnf. By default MySQL's C client library doesn't use any configfiles unlike the client programs (mysql, mysqladmin, ...) that do, butoutside of the C client library. Thus you need to explicitly requestreading a config file, as in

    $dsn = "DBI:mysql:test;mysql_read_default_file=/home/joe/my.cnf";    $dbh = DBI->connect($dsn, $user, $password)

The option mysql_read_default_group can be used to specify the defaultgroup in the config file: Usually this is the client group, butsee the following example:

    [client]    host=localhost

    [perl]    host=perlhost

(Note the order of the entries! The example won't work, if you reversethe [client] and [perl] sections!)

If you read this config file, then you'll be typically connected tolocalhost. However, by using

    $dsn = "DBI:mysql:test;mysql_read_default_group=perl;"        . "mysql_read_default_file=/home/joe/my.cnf";    $dbh = DBI->connect($dsn, $user, $password);

you'll be connected to perlhost. Note that if you specify adefault group and do not specify a file, then the default configfiles will all be read. See the documentation ofthe C function mysql_options() for details.

mysql_socket
As of MySQL 3.21.15, it is possible to choose the Unix socket that isused for connecting to the server. This is done, for example, with

    mysql_socket=/dev/mysql

Usually there's no need for this option, unless you are using anotherlocation for the socket than that built into the client.

mysql_ssl
A true value turns on the CLIENT_SSL flag when connecting to the MySQLdatabase:

  mysql_ssl=1

This means that your communication with the server will be encrypted.

If you turn mysql_ssl on, you might also wish to use the followingflags:

mysql_ssl_client_key
mysql_ssl_client_cert
mysql_ssl_ca_file
mysql_ssl_ca_path
mysql_ssl_cipher
These are used to specify the respective parameters of a callto mysql_ssl_set, if mysql_ssl is turned on.
mysql_local_infile
As of MySQL 3.23.49, the LOCAL capability for LOAD DATA may be disabledin the MySQL client library by default. If your DSN contains the option``mysql_local_infile=1'', LOAD DATA LOCAL will be enabled. (However,this option is *ineffective* if the server has also been configured todisallow LOCAL.)
Prepared statement support (server side prepare)
To use server side prepared statements, all you need to do is set the variable mysql_server_prepare in the connect:

$dbh = DBI->connect(
                    ``DBI:mysql:database=test;host=localhost:mysql_server_prepare=1'',
                    "``,
                    ''",
                    { RaiseError => 1, AutoCommit => 1 }
                    );

To make sure that the 'make test' step tests whether server prepare works, you justneed to export the env variable MYSQL_SERVER_PREPARE:

export MYSQL_SERVER_PREPARE=1

Test first without server side prepare, then with.

mysql_embedded_options
The option <mysql_embedded_options> can be used to pass 'command-line' options to embedded server.

Example:

$testdsn=``DBI:mysqlEmb:database=test;mysql_embedded_options=--help,--verbose'';

mysql_embedded_groups
The option <mysql_embedded_groups> can be used to specify the groups in the config file(my.cnf) which will be used to get options for embedded server. If not specified [server] and [embedded] groups will be used.

Example:

$testdsn=``DBI:mysqlEmb:database=test;mysql_embedded_groups=embedded_server,common'';

 

Private MetaData Methods

ListDBs
    my $drh = DBI->install_driver("mysql");    @dbs = $drh->func("$hostname:$port", '_ListDBs');    @dbs = $drh->func($hostname, $port, '_ListDBs');    @dbs = $dbh->func('_ListDBs');

Returns a list of all databases managed by the MySQL daemonrunning on $hostname, port $port. This methodis rarely needed for databases running on "localhost": You shoulduse the portable method

    @dbs = DBI->data_sources("mysql");

whenever possible. It is a design problem of this method, that there'sno way of supplying a host name or port number to "data_sources", that'sthe only reason why we still support "ListDBs". :-(

 

Server Administration

admin
    $rc = $drh->func("createdb", $dbname, [host, user, password,], 'admin');    $rc = $drh->func("dropdb", $dbname, [host, user, password,], 'admin');    $rc = $drh->func("shutdown", [host, user, password,], 'admin');    $rc = $drh->func("reload", [host, user, password,], 'admin');

      or

    $rc = $dbh->func("createdb", $dbname, 'admin');    $rc = $dbh->func("dropdb", $dbname, 'admin');    $rc = $dbh->func("shutdown", 'admin');    $rc = $dbh->func("reload", 'admin');

For server administration you need a server connection. For obtainingthis connection you have two options: Either use a driver handle (drh)and supply the appropriate arguments (host, defaults localhost, user,defaults to '' and password, defaults to ''). A driver handle can beobtained with

    $drh = DBI->install_driver('mysql');

Otherwise reuse the existing connection of a database handle (dbh).

There's only one function available for administrative purposes, comparableto the m(y)sqladmin programs. The command being execute depends on thefirst argument:

createdb
Creates the database $dbname. Equivalent to ``m(y)sqladmin create $dbname''.
dropdb
Drops the database $dbname. Equivalent to ``m(y)sqladmin drop $dbname''.

It should be noted that database deletion isnot prompted for in any way. Nor is it undo-able from DBI.

    Once you issue the dropDB() method, the database will be gone!

These method should be used at your own risk.

shutdown
Silently shuts down the database engine. (Without prompting!)Equivalent to ``m(y)sqladmin shutdown''.
reload
Reloads the servers configuration files and/or tables. This can be particularlyimportant if you modify access privileges or create new users.
 

DATABASE HANDLES

The DBD::mysql driver supports the following attributes of databasehandles (read only):

  $errno = $dbh->{'mysql_errno'};  $error = $dbh->{'mysql_error};  $info = $dbh->{'mysql_hostinfo'};  $info = $dbh->{'mysql_info'};  $insertid = $dbh->{'mysql_insertid'};  $info = $dbh->{'mysql_protoinfo'};  $info = $dbh->{'mysql_serverinfo'};  $info = $dbh->{'mysql_stat'};  $threadId = $dbh->{'mysql_thread_id'};

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

 $info_hashref = $dhb->{mysql_dbd_stats}

DBD::mysql keeps track of some statistics in the mysql_dbd_stats attribute.The following stats are being maintained:

auto_reconnects_ok
The number of times that DBD::mysql successfully reconnected to the mysql server.
auto_reconnects_failed
The number of times that DBD::mysql tried to reconnect to mysql but failed.

The DBD::mysql driver also supports the following attribute(s) of databasehandles (read/write):

 $bool_value = $dbh->{mysql_auto_reconnect}; $dbh->{mysql_auto_reconnect} = $AutoReconnect ? 1 : 0;
mysql_auto_reconnect
This attribute determines whether DBD::mysql will automatically reconnectto mysql if the connection be lost. This feature defaults to off; however,if either the GATEWAY_INTERFACE or MOD_PERL envionment variable is set, DBD::mysql will turn mysql_auto_reconnect on. Setting mysql_auto_reconnect to on is not advised if 'lock tables' is used because if DBD::mysql reconnect to mysql all table locks will be lost. This attribute is ignored whenAutoCommit is turned off, and when AutoCommit is turned off, DBD::mysql willnot automatically reconnect to the server.
mysql_use_result
This attribute forces the driver to use mysql_use_result rather thanmysql_store_result. The former is faster and less memory consuming, buttends to block other processes. (That's why mysql_store_result is thedefault.)

It is possible to set default value of the "mysql_use_result" attribute for $dbh using several ways:

 - through DSN

   $dbh= DBI->connect("DBI:mysql:test;mysql_use_result=1", "root", "");

 - after creation of database handle

   $dbh->{'mysql_use_result'}=0; #disable   $dbh->{'mysql_use_result'}=1; #enable

It is possible to set/unset the "mysql_use_result" attribute after creation of statement handle. See below. 

STATEMENT HANDLES

The statement handles of DBD::mysql support a numberof attributes. You access these by using, for example,

  my $numFields = $sth->{'NUM_OF_FIELDS'};

Note, that most attributes are valid only after a successfull execute.An "undef" value will returned in that case. The most important exceptionis the "mysql_use_result" attribute: This forces the driver to usemysql_use_result rather than mysql_store_result. The former is fasterand less memory consuming, but tends to block other processes. (That's whymysql_store_result is the default.)

To set the "mysql_use_result" attribute, use either of the following:

  my $sth = $dbh->prepare("QUERY", { "mysql_use_result" => 1});

or

  my $sth = $dbh->prepare("QUERY");  $sth->{"mysql_use_result"} = 1;

Column dependent attributes, for example NAME, the column names,are returned as a reference to an array. The array indices arecorresponding to the indices of the arrays returned by fetchrowand similar methods. For example the following code will print aheader of table names together with all rows:

  my $sth = $dbh->prepare("SELECT * FROM $table");  if (!$sth) {      die "Error:" . $dbh->errstr . "\n";  }  if (!$sth->execute) {      die "Error:" . $sth->errstr . "\n";  }  my $names = $sth->{'NAME'};  my $numFields = $sth->{'NUM_OF_FIELDS'};  for (my $i = 0;  $i < $numFields;  $i++) {      printf("%s%s", $i ? "," : "", $$names[$i]);  }  print "\n";  while (my $ref = $sth->fetchrow_arrayref) {      for (my $i = 0;  $i < $numFields;  $i++) {          printf("%s%s", $i ? "," : "", $$ref[$i]);      }      print "\n";  }

For portable applications you should restrict yourself to attributes withcapitalized or mixed case names. Lower case attribute names are privateto DBD::mysql. The attribute list includes:

ChopBlanks
this attribute determines whether a fetchrow will chop precedingand trailing blanks off the column values. Chopping blanks does nothave impact on the max_length attribute.
mysql_insertid
MySQL has the ability to choose unique key values automatically. If thishappened, the new ID will be stored in this attribute. An alternativeway for accessing this attribute is via $dbh->{'mysql_insertid'}.(Note we are using the $dbh in this case!)
mysql_is_blob
Reference to an array of boolean values; TRUE indicates, that therespective column is a blob. This attribute is valid for MySQL only.
mysql_is_key
Reference to an array of boolean values; TRUE indicates, that therespective column is a key. This is valid for MySQL only.
mysql_is_num
Reference to an array of boolean values; TRUE indicates, that therespective column contains numeric values.
mysql_is_pri_key
Reference to an array of boolean values; TRUE indicates, that therespective column is a primary key.
mysql_is_auto_increment
Reference to an array of boolean values; TRUE indicates that therespective column is an AUTO_INCREMENT column. This is only validfor MySQL.
mysql_length
mysql_max_length
A reference to an array of maximum column sizes. The max_length isthe maximum physically present in the result table, length givesthe theoretically possible maximum. max_length is valid for MySQLonly.
NAME
A reference to an array of column names.
NULLABLE
A reference to an array of boolean values; TRUE indicates that this columnmay contain NULL's.
NUM_OF_FIELDS
Number of fields returned by a SELECT or LISTFIELDS statement.You may use this for checking whether a statement returned a result:A zero value indicates a non-SELECT statement like INSERT,DELETE or UPDATE.
mysql_table
A reference to an array of table names, useful in a JOIN result.
TYPE
A reference to an array of column types. The engine's native columntypes are mapped to portable types like DBI::SQL_INTEGER() orDBI::SQL_VARCHAR(), as good as possible. Not all native types havea meaningfull equivalent, for example DBD::mysql::FIELD_TYPE_INTERVALis mapped to DBI::SQL_VARCHAR().If you need the native column types, use mysql_type. See below.
mysql_type
A reference to an array of MySQL's native column types, for exampleDBD::mysql::FIELD_TYPE_SHORT() or DBD::mysql::FIELD_TYPE_STRING().Use the TYPE attribute, if you want portable types likeDBI::SQL_SMALLINT() or DBI::SQL_VARCHAR().
mysql_type_name
Similar to mysql, but type names and not numbers are returned.Whenever possible, the ANSI SQL name is preferred.
 

TRANSACTION SUPPORT

Beginning with DBD::mysql 2.0416, transactions are supported.The transaction support works as follows:
*
By default AutoCommit mode is on, following the DBI specifications.
*
If you execute

    $dbh->{'AutoCommit'} = 0;

or

    $dbh->{'AutoCommit'} = 1;

then the driver will set the MySQL server variable autocommit to 0 or1, respectively. Switching from 0 to 1 will also issue a COMMIT,following the DBI specifications.

*
The methods

    $dbh->rollback();    $dbh->commit();

will issue the commands COMMIT and ROLLBACK, respectively. AROLLBACK will also be issued if AutoCommit mode is off and thedatabase handles DESTROY method is called. Again, this is followingthe DBI specifications.

Given the above, you should note the following:

*
You should never change the server variable autocommit manually,unless you are ignoring DBI's transaction support.
*
Switching AutoCommit mode from on to off or vice versa may fail.You should always check for errors, when changing AutoCommit mode.The suggested way of doing so is using the DBI flag RaiseError.If you don't like RaiseError, you have to use code like thefollowing:

  $dbh->{'AutoCommit'} = 0;  if ($dbh->{'AutoCommit'}) {    # An error occurred!  }
*
If you detect an error while changing the AutoCommit mode, youshould no longer use the database handle. In other words, youshould disconnect and reconnect again, because the transactionmode is unpredictable. Alternatively you may verify the transactionmode by checking the value of the server variable autocommit.However, such behaviour isn't portable.
*
DBD::mysql has a ``reconnect'' feature that handles the so-calledMySQL ``morning bug'': If the server has disconnected, most probablydue to a timeout, then by default the driver will reconnect andattempt to execute the same SQL statement again. However, thisbehaviour is disabled when AutoCommit is off: Otherwise thetransaction state would be completely unpredictable after areconnect.
*
The ``reconnect'' feature of DBD::mysql can be toggled by using themysql_auto_reconnect attribute. This behaviour should be turned offin code that uses LOCK TABLE because if the database server time outand DBD::mysql reconnect, table locks will be lost without any indication of such loss.
 

MULTITHREADING

The multithreading capabilities of DBD::mysql depend completelyon the underlying C libraries: The modules are working with handle dataonly, no global variables are accessed or (to the best of my knowledge)thread unsafe functions are called. Thus DBD::mysql is believedto be completely thread safe, if the C libraries are thread safeand you don't share handles among threads.

The obvious question is: Are the C libraries thread safe?In the case of MySQL the answer is ``mostly'' and, in theory, you shouldbe able to get a ``yes'', if the C library is compiled for being threadsafe (By default it isn't.) by passing the option -with-thread-safe-clientto configure. See the section on How to make a threadsafe client inthe manual. 

INSTALLATION

Windows users may skip this section and pass over to ``WIN32 INSTALLATION'' below. Others, go on reading.

First of all, you do not need an installed MySQL server for installingDBD::mysql. However, you need at least the clientlibraries and possibly the header files, if you are compiling DBD::mysqlfrom source. In the case of MySQL you can create aclient-only version by using the configure option --without-server.If you are using precompiled binaries, then it may be possible touse just selected RPM's like MySQL-client and MySQL-devel or somethingsimilar, depending on the distribution.

First you need to install the DBI module. For using dbimon, asimple DBI shell it is recommended to install Data::ShowTable anotherPerl module.

I recommend trying automatic installation via the CPAN module. Try

  perl -MCPAN -e shell

If you are using the CPAN module for the first time, it will promptyou a lot of questions. If you finally receive the CPAN prompt, enter

  install Bundle::DBD::mysql

If this fails (which may be the case for a number of reasons, forexample because you are behind a firewall or don't have networkaccess), you need to do a manual installation. First of all youneed to fetch the modules from CPAN search

   http://search.cpan.org/

The following modules are required

  DBI  Data::ShowTable  DBD::mysql

Then enter the following commands (note - versions are just examples):

  gzip -cd DBI-(version).tar.gz | tar xf -  cd DBI-(version)  perl Makefile.PL  make  make test  make install

  cd ..  gzip -cd Data-ShowTable-(version).tar.gz | tar xf -  cd Data-ShowTable-(version)  perl Makefile.PL  make  make install

  cd ..  gzip -cd DBD-mysql-(version)-tar.gz | tar xf -  cd DBD-mysql-(version)  perl Makefile.PL  make  make test  make install

During ``perl Makefile.PL'' you will be prompted some questions.Other questions are the directories with header files and libraries.For example, of your file mysql.h is in /usr/include/mysql/mysql.h,then enter the header directory /usr, likewise for/usr/lib/mysql/libmysqlclient.a or /usr/lib/libmysqlclient.so. 

WIN32 INSTALLATION

If you are using ActivePerl, you may use ppm to install DBD-mysql.For Perl 5.6, upgrade to Build 623 or later, then it is sufficientto run

  ppm install DBI  ppm install DBD::mysql

If you need an HTTP proxy, you might need to set the environmentvariable http_proxy, for example like this:

  set http_proxy=http://myproxy.com:8080/

As of this writing, DBD::mysql is missing in the ActivePerl 5.8.0repository. However, Randy Kobes has kindly donated an owndistribution and the following might succeed:

  ppm install http://theoryx5.uwinnipeg.ca/ppms/DBD-mysql.ppd

Otherwise you definitely *need* a C compiler. And it *must* be the samecompiler that was being used for compiling Perl itself. If you don'thave a C compiler, the file README.win32 from the Perl sourcedistribution tells you where to obtain freely distributable C compilerslike egcs or gcc. The Perl sources are available via CPAN search

    http://search.cpan.org

I recommend using the win32clients package for installing DBD::mysqlunder Win32, available for download on www.tcx.se. The following stepshave been required for me:

-
The current Perl versions (5.6, as of this writing) do have a problemwith detecting the C libraries. I recommend to apply the followingpatch:

  *** c:\Perl\lib\ExtUtils\Liblist.pm.orig Sat Apr 15 20:03:40 2000  --- c:\Perl\lib\ExtUtils\Liblist.pm      Sat Apr 15 20:03:45 2000  ***************  *** 230,235 ****  --- 230,239 ----      # add "$Config{installarchlib}/CORE" to default search path      push @libpath, "$Config{installarchlib}/CORE";

  +     if ($VC  and  exists($ENV{LIB})  and  defined($ENV{LIB})) {  +       push(@libpath, split(/;/, $ENV{LIB}));  +     }  +      foreach (Text::ParseWords::quotewords('\s+', 0, $potential_libs)){

        $thislib = $_;
-
Extract sources into C:\. This will create a directory C:\mysqlwith subdirectories include and lib.

IMPORTANT: Make sure this subdirectory is not shared by other TCXfiles! In particular do *not* store the MySQL server in the samedirectory. If the server is already installed in C:\mysql,choose a location like C:\tmp, extract the win32clients there.Note that you can remove this directory entirely once you haveinstalled DBD::mysql.

-
Extract the DBD::mysql sources into another directory, forexample C:\src\siteperl
-
Open a DOS shell and change directory to C:\src\siteperl.
-
The next step is only required if you repeat building the modules: Makesure that you have a clean build tree by running

  nmake realclean

If you don't have VC++, replace nmake with your flavour of make. Iferror messages are reported in this step, you may safely ignore them.

-
Run

  perl Makefile.PL

which will prompt you for some settings. The really important ones are:

  Which DBMS do you want to use?

enter a 1 here (MySQL only), and

  Where is your mysql installed? Please tell me the directory that  contains the subdir include.

where you have to enter the win32clients directory, for exampleC:\mysql or C:\tmp\mysql.

-
Continued in the usual way:

  nmake  nmake install

If you want to create a PPM package for the ActiveState Perl version, thenmodify the above steps as follows: Run

  perl Makefile.PL NAME=DBD-mysql BINARY_LOCATION=DBD-mysql.tar.gz  nmake ppd  nmake

Once that is done, use tar and gzip (for example those from the CygWin32distribution) to create an archive:

  mkdir x86  tar cf x86/DBD-mysql.tar blib  gzip x86/DBD-mysql.tar

Put the files x86/DBD-mysql.tar.gz and DBD-mysql.ppd onto some WWW serverand install them by typing

  install http://your.server.name/your/directory/DBD-mysql.ppd

in the PPM program. 

AUTHORS

A good part of the current version of DBD::mysql is writtenby Jochen Wiedmann, then was maintained byRudy Lippan (rlippanAATTremotelinux.com), and Prepared Statementcode written by Alexey Stroganov and Patrick Galbraith, and now maintained by Patrick Galbraith (patgAATTmysql.com), with thehelp of various people in the community. The first version's authorwas Alligator Descartes (descarteAATTsymbolstone.org), who has beenaided and abetted by Gary Shea, Andreas König and Tim Bunceamongst others.

The Mysql module was originally written by Andreas König<koenigAATTkulturbox.de>. The current version, mainly an emulationlayer, is from Jochen Wiedmann. 

COPYRIGHT

This module is Large Portions Copyright (c) 2004-2006 MySQL Patrick Galbraith, Alexey Stroganov,Large Portions Copyright (c) 2003-2005 Rudolf Lippan; Large Portions Copyright (c) 1997-2003 Jochen Wiedmann, with code portions Copyright (c)1994-1997 their original authors This module isreleased under the same license as Perl itself. See the Perl READMEfor details. 

MAILING LIST SUPPORT

This module is maintained and supported on a mailing list,

    perlAATTlists.mysql.com

To subscribe to this list, send a mail to

    perl-subscribeAATTlists.mysql.com

or

    perl-digest-subscribeAATTlists.mysql.com

Mailing list archives are available at

    http://www.progressive-comp.com/Lists/?l=msql-mysql-modules

Additionally you might try the dbi-user mailing list for questions aboutDBI and its modules in general. Subscribe via

    http://www.fugue.com/dbi

Mailing list archives are at

     http://www.rosat.mpe-garching.mpg.de/mailing-lists/PerlDB-Interest/     http://outside.organic.com/mail-archives/dbi-users/     http://www.coe.missouri.edu/~faq/lists/dbi.html
 

ADDITIONAL DBI INFORMATION

Additional information on the DBI project can be found on the WorldWide Web at the following URL:

    http://www.symbolstone.org/technology/perl/DBI

where documentation, pointers to the mailing lists and mailing listarchives and pointers to the most current versions of the modules canbe used.

Information on the DBI interface itself can be gained by typing:

    perldoc DBI

right now!


 

Index

NAME
SYNOPSIS
EXAMPLE
DESCRIPTION
Class Methods
Private MetaData Methods
Server Administration
DATABASE HANDLES
STATEMENT HANDLES
TRANSACTION SUPPORT
MULTITHREADING
INSTALLATION
WIN32 INSTALLATION
AUTHORS
COPYRIGHT
MAILING LIST SUPPORT
ADDITIONAL DBI INFORMATION

This document was created byman2html,using the manual pages.
 
ICM Bot detect detector