NoSQL::PL2SQL::DBI::SQLite - SQLite driver for NoSQL::PL2SQL
package AnyClass ; use base qw( NoSQL::PL2SQL ) ; use NoSQL::PL2SQL::DBI::SQLite ; ## define a data source my $dsn = new NoSQL::PL2SQL::DBI::SQLite $tablename ; ## connect $dsn->connect( $data_source, $username, $auth, \%attr ) ; ## access my $object = AnyClass->SQLObject( $dsn, $objectid ) ; ## create a data source $dsn->loadschema ; ## utilities $dsn->do('DROP TABLE %s') ; $dsn->do('DELETE FROM %s') ; my @fetchrows = $dsn->rows_hash('SELECT * FROM %s WHERE objectid=1') ; my @fetchrows = $dsn->rows_array('SELECT * FROM %s WHERE objectid=1') ;
NoSQL::PL2SQL::DBI::SQLite creates a SQLite database datasource for NoSQL::PL2SQL.
Developers who are comfortable with RDB can design a thin object interface using any number of tools, such as DBIx::Class. NoSQL::PL2SQL is designed for developers of thicker objects that may be more logical and require data flexibility. For these developers, where the database is merely a mechanism for object persistance, NoSQL::PL2SQL provides a simple abstraction with a trivial interface, and great portability.
One of NoSQL::PL2SQL's features is a "universal" table definition that can accomodate arbitrary and indeterminate data structures. This flexibility means that a single table can be used for heterogeneous instantiations of different classes. In many cases, a single table can serve the data needs of an entire application. Consequently, a NoSQL::PL2SQL::DBI object is primarily defined by the tablename using a constructor argument.
The driver object contains only one other property, a database handle, which is defined using the
connect() method with the same arguments as the default
DBI->connect() method. Otherwise, the default handle is a NoSQL::PL2SQL::DBI::Null object that simply reflects statement arguments, and can be useful for debugging.
This object can also invoke any DBI method. SQL statement arguments do not need to specify a table name which is a property of the driver object. Use the
sprintf() notation '%s' intead.
Additionally, NoSQL::PL2SQL::DBI provides versions of
rows_hash() respectively. These methods take an SQL statement as an argument, perform preparation and execution, and return the same output as their counterparts.
None by default.
Jim Schueler, <email@example.com>
Copyright (C) 2012 by Jim Schueler
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.9 or, at your option, any later version of Perl 5 you may have available.