Source for file database.cls.php
Documentation is available at database.cls.php
/***********************************************\
* Copyright (c) 2008 Zibings Incorporated *
* You should have received a copy of the *
* Microsoft Reciprocal License along with *
* this program. If not, see: *
* <http://opensource.org/licenses/ms-rl.html> *
\***********************************************/
* $Id: database.cls.php 166 2008-10-31 06:34:08Z amale $
global $_n2f_db_extensions;
* Core database class for N2 Framework Yverdon.
* Connection resource for this n2f_database object.
* Number of queries performed by this n2f_database object.
* The extension currently in use by this n2f_database object.
* Internal container for object data.
* Static function for adding database extensions to the available list.
* @param array $callbacks
public static function addExtension($name, array $callbacks) {
if (count($callbacks) <>
10 ||
global $_n2f_db_extensions;
$_n2f_db_extensions[$name] =
array(
* Initializes a new n2f_database object.
global $_n2f_db_extensions;
if (!isset
($_n2f_db_extensions[$ext])) {
* Mechanism for storing data in the n2f_database object's internal data container.
public function addData($key, $data) {
* Retrieves data from the n2f_database object's internal data container.
* Opens the connection for this n2f_database object.
* Closes the connection for this n2f_database object.
public function close() {
* Returns true or false based on whether or not the object's connection is active.
* Produces a new n2f_database_query object from the given query.
* @return n2f_database_query
public function query($sql) {
* Core database query class for N2 Framework Yverdon.
* Internal reference to the global database handler.
* SQL string used for this query.
* Collection of parameters for the current query.
* Holds the current result set for the query if applicable.
* Latest error returned by the query.
* Internal container for object data.
* Initializes a new n2f_database_query object.
* @param n2f_database $db
* @return n2f_database_query
global $n2f, $_n2f_db_extensions;
if ($db->extension ===
null ||
empty($db->extension)) {
} else if ($db->isOpen() !==
true) {
$n2f->debug->throwNotice(N2F_NOTICE_DB_QUERY_CREATED, S('N2F_NOTICE_DB_QUERY_CREATED', array($db->extension, $sql)), 'system/classes/database.cls.php');
* Mechanism for storing data in the n2f_database_query object's internal data container.
public function addData($key, $data) {
* Retrieves data from the n2f_database_query object's internal data container.
* Adds a parameter to the query stack.
* @return n2f_database_query
public function addParam($key, $value, $type) {
* @return n2f_database_query
if (count($this->_errors) <
1) {
* Adds an error to the n2f_database_query object's error stack.
* @return n2f_database_query
$this->_errors[] =
$string;
* Returns true or false based on whether or not an error has occurred.
if (count($this->_errors) >
0) {
* Returns the last populated error string.
return($this->_errors[count($this->_errors) -
1]);
* Returns the error stack.
* Fetches a single row from the result.
* Fetches all rows from the result.
* Fetches a specific field from the result.
* @param string $field_name
* Fetches the last automatically incremented value from the query (if applicable).
* Returns the number of rows from the result.
Documentation generated on Wed, 05 Nov 2008 13:15:11 -0500 by phpDocumentor 1.4.0