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

Class: MDB2_Driver_Common

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

Class Overview

PEAR
   |
   --MDB2_Driver_Common

MDB2_Driver_Common: Base class that is extended by each MDB2 driver


Author(s):

Variables

Methods


Child classes:

MDB2_Driver_ibase
MDB2 FireBird/InterBase driver
MDB2_Driver_mysql
MDB2 MySQL driver
MDB2_Driver_querysim
MDB2 QuerySim driver
MDB2_Driver_fbsql
MDB2 FrontBase driver
MDB2_Driver_oci8
MDB2 OCI8 driver
MDB2_Driver_pgsql
MDB2 PostGreSQL driver
MDB2_Driver_sqlite
MDB2 SQLite driver
MDB2_Driver_mssql
MDB2 MSSQL Server driver
MDB2_Driver_mysqli
MDB2 MySQL driver
MDB2_xxx
MDB2 XXX driver

Inherited Variables

Inherited Methods


Class Details

[line 862]
MDB2_Driver_Common: Base class that is extended by each MDB2 driver


[ Top ]


Class Variables

$blobs = array()

[line 1058]

contains all BLOB objects created with this MDB2 instance
  • Access: protected

Type:   array


[ Top ]

$clobs = array()

[line 1051]

contains all CLOB objects created with this MDB2 instance
  • Access: protected

Type:   array


[ Top ]

$connected_database_name =  ''

[line 911]

the name of the database currrently selected
  • Access: protected

Type:   string


[ Top ]

$connected_dsn = array()

[line 883]

DSN that was used to create the current connection
  • Access: protected

Type:   array


[ Top ]

$connection =  0

[line 890]

connection resource
  • Access: protected

Type:   mixed


[ Top ]

$database_name =  ''

[line 904]

the name of the database for the next query
  • Access: protected

Type:   string


[ Top ]

$dbsyntax =

[line 1023]

Database used with regards to SQL syntax etc.
  • Access: protected

Type:   string


[ Top ]

$db_index =  0

[line 869]

index of the MDB2 object within the $GLOBALS['_MDB2_databases'] array
  • Access: public

Type:   integer


[ Top ]

$debug_output =  ''

[line 988]

string with the debugging information
  • Access: public

Type:   string


[ Top ]

$destructor_registered =

[line 1072]

determines of the PHP4 destructor emulation has been enabled yet
  • Access: protected

Type:   array


[ Top ]

$dsn = array()

[line 876]

DSN used for the next query
  • Access: protected

Type:   array


[ Top ]

$escape_quotes =  ''

[line 974]

escape character
  • Access: protected

Type:   string


[ Top ]

$fetchmode =  MDB2_FETCHMODE_ORDERED

[line 1037]

the default fetchmode used
  • Access: protected

Type:   integer


[ Top ]

$in_transaction =  false

[line 995]

determine if there is an open transaction
  • Access: protected

Type:   boolean


[ Top ]

$last_query =

[line 1030]

the last query sent to the driver
  • Access: public

Type:   string


[ Top ]

$lobs = array()

[line 1044]

contains all LOB objects created with this MDB2 instance
  • Access: protected

Type:   array


[ Top ]

$modules = array()

[line 1065]

array of module instances
  • Access: protected

Type:   array


[ Top ]

$opened_persistent =

[line 897]

if the current opened connection is a persistent connection
  • Access: protected

Type:   boolean


[ Top ]

$options = array(
            'ssl' => false,
            'disable_query' => false,
            'result_class' => 'MDB2_Result_%s',
            'buffered_result_class' => 'MDB2_BufferedResult_%s',
            'result_wrap_class' => false,
            'result_buffering' => true,
            'fetch_class' => 'stdClass',
            'persistent' => false,
            'debug' => 0,
            'debug_handler' => 'MDB2_defaultDebugOutput',
            'lob_buffer_length' => 8192,
            'log_line_break' => "\n",
            'seqname_format' => '%s_seq',
            'seqcol_name' => 'sequence',
            'use_transactions' => false,
            'decimal_places' => 2,
            'portability' => MDB2_PORTABILITY_ALL,
            'modules' => array(
                'ex' => 'Extended',
                'dt' => 'Datatype',
                'mg' => 'Manager',
                'rv' => 'Reverse',
                'na' => 'Native',
            ),)

