Public Member Functions |
| | __construct () |
| | get_object () |
| | query ($Query) |
| | query_as ($theQueryMode) |
| | select ($What, $Tables, $Condition= '1=1') |
| | fetch_results ($Result) |
| | insert ($Table, $Fields, $Values) |
| | delete ($Table, $Condition= '1=1') |
| | update ($Table, $Fields, $Values, $Condition= '1=1') |
| | create ($Table, $FirstIndexField= 'id') |
| | drop ($Table) |
| | lock ($Tables, $Modes) |
| | unlock () |
| | savepoint ($Savepoint) |
| | rollback ($Savepoint) |
| | transaction () |
| | commit () |
Static Public Attributes |
| static | $Session = false |
Detailed Description
Class providees routine for database manipulation.
- Author
- Dodonov A.A.
Definition at line 30 of file database.php.
Constructor & Destructor Documentation
Constructor.
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 137 of file database.php.
{
try
{
$this->CachedMultyFS =
get_package(
'cached_multy_fs' ,
'last' , __FILE__ );
$this->DatabaseLogger =
get_package(
'database::database_logger' ,
'last' , __FILE__ );
$this->PageComposer =
get_package(
'page::page_composer' ,
'last' , __FILE__ );
$this->Security =
get_package(
'security' ,
'last' , __FILE__ );
$this->String =
get_package(
'string' ,
'last' , __FILE__ );
$this->Text =
get_package(
'string::text' ,
'last' , __FILE__ );
$this->Tags =
get_package(
'string::tags' ,
'last' , __FILE__ );
}
catch( Exception $e )
{
}
}
Member Function Documentation
Function commits transaction.
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 840 of file database.php.
{
try
{
$this->QueryCounter++;
$DBO->commit();
}
catch( Exception $e )
{
}
}
| create |
( |
|
$Table, |
|
|
|
$FirstIndexField = 'id' |
|
) |
| |
Executes delete query.
- Parameters
-
| $Table | - Created table. |
| $FirstIndexField | - Name of index field. Field will be created automatically. |
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 624 of file database.php.
{
try
{
$this->QueryCounter++;
$DBO->create( $Table , $FirstIndexField );
}
catch( Exception $e )
{
}
}
| delete |
( |
|
$Table, |
|
|
|
$Condition = '1 = 1' |
|
) |
| |
Executes delete query.
- Parameters
-
| $Table | - Record (or records) will be deleted from this table. |
| $Condition | - Record selection condition. |
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 544 of file database.php.
{
try
{
$this->QueryCounter++;
$DBO->delete( $Table , $Condition );
}
catch( Exception $e )
{
}
}
Executes delete table query.
- Parameters
-
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 656 of file database.php.
{
try
{
$this->QueryCounter++;
$DBO->drop( $Table );
}
catch( Exception $e )
{
}
}
Function fetches results of the query.
- Parameters
-
| $Result | - Query result object. |
- Returns
- Array of selected records.
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 461 of file database.php.
{
try
{
$Result = $DBO->fetch_results( $Result );
if( $this->DatabaseEncoding != 'UTF-8' )
{
$Result = $this->Text->iconv( $this->DatabaseEncoding , 'UTF-8' , $Result );
}
return( $Result );
}
catch( Exception $e )
{
}
}
Function executes query.
- Returns
- Data access object.
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Додонов А.А.
Definition at line 281 of file database.php.
{
try
{
if( $this->DatabaseAccessObject === false )
{
$Config = $this->CachedMultyFS->get_config( __FILE__ , 'cf_database_settings' );
$Config = explode( '#' , $Config );
$this->DatabaseAccessObject =
get_package( $Config[ 0 ] , $Config[ 1 ] , __FILE__ );
$this->DatabaseAccessObject->get_connection();
$this->setup( $Config );
}
return( $this->DatabaseAccessObject );
}
catch( Exception $e )
{
}
}
| insert |
( |
|
$Table, |
|
|
|
$Fields, |
|
|
|
$Values |
|
) |
| |
Executes insert query.
- Parameters
-
| $Table | - New record will be inserted in this table. |
| $Fields | - List of fields wich will be filled while record insertion. |
| $Values | - Field values. |
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 508 of file database.php.
{
try
{
$this->QueryCounter++;
$DBO->insert( $Table , $Fields , $Values );
}
catch( Exception $e )
{
}
}
Function blocks tables.
- Parameters
-
| $Tables | - Blocking tables. |
| $Modes | - Blocking modes. |
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Додонов А.А.
Definition at line 692 of file database.php.
{
try
{
$this->QueryCounter++;
$DBO->lock( $Tables , $Modes );
}
catch( Exception $e )
{
}
}
Function executes query.
- Parameters
-
- Returns
- Query result.
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 326 of file database.php.
{
try
{
$Start = microtime( true );
$this->QueryCounter++;
$Query = str_replace( array( '[eq]' ) , array( '=' ) , $Query );
if( $this->DatabaseEncoding != 'UTF-8' )
{
$Result = $this->Text->iconv(
$this->DatabaseEncoding , 'UTF-8' , $DBO->query( $this->Tags->compile_ultimix_tags( $Query ) )
);
}
else
{
$Result = $DBO->query( $this->Tags->compile_ultimix_tags( $Query ) );
}
$this->DatabaseLogger->log_query( $Query , $Start , $this->DBLogging );
return( $Result );
}
catch( Exception $e )
{
}
}
| query_as |
( |
|
$theQueryMode | ) |
|
Mode of extracting data from table.
- Parameters
-
| $theQueryMode | - Either DB_ASSOC_ARRAY or DB_OBJECT. |
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 374 of file database.php.
{
try
{
$DBO->query_as( $theQueryMode );
}
catch( Exception $e )
{
}
}
Function rollbacks transaction to savepoint.
- Parameters
-
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 784 of file database.php.
{
try
{
$this->QueryCounter++;
$DBO->rollback( $Savepoint );
}
catch( Exception $e )
{
}
}
Function sets savepoint.
- Parameters
-
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 752 of file database.php.
{
try
{
$this->QueryCounter++;
$DBO->savepoint( $Savepoint );
}
catch( Exception $e )
{
}
}
| select |
( |
|
$What, |
|
|
|
$Tables, |
|
|
|
$Condition = '1 = 1' |
|
) |
| |
Function executes select query.
- Parameters
-
| $What | - List of selecting fields. |
| $Tables | - List of tables to select data. |
| $Condition | - Condition for records filtering. |
- Returns
- Array of selected records.
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 417 of file database.php.
{
try
{
$this->QueryCounter++;
$Result = $DBO->select( $What , $Tables , $Condition );
if( $this->DatabaseEncoding != 'UTF-8' )
{
$Result = $this->Text->iconv( $this->DatabaseEncoding , 'UTF-8' , $Result );
}
return( $Result );
}
catch( Exception $e )
{
}
}
Function starts new transaction.
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 812 of file database.php.
{
try
{
$this->QueryCounter++;
$DBO->transaction();
}
catch( Exception $e )
{
}
}
Function releases all locks for all tables.
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 720 of file database.php.
{
try
{
$this->QueryCounter++;
$DBO->unlock();
}
catch( Exception $e )
{
}
}
| update |
( |
|
$Table, |
|
|
|
$Fields, |
|
|
|
$Values, |
|
|
|
$Condition = '1 = 1' |
|
) |
| |
Executes update query.
- Parameters
-
| $Table | - Record (or records) will be updated in this table. |
| $Fields | - List of fields wich will be filled while record update. |
| $Values | - Field values. |
| $Condition | - Record selection condition. |
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 588 of file database.php.
{
try
{
$this->QueryCounter++;
$DBO->update( $Table , $Fields , $Values , $Condition );
}
catch( Exception $e )
{
}
}
Field Documentation
Cached objects.
- Author
- Dodonov A.A.
Definition at line 42 of file database.php.
| $DatabaseAccessObject = false |
DB access object.
- Author
- Dodonov A.A.
Definition at line 61 of file database.php.
| $DatabaseEncoding = 'UTF-8' |
Database default encoding.
- Author
- Dodonov A.A.
Definition at line 73 of file database.php.
Query logging.
- Author
- Dodonov A.A.
Definition at line 97 of file database.php.
Counting database query.
- Author
- Dodonov A.A.
Definition at line 85 of file database.php.
Table name's prefix.
- Author
- Dodonov A.A.
Definition at line 109 of file database.php.
The documentation for this class was generated from the following file: