Class AbstractDBAdapter

Description

Abstract database adapter

  • version: 1.0
  • abstract:

Located in /environment/library/database/adapters/AbstractDBAdapter.class.php (line 9)


	
			
Direct descendents
Class Description
MysqlDBAdapter DB access for MySQL
Variable Summary
resource $link
Method Summary
AbstractDBAdapter __construct (array $params)
integer affectedRows (void 0)
boolean beginWork (void 0)
boolean clearDatabase (void 0)
boolean commit (void 0)
null connect (array $params)
boolean dropTables (mixed $table_names)
boolean emptyDatabase (void 0)
boolean emptyTables (mixed $table_names)
string escapeField (string $field)
string escapeValue (mixed $unescaped)
DBResult execute (string $sql, [array $arguments = null])
array executeAll (string $sql, [array $arguments = null])
array executeOne (string $sql, [array $arguments = null])
mixed executeQuery (string $sql)
array exportDatabaseStructure (void 0)
string exportTableStructure (string $table_name)
array fetchRow (resource $resource)
boolean freeResult (resource $resource)
string getBeginWorkCommand (void 0)
string getCommitCommand (void 0)
string getDatabaseName (null 0)
resource getLink (void 0)
array getParams (null 0)
string getRollbackCommand (void 0)
boolean importDatabaseStructure (AbstractDBAdapter $adapter, [boolean $clear = false])
boolean isConnected (void 0)
string lastError (void 0)
integer lastErrorCode (void 0)
integer lastInsertId (void 0)
array listTables (void 0)
integer numRows (resource $resource)
DBResult prepareAndExecute (string $sql, [ $arguments = null])
null reconnect (void 0)
boolean rollback (void 0)
null setDatabaseName (string $value)
null setLink (resource $link)
null setParams (array $value)
Variables
array $connection_params (line 23)

Array of params used fro this connection

  • access: protected
string $database_name (line 30)

Name of the database we are connected on

  • access: protected
resource $link (line 16)

Connection resource

  • access: protected
Methods
Constructor __construct (line 39)

Construct adpater and connect

  • access: public
AbstractDBAdapter __construct (array $params)
  • array $params: Connection params
affectedRows (line 100)

Return number of affected rows

  • abstract:
  • access: public
integer affectedRows (void 0)
  • void 0

Redefined in descendants as:
beginWork (line 306)

Start transaction

  • throws: DBQueryError
  • access: public
boolean beginWork (void 0)
  • void 0
clearDatabase (line 341)

This function will drop all tables from database this adapter is connected on

  • access: public
boolean clearDatabase (void 0)
  • void 0
commit (line 318)

Commit transaction

  • throws: DBQueryError
  • access: public
boolean commit (void 0)
  • void 0
connect (line 55)

Connect to the database based on the params array

  • abstract:
  • throws: DBConnectError
  • access: protected
null connect (array $params)
  • array $params

Redefined in descendants as:
dropTables (line 145)

Drop one or more tables. If $table_names is string only that table will be droped, else script will drop

  • abstract:
  • access: public
boolean dropTables (mixed $table_names)
  • mixed $table_names: Array of table names or single table name

Redefined in descendants as:
emptyDatabase (line 352)

This function will remove all data from database keeping the structure intact

  • access: public
boolean emptyDatabase (void 0)
  • void 0
emptyTables (line 154)

Remove all data from specific tables

  • abstract:
  • access: public
boolean emptyTables (mixed $table_names)
  • mixed $table_names: Single table name or array of table names

Redefined in descendants as:
escapeField (line 191)

Escape name of table field or name of the table

  • abstract:
  • access: public
string escapeField (string $field)
  • string $field

Redefined in descendants as:
escapeValue (line 201)

Escape value before use it in query. This function makes difference between NULL, scalar and DateTime values

  • abstract:
  • access: public
string escapeValue (mixed $unescaped)
  • mixed $unescaped: Value that need to be escaped

Redefined in descendants as:
execute (line 256)

Execute sql

  • throws: DBQueryError
  • access: public
DBResult execute (string $sql, [array $arguments = null])
  • string $sql
  • array $arguments
executeAll (line 288)

Execute SQL and return all rows. If there is no rows NULL is returned

  • throws: DBQueryError
  • access: public