[line 942]

$options['ssl'] -> determines if ssl should be used for connections

$options['disable_query'] -> determines if querys should be executed $options['result_class'] -> class used for result sets $options['buffered_result_class'] -> class used for buffered result sets $options['result_wrap_class'] -> class used to wrap result sets into $options['result_buffering'] -> boolean|integer should results be buffered or not? $options['fetch_class'] -> class to use when fetch mode object is used $options['persistent'] -> boolean persistent connection? $options['debug'] -> integer numeric debug level $options['debug_handler'] -> string function/meothd that captures debug messages $options['lob_buffer_length'] -> integer LOB buffer length $options['log_line_break'] -> string line-break format $options['seqname_format'] -> string pattern for sequence name $options['seqcol_name'] -> string sequence column name $options['use_transactions'] -> boolean $options['decimal_places'] -> integer $options['portability'] -> portability constant $options['modules'] -> short to long module name mapping for __call()

  • Access: public

Type:   array


[ Top ]

$phptype =

[line 1016]

Database backend used in PHP (mysql, odbc etc.)
  • Access: protected

Type:   string


[ Top ]

$row_limit =  0

[line 1009]

result limit used in the next query
  • Access: protected

Type:   integer


[ Top ]

$row_offset =  0

[line 1002]

result offset used in the next query
  • Access: protected

Type:   integer


[ Top ]

$supported = array()

[line 918]

list of all supported features of the given driver
  • Access: public

Type:   array


[ Top ]

$warnings = array()

[line 981]

warnings
  • Access: protected

Type:   array


[ Top ]



Method Detail

MDB2_Driver_Common (Constructor)   [line 1098]

MDB2_Driver_Common MDB2_Driver_Common( )

PHP 4 Constructor

[ Top ]

__construct (Constructor)   [line 1080]

MDB2_Driver_Common __construct( )

Constructor

Overridden in child classes as:

MDB2_Driver_ibase::__construct()
Constructor
MDB2_Driver_mysql::__construct()
Constructor
MDB2_Driver_querysim::__construct()
Constructor
MDB2_Driver_fbsql::__construct()
Constructor
MDB2_Driver_oci8::__construct()
Constructor
MDB2_Driver_pgsql::__construct()
Constructor
MDB2_Driver_sqlite::__construct()
Constructor
MDB2_Driver_mssql::__construct()
Constructor
MDB2_Driver_mysqli::__construct()
Constructor

[ Top ]

__destruct (Destructor)   [line 1109]

void __destruct( )

Destructor

[ Top ]

beginTransaction   [line 1587]

mixed beginTransaction( )

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

Overridden in child classes as:

MDB2_Driver_ibase::beginTransaction()
Start a transaction.
MDB2_Driver_mysql::beginTransaction()
Start a transaction.
MDB2_Driver_fbsql::beginTransaction()
Start a transaction.
MDB2_Driver_oci8::beginTransaction()
Start a transaction.
MDB2_Driver_pgsql::beginTransaction()
Start a transaction.
MDB2_Driver_sqlite::beginTransaction()
Start a transaction.
MDB2_Driver_mssql::beginTransaction()
Start a transaction.
MDB2_Driver_mysqli::beginTransaction()
Start a transaction.
MDB2_xxx::beginTransaction()
Define whether database changes done on the database be automatically committed. This function may also implicitly start or end a transaction.

[ Top ]

commit   [line 1606]

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

Overridden in child classes as:

MDB2_Driver_ibase::commit()
Commit the database changes done during a transaction that is in progress.
MDB2_Driver_mysql::commit()
Commit the database changes done during a transaction that is in progress.
MDB2_Driver_fbsql::commit()
Commit the database changes done during a transaction that is in progress.
MDB2_Driver_oci8::commit()
Commit the database changes done during a transaction that is in progress.
MDB2_Driver_pgsql::commit()
Commit the database changes done during a transaction that is in progress.
MDB2_Driver_sqlite::commit()
Commit the database changes done during a transaction that is in progress.
MDB2_Driver_mssql::commit()
Commit the database changes done during a transaction that is in progress.
MDB2_Driver_mysqli::commit()
Commit the database changes done during a transaction that is in progress.
MDB2_xxx::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 ]

