Class miStaticDBUtil

Description

Implements functions for database

  • copyright: Mirchev Ideas Ltd. © 2003, 2004

Located in /database/StaticDBUtil.inc (line 23)


	
			
Method Summary
 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)
 object object getObject ()
 array &getTableFields (string $table)
Methods
execDelete (line 205)

Executes a SQL delete query for a specify record key

Example:


1 <?php
2 $StaticDBUtil = new miStaticDBUtil;
3 $StaticDBUtil->execDelete($table, $key, $keyval);
4 ?>

  • 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 158)

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 $StaticDBUtil = new miStaticDBUtil;
3 //$values is an associative array with data for inserting
4 $StaticDBUtil->execInsert($table, $values);
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 execInsert (string $table, array $values)
  • string $table: table name
  • array $values: associative arrays with data for inserting
execSelect (line 107)

Returns an array with associative arrays from the result

Example:


1 <?php
2 $StaticDBUtil = new miStaticDBUtil;
3 $rows = $StaticDBUtil->execSelect($query)
4 ?>

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

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

Example:


1 <?php
2 $StaticDBUtil = new miStaticDBUtil;
3 $rows = $StaticDBUtil->execSelectGetFields($query, $fieldsArray);
4 ?>

  • 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 62)

Executes a SQL query

Example:


1 <?php
2 $StaticDBUtil = new miStaticDBUtil;
3 $rezult = $StaticDBUtil->execSQL($query);
4 ?>

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

Executes a SQL insert query

Example:


1 <?php
2 $StaticDBUtil = new miStaticDBUtil;
3 $result = $StaticDBUtil->execSQLInsert($query);
4 ?>

  • 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 182)

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

Example:


1 <?php
2 $StaticDBUtil = new miStaticDBUtil;
3 $StaticDBUtil->execUpdate($table, $values, $key, $keyval);
4 ?>

  • 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
getObject (line 35)

Return an object of class miDBUtilImpl or its subclasses

Object of class miDBUtilImpl or its subclasses is needed to handle the connection between database and miStaticDBUtil class

  • return: of class miDBUtilImpl or its subclasses
  • access: public
object object getObject ()
getTableFields (line 227)

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

Example:


1 <?php
2 $StaticDBUtil = new miStaticDBUtil;
3 $StaticDBUtil = $DBUtilImpl->getTableFields($tableName);
4 ?>

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

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