Appendix F. Perl Interface Reference

This appendix is a reference for the Perl DBI module, which can be used to communicate with a SQLite database. Methods and attributes specific to the DBD::SQLite module are also listed.

In this appendix, the commands or methods are shown first, followed by the explanation.

The Perl DBI

The Perl interface to SQLite is the Perl Database Interface (DBI) module using the SQLite Database Driver (DBD) module.

use DBI;

Loads the DBI module into your script. There is no need to explicitly load a DBD driver as DBI takes care of this automatically.

In this appendix we use $dbh to refer to a database handle object and $sth for a statement handle.

Opening and Closing a Database

 $dbh = DBI->connect($data_source, $username, $auth, ...

Get SQLite now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.