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

Class: MDB2_xxx

Source Location: /MDB2-2.0.0beta4/docs/Driver_skeleton.php

Class Overview

PEAR
   |
   --MDB2_Driver_Common
      |
      --MDB2_xxx

MDB2 XXX driver


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods

Class: MDB2_Driver_Common

MDB2_Driver_Common::__construct()
Constructor
MDB2_Driver_Common::MDB2_Driver_Common()
PHP 4 Constructor
MDB2_Driver_Common::beginTransaction()
Start a transaction.
MDB2_Driver_Common::commit()
Commit the database changes done during a transaction that is in progress. This function may only be called when auto-committing is disabled, otherwise it will fail. Therefore, a new transaction is implicitly started after committing the pending changes.
MDB2_Driver_Common::compareDefinition()
Obtain an array of changes that may need to applied
MDB2_Driver_Common::currID()
returns the current id of a sequence
MDB2_Driver_Common::debug()
set a debug message
MDB2_Driver_Common::debugOutput()
output debug info
MDB2_Driver_Common::disconnect()
Log out and disconnect from the database.
MDB2_Driver_Common::errorInfo()
This method is used to collect information about an error
MDB2_Driver_Common::errorNative()
returns an errormessage, provides by the database
MDB2_Driver_Common::escape()
Quotes a string so it can be safely used in a query. It will quote the text so it can safely be used within a query.
MDB2_Driver_Common::getAfterID()
returns the autoincrement ID if supported or $id
MDB2_Driver_Common::getBeforeID()
returns the next free id of a sequence if the RDBMS does not support auto increment
MDB2_Driver_Common::getDatabase()
get the current database
MDB2_Driver_Common::getDeclaration()
Obtain DBMS specific SQL code portion needed to declare of the given type
MDB2_Driver_Common::getDSN()
return the DSN as a string
MDB2_Driver_Common::getOption()
returns the value of an option
MDB2_Driver_Common::getSequenceName()
adds sequence name formating to a sequence name
MDB2_Driver_Common::getWarnings()
get all warnings in reverse order.
MDB2_Driver_Common::loadModule()
loads a module
MDB2_Driver_Common::nextID()
returns the next free id of a sequence
MDB2_Driver_Common::prepare()
Prepares a query for multiple execution with execute().
MDB2_Driver_Common::query()
Send a query to the database and return any results
MDB2_Driver_Common::queryAll()
Execute the specified query, fetch all the rows of the result set into a two dimensional array and then frees the result set.
MDB2_Driver_Common::queryCol()
Execute the specified query, fetch the value from the first column of each row of the result set into an array and then frees the result set.
MDB2_Driver_Common::queryOne()
Execute the specified query, fetch the value from the first column of the first row of the result set and then frees the result set.
MDB2_Driver_Common::queryRow()
Execute the specified query, fetch the values from the first row of the result set into an array and then frees the result set.
MDB2_Driver_Common::quote()
Convert a text value into a DBMS specific format that is suitable to compose query statements.
MDB2_Driver_Common::quoteIdentifier()
Quote a string so it can be safely used as a table or column name
MDB2_Driver_Common::raiseError()
This method is used to communicate an error and invoke error callbacks etc. Basically a wrapper for PEAR::raiseError without the message string.
MDB2_Driver_Common::replace()
Execute a SQL REPLACE query. A REPLACE query is identical to a INSERT query, except that if there is already a row in the table with the same key field values, the REPLACE query just updates its values instead of inserting a new row.
MDB2_Driver_Common::resetWarnings()
reset the warning array
MDB2_Driver_Common::rollback()
Cancel any database changes done during a transaction that is in progress. This function may only be called when auto-committing is disabled, otherwise it will fail. Therefore, a new transaction is implicitly started after canceling the pending changes.
MDB2_Driver_Common::setDatabase()
Select a different database
MDB2_Driver_Common::setDSN()
set the DSN
MDB2_Driver_Common::setFetchMode()
Sets which fetch mode should be used by default on queries on this connection
MDB2_Driver_Common::setLimit()
set the range of the next query
MDB2_Driver_Common::setOption()
set the option for the db class
MDB2_Driver_Common::standaloneQuery()
execute a query as database administrator
MDB2_Driver_Common::subSelect()
simple subselect emulation: leaves the query untouched for all RDBMS that support subselects
MDB2_Driver_Common::supports()
Tell whether a DB implementation or its backend extension supports a given feature.
MDB2_Driver_Common::_convertEmptyArrayValuesToNull()
Convert all empty values in an array to null strings
MDB2_Driver_Common::_doQuery()
Execute a query
MDB2_Driver_Common::_modifyQuery()
Changes a query string for various DBMS specific reasons
MDB2_Driver_Common::_rtrimArrayValues()
Right trim all strings in an array
MDB2_Driver_Common::_wrapResult()
wrap a result set into the correct class
MDB2_Driver_Common::__call()
Calls a module method using the __call magic method
MDB2_Driver_Common::__destruct()
Destructor
MDB2_Driver_Common::__toString()
String conversation

Class Details

[line 70]
MDB2 XXX driver


[ Top ]


Class Variables

$escape_quotes =

[line 76]


Type:   mixed
Overrides:   Array


[ Top ]



Method Detail

MDB2_xxx (Constructor)   [line 83]

MDB2_xxx MDB2_xxx( )

Constructor

[ Top ]

beginTransaction   [line 133]

mixed beginTransaction( )

