Documentation » API Reference

Application:

Functions


db_query ($sql ''$cache 0

Alias of the query() method above.


db_table ($table$pkey ''

Alias of the table() method above.


db_fetch () 

  • Access: public
  • Return: mixed

Returns the results of a single database query. Returns
false if no results are returned, or on error. Returns an
object if there is only one result. Returns an array of
objects if there are multiple results.


db_fetch_array () 

  • Access: public
  • Return: array

Same as db_fetch(), except it always returns an array, including
an empty array on error or no results (fetch the error with
db_error() to differentiate between the two), and an array
of one item if there is only one result (whereas db_fetch()
would return that as an object).


db_shift_array () 

  • Access: public
  • Return: array

Same as db_fetch_array(), except it returns an array of the first
value of each object (like db_shift() does for a single result).
Please note: Keys are not preserved.


db_pairs () 

  • Access: public
  • Return: array

Similar to db_shift_array(), except it returns an associative array
of the first two columns of the query results, where the first column
is the key and the second column is the value.


db_execute () 

  • Access: public
  • Return: boolean

Similar to db_fetch(), but used for SQL statements that return no
results (ie. inserts, updates, deletes, etc.). Returns true or
false as to whether the statement executed successfully, or on
inserts with an auto-incrementing primary key, returns the last
inserted value.


db_single () 

  • Access: public
  • Return: object

Similar to db_fetch(), but only returns a single result as an
object, even if there are multiple results. Returns false on
error or if there are no results.


db_shift () 

  • Access: public
  • Return: mixed

Similar to db_shift(), but only returns the first column of
the first result. Returns false on error or if there are no
results.


db_rows () 

  • Access: public
  • Return: int

Returns the number of rows from the last executed query.


db_lastid () 

  • Access: public
  • Return: int

Returns the last inserted value from an insert to a table with
an auto-incrementing primary key.


db_error () 

  • Access: public
  • Return: string

Returns the error message, if an error occurred during the last
query.


db_err_sql () 

  • Access: public
  • Return: string

Returns the erroneous SQL statement, if an error occurred during
the last query.


db_quote ($string

  • Access: public
  • Return: string

Returns the specified string as a value quoted and ready for
insertion into an SQL statement. This is called automatically
on bind values.


db_create_sequence ($sqn


db_drop_sequence ($sqn


db_next_id ($sqn


db_get_sequence_name ($sqn


db_fetch_mode ($mode false


db_pear_emu ($bool true


dropSequence ($seq_name


nextId ($seq_name


dbm_add ($name$connstr '::'$user ''$pass ''$persistent 0

  • Access: public
  • Return: boolean

Add a new connection. Alias of DBM::add().


dbm_remove ($name$disconnect true

  • Access: public
  • Return: boolean

Remove a connection. Alias of DBM::remove()


dbm_set_current ($name$affectGlobalDB true

  • Access: public
  • Return: boolean

Set the specified connection to be the currently active one. Alias of
DBM::setCurrent().


&dbm_get_current () 

  • Access: public
  • Return: object

Retrieves the currently active database object. Alias of DBM::getCurrent().

Return to Top