[line 56]
The methods PEAR DB uses to interact with PHP's interbase extension for interacting with Interbase and Firebird databases
These methods overload the ones declared in DB_common.
While this class works with PHP 4, PHP's InterBase extension is unstable in PHP 4. Use PHP 5.
NOTICE: limitQuery() only works for Firebird.
$connection =
[line 137]
The raw database connection created by PHP
$dbsyntax = 'ibase'
[line 70]
The database syntax variant to be used (db2, access, etc.), if any
$dsn = array()
[line 143]
The DSN information for connecting to a database
$errorcode_map = array(
-104 => DB_ERROR_SYNTAX,
-150 => DB_ERROR_ACCESS_VIOLATION,
-151 => DB_ERROR_ACCESS_VIOLATION,
-155 => DB_ERROR_NOSUCHTABLE,
-157 => DB_ERROR_NOSUCHFIELD,
-158 => DB_ERROR_VALUE_COUNT_ON_ROW,
-170 => DB_ERROR_MISMATCH,
-171 => DB_ERROR_MISMATCH,
-172 => DB_ERROR_INVALID,
// -204 => // Covers too many errors, need to use regex on msg
-205 => DB_ERROR_NOSUCHFIELD,
-206 => DB_ERROR_NOSUCHFIELD,
-208 => DB_ERROR_INVALID,
-219 => DB_ERROR_NOSUCHTABLE,
-297 => DB_ERROR_CONSTRAINT,
-303 => DB_ERROR_INVALID,
-413 => DB_ERROR_INVALID_NUMBER,
-530 => DB_ERROR_CONSTRAINT,
-551 => DB_ERROR_ACCESS_VIOLATION,
-552 => DB_ERROR_ACCESS_VIOLATION,
// -607 => // Covers too many errors, need to use regex on msg
-625 => DB_ERROR_CONSTRAINT_NOT_NULL,
-803 => DB_ERROR_CONSTRAINT,
-804 => DB_ERROR_VALUE_COUNT_ON_ROW,
// -902 => // Covers too many errors, need to use regex on msg
-904 => DB_ERROR_CONNECT_FAILED,
-922 => DB_ERROR_NOSUCHDB,
-923 => DB_ERROR_CONNECT_FAILED,
-924 => DB_ERROR_CONNECT_FAILED
)
[line 101]
A mapping of native error codes to DB error codes
$features = array(
'limit' => false,
'new_link' => false,
'numrows' => 'emulate',
'pconnect' => true,
'prepare' => true,
'ssl' => false,
'transactions' => true,
)
[line 87]
The capabilities of this DB implementation
The 'new_link' element contains the PHP version that first provided new_link support for this DBMS. Contains false if it's unsupported.
Meaning of the 'limit' element:
- 'emulate' = emulate with fetch row by number
- 'alter' = alter the query
- false = skip rows
NOTE: only firebird supports limit.
$last_stmt =
[line 169]
The prepared statement handle from the most recently executed statement
$phptype = 'ibase'
[line 64]
The DB driver type (mysql, oci8, odbc, etc.)
__construct (Constructor) [line 187]
This constructor calls
parent::__construct()
Overrides
DB_common::__construct() (This constructor calls
$this->PEAR('DB_Error'))
affectedRows [line 437]
Determines the number of rows affected by a data maniuplation query
- is returned for queries that don't manipulate data.
- Return: the number of rows. A DB_Error object on failure.
Overrides
DB_common::affectedRows() (Determines the number of rows affected by a data maniuplation query)
autoCommit [line 646]
int autoCommit(
[bool
$onoff = false])
Enables or disables automatic commits
- Return: DB_OK on success. A DB_Error object if the driver doesn't support auto-committing transactions.
Overrides
DB_common::autoCommit() (Enables or disables automatic commits)
Parameters:
bool
$onoff
—
true turns it on, false turns it off
commit [line 660]
Commits the current transaction
- Return: DB_OK on success. A DB_Error object on failure.
Overrides
DB_common::commit() (Commits the current transaction)
connect [line 215]
int connect(
array
$dsn, [bool
$persistent = false])
Connect to the database server, log in and open the database
Don't call this method directly. Use DB::connect() instead.
PEAR DB's ibase driver supports the following extra DSN options:
- buffers The number of database buffers to allocate for the
server-side cache.
- charset The default character set for a database.
- dialect The default SQL dialect for any statement
executed within a connection. Defaults to the
highest one supported by client libraries.
Functional only with InterBase 6 and up.
- role Functional only with InterBase 5 and up.
- Return: DB_OK on success. A DB_Error object on failure.
Parameters:
array
$dsn
—
the data source name
bool
$persistent
—
should the connection be persistent?
createSequence [line 745]
int createSequence(
string
$seq_name)
Creates a new sequence
Overrides
DB_common::createSequence() (Creates a new sequence)
Parameters:
string
$seq_name
—
name of the new sequence
disconnect [line 258]
Disconnects from the database server
- Return: TRUE on success, FALSE on failure
dropSequence [line 768]
int dropSequence(
string
$seq_name)
Deletes a sequence
Overrides
DB_common::dropSequence() (Deletes a sequence)
Parameters:
string
$seq_name
—
name of the sequence to be deleted
errorCode [line 908]
int errorCode(
[int
$nativecode = null])
Maps native error codes to DB's portable ones
- Return: the portable DB error code. Return DB_ERROR if the current driver doesn't have a mapping for the $nativecode submitted.
- Since: Method available since Release 1.7.0
Overrides
DB_common::errorCode() (Maps native error codes to DB's portable ones)
Parameters:
int
$nativecode
—
the error code returned by the DBMS
errorNative [line 882]
Gets the DBMS' native error code produced by the last query
- Return: the DBMS' error code. NULL if there is no error code.
- Since: Method available since Release 1.7.0
Overrides
DB_common::errorNative() (Gets the DBMS' native error code produced by the last query)
execute [line 551]
object a &execute(
resource
$stmt, [mixed
$data = array()])
Executes a DB statement prepared with prepare().
Overrides
DB_common::execute() (Executes a DB statement prepared with prepare())
Parameters:
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.
fetchInto [line 369]
mixed fetchInto(
resource
$result,
&$arr, int
$fetchmode, [int
$rownum = null], array
$arr)
Places a row from the result set into the given array
Formating of the array and the data therein are configurable. See DB_result::fetchInto() for more information.
This method is not meant to be called directly. Use DB_result::fetchInto() instead. It can't be declared "protected" because DB_result is a separate object.
- Return: DB_OK on success, NULL when the end of a result set is reached or on failure
- See: DB_result::fetchInto()
Parameters:
resource
$result
—
the query result resource
array
$arr
—
the referenced array to put the data in
int
$fetchmode
—
how the resulting array should be indexed
int
$rownum
—
the row number to fetch (0 = first row)
&$arr
—
freePrepared [line 621]
bool freePrepared(
resource
$stmt, [bool
$free_resource = true])
Frees the internal resources associated with a prepared query
Overrides
DB_common::freePrepared() (Frees the internal resources associated with a prepared query)
Parameters:
resource
$stmt
—
the prepared statement's PHP resource
bool
$free_resource
—
should the PHP resource be freed too? Use false if you need to get data from the result set later.
freeQuery [line 422]
freeResult [line 414]
bool freeResult(
resource
$result)
Deletes the result set and frees the memory occupied by the result set
This method is not meant to be called directly. Use DB_result::free() instead. It can't be declared "protected" because DB_result is a separate object.
Parameters:
resource
$result
—
PHP's query result resource
getSpecialQuery [line 1056]
string getSpecialQuery(
string
$type)
Obtains the query string needed for listing a given type of objects
- Return: the SQL query string or null if the driver doesn't support the object type requested
- See: DB_common::getListOf()
- Access: protected
Overrides
DB_common::getSpecialQuery() (Obtains the query string needed for listing a given type of objects)
Parameters:
string
$type
—
the kind of objects you want to retrieve
ibaseRaiseError [line 863]
object the &ibaseRaiseError(
[int
$errno = null])
Produces a DB_Error object regarding the current problem
Parameters:
int
$errno
—
if the error is being manually raised pass a DB_ERROR* constant here. If this isn't passed the error information gathered from the DBMS.
modifyLimitQuery [line 320]
string modifyLimitQuery(
string
$query, int
$from, int
$count, [mixed
$params = array()])
Adds LIMIT clauses to a query string according to current DBMS standards
Only works with Firebird.
- Return: the query string with LIMIT clauses added
- Access: protected
Overrides
DB_common::modifyLimitQuery() (Adds LIMIT clauses to a query string according to current DBMS standards)
Parameters:
string
$query
—
the query to modify
int
$from
—
the row to start to fetching (0 = the first row)
int
$count
—
the numbers of rows to fetch
mixed
$params
—
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 placeholder for non-array parameters or 1 placeholder per array element.
nextId [line 704]
int nextId(
string
$seq_name, [boolean
$ondemand = true])
Returns the next free id in a sequence
Overrides
DB_common::nextId() (Returns the next free id in a sequence)
Parameters:
string
$seq_name
—
name of the sequence
boolean
$ondemand
—
when true, the seqence is automatically created if it does not exist
nextResult [line 341]
true nextResult(
a
$result)
Move the internal ibase result pointer to the next available result
- Return: if a result is available otherwise return false
- Access: public
Parameters:
a
$result
—
valid fbsql result resource
numCols [line 461]
int numCols(
resource
$result)
Gets the number of columns in a result set
This method is not meant to be called directly. Use DB_result::numCols() instead. It can't be declared "protected" because DB_result is a separate object.
Parameters:
resource
$result
—
PHP's query result resource
prepare [line 495]
mixed prepare(
string
$query)
Prepares a query for multiple execution with execute().
prepare() requires a generic query as string like 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:
"UPDATE foo SET col=? WHERE col='over \& under'"
- Return: DB statement resource on success. DB_Error on failure.
Overrides
DB_common::prepare() (Prepares a query for multiple execution with execute())
Parameters:
string
$query
—
query to be prepared
rollback [line 673]
Reverts the current transaction
- Return: DB_OK on success. A DB_Error object on failure.
Overrides
DB_common::rollback() (Reverts the current transaction)
simpleQuery [line 277]
mixed simpleQuery(
string
$query)
Sends a query to the database server
- Return: + a PHP result resrouce for successful SELECT queries
- the DB_OK constant for other successful queries
- a DB_Error object on failure
Parameters:
string
$query
—
the SQL query string
tableInfo [line 972]
array tableInfo(
object|string
$result, [int
$mode = null])
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. A DB_Error object on failure.
- See: DB_common::tableInfo()
Overrides
DB_common::tableInfo() (Returns information about a table or a result set)
Parameters:
object|string
$result
—
DB_result object from a query or a string containing the name of a table. While this also accepts a query result resource identifier, this behavior is deprecated.
int
$mode
—
a valid tableInfo mode
transactionInit [line 681]
void transactionInit(
[
$trans_args = 0])
Parameters: