Class DB_ibase

Description

Database independent query interface definition for PHP's Interbase extension.

  • author: Sterling Hughes <sterling@php.net>
  • version: $Id: ibase.php,v 1.69 2004/06/24 15:24:56 danielc Exp $

Located in /maintenance/libraries/pear/DB/ibase.php (line 38)

PEAR
   |
   --DB_common
      |
      --DB_ibase
Variable Summary
 mixed $autocommit
 mixed $connection
 mixed $dbsyntax
 mixed $manip_query
 mixed $phptype
Method Summary
 DB_ibase DB_ibase ()
 void autoCommit ([mixed $onoff = false])
 void commit ()
 void connect (mixed $dsninfo, [mixed $persistent = false])
 mixed createSequence (string $seq_name)
 void disconnect ()
 mixed dropSequence (string $seq_name)
 object a &execute (resource $stmt, [mixed $data = array()])
 mixed fetchInto (resource $result, array &$arr, int $fetchmode, [int $rownum = null])
 bool freePrepared ($stmt $stmt)
 void freeQuery (mixed $query)
 void freeResult (mixed $result)
 object DB &ibaseRaiseError ([integer $db_errno = null], [string $native_errmsg = null])
 the modifyLimitQuery (string $query, integer $from, integer $count, [mixed $params = array()])
 int nextId (string $seq_name, [boolean $ondemand = true])
 true nextResult (a $result)
 void numCols (mixed $result)
 mixed prepare (string $query)
 void rollback ()
 void simpleQuery (mixed $query)
 array tableInfo (object|string $result, [int $mode = null])
 void transactionInit (mixed $trans_args)
 string _ibaseFieldFlags (string $field_name, string $table_name)
Variables
mixed $autocommit = 1 (line 45)
mixed $connection (line 43)
mixed $dbsyntax (line 44)
mixed $manip_query = array() (line 46)
mixed $phptype (line 44)

Redefinition of:
DB_common::$phptype
DB type (mysql, oci8, odbc etc.)

Inherited Variables

Inherited from DB_common

DB_common::$dbh
DB_common::$errorcode_map
DB_common::$features
DB_common::$fetchmode
DB_common::$fetchmode_object_class
DB_common::$last_query
DB_common::$options
DB_common::$prepared_queries
DB_common::$prepare_maxstmt
DB_common::$prepare_tokens
DB_common::$prepare_types
Methods
Constructor DB_ibase (line 51)
DB_ibase DB_ibase ()
autoCommit (line 436)
void autoCommit ([mixed $onoff = false])

Redefinition of:
DB_common::autoCommit()
enable automatic Commit
commit (line 445)
void commit ()

Redefinition of:
DB_common::commit()
starts a Commit
connect (line 95)
void connect (mixed $dsninfo, [mixed $persistent = false])
createSequence (line 520)

Create the sequence

  • return: DB_OK on success or DB error on error
  • access: public
mixed createSequence (string $seq_name)
  • string $seq_name: the name of the sequence

Redefinition of:
DB_common::createSequence()
Creates a new sequence
disconnect (line 130)
void disconnect ()
dropSequence (line 540)

Drop a sequence

  • return: DB_OK on success or DB error on error
  • access: public
mixed dropSequence (string $seq_name)
  • string $seq_name: the name of the sequence

Redefinition of:
DB_common::dropSequence()
Deletes a sequence
execute (line 359)

Executes a DB statement prepared with prepare().

object a &execute (resource $stmt, [mixed $data = array()])
  • resource $stmt: a DB statement resource returned from prepare()
  • mixed $data: array, string or numeric data to be used in execution of the statement. Quantity of items passed must match quantity of placeholders in query: meaning 1 for non-array items or the quantity of elements in the array.

Redefinition of:
DB_common::execute()
Executes a DB statement prepared with prepare()
fetchInto (line 222)

Fetch a row and insert the data into an existing array.

Formating of the array and the data therein are configurable. See DB_result::fetchInto() for more information.

  • return: DB_OK on success, null when end of result set is reached or on failure
  • access: private
  • see: DB_result::fetchInto()
mixed fetchInto (resource $result, array &$arr, int $fetchmode, [int $rownum = null])
  • resource $result: query result identifier
  • array $arr: (reference) array where data from the row should be placed
  • int $fetchmode: how the resulting array should be indexed
  • int $rownum: the row number to fetch
freePrepared (line 421)

Free the internal resources associated with a prepared query.

  • return: true on success, false if $result is invalid
bool freePrepared ($stmt $stmt)
  • $stmt $stmt: The interbase_query resource type

Redefinition of:
DB_common::freePrepared()
Free the resource used in a prepared query
freeQuery (line 266)
void freeQuery (mixed $query)
freeResult (line 258)
void freeResult (mixed $result)
ibaseRaiseError (line 724)

Gather information about an error, then use that info to create a DB error object and finally return that object.

