Naming Conventions and Name Space
The
DBI package and all packages
below it (DBI::*
) are reserved for use by the DBI.
Extensions and related modules use the DBIx::
namespace (see http://www.perl.com/CPAN/modules/by-module/DBIx/). Package names beginning with DBD::
are reserved for use by DBI database drivers. All environment
variables used by the DBI or by individual DBDs begin with
DBI_
or DBD_
.
The letter case used for attribute names is significant and plays an important part in the portability of DBI scripts. The case of the attribute name is used to signify who defined the meaning of that name and its values, as the following table shows.
Case of Name |
Has a Meaning Defined By |
UPPER_CASE |
Standards, e.g., X/Open, ISO SQL92, etc. (portable) |
MixedCase |
DBI API (portable), underscores are not used |
lower_case |
Driver or database engine specific (non-portable) |
It is of the utmost importance that driver developers use only
lowercase attribute names when defining private attributes. Private
attribute names must be prefixed with the driver name or suitable
abbreviation (e.g., ora_
for Oracle,
ing_
for Ingres, etc.).
Here’s a sample of the Driver Specific Prefix Registry:
ado_ DBD::ADO best_ DBD::BestWins csv_ DBD::CSV db2_ DBD::DB2 f_ DBD::File file_ DBD::TextFile ib_ DBD::InterBase ing_ DBD::Ingres ix_ DBD::Informix msql_ DBD::mSQL mysql_ DBD::mysql odbc_ DBD::ODBC ora_ DBD::Oracle proxy_ DBD::Proxy solid_ DBD::Solid syb_ DBD::Sybase tuber_ DBD::Tuber xbase_ DBD::XBase
Get Programming the Perl DBI 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.