DB_odbtp
[ class tree: DB_odbtp ] [ index: DB_odbtp ] [ all elements ]

Class: DB_odbtp

Source Location: /DB_odbtp-1.0.4/DB/odbtp.php

Class Overview

DB_common
   |
   --DB_odbtp

The methods PEAR DB uses to interact with the odbtp extension for remotely interacting with Win32-based databases.


Author(s):

Version:

  • Release: 1.0.3

Copyright:

  • 1997-2005 The PHP Group

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 56]
The methods PEAR DB uses to interact with the odbtp extension for remotely interacting with Win32-based databases.

These methods overload the ones declared in DB_common.



[ Top ]


Class Variables

$dbsyntax =  'unknown'

[line 81]

Database used with regards to SQL syntax, ODBC driver, etc.

Type:   string


[ Top ]

$dsn = array()

[line 73]

DSN used to establish connection.
  • See: DB::parseDSN()
  • Access: public

Type:   array


[ Top ]

$phptype =  'odbtp'

[line 65]

The DB driver type (mysql, oci8, odbc, etc.)
  • Access: public

Type:   string


[ Top ]



Method Detail

DB_odbtp (Constructor)   [line 174]

void DB_odbtp( )

This constructor calls $this->DB_common()
  • See: DB::common()
  • Access: public

[ Top ]

affectedRows   [line 740]

mixed affectedRows( )

Returns the affected rows of a query
  • Return: DB_Error or the number of rows
  • Access: public

[ Top ]

autoCommit   [line 685]

mixed autoCommit( [boolean $onoff = false])

enable automatic Commit
  • Return: DB_Error
  • Access: public

Parameters:

boolean   $onoff   — 

[ Top ]

commit   [line 704]

mixed commit( )

Commit the current transaction.
  • Return: DB_Error
  • Access: public

[ Top ]

connect   [line 209]

int connect( array $dsninfo, [boolean $persistent = false])

Connect to a database via an ODBTP server

The format of the supplied DSN:

odbtp(dbsyntax)://username:password@odbtphost/database

or

odbtp://username:password@odbtpinterface/database

Examples:

odbtp(access)://myuid:mypwd@odbtp.somewhere.com/c:\mydb.mdb odbtp(mssql)://myuid:mypwd@odbtp.somewhere.com/mydb?server=mysqlsrv odbtp://myuid:mypwd@myinterface/mydb

  • Return: DB_OK if successful, or DB error code if failure
  • See: DB::parseDSN()
  • Access: public

Parameters:

array   $dsninfo   —  data source name info returned by DB::parseDSN
boolean   $persistent   —  kept for interface compatibility

[ Top ]

createSequence   [line 821]

int createSequence( string $seq_name)

Creates a new sequence
  • Return: DB_OK on success. A DB_Error object is returned if problems arise.
  • See: DB_common::createSequence()
  • Access: public

Parameters:

string   $seq_name   —  name of the new sequence

[ Top ]

disconnect   [line 516]

boolean disconnect( )

Disconnect from ODBTP server
  • Return: TRUE if successful, otherwise FALSE
  • Access: public

[ Top ]

dropSequence   [line 851]

int dropSequence( string $seq_name)

Deletes a sequence
  • Return: DB_OK on success. DB_Error if problems.
  • See: DB_common::dropSequence()
  • Access: public

Parameters:

string   $seq_name   —  name of the sequence to be deleted

[ Top ]

errorNative   [line 908]

string errorNative( )

Get the native error code of the last error (if any) that occured on the current connection.
  • Return: native ODBTP error message
  • Access: public

[ Top ]

freeResult   [line 626]

boolean freeResult( resource $result)

Free the internal resources associated with $result.
  • Return: TRUE on success, FALSE if $result is invalid
  • Access: public

Parameters:

resource   $result   —  ODBTP query result identifier

[ Top ]

getConnectionId   [line 1273]

mixed getConnectionId( )

Get ODBTP Connection Id string
  • Return: Connection Id string, or DB_Error if failure
  • Access: public

[ Top ]

getSpecialQuery   [line 1177]

string getSpecialQuery( string $type)

Returns the query needed to get some backend info
  • Return: The SQL query string
  • Access: public

Parameters:

string   $type   —  What kind of info you want to retrieve

[ Top ]

nextId   [line 769]

int nextId( string $seq_name, [boolean $ondemand = true])

Returns the next free id in a sequence
  • Return: the next id number in the sequence. DB_Error if problem.
  • See: DB_common::nextID()
  • Access: public

Parameters:

string   $seq_name   —  name of the sequence
boolean   $ondemand   —  when true, the seqence is automatically created if it does not exist

