This section provides an overview of how to write Perl scripts that use the
DBD::SQLAnywhere interface.
DBD::SQLAnywhere is a driver for the DBI module. Complete documentation for the DBI module is
available online at http://dbi.perl.org.
The DBI Module
To use the DBD::SQLAnywhere interface from a Perl script, you must first tell Perl that you plan to use the DBI module. To do so, include the following line at the top of the file.
How to Open and Close a Database Connection Using Perl DBI
Generally, you open a single connection to a database and then perform all the required operations through it by executing a sequence of SQL statements. To open a connection, you use the connect method. The return value is a handle to the database connection that you use to perform subsequent operations on that connection.
How to Obtain Result Sets Using Perl DBI
Once you have obtained a handle to an open connection, you can access and modify data stored in the database. Perhaps the simplest operation is to retrieve some rows and print them out.
How to Insert Rows Using Perl DBI
Inserting rows requires a handle to an open connection. The simplest method is to use a parameterized INSERT statement, meaning that question marks are used as placeholders for values. The statement is first prepared, and then executed once per new row. The new row values are supplied as parameters to the execute method.