Source for file StaticDBUtil.php
Documentation is available at StaticDBUtil.php
* Proxy Database Util Class
* @copyright Copyright (c) 2003-2006 Mirchev Ideas Ltd. All rights reserved.
require_once('DBUtilImpl.php');
* A proxy class that has static methods to access the preconfigured database connection
* The database connection is configured using the following settings:
* MI_DEFAULT_DB_HOST, MI_DEFAULT_DB_USER, MI_DEFAULT_DB_PASS and MI_DEFAULT_DB_NAME
* @copyright Copyright (c) 2003-2006 Mirchev Ideas Ltd. All rights reserved.
* Returns an object of class miDBUtilImpl
* Object of class miDBUtilImpl or its subclasses is needed to handle
* the connection between database and miStaticDBUtil class
* @return object object of class miDBUtilImpl or its subclasses
$dBUtil =
new miDBUtilImpl($settings->get('MI_DEFAULT_DB_HOST'), $settings->get('MI_DEFAULT_DB_USER'),
$settings->get('MI_DEFAULT_DB_PASS'), $settings->get('MI_DEFAULT_DB_NAME'));
* Ping the database and attempt to reconnect if necessary
* @return false on failure, true on success
public static function ping()
* @param string $query query string
* @return resource Resource identifier or true depending on the query
public static function &execSQL($query)
* Executes a SQL insert query
* @param string $query query string
* @return int the ID generated for an AUTO_INCREMENT column by the previous INSERT query
* or 0 if the previous query does not generate an AUTO_INCREMENT value
* Returns an array with associative arrays from the result
* @param string $query query string
* @param array $params positional query params (optional)
* @return array array with associative arrays from the result
public static function execSelect($query, $params =
array())
* Executes the select query and also returns the selected column names in the $fieldsArray
* @param string $query query string
* @param array $fieldsArray array for names of the fields
* @return array array with associative arrays from the result
* Executes a SQL insert query from an associative array.
* Associative array is representing one record where keys
* are the table fields names.
* @param string $table table name
* @param array $values associative arrays with data for inserting
* @return int the ID generated for an AUTO_INCREMENT column by the previous INSERT query
* or 0 if the previous query does not generate an AUTO_INCREMENT value
public static function execInsert($table, $values)
* Executes a SQL update query from an array for a specify record key
* @param string $table database table name
* @param array $values associative arrays with data for updating
* @param string $key name of the key field
* @param int $keyval value of the key field
public static function execUpdate($table, $values, $key, $keyval)
* Executes a SQL delete query for a specify record key
* @param string $table database table name
* @param string $key name of the key field
* @param int $keyval value of the key field
public static function execDelete($table, $key, $keyval)
* Returns an array with names of the fields in the specified table.
* @param string $table database table name
* @return array array with names of the fields
Documentation generated on Thu, 08 May 2008 16:57:41 +0300 by phpDocumentor 1.4.1