Define whether database changes done on the database be automatically committed. This function may also implicitly start or end a transaction.
  • Return: MDB2_OK on success, a MDB2 error on failure
  • Access: public

Overrides MDB2_Driver_Common::beginTransaction() (Start a transaction.)
[ Top ]

commit   [line 153]

mixed commit( )

Commit the database changes done during a transaction that is in progress. This function may only be called when auto-committing is disabled, otherwise it will fail. Therefore, a new transaction is implicitly started after committing the pending changes.
  • Return: MDB2_OK on success, a MDB2 error on failure
  • Access: public

Overrides MDB2_Driver_Common::commit() (Commit the database changes done during a transaction that is in progress. This function may only be called when auto-committing is disabled, otherwise it will fail. Therefore, a new transaction is implicitly started after committing the pending changes.)
[ Top ]

connect   [line 184]

true connect( )

Connect to the database
  • Return: on success, MDB2 Error Object on failure

[ Top ]

currID   [line 350]

mixed currID( string $seq_name)

returns the current id of a sequence
  • Return: MDB2 Error Object or id
  • Access: public

Overrides MDB2_Driver_Common::currID() (returns the current id of a sequence)

Parameters:

string   $seq_name   —  name of the sequence

[ Top ]

disconnect   [line 203]

mixed disconnect( )

Log out and disconnect from the database.
  • Return: true on success, false if not connected and error object on error
  • Access: public

Overrides MDB2_Driver_Common::disconnect() (Log out and disconnect from the database.)
[ Top ]

errorInfo   [line 116]

array errorInfo( [integer $error = null])

This method is used to collect information about an error
  • Access: public

Overrides MDB2_Driver_Common::errorInfo() (This method is used to collect information about an error)

Parameters:

integer   $error   — 

[ Top ]

nextID   [line 334]

mixed nextID( string $seq_name, [boolean $ondemand = true])

returns the next free id of a sequence
  • Return: MDB2 Error Object or id
  • Access: public

Overrides MDB2_Driver_Common::nextID() (returns the next free id of a sequence)

Parameters:

string   $seq_name   —  name of the sequence
boolean   $ondemand   —  when true the seqence is automatic created, if it not exists

[ Top ]

query   [line 222]

mixed &query( string $query, [array $types = null])

Send a query to the database and return any results
  • Return: a result handle or MDB2_OK on success, a MDB2 error on failure
  • Access: public

Overrides MDB2_Driver_Common::query() (Send a query to the database and return any results)

Parameters:

string   $query   —  the SQL query
array   $types   —  array that contains the types of the columns in the result set

[ Top ]

replace   [line 315]

mixed replace( string $table, array $fields)

Execute a SQL REPLACE query. A REPLACE query is identical to a INSERT query, except that if there is already a row in the table with the same key field values, the REPLACE query just updates its values instead of inserting a new row.

The REPLACE type of query does not make part of the SQL standards. Since practically only MySQL implements it natively, this type of query is emulated through this method for other DBMS using standard types of queries inside a transaction to assure the atomicity of the operation.

  • Return: MDB2_OK on success, a MDB2 error on failure
  • Access: public

Overrides MDB2_Driver_Common::replace() (Execute a SQL REPLACE query. A REPLACE query is identical to a INSERT query, except that if there is already a row in the table with the same key field values, the REPLACE query just updates its values instead of inserting a new row.)

Parameters:

string   $table   —  name of the table on which the REPLACE query will be executed.
array   $fields   — 

associative array that describes the fields and the values that will be inserted or updated in the specified table. The indexes of the array are the names of all the fields of the table. The values of the array are also associative arrays that describe the values and other properties of the table fields.

Here follows a list of field properties that need to be specified:

Value: Value to be assigned to the specified field. This value may be of specified in database independent type format as this function can perform the necessary datatype conversions.

Default: this property is required unless the Null property is set to 1.

Type Name of the type of the field. Currently, all types Metabase are supported except for clob and blob.

Default: text

Null Boolean property that indicates that the value for this field should be set to null.

The default value for fields missing in INSERT queries may be specified the definition of a table. Often, the default value is already null, but since the REPLACE may be emulated using an UPDATE query, make sure that all fields of the table are listed in this function argument array.

Default: 0

Key Boolean property that indicates that this field should be handled as a primary key or at least as part of the compound unique index of the table that will determine the row that will updated if it exists or inserted a new row otherwise.

This function will fail if no key field is specified or if the value of a key field is set to null because fields that are part of unique index they may not be null.

Default: 0


[ Top ]

rollback   [line 171]

mixed rollback( )

Cancel any database changes done during a transaction that is in progress. This function may only be called when auto-committing is disabled, otherwise it will fail. Therefore, a new transaction is implicitly started after canceling the pending changes.
  • Return: MDB2_OK on success, a MDB2 error on failure
  • Access: public

Overrides MDB2_Driver_Common::rollback() (Cancel any database changes done during a transaction that is in progress. This function may only be called when auto-committing is disabled, otherwise it will fail. Therefore, a new transaction is implicitly started after canceling the pending changes.)
[ Top ]

subSelect   [line 242]

string subSelect( string $query, [string $quote = false])

simple subselect emulation for Mysql
  • Return: the query
  • Access: public

Overrides MDB2_Driver_Common::subSelect() (simple subselect emulation: leaves the query untouched for all RDBMS that support subselects)

Parameters:

string   $query   —  the SQL query for the subselect that may only return a column
string   $quote   —  determines if the data needs to be quoted before being returned

[ Top ]


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