MySQL Perl API
This section documents the Perl DBI interface. The former interface was called mysqlperl. DBI/DBD now is the recommended Perl interface, so mysqlperl is obsolete and is not documented here.
DBI with DBD::mysql
DBI is a generic interface for many databases. That means that you can write a script that works with many different database engines without change. You need a dataBase driver (DBD) defined for each database type. For MySQL, this driver is called DBD::mysql.
For more information on the Perl5 DBI, please visit the DBI web page and read the documentation:
http://www.symbolstone.org/technology/perl/DBI/
For more information on object oriented programming (OOP) as defined in Perl5, see the Perl OOP page:
http://language.perl.com/info/documentation.html
Note that if you want to use transactions with Perl, you need to have Msql-Mysql-modules Version 1.2216 or newer.
Installation instructions for MySQL Perl support are given in Section 2.7.
The DBI Interface
Portable DBI methods
|
Method |
Description |
|---|---|
|
connect |
Establishes a connection to a database server |
|
disconnect |
Disconnects from the database server |
|
prepare |
Prepares an SQL statement for execution |
|
execute |
Executes prepared statements |
|
do |
Prepares and executes an SQL statement |
|
quote |
Quotes string or BLOB values to be inserted |
|
fetchrow_array |
Fetches the next row as an array of fields |
|
fetchrow_arrayref |
Fetches the next row as a reference array of fields |
|
fetchrow_hashref |
Fetches the next row as a reference to ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access