CaMykS  1.0-20231201
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CDBConnection Class Reference

CaMykS Generic Database connection object.
To be extended by specific database connection objects. More...

Inheritance diagram for CDBConnection:
MySQLDBConnection MySQLiDBConnection PDODBConnection PgSQLDBConnection SQLite3DBConnection

Public Member Functions

 __construct ()
 
 connect_server ($host='localhost', $login='', $pwd='', $driver='')
 
 disconnect_server ()
 
 is_connectionActive ()
 
 check_status ($name)
 
 get_serverVersion ()
 
 select_database ($name)
 
 create_database ($name, $charset='utf8')
 
 database_exists ($name)
 
 dump_database ($file=false)
 
 get_databaseSize ()
 
 get_databaseSummary ()
 
 get_tableList ()
 
 create_table ($name, $fields, $charset='utf8', $autoId=true, $primaryKeys=array('id'))
 
 execute_query ($sql='', $resName='defaultRes')
 
 execute_multiQueries ($sql='', $resName='defaultRes')
 
 get_queryGeneratedId ($resName='defaultRes')
 
 get_queryDataLine ($resName='defaultRes')
 
 get_queryNumDataLine ($resName='defaultRes')
 
 get_queryError ($resName='defaultRes')
 
 get_queryAffectedRows ($resName='defaultRes')
 
 get_queryFieldCount ($resName='defaultRes')
 
 get_queryFieldType ($fIndex=0, $resName='defaultRes')
 
 close_ressource ($resName='defaultRes')
 
 escape_string ($string)
 
 get_insertExtra ()
 

Protected Member Functions

 get_resName ()
 

Protected Attributes

 $active = false
 CDBConnection status. More...
 
 $connection = null
 CDBConnection database ressource. More...
 
 $queryRes = array()
 Query ressources. More...
 
 $dbName = null
 Name of the database. More...
 

Detailed Description

CaMykS Generic Database connection object.
To be extended by specific database connection objects.

Engine / Object Library

Author
CaMykS Team camyk.nosp@m.s.co.nosp@m.ntact.nosp@m.@gma.nosp@m.il.co.nosp@m.m
Version
1.0.2
Date
Creation: Sep 2014
Modification: Sep 2020
Note
This program is distributed as is - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. CDBConnection class.

Constructor & Destructor Documentation

◆ __construct()

CDBConnection::__construct ( )

Class constructor.

Returns
void

Reimplemented in SQLite3DBConnection.

Member Function Documentation

◆ connect_server()

CDBConnection::connect_server (   $host = 'localhost',
  $login = '',
  $pwd = '',
  $driver = '' 
)
abstract

Connect to server.

Parameters
string$host
string$login
string$pwd
string$driver
Returns
boolean success

Reimplemented in SQLite3DBConnection, PgSQLDBConnection, PDODBConnection, MySQLiDBConnection, and MySQLDBConnection.

◆ disconnect_server()

CDBConnection::disconnect_server ( )
abstract

Close server connection.

Returns
boolean success

Reimplemented in SQLite3DBConnection, PgSQLDBConnection, PDODBConnection, MySQLiDBConnection, and MySQLDBConnection.

◆ is_connectionActive()

CDBConnection::is_connectionActive ( )

Check if connection is active.

Returns
boolean success

◆ check_status()

CDBConnection::check_status (   $name)

Check database status.

Parameters
string$name
Returns
array

◆ get_serverVersion()

CDBConnection::get_serverVersion ( )
abstract

Return database engine version.

Returns
string

Reimplemented in SQLite3DBConnection, PgSQLDBConnection, PDODBConnection, MySQLiDBConnection, and MySQLDBConnection.

◆ select_database()

CDBConnection::select_database (   $name)
abstract

Select database.

Parameters
string$name
Returns
boolean

Reimplemented in SQLite3DBConnection, PgSQLDBConnection, PDODBConnection, MySQLiDBConnection, and MySQLDBConnection.

◆ create_database()

CDBConnection::create_database (   $name,
  $charset = 'utf8' 
)
abstract

Create a database.

Parameters
string$name
string$charset
Returns
boolean

Reimplemented in SQLite3DBConnection, PgSQLDBConnection, PDODBConnection, MySQLiDBConnection, and MySQLDBConnection.

◆ database_exists()

CDBConnection::database_exists (   $name)
abstract

Check if a base exists.

Parameters
string$name
Returns
boolean

Reimplemented in SQLite3DBConnection, PgSQLDBConnection, PDODBConnection, MySQLiDBConnection, and MySQLDBConnection.

◆ dump_database()

CDBConnection::dump_database (   $file = false)
abstract

Dump database.

Parameters
mixed$file
Returns
mixed

Reimplemented in SQLite3DBConnection, PgSQLDBConnection, PDODBConnection, MySQLiDBConnection, and MySQLDBConnection.

◆ get_databaseSize()

CDBConnection::get_databaseSize ( )
abstract

Return database size.

Returns
integer

Reimplemented in SQLite3DBConnection, PgSQLDBConnection, PDODBConnection, MySQLiDBConnection, and MySQLDBConnection.

◆ get_databaseSummary()

CDBConnection::get_databaseSummary ( )
abstract

Return database information summary.

Returns
array