object DB &ibaseRaiseError ([integer $db_errno = null], [string $native_errmsg = null])
  • integer $db_errno: PEAR error number (usually a DB constant) if manually raising an error
  • string $native_errmsg: text of error message if known
modifyLimitQuery (line 173)

This method is used by backends to alter limited queries Uses the new FIRST n SKIP n Firebird 1.0 syntax, so it is only compatible with Firebird 1.x

the modifyLimitQuery (string $query, integer $from, integer $count, [mixed $params = array()])
  • string $query: query to modify
  • integer $from: the row to start to fetching
  • integer $count: the numbers of rows to fetch

Redefinition of:
DB_common::modifyLimitQuery()
This method is used by backends to alter limited queries
nextId (line 482)

Returns the next free id in a sequence

  • return: the next id number in the sequence. DB_Error if problem.
  • access: public
  • see: DB_common::nextID()
  • internal:
int nextId (string $seq_name, [boolean $ondemand = true])
  • string $seq_name: name of the sequence
  • boolean $ondemand: when true, the seqence is automatically created if it does not exist

Redefinition of:
DB_common::nextId()
Returns the next free id in a sequence
nextResult (line 196)

Move the internal ibase result pointer to the next available result

  • return: if a result is available otherwise return false
  • access: public
true nextResult (a $result)
  • a $result: valid fbsql result resource
numCols (line 275)
void numCols (mixed $result)
prepare (line 309)

Prepares a query for multiple execution with execute().

prepare() requires a generic query as string like

  1. INSERT INTO numbers VALUES (?, ?, ?)
. The ? characters are placeholders.

Three types of placeholders can be used:

  • ? a quoted scalar value, i.e. strings, integers
  • ! value is inserted 'as is'
  • & requires a file name. The file's contents get inserted into the query (i.e. saving binary data in a db)
Use backslashes to escape placeholder characters if you don't want them to be interpreted as placeholders. Example:
  1. "UPDATE foo SET col=? WHERE col='over \& under'"

  • return: DB statement resource on success. DB_Error on failure.
mixed prepare (string $query)
  • string $query: query to be prepared

Redefinition of:
DB_common::prepare()
Prepares a query for multiple execution with execute()
rollback (line 453)
void rollback ()

Redefinition of:
DB_common::rollback()
starts a rollback
simpleQuery (line 140)
void simpleQuery (mixed $query)
tableInfo (line 634)

Returns information about a table or a result set.

NOTE: only supports 'table' and 'flags' if $result is a table name.

  • return: an associative array with the information requested or an error object if something is wrong
  • see: DB_common::tableInfo()
  • internal:
  • access: public
array tableInfo (object|string $result, [int $mode = null])
  • object|string $result: DB_result object from a query or a string containing the name of a table
  • int $mode: a valid tableInfo mode

Redefinition of:
DB_common::tableInfo()
Returns information about a table or a result set
transactionInit (line 461)
void transactionInit (mixed $trans_args)
_ibaseFieldFlags (line 560)

get the Flags of a Field

  • return: The flags of the field ("primary_key", "unique_key", "not_null" "default", "computed" and "blob" are supported)
  • access: private
string _ibaseFieldFlags (string $field_name, string $table_name)
  • string $field_name: the name of the field
  • string $table_name: the name of the table

Inherited Methods

Inherited From DB_common

 DB_common::DB_common()
 DB_common::affectedRows()
 DB_common::autoCommit()
 DB_common::autoExecute()
 DB_common::autoPrepare()
 DB_common::buildManipSQL()
 DB_common::commit()
 DB_common::createSequence()
 DB_common::dropSequence()
 DB_common::errorCode()
 DB_common::errorMessage()
 DB_common::errorNative()
 DB_common::escapeSimple()
 DB_common::execute()
 DB_common::executeEmulateQuery()
 DB_common::executeMultiple()
 DB_common::freePrepared()
 DB_common::getAll()
 DB_common::getAssoc()
 DB_common::getCol()
 DB_common::getListOf()
 DB_common::getOne()
 DB_common::getOption()
 DB_common::getRow()
 DB_common::getSequenceName()
 DB_common::getSpecialQuery()
 DB_common::getTables()
 DB_common::limitQuery()
 DB_common::modifyLimitQuery()
 DB_common::modifyQuery()
 DB_common::nextId()
 DB_common::numRows()
 DB_common::prepare()
 DB_common::provides()
 DB_common::query()
 DB_common::quote()
 DB_common::quoteIdentifier()
 DB_common::quoteSmart()
 DB_common::quoteString()
 DB_common::raiseError()
 DB_common::rollback()
 DB_common::setFetchMode()
 DB_common::setOption()
 DB_common::tableInfo()
 DB_common::toString()
 DB_common::_convertNullArrayValuesToEmpty()
 DB_common::_rtrimArrayValues()

Documentation generated on Fri, 3 Dec 2004 12:26:51 +0000 by phpDocumentor 1.3.0RC3