array executeAll (string $sql, [array $arguments = null])
  • string $sql
  • array $arguments
executeOne (line 269)

Execute query and return first row. If there is no first row NULL is returned

  • throws: DBQueryError
  • access: public
array executeOne (string $sql, [array $arguments = null])
  • string $sql
  • array $arguments
executeQuery (line 64)

Basic query execution

  • abstract:
  • access: protected
mixed executeQuery (string $sql)
  • string $sql

Redefined in descendants as:
exportDatabaseStructure (line 163)

This function will return array of table names and their CREATE TABLE commands

  • return: or NULL if there are no tables in database
  • abstract:
  • access: public
array exportDatabaseStructure (void 0)
  • void 0

Redefined in descendants as:
exportTableStructure (line 182)

Return CREATE TABLE sql for specific table

  • return: or NULL if table does not exists
  • abstract:
  • access: public
string exportTableStructure (string $table_name)
  • string $table_name

Redefined in descendants as:
fetchRow (line 210)

Fetch row from query result

  • abstract:
  • access: public
array fetchRow (resource $resource)
  • resource $resource

Redefined in descendants as:
freeResult (line 228)

Free database result

  • abstract:
  • access: public
boolean freeResult (resource $resource)
  • resource $resource

Redefined in descendants as:
getBeginWorkCommand (line 73)

Get begin work SQL (start transaction)

  • abstract:
  • access: public
string getBeginWorkCommand (void 0)
  • void 0

Redefined in descendants as:
getCommitCommand (line 82)

Get comming SQL

  • abstract:
  • access: public
string getCommitCommand (void 0)
  • void 0

Redefined in descendants as:
getDatabaseName (line 438)

Get database_name

  • access: public
string getDatabaseName (null 0)
  • null 0
getLink (line 394)

Return link

resource getLink (void 0)
  • void 0
getParams (line 416)

Get params

  • access: public
array getParams (null 0)
  • null 0
getRollbackCommand (line 91)

Get rollback SQL

  • abstract:
  • access: public
string getRollbackCommand (void 0)
  • void 0

Redefined in descendants as:
importDatabaseStructure (line 173)

This function is able to import database construction from any connected adapter

  • abstract:
  • access: public
boolean importDatabaseStructure (AbstractDBAdapter $adapter, [boolean $clear = false])

Redefined in descendants as:
isConnected (line 384)

Returns true if this adapter is connected to the database

  • access: public
boolean isConnected (void 0)
  • void 0
lastError (line 118)

Returns last error message that server thrown

  • abstract:
  • access: public
string lastError (void 0)
  • void 0

Redefined in descendants as:
lastErrorCode (line 127)

Returns code of the last error

  • abstract:
  • access: public
integer lastErrorCode (void 0)
  • void 0

Redefined in descendants as:
lastInsertId (line 109)

Return last insert ID

  • abstract:
  • access: public
integer lastInsertId (void 0)
  • void 0

Redefined in descendants as:
listTables (line 136)

Return array of tables that exists in database

  • abstract:
  • access: public
array listTables (void 0)
  • void 0

Redefined in descendants as:
  • MysqlDBAdapter::listTables() : Return array of tables that exists in database. This function will return NULL if there are no tables in database
numRows (line 219)

Return number of rows in specific query result

  • abstract:
  • access: public
integer numRows (resource $resource)
  • resource $resource

Redefined in descendants as:
prepareAndExecute (line 364)

Prepare SQL and execute it...

  • throws: DBQueryError
  • access: protected
DBResult prepareAndExecute (string $sql, [ $arguments = null])
  • string $sql
  • $arguments
reconnect (line 241)

Reconnect

  • access: public
null reconnect (void 0)
  • void 0
rollback (line 330)

Rollback transaction

  • throws: DBQueryError
  • access: public
boolean rollback (void 0)
  • void 0
setDatabaseName (line 449)

Set database_name value

  • access: protected
null setDatabaseName (string $value)
  • string $value
setLink (line 405)

Set connection link

  • access: protected
null setLink (resource $link)
  • resource $link
setParams (line 427)

Set params value

  • access: public
null setParams (array $value)
  • array $value

Documentation generated on Wed, 23 Jan 2008 01:57:32 +0000 by phpDocumentor 1.4.0