Reimplemented in SQLite3DBConnection, PgSQLDBConnection, PDODBConnection, MySQLiDBConnection, and MySQLDBConnection.

◆ get_tableList()

CDBConnection::get_tableList ( )
abstract

Return available table list.

Returns
array

Reimplemented in SQLite3DBConnection, PgSQLDBConnection, PDODBConnection, MySQLiDBConnection, and MySQLDBConnection.

◆ create_table()

CDBConnection::create_table (   $name,
  $fields,
  $charset = 'utf8',
  $autoId = true,
  $primaryKeys = array('id') 
)
abstract

Create a table in the database.

Parameters
string$name
array$fields
string$charset
boolean$autoId
array$primaryKeys
Returns
boolean success

Reimplemented in SQLite3DBConnection, PgSQLDBConnection, PDODBConnection, MySQLiDBConnection, and MySQLDBConnection.

◆ execute_query()

CDBConnection::execute_query (   $sql = '',
  $resName = 'defaultRes' 
)
abstract

Execute query.

Parameters
string$sql
string$resName
Returns
boolean success

Reimplemented in SQLite3DBConnection, PgSQLDBConnection, PDODBConnection, MySQLiDBConnection, and MySQLDBConnection.

◆ execute_multiQueries()

CDBConnection::execute_multiQueries (   $sql = '',
  $resName = 'defaultRes' 
)

Execute multiple queries at once.

Parameters
string$sql
string$resName
Returns
boolean success

Reimplemented in SQLite3DBConnection, PgSQLDBConnection, PDODBConnection, MySQLiDBConnection, and MySQLDBConnection.

◆ get_queryGeneratedId()

CDBConnection::get_queryGeneratedId (   $resName = 'defaultRes')
abstract

Return id generated by last query.

Parameters
string$resName
Returns
integer

Reimplemented in SQLite3DBConnection, PgSQLDBConnection, PDODBConnection, MySQLiDBConnection, and MySQLDBConnection.

◆ get_queryDataLine()

CDBConnection::get_queryDataLine (   $resName = 'defaultRes')
abstract

Return next query data line.

Parameters
string$resName
Returns
array

Reimplemented in SQLite3DBConnection, PgSQLDBConnection, PDODBConnection, MySQLiDBConnection, and MySQLDBConnection.

◆ get_queryNumDataLine()

CDBConnection::get_queryNumDataLine (   $resName = 'defaultRes')
abstract

Return next query data line with numeric indexes.

Parameters
string$resName
Returns
array

Reimplemented in SQLite3DBConnection, PgSQLDBConnection, PDODBConnection, MySQLiDBConnection, and MySQLDBConnection.

◆ get_queryError()

CDBConnection::get_queryError (   $resName = 'defaultRes')
abstract

Return latest query error.

Parameters
string$resName
Returns
string

Reimplemented in SQLite3DBConnection, PgSQLDBConnection, PDODBConnection, MySQLiDBConnection, and MySQLDBConnection.

◆ get_queryAffectedRows()

CDBConnection::get_queryAffectedRows (   $resName = 'defaultRes')
abstract

Return latest query affected rows.

Parameters
string$resName
Returns
integer

Reimplemented in SQLite3DBConnection, PgSQLDBConnection, PDODBConnection, MySQLiDBConnection, and MySQLDBConnection.

◆ get_queryFieldCount()

CDBConnection::get_queryFieldCount (   $resName = 'defaultRes')
abstract

Return latest query field count.

Parameters
string$resName
Returns
integer

Reimplemented in SQLite3DBConnection, PgSQLDBConnection, PDODBConnection, MySQLiDBConnection, and MySQLDBConnection.

◆ get_queryFieldType()

CDBConnection::get_queryFieldType (   $fIndex = 0,
  $resName = 'defaultRes' 
)
abstract

Return latest query field type.

Parameters
integer$fIndex
string$resName
Returns
string

Reimplemented in SQLite3DBConnection, PgSQLDBConnection, PDODBConnection, MySQLiDBConnection, and MySQLDBConnection.

◆ close_ressource()

CDBConnection::close_ressource (   $resName = 'defaultRes')
abstract

Close ressource.

Parameters
string$resName
Returns
boolean result

Reimplemented in SQLite3DBConnection, PgSQLDBConnection, PDODBConnection, MySQLiDBConnection, and MySQLDBConnection.

◆ escape_string()

CDBConnection::escape_string (   $string)

Return escaped string.

Parameters
string$string
Returns
string

Reimplemented in SQLite3DBConnection, PgSQLDBConnection, PDODBConnection, MySQLiDBConnection, and MySQLDBConnection.

◆ get_insertExtra()

CDBConnection::get_insertExtra ( )

Return specific insert extra from driver.

Returns
string

Reimplemented in PgSQLDBConnection.

◆ get_resName()

CDBConnection::get_resName ( )
protected

Return automatic ressource name.

Returns
string

Member Data Documentation

◆ $active

boolean CDBConnection::$active = false
protected

CDBConnection status.

◆ $connection

Ressource CDBConnection::$connection = null
protected

CDBConnection database ressource.

◆ $queryRes

array CDBConnection::$queryRes = array()
protected

Query ressources.

◆ $dbName

string CDBConnection::$dbName = null
protected

Name of the database.


The documentation for this class was generated from the following file: