Class db

Description

Class representing a connection to a database.

Not intended to be instantiated by end users; see db_get_object for documentation about connecting to a database.

  • abstract:

Located in /include/db.php (line 120)


	
			
Direct descendents
Class Description
db_postgresql Class representing a connection to a PostgreSQL database.
db_mysql Class representing a connection to a MySQL database.
Variable Summary
mixed $ign
Method Summary
bool close ()
bool commit ()
bool ignore_errors (bool $ign)
db_result query (string $query)
int query_count ()
string quote (string $str)
int rollback ()
Variables
mixed $ign (line 123)
  • access: protected
Methods
begin_transaction (line 193)

Begin a database transaction.

Returns false if transactions are not supported.

  • abstract:
bool begin_transaction ()

Redefined in descendants as:
close (line 244)

Closes the database connection.

While this should automatically be done by PHP, in case a script makes lots of connections this can be necessary to avoid resource shortages. Returns true on success or false on failure.

  • abstract:
bool close ()

Redefined in descendants as:
commit (line 201)

Commit to a database transaction.

Returns false if transactions are not supported.

  • abstract:
bool commit ()

Redefined in descendants as:
ignore_errors (line 146)

Set whether errors are fatal.

If this method is called with a argument that evaluate to true, all further database queries will complete silently, and errors will be ignored. It returns the previous value of the ignore_errors setting.

bool ignore_errors (bool $ign)
  • bool $ign
query (line 183)

Perform an SQL query on the database.

Perfoms the supplied query on the connected database, and returns a newly created db_result object (of the correct type) that represents the result.

db_result query (string $query)
  • string $query: the SQL query

Redefined in descendants as:
query_count (line 254)

Returns the amount of queries performed using this connection.

Note that this only counts the number of queries executed using this object -- using multiple database objects will skew the results.

int query_count ()
quote (line 222)

Returns the SQL escaped version of the string.

This uses the appropriate internal PHP function to escape the string in a database specific way, thus making it safe to use in queries. Always use this before sending user input to the database! It returns the escaped string surrounded by single quotes.

  • abstract:
string quote (string $str)
  • string $str

Redefined in descendants as:
rollback (line 209)

Rollback a database transaction.

Returns false if transactions are not supported.

  • abstract:
int rollback ()

Redefined in descendants as:

Documentation generated on Fri, 30 Jun 2006 10:31:37 +0200 by phpDocumentor 1.3.0RC3