Class DB

Description

This function holds open database connections and provides interface to them. It is also used for SQL logging

  • version: 1.0

Located in /environment/library/database/DB.class.php (line 10)


	
			
Class Constant Summary
 PRIMARY_CONNECTION_ID = 'PRIMARY'
Method Summary
static integer affectedRows (void 0)
static boolean beginWork (void 0)
static boolean commit (void 0)
static boolean connect (string $adapter, array $params, [string $connection_name = null])
static AbstractDBAdapter connection ([string $connection_name = null])
static string escape (mixed $value)
static string escapeField (string $field)
static DBResult execute (string $sql)
static array executeAll (string $sql)
static array executeOne (string $sql)
static string getPrimaryConnection (null 0)
static integer lastInsertId (void 0)
static string prepareString (string $sql, [array $arguments = null])
static boolean rollback (void 0)
static null setPrimaryConnection (string $value)
void addToSQLLog (string $sql)
array getSQLLog (void 0)
Methods
static method affectedRows (line 228)

Return number of affected rows

  • access: public
static integer affectedRows (void 0)
  • void 0
static method beginWork (line 182)

Start transaction

  • throws: DBQueryError
  • access: public
static boolean beginWork (void 0)
  • void 0
static method commit (line 194)

Commit transaction

  • throws: DBQueryError
  • access: public
static boolean commit (void 0)
  • void 0
static method connect (line 59)

Create new database connection

  • throws: FileDnxError
  • throws: DBAdapterDnx
  • access: public
static boolean connect (string $adapter, array $params, [string $connection_name = null])
  • string $adapter: Adapter name (currently only mysql adapter is implemeted)
  • array $params: Connection params
  • string $connection_name: Name of the connection, if NULL default connection ID will be used
static method connection (line 43)

This function will return specific connection. If $connection_name is NULL primary connection will be used

  • access: public
static AbstractDBAdapter connection ([string $connection_name = null])
  • string $connection_name: Connection name, if NULL primary connection will be used
static method escape (line 239)

Escape value

  • access: public
static string escape (mixed $value)
  • mixed $value
static method escapeField (line 250)

Escape field / table name

  • access: public
static string escapeField (string $field)
  • string $field
static method execute (line 134)

Execute query and return result

  • throws: DBQueryError
  • access: public
static DBResult execute (string $sql)
  • string $sql
static method executeAll (line 166)

Execute query and return all rows

  • throws: DBQueryError
  • access: public
static array executeAll (string $sql)
  • string $sql
static method executeOne (line 150)

Execute query and return first row from result

  • throws: DBQueryError
  • access: public
static array executeOne (string $sql)
  • string $sql
static method getPrimaryConnection (line 281)

Get primary_connection

  • access: public
static string getPrimaryConnection (null 0)
  • null 0
static method lastInsertId (line 217)

Return insert ID

  • access: public
static integer lastInsertId (void 0)
  • void 0
static method prepareString (line 261)

Prepare string. Replace every '?' with matching escaped value

static string prepareString (string $sql, [array $arguments = null])
  • string $sql
  • array $arguments: Array of arguments
static method rollback (line 206)

Rollback transaction

  • throws: DBQueryError
  • access: public
static boolean rollback (void 0)
  • void 0
static method setPrimaryConnection (line 293)

Set primary_connection value

  • throws: Error if connection does not exists
  • access: public
static null setPrimaryConnection (string $value)
  • string $value
addToSQLLog (line 307)

Add query to SQL log

  • access: public
void addToSQLLog (string $sql)
  • string $sql
getSQLLog (line 318)

Return SQL log

  • access: public
array getSQLLog (void 0)
  • void 0
Class Constants
PRIMARY_CONNECTION_ID = 'PRIMARY' (line 13)

ID of primary connection *

Documentation generated on Wed, 23 Jan 2008 01:58:34 +0000 by phpDocumentor 1.4.0