[ Top ]

nextResult   [line 561]

boolean nextResult( resource $result)

Move the internal odbtp result pointer to the next available result
  • Return: TRUE if a result is available, otherwise FALSE
  • Access: public

Parameters:

resource   $result   —  ODBTP query result identifier

[ Top ]

numCols   [line 643]

mixed numCols( resource $result)

Returns the number of columns in a result
  • Return: DB_Error or the number of columns
  • Access: public

Parameters:

resource   $result   —  ODBTP query result identifier

[ Top ]

numRows   [line 665]

mixed numRows( resource $result)

Returns the number of rows in a result if row caching has been enabled.
  • Return: DB_Error or the number of rows
  • Access: public

Parameters:

resource   $result   —  ODBTP query result identifier

[ Top ]

odbtpRaiseError   [line 933]

object DB odbtpRaiseError( [integer $code = null])

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

Parameters:

integer   $code   —  PEAR error number (usually a DB constant) if manually raising an error

[ Top ]

quote   [line 882]

string quote( [ $str = null], string $string)

DEPRECATED: Quotes a string so it can be safely used in a query
  • Return: The NULL string or the string quotes in magic_quote_sybase style
  • See: DB_common::quoteSmart(), DB_common::escapeSimple()
  • Deprecated: Deprecated in release 1.6.0
  • Access: public

Parameters:

string   $string   —  the input string to quote
   $str   — 

[ Top ]

quoteIdentifier   [line 1248]

string quoteIdentifier( string $str)

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

Quoting style depends on the database syntax in use.

  • Return: quoted identifier string
  • Access: public

Parameters:

string   $str   —  identifier name to be quoted

[ Top ]

rollback   [line 722]

mixed rollback( )

Rollback the current transaction.
  • Return: DB_Error
  • Access: public

[ Top ]

simpleQuery   [line 535]

mixed simpleQuery( string $query)

Perform a SQL query.
  • Return: ODBTP query result resource, DB_OK or DB_Error
  • Access: public

Parameters:

string   $query   —  SQL statement

[ Top ]

tableInfo   [line 1064]

array tableInfo( object|string $result, [int $mode = null])

Returns information about a table or a result set

The format of the resulting array depends on which $mode you select. The sample output below is based on this query:

    SELECT tblFoo.fldID, tblFoo.fldPhone, tblBar.fldId
    FROM tblFoo
    JOIN tblBar ON tblFoo.fldId = tblBar.fldId

  • null (default)
       [0] => Array (
           [table] => tblFoo
           [name] => fldId
           [type] => int
           [len] => 11
           [flags] => primary_key not_null
       )
       [1] => Array (
           [table] => tblFoo
           [name] => fldPhone
           [type] => string
           [len] => 20
           [flags] =>
       )
       [2] => Array (
           [table] => tblBar
           [name] => fldId
           [type] => int
           [len] => 11
           [flags] => primary_key not_null
       )
  • DB_TABLEINFO_ORDER <p>In addition to the information found in the default output, a notation of the number of columns is provided by the num_fields element while the order element provides an array with the column names as the keys and their location index number (corresponding to the keys in the the default output) as the values.</p> <p>If a result set has identical field names, the last one is used.</p>
       [num_fields] => 3
       [order] => Array (
           [fldId] => 2
           [fldTrans] => 1
       )
  • DB_TABLEINFO_ORDERTABLE <p>Similar to DB_TABLEINFO_ORDER but adds more dimensions to the array in which the table names are keys and the field names are sub-keys. This is helpful for queries that join tables which have identical field names.</p>
       [num_fields] => 3
       [ordertable] => Array (
           [tblFoo] => Array (
               [fldId] => 0
               [fldPhone] => 1
           )
           [tblBar] => Array (
               [fldId] => 2
           )
       )

The flags element contains a space separated list of extra information about the field. This data is inconsistent between DBMS's due to the way each DBMS works.

  • primary_key
  • unique_key
  • multiple_key
  • not_null
Most DBMS's only provide the table and flags elements if $result is a table name. The following DBMS's provide full information from queries:
  • fbsql
  • mysql
If the 'portability' option has DB_PORTABILITY_LOWERCASE turned on, the names of tables and fields will be lowercased.

  • Return: an associative array with the information requested. If something goes wrong an error object is returned.
  • See: DB_common::setOption()
  • Access: public

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   —  either unused or one of the tableInfo modes: DB_TABLEINFO_ORDERTABLE, DB_TABLEINFO_ORDER or DB_TABLEINFO_FULL (which does both). These are bitwise, so the first two can be combined using |.

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:32:32 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.