compareDefinition   [line 2240]

array compareDefinition( array $current, array $previous)

Obtain an array of changes that may need to applied
  • Return: containg all changes that will need to be applied
  • Access: public

Parameters:

array   $current   —  new definition
array   $previous   —  old definition

[ Top ]

currID   [line 2349]

mixed currID( string $seq_name)

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

Overridden in child classes as:

MDB2_Driver_ibase::currID()
returns the current id of a sequence
MDB2_Driver_mysql::currID()
returns the current id of a sequence
MDB2_Driver_fbsql::currID()
returns the current id of a sequence
MDB2_Driver_pgsql::currID()
returns the current id of a sequence
MDB2_Driver_sqlite::currID()
returns the current id of a sequence
MDB2_Driver_mysqli::currID()
returns the current id of a sequence
MDB2_xxx::currID()
returns the current id of a sequence

Parameters:

string   $seq_name   —  name of the sequence

[ Top ]

debug   [line 1344]

void debug( string $message, [ $scope = ''])

set a debug message
  • Access: public

Parameters:

string   $message   —  Message with information for the user.
   $scope   — 

[ Top ]

debugOutput   [line 1360]

string debugOutput( )

output debug info
  • Return: content of the debug_output class variable
  • Access: public

[ Top ]

disconnect   [line 1642]

mixed disconnect( )

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

Overridden in child classes as:

MDB2_Driver_ibase::disconnect()
Log out and disconnect from the database.
MDB2_Driver_mysql::disconnect()
Log out and disconnect from the database.
MDB2_Driver_querysim::disconnect()
Log out and disconnect from the database.
MDB2_Driver_fbsql::disconnect()
Log out and disconnect from the database.
MDB2_Driver_oci8::disconnect()
Log out and disconnect from the database.
MDB2_Driver_pgsql::disconnect()
Log out and disconnect from the database.
MDB2_Driver_sqlite::disconnect()
Log out and disconnect from the database.
MDB2_Driver_mssql::disconnect()
Log out and disconnect from the database.
MDB2_Driver_mysqli::disconnect()
Log out and disconnect from the database.
MDB2_xxx::disconnect()
Log out and disconnect from the database.

[ Top ]

errorInfo   [line 1152]

array errorInfo( [integer $error = null])

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

Overridden in child classes as:

MDB2_Driver_ibase::errorInfo()
This method is used to collect information about an error
MDB2_Driver_mysql::errorInfo()
This method is used to collect information about an error
MDB2_Driver_fbsql::errorInfo()
This method is used to collect information about an error
MDB2_Driver_oci8::errorInfo()
This method is used to collect information about an error
MDB2_Driver_pgsql::errorInfo()
This method is used to collect information about an error
MDB2_Driver_sqlite::errorInfo()
This method is used to collect information about an error
MDB2_Driver_mssql::errorInfo()
This method is used to collect information about an error
MDB2_Driver_mysqli::errorInfo()
This method is used to collect information about an error
MDB2_xxx::errorInfo()
This method is used to collect information about an error

Parameters:

integer   $error   — 

[ Top ]

errorNative   [line 1227]

mixed errorNative( )

returns an errormessage, provides by the database
  • Return: MDB2 Error Object or message
  • Access: public

[ Top ]

escape   [line 1376]

string escape( string $text)

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.
  • Return: quoted string
  • Access: public

Overridden in child classes as:

MDB2_Driver_mysql::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_sqlite::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_mysqli::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.

Parameters:

string   $text   —  the input string to quote

[ Top ]

getAfterID   [line 2334]

mixed getAfterID( mixed $id, string $table)

returns the autoincrement ID if supported or $id
  • Return: MDB2 Error Object or id
  • Access: public

Overridden in child classes as:

MDB2_Driver_mysql::getAfterID()
returns the autoincrement ID if supported or $id
MDB2_Driver_fbsql::getAfterID()
returns the autoincrement ID if supported or $id
MDB2_Driver_sqlite::getAfterID()
returns the autoincrement ID if supported or $id
MDB2_Driver_mssql::getAfterID()
returns the autoincrement ID if supported or $id
MDB2_Driver_mysqli::getAfterID()
returns the autoincrement ID if supported or $id

Parameters:

