DBI::DBD::SqlEngine - Base class for DBI drivers without their own SQL engine
package DBD::myDriver; use base qw(DBI::DBD::SqlEngine); sub driver { ... my $drh = $proto->SUPER::driver($attr); ... return $drh->{class}; } package DBD::myDriver::dr; @ISA = qw(DBI::DBD::SqlEngine::dr); sub data_sources { ... } ... package DBD::myDriver::db; @ISA = qw(DBI::DBD::SqlEngine::db); sub init_valid_attributes { ... } sub init_default_attributes { ... } sub set_versions { ... } sub validate_STORE_attr { my ($dbh, $attrib, $value) = @_; ... } sub validate_FETCH_attr { my ($dbh, $attrib) = @_; ... } sub get_myd_versions { ... } sub get_avail_tables { ... } package DBD::myDriver::st; @ISA = qw(DBI::DBD::SqlEngine::st); sub FETCH { ... } sub STORE { ... } package DBD::myDriver::Statement; @ISA = qw(DBI::DBD::SqlEngine::Statement); sub open_table { ... } package DBD::myDriver::Table; @ISA = qw(DBI::DBD::SqlEngine::Table); sub new { ... }
DBI::DBD::SqlEngine abstracts the usage of SQL engines from the DBD. DBD authors can concentrate on the data retrieval they want to provide.
It is strongly recommended that you read DBD::File::Developers and DBD::File::Roadmap, because many of the DBD::File API is provided by DBI::DBD::SqlEngine.
Currently the API of DBI::DBD::SqlEngine is experimental and will likely change in the near future to provide the table meta data basics like DBD::File.
The following attributes are handled by DBI itself and not by DBI::DBD::SqlEngine, thus they all work as expected:
Active ActiveKids CachedKids CompatMode (Not used) InactiveDestroy AutoInactiveDestroy Kids PrintError RaiseError Warn (Not used)
Always on.
Works.
Valid after $sth->execute.
$sth->execute
Valid after $sth->prepare.
$sth->prepare
Valid after $sth->execute; probably undef for Non-Select statements.
Not really working, always returns an array ref of ones, as DBD::CSV does not verify input data. Valid after $sth->execute; undef for non-select statements.
In addition to the DBI attributes, you can use the following dbh attributes:
Contains the module version of this driver (readonly)
Contains the module version of DBI::SQL::Nano (readonly)
Contains the module version of SQL::Statement, if available (readonly)
Contains the SQL Statement engine, either DBI::SQL::Nano or SQL::Statement (readonly).
Contains an instantiated instance of SQL::Parser (readonly). This is filled when used first time (only when used with SQL::Statement).
Contains an internally used DBD::Sponge handle (readonly).
Contains the list of valid attributes for each DBI::DBD::SqlEngine based driver (readonly).
Contains the list of those attributes which are readonly (readonly).
Contains how DBI::DBD::SqlEngine deals with non-quoted SQL identifiers:
* SQL_IC_UPPER (1) means all identifiers are internally converted into upper-cased pendants * SQL_IC_LOWER (2) means all identifiers are internally converted into lower-cased pendants * SQL_IC_MIXED (4) means all identifiers are taken as they are
These conversions happen if (and only if) no existing identifier matches. Once existing identifier is used as known.
The SQL statement execution classes doesn't have to care, so don't expect sql_identifier_case affects column names in statements like
sql_identifier_case
SELECT * FROM foo
Contains how DBI::DBD::SqlEngine deals with quoted SQL identifiers (readonly). It's fixated to SQL_IC_SENSITIVE (3), which is interpreted as SQL_IC_MIXED.
Contains additional flags to instantiate an SQL::Parser. Because an SQL::Parser is instantiated only once, it's recommended to set this flag before any statement is executed.
Controls the dialect understood by SQL::Parser. Possible values (delivery state of SQL::Statement):
* ANSI * CSV * AnyData
Defaults to "CSV". Because an SQL::Parser is instantiated only once and SQL::Parser doesn't allow to modify the dialect once instantiated, it's strongly recommended to set this flag before any statement is executed (best place is connect attribute hash).
You can find documentation for this module with the perldoc command.
perldoc DBI::DBD::SqlEngine
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=DBI http://rt.cpan.org/NoAuth/Bugs.html?Dist=SQL-Statement
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/DBI http://annocpan.org/dist/SQL-Statement
CPAN Ratings
http://cpanratings.perl.org/d/DBI
Search CPAN
http://search.cpan.org/dist/DBI/
For questions about installation or usage, please ask on the dbi-dev@perl.org mailing list.
If you have a bug report, patch or suggestion, please open a new report ticket on CPAN, if there is not already one for the issue you want to report. Of course, you can mail any of the module maintainers, but it is less likely to be missed if it is reported on RT.
Report tickets should contain a detailed description of the bug or enhancement request you want to report and at least an easy way to verify/reproduce the issue and any supplied fix. Patches are always welcome, too.
Thanks to Tim Bunce, Martin Evans and H.Merijn Brand for their continued support while developing DBD::File, DBD::DBM and DBD::AnyData. Their support, hints and feedback helped to design and implement this module.
This module is currently maintained by
H.Merijn Brand < h.m.brand at xs4all.nl > and Jens Rehsack < rehsack at googlemail.com >
The original authors are Jochen Wiedmann and Jeff Zucker.
Copyright (C) 2009-2010 by H.Merijn Brand & Jens Rehsack Copyright (C) 2004-2009 by Jeff Zucker Copyright (C) 1998-2004 by Jochen Wiedmann
All rights reserved.
You may freely distribute and/or modify this module under the terms of either the GNU General Public License (GPL) or the Artistic License, as specified in the Perl README file.
DBI, DBD::File, DBD::AnyData and DBD::Sys.
To install DBI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBI
CPAN shell
perl -MCPAN -e shell install DBI
For more information on module installation, please visit the detailed CPAN module installation guide.