- NAME
- SYNOPSIS
- DESCRIPTION
- METHODS
- STATEMENT HANDLERS
- PROTECTED METHODS
- REFERENCES
- LICENSE
- AUTHOR
NAME
YaBB3::DataSource::sql_base - Datasource base class for SQL-like backends
SYNOPSIS
DESCRIPTION
Provides a base class for YaBB3::DataSource::* modules that use DBI-based
sources for data
METHODS
new(option => 'value')
This functions is usually called by the YaBB3::DataSource module. It will supply the user, password and database arguments based on the current board's configuration.
Options
- db_type
- This indicates what type of database we are connecting to. In most cases, this is not set here and is instead initialized in the subclassed c<initialize()> method.
- user
- This is the user to use for DB connection. It should be set by the user of the module.
- password
- This is the password for the DB connection. It should be set by the user of the module.
- database
- This is the name of the database to connect to. It should be set by the user of the module.
Return Value
Returns an object of the class that new was called in.
do_query( $sql, [ bind_values, ... ])
Behaves in accordance with the API defined in the YaBB3::DataSource manpage
prepare( $sql )
Behaves in accordance with the API defined in the YaBB3::DataSource manpage
STATEMENT HANDLERS
execute( bind_values, ... )
Behaves in accordance with the API defined in the YaBB3::DataSource manpage
fetch( )
Behaves in accordance with the API defined in the YaBB3::DataSource manpage
PROTECTED METHODS
These methods are for use in subclasses only and are not so be called by other modules.
_initialize( $arg_ref )
This is not a method designed for public calling. It is for use only by this class and it's sub-classes. (A protected method in C++ speak.)
This method is empty and is designed to be overriden by a subclass. It is run
just before new() returns. It is passed a hashref to the arguments passed
to new().
Arguments
- $arg_ref
- A hash reference to the hash of arguments passed into the new method.
Return Value
Does not return a value.
_connect( )
This is not a method designed for public calling. It is for use only by this class and it's sub-classes. (A protected method in C++ speak.)
This method connects to the database using DBI. It does it's best to build a dsn, but if you are supporting a weird database it may get it wrong.
When overriding this method, you must ensure the following: =over =item $self->{dbh} contains a handle to the database =item $self->{connected} is set to one on succesful connection =back
Arguments
None.
Return Value
Does not return a value.
_get_dbh( )
Arguments
None.
Return Value
Returns the connected handle to DBI. Will connect if required.
REFERENCES
This following links were helpful when creating this document and may contain further helpful information:
DBI
LICENSE
This module is licensed under the same terms as YaBB.
AUTHOR
Matthew Siegman
Copyright (c) 2000-2009 YaBB (www.yabbforum.com) - All Rights Reserved.