mixed   $id   —  value as returned by getBeforeId()
string   $table   —  name of the table into which a new row was inserted

[ Top ]

getBeforeID   [line 2296]

mixed getBeforeID( string $table, [boolean $ondemand = true])

returns the next free id of a sequence if the RDBMS does not support auto increment
  • Return: MDB2 Error Object or id
  • Access: public

Parameters:

string   $table   —  name of the table into which a new row was inserted
boolean   $ondemand   —  when true the seqence is automatic created, if it not exists

[ Top ]

getDatabase   [line 1673]

string getDatabase( )

get the current database
  • Return: name of the database
  • Access: public

[ Top ]

getDeclaration   [line 2220]

string getDeclaration( string $type, string $name, string $field)

Obtain DBMS specific SQL code portion needed to declare of the given type
  • Return: DBMS specific SQL code portion that should be used to declare the specified field.
  • Access: public

Parameters:

string   $type   —  type to which the value should be converted to
string   $name   —  name the field to be declared.
string   $field   —  definition of the field

[ Top ]

getDSN   [line 1711]

mixed getDSN( [string $type = 'string'], [string $hidepw = false])

return the DSN as a string
  • Return: DSN in the chosen type
  • Access: public

Parameters:

string   $type   —  format to return ("array", "string")
string   $hidepw   —  string to hide the password with

[ Top ]

getOption   [line 1326]

mixed getOption( string $option)

returns the value of an option
  • Return: the option value or error object
  • Access: public

Parameters:

string   $option   —  option name

[ Top ]

getSequenceName   [line 2275]

string getSequenceName( string $sqn)

adds sequence name formating to a sequence name
  • Return: formatted sequence name
  • Access: public

Parameters:

string   $sqn   —  name of the sequence

[ Top ]

getWarnings   [line 1256]

array getWarnings( )

get all warnings in reverse order.

This means that the last warning is the first element in the array


[ Top ]

loadModule   [line 1479]

object on &loadModule( string $module, [string $property = null])

loads a module
  • Return: success a reference to the given module is returned and on failure a PEAR error
  • Access: public

Parameters:

string   $module   —  name of the module that should be loaded (only used for error messages)
string   $property   —  name of the property into which the class will be loaded

[ Top ]

nextID   [line 2317]

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

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

Overridden in child classes as:

MDB2_Driver_ibase::nextID()
returns the next free id of a sequence
MDB2_Driver_mysql::nextID()
returns the next free id of a sequence
MDB2_Driver_fbsql::nextID()
returns the next free id of a sequence
MDB2_Driver_oci8::nextID()
returns the next free id of a sequence
MDB2_Driver_pgsql::nextID()
returns the next free id of a sequence
MDB2_Driver_sqlite::nextID()
returns the next free id of a sequence
MDB2_Driver_mssql::nextID()
returns the next free id of a sequence
MDB2_Driver_mysqli::nextID()
returns the next free id of a sequence
MDB2_xxx::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 ]

prepare   [line 2113]

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

Prepares a query for multiple execution with execute().

With some database backends, this is emulated. prepare() requires a generic query as string like 'INSERT INTO numbers VALUES(?,?)' or 'INSERT INTO numbers VALUES(:foo,:bar)'. The ? and :[a-zA-Z] and are placeholders which can be set using bindParam() and the query can be send off using the execute() method.

  • Return: resource handle for the prepared query on success, a MDB2 error on failure
  • See: bindParam, execute
  • Access: public

Overridden in child classes as:

MDB2_Driver_ibase::prepare()
Prepares a query for multiple execution with execute().
MDB2_Driver_oci8::prepare()
Prepares a query for multiple execution with execute().

Parameters:

string   $query   —  the query to prepare
mixed   $types   —  array that contains the types of the placeholders
mixed   $result_types   —  array that contains the types of the columns in the result set

[ Top ]

query   [line 1820]

mixed &query( string $query, [mixed $types = null], [mixed $result_class = true], [mixed $result_wrap_class = false])

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

Overridden in child classes as:

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

Parameters:

string   $query   —  the SQL query
mixed   $types   —  array that contains the types of the columns in the result set
mixed   $result_class   —  string which specifies which result class to use
mixed   $result_wrap_class   —  string which specifies which class to wrap results in

