[line 50]
The methods PEAR DB uses to interact with PHP's odbc extension for interacting with databases via ODBC connections
These methods overload the ones declared in DB_common.
More info on ODBC errors could be found here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/trblsql/tr_err_odbc_5stz.asp
$connection =
[line 135]
The raw database connection created by PHP
$dbsyntax = 'sql92'
[line 64]
The database syntax variant to be used (db2, access, etc.), if any
$dsn = array()
[line 141]
The DSN information for connecting to a database
$errorcode_map = array(
'01004' => DB_ERROR_TRUNCATED,
'07001' => DB_ERROR_MISMATCH,
'21S01' => DB_ERROR_VALUE_COUNT_ON_ROW,
'21S02' => DB_ERROR_MISMATCH,
'22001' => DB_ERROR_INVALID,
'22003' => DB_ERROR_INVALID_NUMBER,
'22005' => DB_ERROR_INVALID_NUMBER,
'22008' => DB_ERROR_INVALID_DATE,
'22012' => DB_ERROR_DIVZERO,
'23000' => DB_ERROR_CONSTRAINT,
'23502' => DB_ERROR_CONSTRAINT_NOT_NULL,
'23503' => DB_ERROR_CONSTRAINT,
'23504' => DB_ERROR_CONSTRAINT,
'23505' => DB_ERROR_CONSTRAINT,
'24000' => DB_ERROR_INVALID,
'34000' => DB_ERROR_INVALID,
'37000' => DB_ERROR_SYNTAX,
'42000' => DB_ERROR_SYNTAX,
'42601' => DB_ERROR_SYNTAX,
'IM001' => DB_ERROR_UNSUPPORTED,
'S0000' => DB_ERROR_NOSUCHTABLE,
'S0001' => DB_ERROR_ALREADY_EXISTS,
'S0002' => DB_ERROR_NOSUCHTABLE,
'S0011' => DB_ERROR_ALREADY_EXISTS,
'S0012' => DB_ERROR_NOT_FOUND,
'S0021' => DB_ERROR_ALREADY_EXISTS,
'S0022' => DB_ERROR_NOSUCHFIELD,
'S1009' => DB_ERROR_INVALID,
'S1090' => DB_ERROR_INVALID,
'S1C00' => DB_ERROR_NOT_CAPABLE,
)
[line 98]
A mapping of native error codes to DB error codes
$features = array(
'limit' => 'emulate',
'new_link' => false,
'numrows' => true,
'pconnect' => true,
'prepare' => false,
'ssl' => false,
'transactions' => false,
)
[line 84]
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: The feature set of the following drivers are different than the default:
- solid: 'transactions' = true
- navision: 'limit' = false
$phptype = 'odbc'
[line 58]
The DB driver type (mysql, oci8, odbc, etc.)
__construct (Constructor) [line 160]
This constructor calls
parent::__construct()
Overrides
DB_common::__construct() (This constructor calls
$this->PEAR('DB_Error'))
affectedRows [line 408]
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 586]
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 602]
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 181]
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 odbc driver supports the following extra DSN options:
- cursor The type of cursor to be used for this connection.
- 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 549]
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 240]
Disconnects from the database server
- Return: TRUE on success, FALSE on failure
dropSequence [line 570]
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
errorNative [line 693]
Gets the DBMS' native error code and message produced by the last query
- Return: the DBMS' error code and message
Overrides
DB_common::errorNative() (Gets the DBMS' native error code produced by the last query)
fetchInto [line 317]
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
—
freeResult [line 368]
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 806]
string getSpecialQuery(
string
$type)
Obtains the query string needed for listing a given type of objects
Thanks to symbol1@gmail.com and Philippe.Jausions@11abacus.com.
- Return: the list of objects requested
- See: DB_common::getListOf()
- Since: Method available since Release 1.7.0
- 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
nextId [line 499]
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 289]
true nextResult(
a
$result)
Move the internal odbc 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 389]
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
numRows [line 439]
int numRows(
resource
$result)
Gets the number of rows in a result set
Not all ODBC drivers support this functionality. If they don't a DB_Error object for DB_ERROR_UNSUPPORTED is returned.
This method is not meant to be called directly. Use DB_result::numRows() instead. It can't be declared "protected" because DB_result is a separate object.
Overrides
DB_common::numRows() (Determines the number of rows in a query result)
Parameters:
resource
$result
—
PHP's query result resource
odbcRaiseError [line 641]
object the odbcRaiseError(
[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.
quoteIdentifier [line 467]
string quoteIdentifier(
string
$str)
Quotes a string so it can be safely used as a table or column name
Use 'mssql' as the dbsyntax in the DB DSN only if you've unchecked "Use ANSI quoted identifiers" when setting up the ODBC data source.
Overrides
DB_common::quoteIdentifier() (Quotes a string so it can be safely used as a table or column name)
Parameters:
string
$str
—
identifier name to be quoted
rollback [line 618]
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 259]
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 720]
array tableInfo(
object|string
$result, [int
$mode = null])
Returns information about a table or a result set
- Return: an associative array with the information requested. A DB_Error object on failure.
- See: DB_common::tableInfo()
- Since: Method available since Release 1.7.0
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