Source for file DBUtilImpl.php
Documentation is available at DBUtilImpl.php
     * Database Util Implementation Class  
     * @copyright Copyright (c) 2003-2006 Mirchev Ideas Ltd. All rights reserved.  
    require_once(MI_DATABASE_ENGINE . 
'.php');  
     * Implements functions for database  
     * @copyright Copyright (c) 2003-2006 Mirchev Ideas Ltd. All rights reserved.  
         * miDBUtilImpl constructor.  
         * $DBUtilImpl = new miDBUtilImpl($dbHost, $dbUser, $dbPass, $dbName);  
         * @param string $dbHost host name  
         * @param string $dbUser username  
         * @param string $dbPass password  
         * @param string $dbName database name  
        public function __construct($dbHost, $dbUser, $dbPass, $dbName)  
         * Connects to a SQL database  
         * $DBUtilImpl = new miDBUtilImpl($dbHost, $dbUser, $dbPass, $dbName);  
         * $DBUtilImpl->pconnect();  
         * @return resource Returns a SQL link identifier  
            if ($this->_link === 
false) {  
         * Ping the database and attempt to reconnect if necessary  
         * @return false on failure, true on success  
         * $DBUtilImpl = new miDBUtilImpl($dbHost, $dbUser, $dbPass, $dbName);  
         * $DBUtilImpl->pconnect();  
         * $rezult = $DBUtilImpl->execSQL($query);  
         * @param string $query query string  
         * @param array $params positional params (optional)  
         * @return mixed Resource identifier or true depending on the query  
        public function &execSQL($query, $params = 
array())  
            if (count($params) > 
0) {  
                $queryParts = 
explode('?', $query);  
                foreach ($params as $key => 
$param)  
         * Executes a SQL insert query  
         * $DBUtilImpl = new miDBUtilImpl($dbHost, $dbUser, $dbPass, $dbName);  
         * $DBUtilImpl->pconnect();  
         * $result = $DBUtilImpl->execSQLInsert($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  
         * $DBUtilImpl = new miDBUtilImpl($dbHost, $dbUser, $dbPass, $dbName);  
         * $DBUtilImpl->pconnect();  
         * $rows = $DBUtilImpl->execSelect($query)  
         * @param string $query query string  
         * @param array $params positional query params (optional)  
         * @return array array with associative arrays from the result  
        public function execSelect($query, $params = 
array())  
            $result = 
$this->execSQL($query, $params);  
         * Executes the select query and also returns the selected column names in the $fieldsArray  
         * $DBUtilImpl = new miDBUtilImpl($dbHost, $dbUser, $dbPass, $dbName);  
         * $DBUtilImpl->pconnect();  
         * $rows = $DBUtilImpl->execSelectAndGetFields($query, $fieldsArray);  
         * @param string $query query string  
         * @param array $fieldsArray array for names of the fields  
         * @return array array with associative arrays from the result  
            if ($num_fields === 
false)  
            for ($i = 
0; $i < 
$num_fields; $i++
) {  
         * Executes a SQL insert query from an associative array.  
         * Associative array is representing one record where keys  
         * are the table fields names.  
         * $DBUtilImpl = new miDBUtilImpl($dbHost, $dbUser, $dbPass, $dbName);  
         * $DBUtilImpl->pconnect();  
         * //$values is an associative array with data for inserting  
         * $DBUtilImpl->execInsert($table, $values);  
         * @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  
            foreach ($values as $key => 
$value) {  
            $query = 
'INSERT INTO ' . 
$table . 
'(';  
         * Executes a SQL update query from an array for a specify record key  
         * $DBUtilImpl = new miDBUtilImpl($dbHost, $dbUser, $dbPass, $dbName);  
         * $DBUtilImpl->pconnect();  
         * $DBUtilImpl->execUpdate($table, $values, $key, $keyval);  
         * @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 function execUpdate($table, $values, $key, $keyval)  
            foreach ($values as $field => 
$fieldValue) {  
                if ($fieldValue === 
null)  
                    $data[] = 
$field . 
'=NULL';  
            $query = 
'UPDATE ' . 
$table . 
' SET ';  
                foreach ($key as $keyId => 
$keyName)  
                $query .= 
' WHERE ' . 
implode(' AND ', $keysArray);  
         * Executes a SQL delete query for a specify record key  
         * $DBUtilImpl = new miDBUtilImpl($dbHost, $dbUser, $dbPass, $dbName);  
         * $DBUtilImpl->pconnect();  
         * $DBUtilImpl->execDelete($table, $key, $keyval);  
         * @param string $table database table name  
         * @param string $key name of the key field  
         * @param int $keyval value of the key field  
            $query = 
'DELETE FROM ' . 
$table;  
                foreach ($key as $keyId => 
$keyName)  
                $query .= 
' WHERE ' . 
implode(' AND ', $keysArray);  
         * Returns an array with names of the fields in the specified table.  
         * $DBUtilImpl = new miDBUtilImpl($dbHost, $dbUser, $dbPass, $dbName);  
         * $DBUtilImpl->pconnect();  
         * $fieldsArray = $DBUtilImpl->getTableFields($tableName);  
         * @param string $table database table name  
         * @return array array with names of the fields  
            for ($i = 
0; $i < 
$columns; $i++
) {  
 
 
	
		Documentation generated on Thu, 08 May 2008 16:57:23 +0300 by phpDocumentor 1.4.1