[ Top ]

queryAll   [line 2466]

mixed queryAll( string $query, [array $types = null], [int $fetchmode = MDB2_FETCHMODE_DEFAULT], [boolean $rekey = false], [boolean $force_array = false], [boolean $group = false])

Execute the specified query, fetch all the rows of the result set into a two dimensional array and then frees the result set.
  • Return: MDB2_OK or data array on success, a MDB2 error on failure
  • Access: public

Parameters:

string   $query   —  the SELECT query statement to be executed.
array   $types   —  optional array argument that specifies a list of expected datatypes of the result set columns, so that the eventual conversions may be performed. The default list of datatypes is empty, meaning that no conversion is performed.
int   $fetchmode   —  how the array data should be indexed
boolean   $rekey   —  if set to true, the $all will have the first column as its first dimension
boolean   $force_array   —  used only when the query returns exactly two columns. If true, the values of the returned array will be one-element arrays instead of scalars.
boolean   $group   —  if true, the values of the returned array is wrapped in another array. If the same key value (in the first column) repeats itself, the values will be appended to this array instead of overwriting the existing values.

[ Top ]

queryCol   [line 2429]

mixed queryCol( string $query, [string $type = null], [int $colnum = 0])

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.
  • Return: MDB2_OK or data array on success, a MDB2 error on failure
  • Access: public

Parameters:

string   $query   —  the SELECT query statement to be executed.
string   $type   —  optional argument that specifies the expected datatype of the result set field, so that an eventual conversion may be performed. The default datatype is text, meaning that no conversion is performed
int   $colnum   —  the row number to fetch

[ Top ]

queryOne   [line 2372]

mixed queryOne( string $query, [string $type = null])

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.
  • Return: MDB2_OK or field value on success, a MDB2 error on failure
  • Access: public

Parameters:

string   $query   —  the SELECT query statement to be executed.
string   $type   —  optional argument that specifies the expected datatype of the result set field, so that an eventual conversion may be performed. The default datatype is text, meaning that no conversion is performed

[ Top ]

queryRow   [line 2401]

mixed queryRow( string $query, [array $types = null], [int $fetchmode = MDB2_FETCHMODE_DEFAULT])

Execute the specified query, fetch the values from the first row of the result set into an array and then frees the result set.
  • Return: MDB2_OK or data array on success, a MDB2 error on failure
  • Access: public

Parameters:

string   $query   —  the SELECT query statement to be executed.
array   $types   —  optional array argument that specifies a list of expected datatypes of the result set columns, so that the eventual conversions may be performed. The default list of datatypes is empty, meaning that no conversion is performed.
int   $fetchmode   —  how the array data should be indexed

[ Top ]

quote   [line 2197]

string quote( string $value, [string $type = null])

Convert a text value into a DBMS specific format that is suitable to compose query statements.
  • Return: text string that represents the given argument value in a DBMS specific format.
  • Access: public

Parameters:

string   $value   —  text string value that is intended to be converted.
string   $type   —  type to which the value should be converted to

[ Top ]

quoteIdentifier   [line 1423]

string quoteIdentifier( string $str)

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

Delimiting style depends on which database driver is being used.

NOTE: just because you CAN use delimited identifiers doesn't mean you SHOULD use them. In general, they end up causing way more problems than they solve.

