Class miDBUtilImpl

Description

Implements functions for database

  • copyright: Mirchev Ideas Ltd. © 2003, 2004

Located in /database/DBUtilImpl.inc (line 21)


	
			
Method Summary
 miDBUtilImpl miDBUtilImpl (string $dbHost, string $dbUser, string $dbPass, string $dbName)
 void execDelete (string $table, string $key, int $keyval)
 int execInsert (string $table, array $values)
 array execSelect (string $query)
 array execSelectGetFields (string $query, array &$fieldsArray)
 resource &execSQL (string $query)
 int execSQLInsert (string $query)
 void execUpdate (string $table, array $values, string $key, int $keyval)
 array &getTableFields (string $table)
 resource &pconnect (string $dbHost, string $dbUser, string $dbPass)
Methods
Constructor miDBUtilImpl (line 69)

miDBUtilImpl constructor.

Example:


1 <?php
2 $DBUtilImpl = new miDBUtilImpl($dbHost, $dbUser, $dbPass, $dbName);
3 ?>

  • access: public
miDBUtilImpl miDBUtilImpl (string $dbHost, string $dbUser, string $dbPass, string $dbName)
  • string $dbHost: host name
  • string $dbUser: username
  • string $dbPass: password
  • string $dbName: database name
execDelete (line 334)

Executes a SQL delete query for a specify record key

Example:


1 <?php
2 $DBUtilImpl = new miDBUtilImpl($dbHost, $dbUser, $dbPass, $dbName);
3 $DBUtilImpl->pconnect();
4 $DBUtilImpl->execDelete($table, $key, $keyval);
5 ?>

  • access: public
void execDelete (string $table, string $key, int $keyval)
  • string $table: database table name
  • string $key: name of the key field
  • int $keyval: value of the key field
execInsert (line 269)

Executes a SQL insert query from an associative array.

Associative array is representing one record where keys are the table fields names. Example:


1 <?php
2 $DBUtilImpl = new miDBUtilImpl($dbHost, $dbUser, $dbPass, $dbName);
3 $DBUtilImpl->pconnect();
4 //$values is an associative array with data for inserting
5 $DBUtilImpl->execInsert($table, $values);
6 ?>

  • return: 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
  • access: public
int execInsert (string $table, array $values)
  • string $table: table name
  • array $values: associative arrays with data for inserting
execSelect (line 193)

Returns an array with associative arrays from the result

Example:


1 <?php
2 $DBUtilImpl = new miDBUtilImpl($dbHost, $dbUser, $dbPass, $dbName);
3 $DBUtilImpl->pconnect();
4 $rows = $DBUtilImpl->execSelect($query)
5 ?>

  • return: array with associative arrays from the result
  • access: public
array execSelect (string $query)
  • string $query: query string
execSelectGetFields (line 227)

Returns an array with associative arrays from the result and sets an fills specify array with names of the fields.

Example:


1 <?php
2 $DBUtilImpl = new miDBUtilImpl($dbHost, $dbUser, $dbPass, $dbName);
3 $DBUtilImpl->pconnect();
4 $rows = $DBUtilImpl->execSelectGetFields($query, $fieldsArray);
5 ?>

  • return: array with associative arrays from the result
  • access: public
array execSelectGetFields (string $query, array &$fieldsArray)
  • string $query: query string
  • array $fieldsArray: array for names of the fields
execSQL (line 131)

Executes a SQL query

Example:


1 <?php
2 $DBUtilImpl = new miDBUtilImpl($dbHost, $dbUser, $dbPass, $dbName);
3 $DBUtilImpl->pconnect();
4 $rezult = $DBUtilImpl->execSQL($query);
5 ?>

  • return: Resource identifier or FALSE if the query was not executed correctly
  • access: public
resource &execSQL (string $query)
  • string $query: query string
execSQLInsert (line 163)

Executes a SQL insert query

Example:


1 <?php
2 $DBUtilImpl = new miDBUtilImpl($dbHost, $dbUser, $dbPass, $dbName);
3 $DBUtilImpl->pconnect();
4 $result = $DBUtilImpl->execSQLInsert($query);
5 ?>

  • return: 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
  • access: public
int execSQLInsert (string $query)
  • string $query: query string
execUpdate (line 302)

Executes a SQL update query from an array for a specify record key

Example:


1 <?php
2 $DBUtilImpl = new miDBUtilImpl($dbHost, $dbUser, $dbPass, $dbName);
3 $DBUtilImpl->pconnect();
4 $DBUtilImpl->execUpdate($table, $values, $key, $keyval);
5 ?>

  • access: public
void execUpdate (string $table, array $values, string $key, int $keyval)
  • string $table: database table name
  • array $values: associative arrays with data for updating
  • string $key: name of the key field
  • int $keyval: value of the key field
getTableFields (line 357)

Returns an array with names of the fields for a specify table.

Example:


1 <?php
2 $DBUtilImpl = new miDBUtilImpl($dbHost, $dbUser, $dbPass, $dbName);
3 $DBUtilImpl->pconnect();
4 $fieldsArray = $DBUtilImpl->getTableFields($tableName);
5 ?>

  • return: array with names of the fields
  • access: public
array &getTableFields (string $table)
  • string $table: database table name
pconnect (line 95)

Connects to a SQL database

Example:


1 <?php
2 $DBUtilImpl = new miDBUtilImpl($dbHost, $dbUser, $dbPass, $dbName);
3 $DBUtilImpl->pconnect();
4 ?>

  • return: Returns a SQL link identifier on success, or false on failure
  • access: public
resource &pconnect (string $dbHost, string $dbUser, string $dbPass)
  • string $dbHost: host name
  • string $dbUser: username
  • string $dbPass: password

Documentation generated on Mon, 18 Oct 2004 14:58:31 +0300 by phpDocumentor 1.2.3