Class DB_odbc

Description

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

  • author: Stig Bakken <ssb@php.net>
  • version: $Id: odbc.php,v 1.47 2004/10/04 17:14:32 danielc Exp $

Located in /maintenance/libraries/pear/DB/odbc.php (line 42)

PEAR
   |
   --DB_common
      |
      --DB_odbc
Variable Summary
 mixed $connection
 mixed $dbsyntax
 mixed $phptype
 mixed $row
Method Summary
 DB_odbc DB_odbc ()
 mixed affectedRows ()
 void autoCommit ([mixed $onoff = false])
 void commit ()
 int connect ($dsn $dsninfo, [$persistent $persistent = false])
 int createSequence (string $seq_name)
 void disconnect ()
 int dropSequence (string $seq_name)
 int errorNative ()
 mixed fetchInto (resource $result, array &$arr, int $fetchmode, [int $rownum = null])
 void freeResult (mixed $result)
 int nextId (string $seq_name, [boolean $ondemand = true])
 true nextResult (a $result)
 void numCols (mixed $result)
 the numRows ($result $result)
 object DB odbcRaiseError ([integer $errno = null])
 void quote (mixed $str)
 string quoteIdentifier (string $str)
 void rollback ()
 int simpleQuery ($query $query)
Variables
mixed $connection (line 46)
mixed $dbsyntax (line 47)
mixed $phptype (line 47)

Redefinition of:
DB_common::$phptype
DB type (mysql, oci8, odbc etc.)
mixed $row = array() (line 48)

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_odbc (line 53)
DB_odbc DB_odbc ()
affectedRows (line 318)

Returns the number of rows affected by a manipulative query

(INSERT, DELETE, UPDATE)

  • return: int affected rows, 0 when non manip queries or DB error on error
mixed affectedRows ()

Redefinition of:
DB_common::affectedRows()
Returns the affected rows of a query
autoCommit (line 512)
void autoCommit ([mixed $onoff = false])

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

Redefinition of:
DB_common::commit()
starts a Commit
connect (line 109)

Connect to a database and log in as the specified user.

  • return: DB_OK on success, a DB error code on failure
int connect ($dsn $dsninfo, [$persistent $persistent = false])
  • $dsn $dsninfo: the data source name (see DB::parseDSN for syntax)
  • $persistent $persistent: (optional) whether the connection should be persistent
createSequence (line 481)

Creates a new sequence

int createSequence (string $seq_name)
  • string $seq_name: name of the new sequence

Redefinition of:
DB_common::createSequence()
Creates a new sequence
disconnect (line 170)
void disconnect ()
dropSequence (line 503)

Deletes a sequence

int dropSequence (string $seq_name)
  • string $seq_name: name of the sequence to be deleted

Redefinition of:
DB_common::dropSequence()
Deletes a sequence
errorNative (line 405)

Get the native error code of the last error (if any) that occured on the current connection.

  • return: ODBC error code
  • access: public
int errorNative ()

Redefinition of:
DB_common::errorNative()
Returns an errormessage, provides by the database
fetchInto (line 247)

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
freeResult (line 291)
void freeResult (mixed $result)
nextId (line 429)

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 221)

Move the internal odbc 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 300)
void numCols (mixed $result)
numRows (line 340)

ODBC may or may not support counting rows in the result set of SELECTs.

  • return: number of rows, or 0
the numRows ($result $result)
  • $result $result: the odbc result resource

Redefinition of:
DB_common::numRows()
Returns the number of rows in a result object
odbcRaiseError (line 556)

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

object DB odbcRaiseError ([integer $errno = null])
  • integer $errno: PEAR error number (usually a DB constant) if manually raising an error
quote (line 390)
  • internal:
  • deprecated: Deprecated in release 1.6.0
void quote (mixed $str)

Redefinition of:
DB_common::quote()
DEPRECATED: Quotes a string so it can be safely used in a query
quoteIdentifier (line 367)

Quote a string so it can be safely used as a table / column name

Quoting style depends on which dbsyntax was passed in the DSN.

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.

  • return: quoted identifier string
  • access: public
  • since: 1.6.0
string quoteIdentifier (string $str)
  • string $str: identifier name to be quoted

Redefinition of:
DB_common::quoteIdentifier()
Quote a string so it can be safely used as a table or column name
rollback (line 534)
void rollback ()

Redefinition of:
DB_common::rollback()
starts a rollback
simpleQuery (line 190)

Send a query to ODBC and return the results as a ODBC resource identifier.

  • return: returns a valid ODBC result for successful SELECT queries, DB_OK for other successful queries. A DB error code is returned on failure.
int simpleQuery ($query $query)
  • $query $query: the SQL query

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, 11 Feb 2005 18:13:41 +0000 by phpDocumentor 1.3.0RC3