NAME
Meta::Db::Dbi - an extension of the regular DBI module.
COPYRIGHT
Copyright (C) 2001, 2002 Mark Veltzer; All rights reserved.
LICENSE
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
DETAILS
MANIFEST: Dbi.pm
PROJECT: meta
VERSION: 0.30
SYNOPSIS
package foo;
use Meta::Db::Dbi qw();
my($object)=Meta::Db::Dbi->new();
my($result)=$object->do("CREATE DATABASE foo");
DESCRIPTION
This is my extension of the Dbi module. The reason that there is no inheritance here is that DBI is hard to inherit from since the object which is the database handle (which is returned from connect) is not clear (I mean which object is it). And all the internals of the other objects (statement handles and others) are not well documented. This is the reason that this object just stores a handle and not IS a handle.
FUNCTIONS
new($)
error($$)
connect_dsn($$$)
connect_xml($$$$)
connect($$)
connect_def($$$)
connect_name($$$)
connect_info($$$)
execute_single($$)
execute_arrayref($$)
execute($$$$)
prepare($$)
begin_work($)
commit($)
quote_simple($$)
quote($$$)
disconnect($)
table_info($)
full_table_info($)
TEST($)
FUNCTION DOCUMENTATION
- new($)
-
This is a constructor which gives you a new Dbi object.
- error($$)
-
This class method will handle error for us by raising an exception with the relevant errors data.
- connect_dsn($$$)
-
This will connect the Dbi to the specified connection data if you spply the DSN. Input: 0. object to connect. 1. connection object. 2. DSN used for connection.
- connect_xml($$$$)
-
This method will receive: 0. A Meta::Db::Dbi object to connect. 1. A file name of XML data for connection. 2. A name of a connection to connect with. 3. A name of a database to connect to. The method will connect the Dbi object.
- connect($$)
-
This will connect the Dbi to the specified connection data. The connection will NOT be to a specific database. Parameters: 0. Dbi object - handle of the object to connect. 1. Meta::Db::Connection object - used to get the connection information.
- connect_def($$$)
-
This will connect to a server and a specific db within the server.
- connect_name($$$)
-
This will connect to a server and a specific db name within the server.
- connect_info($$$)
-
This method will connect the Dbi handle to a specific db name take from an info object.
- execute_single($$)
-
This method will execute a single sql statement and will return the result.
- execute_arrayref($$)
-
This method will execute a select_arrayref dbi.
- execute($$$$)
-
This method will execute a list of statements on the Dbi connection.
- prepare($$)
-
This method will prepare a statement for execution. This method returns the handle to the prepared statement.
- begin_work($)
-
This methos is exactly like the DBI::begin_work method except it raises exceptions in the case of errors.
- commit($)
-
This method is exactly like the DBI::commit method except it raises exceptions in the case of errors.
- quote_simple($$)
-
This is the most basic quoting mechanism without type specification.
- quote($$$)
-
This is the two argument Dbi quote function.
- disconnect($)
-
This method will disconnect the Dbi object according to the specified connection data.
- table_info($)
-
This method will give you the list of tables in the database.
- full_table_info($$$$$)
-
This method will give you the list of tables in the database.
- TEST($)
-
Test suite for this object.
SUPER CLASSES
None.
BUGS
None.
AUTHOR
Name: Mark Veltzer
Email: mailto:veltzer@cpan.org
WWW: http://www.veltzer.org
CPAN id: VELTZER
HISTORY
0.00 MV get graph stuff going
0.01 MV more perl quality
0.02 MV perl qulity code
0.03 MV more perl code quality
0.04 MV revision change
0.05 MV languages.pl test online
0.06 MV db stuff
0.07 MV advance the contacts project
0.08 MV xml data sets
0.09 MV more data sets
0.10 MV perl packaging
0.11 MV data sets
0.12 MV PDMT
0.13 MV some chess work
0.14 MV more movies
0.15 MV fix database problems
0.16 MV md5 project
0.17 MV database
0.18 MV perl module versions in files
0.19 MV movies and small fixes
0.20 MV more thumbnail stuff
0.21 MV thumbnail user interface
0.22 MV more thumbnail issues
0.23 MV website construction
0.24 MV improve the movie db xml
0.25 MV web site development
0.26 MV web site automation
0.27 MV SEE ALSO section fix
0.28 MV download scripts
0.29 MV teachers project
0.30 MV md5 issues
SEE ALSO
DBI(3), Error(3), Meta::Db::Connections(3), Meta::Utils::System(3), strict(3)
TODO
-use Meta::Class::MethodMaker so that inheritance and code will be cleaner.
-use the connect_cached method of the DBI instead of straight connect.
-add convenience method of auto_commit on and off.