Source for file Query.class.php
Documentation is available at Query.class.php
* Gumbo Library Framework
* This library is being released under the terms of the New BSD License. A
* copy of the license is packaged with the software (LICENSE.txt). If no
* copy is found, a copy of the license template can be found at:
* http://www.opensource.org/licenses/bsd-license.php
* @copyright Copyright (c) 2007, iBayou, Michael Luster
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @author Michael Luster <mluster79@yahoo.com>
* @link http://sourceforge.net/projects/phpgumbo
* This interface was designed to create a common class for a program to
* execute database queries (select,insert,update,delete). By using a common
* interface, any changes made to the database engine (PDO, ADODB, PEAR_DB, etc)
* can be reflected in a Query class, and not the entire program. For example,
* if a program is written for PEAR_DB, but a decision was made to switch to
* PDO, the transition is made much easier when the implementation is in one
* location. Imagine having to search through thousands of lines of code and
* change the implementation from PEAR_DB to PDO.
* @copyright Copyright (c) 2007, iBayou, Michael Luster
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @author Michael Luster <mluster79@yahoo.com>
* @link http://sourceforge.net/projects/phpgumbo
* Returns an array of Items with the results of a "SELECT ... " query
* @param string $sql query to execute
* @param array $params token parameter values
public static function results ($sql, $params=
null);
* Executes the given query and returns the results
* This is a Bridge between the DB interface and the Item class. It
* will execute a sinle query and return the results. If a SELECT
* is performed, then a single associative array representing a
* record is returned. If an INSERT is performed, then the new insert
* ID is returned. UPDATE and DELETE queries will not return anything.
* @param array $params list of parameters for the prepare method
* @param string $name sequence/column name for returning lastInsertId()
public static function execute ($sql, $params=
null, $name=
null);
* Prepares a query by substituting a token character with parameter values
* @param array $params list of parameters
* @param string $token replacement token character
public static function prepare ($sql, $params=
null, $token=
null);