Portability is broken by using the following characters inside delimited identifiers:

  • backtick (`) -- due to MySQL
  • double quote (") -- due to Oracle
  • brackets ([ or ]) -- due to Access
Delimited identifiers are known to generally work correctly under the following drivers:
  • mssql
  • mysql
  • mysqli
  • oci8
  • odbc(access)
  • odbc(db2)
  • pgsql
  • sqlite
  • sybase
InterBase doesn't seem to be able to use delimited identifiers via PHP 4. They work fine under PHP 5.

  • Return: quoted identifier string
  • Access: public

Overridden in child classes as:

MDB2_Driver_mysql::quoteIdentifier()
Quote a string so it can be safely used as a table or column name
MDB2_Driver_mssql::quoteIdentifier()
Quote a string so it can be safely used as a table / column name
MDB2_Driver_mysqli::quoteIdentifier()
Quote a string so it can be safely used as a table or column name

Parameters:

string   $str   —  identifier name to be quoted

[ Top ]

raiseError   [line 1185]

object a &raiseError( [mixed $code = null], [int $mode = null], [mixed $options = null], [string $userinfo = null])

This method is used to communicate an error and invoke error callbacks etc. Basically a wrapper for PEAR::raiseError without the message string.
  • Return: PEAR error object
  • See: PEAR_Error

Parameters:

mixed   $code   —  integer error code, or a PEAR error object (all other parameters are ignored if this parameter is an object
int   $mode   —  error mode, see PEAR_Error docs
mixed   $options   —  If error mode is PEAR_ERROR_TRIGGER, this is the error level (E_USER_NOTICE etc). If error mode is PEAR_ERROR_CALLBACK, this is the callback function, either as a function name, or as an array of an object and method name. For other error modes this parameter is ignored.
string   $userinfo   —  Extra debug information. Defaults to the last query and native error code.

[ Top ]

replace   [line 2023]

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 pratically 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

Overridden in child classes as:

MDB2_Driver_mysql::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_sqlite::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_mysqli::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_xxx::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: no type conversion

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 ]

resetWarnings   [line 1240]

void resetWarnings( )

reset the warning array
  • Access: public

[ Top ]

rollback   [line 1625]

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

Overridden in child classes as:

MDB2_Driver_ibase::rollback()
Cancel any database changes done during a transaction that is in progress.
MDB2_Driver_mysql::rollback()
Cancel any database changes done during a transaction that is in progress.
MDB2_Driver_fbsql::rollback()
Cancel any database changes done during a transaction that is in progress.
MDB2_Driver_oci8::rollback()
Cancel any database changes done during a transaction that is in progress.
MDB2_Driver_pgsql::rollback()
Cancel any database changes done during a transaction that is in progress.
MDB2_Driver_sqlite::rollback()
Cancel any database changes done during a transaction that is in progress.
MDB2_Driver_mssql::rollback()
Cancel any database changes done during a transaction that is in progress.
MDB2_Driver_mysqli::rollback()
Cancel any database changes done during a transaction that is in progress.
MDB2_xxx::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 ]

setDatabase   [line 1657]

string setDatabase( string $name)

Select a different database
  • Return: name of the database previously connected to
  • Access: public

Parameters:

string   $name   —  name of the database that should be selected

[ Top ]

setDSN   [line 1688]

MDB2_OK setDSN( mixed $dsn)

set the DSN
  • Access: public

Parameters:

mixed   $dsn   —  DSN string or array

[ Top ]

setFetchMode   [line 1281]

void setFetchMode( integer $fetchmode, [string $object_class = 'stdClass'])

Sets which fetch mode should be used by default on queries on this connection

Parameters:

integer   $fetchmode   —  MDB2_FETCHMODE_ORDERED, MDB2_FETCHMODE_ASSOC or MDB2_FETCHMODE_OBJECT
string   $object_class   —  the class name of the object to be returned by the fetch methods when the MDB2_FETCHMODE_OBJECT mode is selected. If no class is specified by default a cast to object from the assoc array row will be done. There is also the posibility to use and extend the 'MDB2_row' class.

[ Top ]

setLimit   [line 1912]

mixed setLimit( string $limit, [string $offset = null])

set the range of the next query
  • Return: MDB2_OK on success, a MDB2 error on failure
  • Access: public

Parameters:

string   $limit   —  number of rows to select
string   $offset   —  first row to select

[ Top ]

setOption   [line 1306]

mixed setOption( string $option, mixed $value)

set the option for the db class
  • Return: MDB2_OK or MDB2 Error Object
  • Access: public

Parameters:

string   $option   —  option name
mixed   $value   —  value for the option

[ Top ]

standaloneQuery   [line 1746]

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

execute a query as database administrator
  • Return: MDB2_OK on success, a MDB2 error on failure
  • Access: public

Overridden in child classes as:

MDB2_Driver_oci8::standaloneQuery()
execute a query as DBA
MDB2_Driver_pgsql::standaloneQuery()
execute a query as DBA

Parameters:

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

[ Top ]

subSelect   [line 1950]

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

simple subselect emulation: leaves the query untouched for all RDBMS that support subselects
  • Return: the query
  • Access: public

Overridden in child classes as:

MDB2_Driver_mysql::subSelect()
simple subselect emulation for Mysql
MDB2_Driver_mysqli::subSelect()
simple subselect emulation for Mysql
MDB2_xxx::subSelect()
simple subselect emulation for Mysql

Parameters:

string   $query   —  the SQL query for the subselect that may only return a column
string   $type   —  determines type of the field

[ Top ]

supports   [line 2260]

boolean supports( string $feature)

Tell whether a DB implementation or its backend extension supports a given feature.
  • Return: whether this DB implementation supports $feature
  • Access: public

Parameters:

string   $feature   —  name of the feature (see the MDB2 class doc)

[ Top ]

_convertEmptyArrayValuesToNull   [line 1457]

void _convertEmptyArrayValuesToNull( &$array, array $array)

Convert all empty values in an array to null strings
  • Access: protected

Parameters:

array   $array   —  the array to be de-nullified (passed by reference)
   &$array   — 

[ Top ]

_doQuery   [line 1798]

result _doQuery( string $query, [boolean $isManip = false], [resource $connection = null], [string $database_name = null])

Execute a query
  • Return: or error object
  • Access: protected

Overridden in child classes as:

MDB2_Driver_ibase::_doQuery()
Execute a query
MDB2_Driver_mysql::_doQuery()
Execute a query
MDB2_Driver_querysim::_doQuery()
Execute a query
MDB2_Driver_fbsql::_doQuery()
Execute a query
MDB2_Driver_oci8::_doQuery()
Execute a query
MDB2_Driver_pgsql::_doQuery()
Execute a query
MDB2_Driver_sqlite::_doQuery()
Execute a query
MDB2_Driver_mssql::_doQuery()
Execute a query
MDB2_Driver_mysqli::_doQuery()
Execute a query

Parameters:

string   $query   —  query
boolean   $isManip   —  if the query is a manipulation query
resource   $connection   — 
string   $database_name   — 

[ Top ]

_modifyQuery   [line 1781]

the _modifyQuery( string $query)

Changes a query string for various DBMS specific reasons
  • Return: new (modified) query
  • Access: protected

Overridden in child classes as:

MDB2_Driver_ibase::_modifyQuery()
Changes a query string for various DBMS specific reasons
MDB2_Driver_mysql::_modifyQuery()
Changes a query string for various DBMS specific reasons
MDB2_Driver_fbsql::_modifyQuery()
Changes a query string for various DBMS specific reasons
MDB2_Driver_oci8::_modifyQuery()
Changes a query string for various DBMS specific reasons
MDB2_Driver_pgsql::_modifyQuery()
Changes a query string for various DBMS specific reasons
MDB2_Driver_sqlite::_modifyQuery()
Changes a query string for various DBMS specific reasons
MDB2_Driver_mssql::_modifyQuery()
Changes a query string for various DBMS specific reasons
MDB2_Driver_mysqli::_modifyQuery()
Changes a query string for various DBMS specific reasons

Parameters:

string   $query   —  query to modify

[ Top ]

_rtrimArrayValues   [line 1438]

void _rtrimArrayValues( &$array, array $array)

Right trim all strings in an array
  • Access: protected

Parameters:

array   $array   —  the array to be trimmed (passed by reference)
   &$array   — 

[ Top ]

_wrapResult   [line 1861]

mixed &_wrapResult( ressource $result, [mixed $types = array()], [mixed $result_class = true], [mixed $result_wrap_class = false], [string $limit = null], [string $offset = null])

wrap a result set into the correct class
  • Return: a result handle or MDB2_OK on success, a MDB2 error on failure
  • Access: protected

Parameters:

ressource   $result   — 
mixed   $types   —  array that contains the types of the columns in the result set
mixed   $result_class   —  string which specifies which result class to use
mixed   $result_wrap_class   —  string which specifies which class to wrap results in
string   $limit   —  number of rows to select
string   $offset   —  first row to select

[ Top ]

__call   [line 1547]

mixed __call( string $method, array $params)

Calls a module method using the __call magic method
  • Return: Returned value.

Parameters:

string   $method   —  Method name.
array   $params   —  Arguments.

[ Top ]

__toString   [line 1132]

string __toString( )

String conversation
  • Access: public

[ Top ]


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