Class DB_sybase

Description

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

  • author: Sterling Hughes <sterling@php.net>
  • author: Antônio Carlos Venâncio Júnior <floripa@php.net>
  • version: $Id: sybase.php,v 1.52 2004/07/12 19:07:34 danielc Exp $

Located in /maintenance/libraries/pear/DB/sybase.php (line 41)

PEAR
   |
   --DB_common
      |
      --DB_sybase
Variable Summary
Method Summary
 DB_sybase DB_sybase ()
 number affectedRows ()
 void autoCommit ([mixed $onoff = false])
 void commit ()
 int connect ($dsn $dsninfo, [$persistent $persistent = false])
 int createSequence (string $seq_name)
 bool disconnect ()
 int dropSequence (string $seq_name)
 integer errorCode (string $errormsg)
 string errorNative ()
 mixed fetchInto (resource $result, array &$arr, int $fetchmode, [int $rownum = null])
 bool freeResult ($result $result)
 string getSpecialQuery (string $type)
 int nextId (string $seq_name, [boolean $ondemand = true])
 true nextResult (a $result)
 int numCols ($result $result)
 int numRows ($result $result)
 string quoteIdentifier (string $str)
 void rollback ()
 mixed simpleQuery (the $query)
 object DB sybaseRaiseError ([integer $errno = null])
 array tableInfo (object|string $result, [int $mode = null])
 void _add_flag (array &$array, mixed $value)
 string _sybase_field_flags (string $table, string $column)
Variables
mixed $autocommit = true (line 50)
mixed $connection (line 45)
mixed $dbsyntax (line 46)
mixed $phptype (line 46)

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

Redefinition of:
DB_common::$prepare_tokens
mixed $prepare_types = array() (line 48)

Redefinition of:
DB_common::$prepare_types
mixed $transaction_opcount = 0 (line 49)

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
Methods
Constructor DB_sybase (line 60)

DB_sybase constructor.

  • access: public
DB_sybase DB_sybase ()
affectedRows (line 429)

Gets the number of rows affected by the data manipulation query. For other queries, this function returns 0.

  • return: of rows affected by the last query
number affectedRows ()

Redefinition of:
DB_common::affectedRows()
Returns the affected rows of a query
autoCommit (line 554)

Enable/disable automatic commits

void autoCommit ([mixed $onoff = false])

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

Commit the current transaction.

void commit ()

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

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

  • return: DB_OK on success, a DB error on failure
  • access: public
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 500)

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

Log out and disconnect from the database.

  • return: true on success, false if not connected.
  • access: public
bool disconnect ()
dropSequence (line 522)

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
errorCode (line 167)

Determine PEAR::DB error code from the database's text error message.

  • return: an error number from a DB error constant
integer errorCode (string $errormsg)
  • string $errormsg: error message returned from the database

Redefinition of:
DB_common::errorCode()
Map native error codes to DB's portable ones
errorNative (line 153)

Get the last server error messge (if any)

  • return: sybase last error message
string errorNative ()

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

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

Free the internal resources associated with $result.

  • return: true on success, false if $result is invalid
  • access: public
bool freeResult ($result $result)
  • $result $result: Sybase result identifier
getSpecialQuery (line 536)

Returns the query needed to get some backend info

  • return: The SQL query string
string getSpecialQuery (string $type)
  • string $type: What kind of info you want to retrieve

Redefinition of:
DB_common::getSpecialQuery()
Returns the query needed to get some backend info
nextId (line 455)

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

Move the internal sybase 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 sybase result resource
numCols (line 390)

Get the number of columns in a result set.

  • return: the number of columns per row in $result
  • access: public
int numCols ($result $result)
  • $result $result: Sybase result identifier
numRows (line 411)

Get the number of rows in a result set.

  • return: the number of rows in $result
  • access: public
int numRows ($result $result)
  • $result $result: Sybase result identifier

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

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

Quoting style depends on which database driver is being used.

  • 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 589)

Roll back (undo) the current transaction.

void rollback ()

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

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

  • return: returns a valid Sybase result for successful SELECT queries, DB_OK for other successful queries. A DB error is returned on failure.
  • access: public
mixed simpleQuery (the $query)
  • the $query: SQL query
sybaseRaiseError (line 221)

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

object DB sybaseRaiseError ([integer $errno = null])
  • integer $errno: PEAR error number (usually a DB constant) if manually raising an error
tableInfo (line 623)

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()
  • since: 1.6.0
  • 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
_add_flag (line 795)

Adds a string to the flags array if the flag is not yet in there

  • if there is no flag present the array is created.

  • access: private
void _add_flag (array &$array, mixed $value)
  • array $array: reference of flags array to add a value to
  • mixed $value: value to add to the flag array
_sybase_field_flags (line 743)

Get the flags for a field.

Currently supports:

  • unique_key (unique index, unique check or primary_key)
  • multiple_key (multi-key index)

  • return: space delimited string of flags. Empty string if none.
  • access: private
string _sybase_field_flags (string $table, string $column)
  • string $table: table name
  • string $column: field name

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:27:41 +0000 by phpDocumentor 1.3.0RC3