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

Class: MDB_Common

Source Location: /MDB-1.3.0/MDB/Common.php

Class Overview

PEAR
   |
   --MDB_Common

MDB_Common: Base class that is extended by each MDB driver


Author(s):

Methods


Child classes:

MDB_xxx
MDB XXX driver
MDB_ibase
MDB FireBird/InterBase driver
MDB_mysql
MDB MySQL driver
MDB_querysim
MDB QuerySim driver
MDB_fbsql
MDB FrontBase driver
MDB_oci8
MDB OCI8 driver
MDB_pgsql
MDB PostGreSQL driver
MDB_mssql
MDB MSSQL Server driver

Inherited Variables

Inherited Methods


Class Details

[line 77]
MDB_Common: Base class that is extended by each MDB driver


[ Top ]


Method Detail

MDB_Common (Constructor)   [line 296]

MDB_Common MDB_Common( )

Constructor

[ Top ]

affectedRows   [line 2505]

mixed affectedRows( )

returns the affected rows of a query
  • Return: MDB_Error or number of rows
  • Access: public

Overridden in child classes as:

MDB_ibase::affectedRows()
returns the affected rows of a query

[ Top ]

alterTable   [line 1141]

mixed alterTable( string $name, array $changes, boolean $check)

alter an existing table
  • Return: MDB_OK on success, a MDB error on failure
  • Access: public

Parameters:

string   $name   —  name of the table that is intended to be changed.
array   $changes   — 

associative array that contains the details of each type of change that is intended to be performed. The types of changes that are currently supported are defined as follows:

name New name for the table.

AddedFields Associative array with the names of fields to be added as indexes of the array. The value of each entry of the array should be set to another associative array with the properties of the fields to be added. The properties of the fields should be the same as defined by the Metabase parser.

Additionally, there should be an entry named Declaration that is expected to contain the portion of the field declaration already in DBMS specific SQL code as it is used in the CREATE TABLE statement.

RemovedFields Associative array with the names of fields to be removed as indexes of the array. Currently the values assigned to each entry are ignored. An empty array should be used for future compatibility.

RenamedFields Associative array with the names of fields to be renamed as indexes of the array. The value of each entry of the array should be set to another associative array with the entry named name with the new field name and the entry named Declaration that is expected to contain the portion of the field declaration already in DBMS specific SQL code as it is used in the CREATE TABLE statement.

ChangedFields Associative array with the names of the fields to be changed as indexes of the array. Keep in mind that if it is intended to change either the name of a field and any other properties, the ChangedFields array entries should have the new names of the fields as array indexes.

The value of each entry of the array should be set to another associative array with the properties of the fields to that are meant to be changed as array entries. These entries should be assigned to the new values of the respective properties. The properties of the fields should be the* same as defined by the Metabase parser.

If the default property is meant to be added, removed or changed, there should also be an entry with index ChangedDefault assigned to 1. Similarly, if the notnull constraint is to be added or removed, there should also be an entry with index ChangedNotNull assigned to 1.

Additionally, there should be an entry named Declaration that is expected to contain the portion of the field changed declaration already in DBMS specific SQL code as it is used in the CREATE TABLE statement.

Example array( 'name' => 'userlist', 'AddedFields' => array( 'quota' => array( 'type' => 'integer', 'unsigned' => 1, 'Declaration' => 'quota INT' ) ), 'RemovedFields' => array( 'file_limit' => array(), 'time_limit' => array() ), 'ChangedFields' => array( 'gender' => array( 'default' => 'M', 'ChangeDefault' => 1, 'Declaration' => "gender CHAR(1) DEFAULT 'M'" ) ), 'RenamedFields' => array( 'sex' => array( 'name' => 'gender', 'Declaration' => "gender CHAR(1) DEFAULT 'M'" ) ) )

boolean   $check   —  indicates whether the function should just check if the DBMS driver can perform the requested table alterations if the value is TRUE or actually perform them otherwise.

[ Top ]

autoCommit   [line 791]

mixed autoCommit( boolean $auto_commit)

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

Overridden in child classes as:

MDB_xxx::autoCommit()
Define whether database changes done on the database be automatically committed. This function may also implicitly start or end a transaction.
MDB_ibase::autoCommit()
Define whether database changes done on the database be automatically committed. This function may also implicitly start or end a transaction.
MDB_mysql::autoCommit()
Define whether database changes done on the database be automatically committed. This function may also implicitly start or end a transaction.
MDB_fbsql::autoCommit()
Define whether database changes done on the database be automatically committed. This function may also implicitly start or end a transaction.
MDB_oci8::autoCommit()
Define whether database changes done on the database be automatically committed. This function may also implicitly start or end a transaction.
MDB_pgsql::autoCommit()
Define whether database changes done on the database be automatically committed. This function may also implicitly start or end a transaction.
MDB_mssql::autoCommit()
Define whether database changes done on the database be automatically committed. This function may also implicitly start or end a transaction.

Parameters:

boolean   $auto_commit   —  flag that indicates whether the database changes should be committed right after executing every query statement. If this argument is 0 a transaction implicitly started. Otherwise, if a transaction is in progress it is ended by committing any database changes that were pending.

[ Top ]

captureDebugOutput   [line 510]

void captureDebugOutput( string $capture)

set a debug handler

Parameters:

string   $capture   —  name of the function that should be used in debug()

[ Top ]

commit   [line 810]

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: MDB_OK on success, a MDB error on failure
  • Access: public

Overridden in child classes as:

MDB_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.
MDB_ibase::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.
MDB_mysql::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.
MDB_fbsql::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.
MDB_oci8::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.
MDB_pgsql::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.
MDB_mssql::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 ]

convertResult   [line 2846]

mixed convertResult( mixed $value, int $type)

convert a value to a RDBMS indepdenant MDB type
  • Return: converted value or a MDB error on failure
  • Access: public

Overridden in child classes as:

MDB_xxx::convertResult()
convert a value to a RDBMS indepdenant MDB type
MDB_ibase::convertResult()
convert a value to a RDBMS indepdenant MDB type
MDB_mysql::convertResult()
convert a value to a RDBMS indepdenant MDB type
MDB_fbsql::convertResult()
convert a value to a RDBMS indepdenant MDB type
MDB_oci8::convertResult()
convert a value to a RDBMS indepdenant MDB type
MDB_pgsql::convertResult()
convert a value to a RDBMS indepdenant MDB type
MDB_mssql::convertResult()
convert a value to a RDBMS indepdenant MDB type

Parameters:

mixed   $value   —  value to be converted
int   $type   —  constant that specifies which type to convert to

[ Top ]

convertResultRow   [line 2862]

mixed convertResultRow( resource $result, array $row)

convert a result row
  • Return: MDB_OK on success, a MDB error on failure
  • Access: public

Parameters:

resource   $result   —  result identifier
array   $row   —  array with data

[ Top ]

createDatabase   [line 957]

mixed createDatabase( string $name)

create a new database
  • Return: MDB_OK on success, a MDB error on failure
  • Access: public

Parameters:

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

[ Top ]

createIndex   [line 1399]

mixed createIndex( string $table, string $name, array $definition)

get the stucture of a field into an array
  • Return: MDB_OK on success, a MDB error on failure
  • Access: public

Parameters:

string   $table   —  name of the table on which the index is to be created
string   $name   —  name of the index to be created
array   $definition   — 

associative array that defines properties of the index to be created. Currently, only one property named FIELDS is supported. This property is also an associative with the names of the index fields as array indexes. Each entry of this array is set to another type of associative array that specifies properties of the index that are specific to each field.

Currently, only the sorting property is supported. It should be used to define the sorting direction of the index. It may be set to either ascending or descending. Not all DBMS support index sorting direction configuration. The DBMS drivers of those that do not support it ignore this property. Use the function support() to determine whether the DBMS driver can manage indexes.

Example array( 'FIELDS' => array( 'user_name' => array( 'sorting' => 'ascending' ), 'last_login' => array() ) )


[ Top ]

createLob   [line 4432]

integer createLob( array $arguments)

Create a handler object of a specified class with functions to retrieve data from a large object data stream.
  • Return: handle value that should be passed as argument insubsequent calls to functions that retrieve data from the large object input stream.
  • Access: public

Parameters:

array   $arguments   — 

An associative array with parameters to create the handler object. The array indexes are the names of the parameters and the array values are the respective parameter values.

Some parameters are specific of the class of each type of handler object that is created. The following parameters are common to all handler object classes:

Type

Name of the type of the built-in supported class that will be used to create the handler object. There are currently four built-in types of handler object classes: data, resultlob, inputfile and outputfile.

The data handler class is the default class. It simply reads data from a given data string.

The resultlob handler class is meant to read data from a large object retrieved from a query result. This class is not used directly by applications.

The inputfile handler class is meant to read data from a file to use in prepared queries with large object field parameters.

The outputfile handler class is meant to write to a file data from result columns with large object fields. The functions to read from this type of large object do not return any data. Instead, the data is just written to the output file with the data retrieved from a specified large object handle.

Class

Name of the class of the handler object that will be created if the Type argument is not specified. This argument should be used when you need to specify a custom handler class.

Database

Database object as returned by MDB::connect. This is an option argument needed by some handler classes like resultlob.

The following arguments are specific of the inputfile handler class:

File

Integer handle value of a file already opened for writing.

FileName

Name of a file to be opened for writing if the File argument is not specified.

The following arguments are specific of the outputfile handler class:

File

Integer handle value of a file already opened for writing.

FileName

Name of a file to be opened for writing if the File argument is not specified.

BufferLength

Integer value that specifies the length of a buffer that will be used to read from the specified large object.

LOB

Integer handle value that specifies a large object from which the data to be stored in the output file will be written.

Result

Integer handle value as returned by the function MDB::query() or MDB::executeQuery() that specifies the result set that contains the large object value to be retrieved. If the LOB argument is specified, this argument is ignored.

Row

Integer value that specifies the number of the row of the result set that contains the large object value to be retrieved. If the LOB argument is specified, this argument is ignored.

Field

Integer or string value that specifies the number or the name of the column of the result set that contains the large object value to be retrieved. If the LOB argument is specified, this argument is ignored.

Binary

Boolean value that specifies whether the large object column to be retrieved is of binary type (blob) or otherwise is of character type (clob). If the LOB argument is specified, this argument is ignored.

The following argument is specific of the data handler class:

Data

String of data that will be returned by the class when it requested with the readLOB() method.

The following argument is specific of the resultlob handler class:

ResultLOB

Integer handle value of a large object result row field.


[ Top ]

createSequence   [line 1478]

mixed createSequence( string $name, [string $start = 1])

create sequence
  • Return: MDB_OK on success, a MDB error on failure
  • Access: public

Parameters:

string   $name   —  name of the sequence to be created
string   $start   —  start value of the sequence; default is 1

[ Top ]

createTable   [line 1018]

mixed createTable( string $name, array $fields)

create a new table
  • Return: MDB_OK on success, a MDB error on failure
  • Access: public

Parameters:

string   $name   —  Name of the database that should be created
array   $fields   — 

Associative array that contains the definition of each field of the new table. The indexes of the array entries are the names of the fields of the table an the array entry values are associative arrays like those that are meant to be passed with the field definitions to get[Type]Declaration() functions.

Example array( 'id' => array( 'type' => 'integer', 'unsigned' => 1 'notnull' => 1 'default' => 0 ), 'name' => array( 'type' => 'text', 'length' => 12 ), 'password' => array( 'type' => 'text', 'length' => 12 ) );


[ Top ]

currId   [line 3612]

mixed currId( string $seq_name)

returns the current id of a sequence
  • Return: MDB_Error or id
  • Access: public

Overridden in child classes as:

MDB_xxx::currId()
returns the current id of a sequence
MDB_ibase::currId()
returns the current id of a sequence
MDB_mysql::currId()
returns the current id of a sequence
MDB_oci8::currId()
returns the current id of a sequence
MDB_pgsql::currId()
returns the current id of a sequence

Parameters:

string   $seq_name   —  name of the sequence

[ Top ]

debug   [line 525]

void debug( string $message)

set a debug message
  • Access: public

Parameters:

string   $message   —  Message with information for the user.

[ Top ]

debugOutput   [line 545]

string debugOutput( )

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

[ Top ]

destroyLob   [line 4527]

void destroyLob( integer $lob)

Free any resources allocated during the lifetime of the large object handler object.
  • Access: public

Parameters:

integer   $lob   —  argument handle that is returned by the MDB::createLob() method.

[ Top ]

disconnect   [line 846]

mixed disconnect( )

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

[ Top ]

dropDatabase   [line 976]

mixed dropDatabase( string $name)

drop an existing database
  • Return: MDB_OK on success, a MDB error on failure
  • Access: public

Parameters:

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

[ Top ]

dropIndex   [line 1419]

mixed dropIndex( string $table, string $name)

drop existing index
  • Return: MDB_OK on success, a MDB error on failure
  • Access: public

Parameters:

string   $table   —  name of table that should be used in method
string   $name   —  name of the index to be dropped

[ Top ]

dropSequence   [line 1497]

mixed dropSequence( string $name)

drop existing sequence
  • Return: MDB_OK on success, a MDB error on failure
  • Access: public

Parameters:

string   $name   —  name of the sequence to be dropped

[ Top ]

dropTable   [line 1037]

mixed dropTable( string $name)

drop an existing table
  • Return: MDB_OK on success, a MDB error on failure
  • Access: public

Parameters:

string   $name   —  name of the table that should be dropped

[ Top ]

endOfLob   [line 4511]

boolean endOfLob( integer $lob)

Determine whether it was reached the end of the large object and therefore there is no more data to be read for the its input stream.
  • Return: flag that indicates whether it was reached the end of the large object input stream
  • Access: public

Parameters:

integer   $lob   —  argument handle that is returned by the MDB::createLob() method.

[ Top ]

endOfResult   [line 2562]

mixed endOfResult( resource $result)

check if the end of the result set has been reached
  • Return: TRUE or FALSE on sucess, a MDB error on failure
  • Access: public

Overridden in child classes as:

MDB_xxx::endOfResult()
check if the end of the result set has been reached
MDB_ibase::endOfResult()
check if the end of the result set has been reached
MDB_mysql::endOfResult()
check if the end of the result set has been reached
MDB_querysim::endOfResult()
check if the end of the result set has been reached
MDB_fbsql::endOfResult()
check if the end of the result set has been reached
MDB_oci8::endOfResult()
check if the end of the result set has been reached
MDB_pgsql::endOfResult()
check if the end of the result set has been reached
MDB_mssql::endOfResult()
check if the end of the result set has been reached

Parameters:

resource   $result   —  result identifier

[ Top ]

endOfResultLob   [line 2679]

mixed endOfResultLob( int $lob)

Determine whether it was reached the end of the large object and therefore there is no more data to be read for the its input stream.
  • Return: TRUE or FALSE on success, a MDB error on failure
  • Access: public

Overridden in child classes as:

MDB_xxx::endOfResultLob()
Determine whether it was reached the end of the large object and therefore there is no more data to be read for the its input stream.
MDB_ibase::endOfResultLob()
Determine whether it was reached the end of the large object and therefore there is no more data to be read for the its input stream.
MDB_pgsql::endOfResultLob()
Determine whether it was reached the end of the large object and therefore there is no more data to be read for the its input stream.

Parameters:

int   $lob   —  handle to a lob created by the createLob() function

[ Top ]

error   [line 622]

string error( )

Retrieve the error message text associated with the last operation that failed. Some functions may fail but they do not return the reason that makes them to fail. This function is meant to retrieve a textual description of the failure cause.
  • Return: the error message text associated with the last failure.
  • Access: public

[ Top ]

errorCode   [line 341]

int errorCode( mixed $nativecode)

Map native error codes to MDB's portable ones. Requires that the DB implementation's constructor fills in the $errorcode_map property.
  • Return: a portable MDB error code, or FALSE if this MDB implementation has no mapping for the given error code.
  • Access: public

Overridden in child classes as:

MDB_ibase::errorCode()
Map native error codes to DB's portable ones. Requires that the DB implementation's constructor fills in the $errorcode_map property.
MDB_pgsql::errorCode()
Map native error codes to DB's portable ones. Requires that the DB implementation's constructor fills in the $errorcode_map property.

Parameters:

mixed   $nativecode   —  the native error code, as returned by the backend database extension (string or integer)

[ Top ]

errorMessage   [line 362]

string errorMessage( integer $dbcode)

Map a MDB error code to a textual message. This is actually just a wrapper for MDB::errorMessage().
  • Return: the corresponding error message, of FALSE if the error code was unknown
  • Access: public

Parameters:

integer   $dbcode   —  the MDB error code

[ Top ]

errorNative   [line 427]

mixed errorNative( )

returns an errormessage, provides by the database
  • Return: MDB_Error or message
  • Access: public

Overridden in child classes as:

MDB_xxx::errorNative()
Get the native error code of the last error (if any) that occured on the current connection.
MDB_ibase::errorNative()
Get the native error code of the last error (if any) that occured on the current connection.
MDB_mysql::errorNative()
Get the native error code of the last error (if any) that occured on the current connection.
MDB_fbsql::errorNative()
Get the native error code of the last error (if any) that occured on the current connection.
MDB_oci8::errorNative()
Get the native error code of the last error (if any) that occured on the current connection.
MDB_pgsql::errorNative()
Get the native error code of the last error (if any) that occured on the current connection.
MDB_mssql::errorNative()
Get the native error code of the last error (if any) that occured on the current connection.

[ Top ]

execute   [line 2035]

mixed execute( resource $prepared_query, [array $types = NULL], [array $params = FALSE], [array $param_types = NULL])

Executes a prepared SQL query

With execute() the generic query of prepare is assigned with the given data array. The values of the array inserted into the query in the same order like the array order

  • Return: a new result handle or a MDB_Error when fail
  • See: prepare()
  • Access: public

Parameters:

resource   $prepared_query   —  query handle from prepare()
array   $types   —  array that contains the types of the columns in the result set
array   $params   —  numeric array containing the data to insert into the query
array   $param_types   —  array that contains the types of the values defined in $params

[ Top ]

executeMultiple   [line 2064]

mixed executeMultiple( $prepared_query, [array $types = NULL], array $params, [ $param_types = NULL], resource $stmt, array $parAM_types)

This function does several execute() calls on the same statement handle.

$params must be an array indexed numerically from 0, one execute call is done for every 'row' in the array.

If an error occurs during execute(), executeMultiple() does not execute the unfinished rows, but rather returns that error.

  • Return: a result handle or MDB_OK on success, a MDB error on failure
  • See: prepare(), MDB_Common::execute()
  • Access: public

Parameters:

resource   $stmt   —  query handle from prepare()
array   $types   —  array that contains the types of the columns in the result set
array   $params   —  numeric array containing the data to insert into the query
array   $parAM_types   —  array that contains the types of the values defined in $params
   $prepared_query   — 
   $param_types   — 

[ Top ]

executeQuery   [line 1941]

mixed executeQuery( int $prepared_query, [array $types = NULL])

Execute a prepared query statement.
  • Return: a result handle or MDB_OK on success, a MDB error on failure
  • Access: public

Parameters:

int   $prepared_query   —  argument is a handle that was returned by the function prepareQuery()
array   $types   —  array that contains the types of the columns in the result set

[ Top ]

fetch   [line 2606]

mixed fetch( resource $result, int $row, int $field)

fetch value from a result set
  • Return: string on success, a MDB error on failure
  • Access: public

Overridden in child classes as:

MDB_xxx::fetch()
fetch value from a result set
MDB_ibase::fetch()
fetch value from a result set
MDB_mysql::fetch()
fetch value from a result set
MDB_querysim::fetch()
fetch value from a simulated result set
MDB_fbsql::fetch()
fetch value from a result set
MDB_oci8::fetch()
fetch value from a result set
MDB_pgsql::fetch()
fetch value from a result set
MDB_mssql::fetch()
fetch value from a result set

Parameters:

resource   $result   —  result identifier
int   $row   —  number of the row where the data can be found
int   $field   —  field number where the data can be found

[ Top ]

fetchAll   [line 3796]

mixed fetchAll( resource $result, [int $fetchmode = MDB_FETCHMODE_DEFAULT], [boolean $rekey = FALSE], [boolean $force_array = FALSE], [boolean $group = FALSE])

Fetch and return a column of data (it uses fetchInto for that)

Parameters:

resource   $result   —  result identifier
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 ]

fetchBlob   [line 2762]

mixed fetchBlob( resource $result, int $row, int $field)

fetch a blob value from a result set
  • Return: content of the specified data cell, a MDB error on failure
  • Access: public

Overridden in child classes as:

MDB_xxx::fetchBlob()
fetch a blob value from a result set
MDB_ibase::fetchBlob()
fetch a blob value from a result set
MDB_mysql::fetchBlob()
fetch a blob value from a result set
MDB_fbsql::fetchBlob()
fetch a blob value from a result set
MDB_oci8::fetchBlob()
fetch a blob value from a result set
MDB_pgsql::fetchBlob()
fetch a blob value from a result set
MDB_mssql::fetchBlob()
fetch a blob value from a result set

Parameters:

resource   $result   —  result identifier
int   $row   —  number of the row where the data can be found
int   $field   —  field number where the data can be found

[ Top ]

fetchBoolean   [line 2961]

mixed fetchBoolean( resource $result, int $row, int $field)

fetch a boolean value from a result set
  • Return: content of the specified data cell, a MDB error on failure
  • Access: public

Parameters:

resource   $result   —  result identifier
int   $row   —  number of the row where the data can be found
int   $field   —  field number where the data can be found

[ Top ]

fetchClob   [line 2744]

mixed fetchClob( resource $result, int $row, int $field)

fetch a clob value from a result set
  • Return: content of the specified data cell, a MDB error on failure, a MDB error on failure
  • Access: public

Overridden in child classes as:

MDB_xxx::fetchClob()
fetch a clob value from a result set
MDB_ibase::fetchClob()
fetch a clob value from a result set
MDB_mysql::fetchClob()
fetch a clob value from a result set
MDB_fbsql::fetchClob()
fetch a clob value from a result set
MDB_oci8::fetchClob()
fetch a clob value from a result set
MDB_pgsql::fetchClob()
fetch a clob value from a result set
MDB_mssql::fetchClob()
fetch a clob value from a result set

Parameters:

resource   $result   —  result identifier
int   $row   —  number of the row where the data can be found
int   $field   —  field number where the data can be found

[ Top ]

fetchCol   [line 3753]

mixed fetchCol( resource $result, [int $colnum = 0])

Fetch and return a column of data (it uses fetchInto for that)
  • Return: data array on success, a MDB error on failure
  • Access: public

Parameters:

resource   $result   —  result identifier
int   $colnum   —  the row number to fetch

[ Top ]

fetchDate   [line 2907]

mixed fetchDate( resource $result, int $row, int $field)

fetch a date value from a result set
  • Return: content of the specified data cell, a MDB error on failure
  • Access: public

Parameters:

resource   $result   —  result identifier
int   $row   —  number of the row where the data can be found
int   $field   —  field number where the data can be found

[ Top ]

fetchDecimal   [line 2997]

mixed fetchDecimal( resource $result, int $row, int $field)

fetch a decimal value from a result set
  • Return: content of the specified data cell, a MDB error on failure
  • Access: public

Parameters:

resource   $result   —  result identifier
int   $row   —  number of the row where the data can be found
int   $field   —  field number where the data can be found

[ Top ]

fetchFloat   [line 2979]

mixed fetchFloat( resource $result, int $row, int $field)

fetch a float value from a result set
  • Return: content of the specified data cell, a MDB error on failure
  • Access: public

Parameters:

resource   $result   —  result identifier
int   $row   —  number of the row where the data can be found
int   $field   —  field number where the data can be found

[ Top ]

fetchInto   [line 3641]

mixed fetchInto( resource $result, [int $fetchmode = MDB_FETCHMODE_DEFAULT], [int $rownum = NULL])

Fetch a row and return data in an array.
  • Return: data array or NULL on success, a MDB error on failure
  • Access: public

Overridden in child classes as:

MDB_xxx::fetchInto()
Fetch a row and insert the data into an existing array.
MDB_ibase::fetchInto()
Fetch a row and return data in an array.
MDB_mysql::fetchInto()
Fetch a row and insert the data into an existing array.
MDB_querysim::fetchInto()
Fetch a row and return data in an array.
MDB_fbsql::fetchInto()
Fetch a row and return data in an array.
MDB_oci8::fetchInto()
Fetch a row and return data in an array.
MDB_pgsql::fetchInto()
Fetch a row and return data in an array.
MDB_mssql::fetchInto()
Fetch a row and insert the data into an existing array.

Parameters:

resource   $result   —  result identifier
int   $fetchmode   —  ignored
int   $rownum   —  the row number to fetch

[ Top ]

fetchLob   [line 2624]

mixed fetchLob( resource $result, int $row, int $field)

fetch a lob value from a result set
  • Return: string on success, a MDB error on failure
  • Access: public

Parameters:

resource   $result   —  result identifier
int   $row   —  number of the row where the data can be found
int   $field   —  field number where the data can be found

[ Top ]

fetchOne   [line 3709]

mixed fetchOne( resource $result)

Fetch and return a field of data (it uses fetchInto for that)
  • Return: data on success, a MDB error on failure
  • Access: public

Parameters:

resource   $result   —  result identifier

[ Top ]

fetchRow   [line 3733]

mixed fetchRow( resource $result, [int $fetchmode = MDB_FETCHMODE_DEFAULT], [int $rownum = NULL])

Fetch and return a row of data (it uses fetchInto for that)
  • Return: data array on success, a MDB error on failure
  • Access: public

Parameters:

resource   $result   —  result identifier
int   $fetchmode   —  how the array data should be indexed
int   $rownum   —  the row number to fetch

[ Top ]

fetchTime   [line 2943]

mixed fetchTime( resource $result, int $row, int $field)

fetch a time value from a result set
  • Return: content of the specified data cell, a MDB error on failure
  • Access: public

Parameters:

resource   $result   —  result identifier
int   $row   —  number of the row where the data can be found
int   $field   —  field number where the data can be found

[ Top ]

fetchTimestamp   [line 2925]

mixed fetchTimestamp( resource $result, int $row, int $field)

fetch a timestamp value from a result set
  • Return: content of the specified data cell, a MDB error on failure
  • Access: public

Parameters:

resource   $result   —  result identifier
int   $row   —  number of the row where the data can be found
int   $field   —  field number where the data can be found

[ Top ]

freeBlobValue   [line 3420]

void freeBlobValue( resource $prepared_query, string $blob, &$value, string $value)

free a binary large object
  • Access: public

Overridden in child classes as:

MDB_xxx::freeBlobValue()
free a binary large object
MDB_ibase::freeBlobValue()
free a binary large object
MDB_mysql::freeBlobValue()
free a binary large object
MDB_fbsql::freeBlobValue()
free a binary large object
MDB_oci8::freeBlobValue()
free a binary large object
MDB_mssql::freeBlobValue()
free a binary large object

Parameters:

resource   $prepared_query   —  query handle from prepare()
string   $blob   — 
string   $value   — 
   &$value   — 

[ Top ]

freeClobValue   [line 3385]

void freeClobValue( resource $prepared_query, $clob, &$value, string $blob, string $value)

free a character large object
  • Access: public

Overridden in child classes as:

MDB_xxx::freeClobValue()
free a chracter large object
MDB_ibase::freeClobValue()
free a character large object
MDB_mysql::freeClobValue()
free a character large object
MDB_fbsql::freeClobValue()
free a character large object
MDB_oci8::freeClobValue()
free a character large object
MDB_mssql::freeClobValue()
free a character large object

Parameters:

resource   $prepared_query   —  query handle from prepare()
string   $blob   — 
string   $value   — 
   $clob   — 
   &$value   — 

[ Top ]

freePreparedQuery   [line 1899]

mixed freePreparedQuery( int $prepared_query)

Release resources allocated for the specified prepared query.
  • Return: MDB_OK on success, a MDB error on failure
  • Access: public

Parameters:

int   $prepared_query   —  argument is a handle that was returned by the function prepareQuery()

[ Top ]

freeResult   [line 3028]

boolean freeResult( $result $result)

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

Overridden in child classes as:

MDB_xxx::freeResult()
Free the internal resources associated with $result.
MDB_ibase::freeResult()
Free the internal resources associated with $result.
MDB_mysql::freeResult()
Free the internal resources associated with $result.
MDB_querysim::freeResult()
Free the internal resources associated with $result.
MDB_fbsql::freeResult()
Free the internal resources associated with $result.
MDB_oci8::freeResult()
Free the internal resources associated with $result.
MDB_pgsql::freeResult()
Free the internal resources associated with $result.
MDB_mssql::freeResult()
Free the internal resources associated with $result.

Parameters:

$result   $result   —  result identifier

[ Top ]

getAll   [line 4241]

array getAll( string $query, [array $types = NULL], [array $params = array()], [array $param_types = NULL], [integer $fetchmode = MDB_FETCHMODE_DEFAULT])

Fetch all the rows returned from a query.
  • Return: an nested array, or a MDB error
  • Access: public

Parameters:

string   $query   —  the SQL query
array   $types   —  array that contains the types of the columns in the result set
array   $params   —  array if supplied, prepare/execute will be used with this array as execute parameters
array   $param_types   —  array that contains the types of the values defined in $params
integer   $fetchmode   —  the fetch mode to use

[ Top ]

getAssoc   [line 4191]

array getAssoc( string $query, [array $types = NULL], [array $params = array()], [array $param_types = NULL], [ $fetchmode = MDB_FETCHMODE_ORDERED], [boolean $force_array = FALSE], [boolean $group = FALSE])

Fetch the entire result set of a query and return it as an associative array using the first column as the key.

If the result set contains more than two columns, the value will be an array of the values from column 2-n. If the result set contains only two columns, the returned value will be a scalar with the value of the second column (unless forced to an array with the $force_array parameter). A MDB error code is returned on errors. If the result set contains fewer than two columns, a MDB_ERROR_TRUNCATED error is returned.

For example, if the table 'mytable' contains:

ID TEXT DATE --------------------------------

  1. 'one' 944679408
  2. 'two' 944679408
  3. 'three' 944679408
Then the call getAssoc('SELECT id,text FROM mytable') returns: array( '1' => 'one', '2' => 'two', '3' => 'three', )

...while the call getAssoc('SELECT id,text,date FROM mytable') returns: array( '1' => array('one', '944679408'), '2' => array('two', '944679408'), '3' => array('three', '944679408') )

If the more than one row occurs with the same value in the first column, the last row overwrites all previous ones by default. Use the $group parameter if you don't want to overwrite like this. Example:

getAssoc('SELECT category,id,name FROM mytable', NULL, NULL MDB_FETCHMODE_ASSOC, FALSE, TRUE) returns: array( '1' => array(array('id' => '4', 'name' => 'number four'), array('id' => '6', 'name' => 'number six') ), '9' => array(array('id' => '4', 'name' => 'number four'), array('id' => '6', 'name' => 'number six') ) )

Keep in mind that database functions in PHP usually return string values for results regardless of the database's internal type.

  • Return: associative array with results from the query.
  • Access: public

Parameters:

string   $query   —  the SQL query
array   $types   —  array that contains the types of the columns in the result set
array   $params   —  array if supplied, prepare/execute will be used with this array as execute parameters
array   $param_types   —  array that contains the types of the values defined in $params
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.
   $fetchmode   — 

[ Top ]

getBlobDeclaration   [line 3153]

string getBlobDeclaration( string $name, string $field)

Obtain DBMS specific SQL code portion needed to declare an binary large object type field to be used in statements like CREATE TABLE.
  • Return: DBMS specific SQL code portion that should be used to declare the specified field.
  • Access: public

Overridden in child classes as:

MDB_ibase::getBlobDeclaration()
Obtain DBMS specific SQL code portion needed to declare an binary large object type field to be used in statements like CREATE TABLE.
MDB_mysql::getBlobDeclaration()
Obtain DBMS specific SQL code portion needed to declare an binary large object type field to be used in statements like CREATE TABLE.
MDB_fbsql::getBlobDeclaration()
Obtain DBMS specific SQL code portion needed to declare an binary large object type field to be used in statements like CREATE TABLE.
MDB_oci8::getBlobDeclaration()
Obtain DBMS specific SQL code portion needed to declare an binary large object type field to be used in statements like CREATE TABLE.
MDB_pgsql::getBlobDeclaration()
Obtain DBMS specific SQL code portion needed to declare an binary large object type field to be used in statements like CREATE TABLE.
MDB_mssql::getBlobDeclaration()
Obtain DBMS specific SQL code portion needed to declare an binary large object type field to be used in statements like CREATE TABLE.

Parameters:

string   $name   —  name the field to be declared.
string   $field   — 

associative array with the name of the properties of the field being declared as array indexes. Currently, the types of supported field properties are as follows:

length Integer value that determines the maximum length of the large object field. If this argument is missing the field should be declared to have the longest length allowed by the DBMS.

notnull Boolean flag that indicates whether this field is constrained to not be set to NULL.


[ Top ]

getBlobValue   [line 3403]

string getBlobValue( resource $prepared_query, $parameter $parameter, $blob $blob)

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

Overridden in child classes as:

MDB_xxx::getBlobValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.
MDB_ibase::getBlobValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.
MDB_mysql::getBlobValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.
MDB_fbsql::getBlobValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.
MDB_oci8::getBlobValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.
MDB_pgsql::getBlobValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.
MDB_mssql::getBlobValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.

Parameters:

resource   $prepared_query   —  query handle from prepare()
$parameter   $parameter   — 
$blob   $blob   — 

[ Top ]

getBooleanDeclaration   [line 3180]

string getBooleanDeclaration( string $name, string $field)

Obtain DBMS specific SQL code portion needed to declare a boolean type field to be used in statements like CREATE TABLE.
  • Return: DBMS specific SQL code portion that should be used to declare the specified field.
  • Access: public

Overridden in child classes as:

MDB_fbsql::getBooleanDeclaration()
Obtain DBMS specific SQL code portion needed to declare a boolean type field to be used in statements like CREATE TABLE.
MDB_oci8::getBooleanDeclaration()
Obtain DBMS specific SQL code portion needed to declare a boolean type field to be used in statements like CREATE TABLE.
MDB_mssql::getBooleanDeclaration()
Obtain DBMS specific SQL code portion needed to declare a boolean type field to be used in statements like CREATE TABLE.

Parameters:

string   $name   —  name the field to be declared.
string   $field   — 

associative array with the name of the properties of the field being declared as array indexes. Currently, the types of supported field properties are as follows:

default Boolean value to be used as default for this field.

notnullL Boolean flag that indicates whether this field is constrained to not be set to NULL.


[ Top ]

getBooleanValue   [line 3436]

string getBooleanValue( string $value)

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

Overridden in child classes as:

MDB_fbsql::getBooleanValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.
MDB_mssql::getBooleanValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.

Parameters:

string   $value   —  text string value that is intended to be converted.

[ Top ]

getClobDeclaration   [line 3124]

string getClobDeclaration( string $name, string $field)

Obtain DBMS specific SQL code portion needed to declare an character large object type field to be used in statements like CREATE TABLE.
  • Return: DBMS specific SQL code portion that should be used to declare the specified field.
  • Access: public

Overridden in child classes as:

MDB_ibase::getClobDeclaration()
Obtain DBMS specific SQL code portion needed to declare an character large object type field to be used in statements like CREATE TABLE.
MDB_mysql::getClobDeclaration()
Obtain DBMS specific SQL code portion needed to declare an character large object type field to be used in statements like CREATE TABLE.
MDB_fbsql::getClobDeclaration()
Obtain DBMS specific SQL code portion needed to declare an character large object type field to be used in statements like CREATE TABLE.
MDB_oci8::getClobDeclaration()
Obtain DBMS specific SQL code portion needed to declare an character large object type field to be used in statements like CREATE TABLE.
MDB_pgsql::getClobDeclaration()
Obtain DBMS specific SQL code portion needed to declare an character large object type field to be used in statements like CREATE TABLE.
MDB_mssql::getClobDeclaration()
Obtain DBMS specific SQL code portion needed to declare an character large object type field to be used in statements like CREATE TABLE.

Parameters:

string   $name   —  name the field to be declared.
string   $field   — 

associative array with the name of the properties of the field being declared as array indexes. Currently, the types of supported field properties are as follows:

length Integer value that determines the maximum length of the large object field. If this argument is missing the field should be declared to have the longest length allowed by the DBMS.

notnull Boolean flag that indicates whether this field is constrained to not be set to NULL.


[ Top ]

getClobValue   [line 3368]

string getClobValue( resource $prepared_query, $parameter $parameter, $clob $clob)

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

Overridden in child classes as:

MDB_xxx::getClobValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.
MDB_ibase::getClobValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.
MDB_mysql::getClobValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.
MDB_fbsql::getClobValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.
MDB_oci8::getClobValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.
MDB_pgsql::getClobValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.
MDB_mssql::getClobValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.

Parameters:

resource   $prepared_query   —  query handle from prepare()
$parameter   $parameter   — 
$clob   $clob   — 

[ Top ]

getCol   [line 4083]

array getCol( string $query, [string $type = NULL], [array $params = array()], [array $param_types = NULL], [mixed $colnum = 0])

Fetch a single column from a result set and return it as an indexed array.
  • Return: an indexed array with the data from the first row at index 0, or a MDB error code.
  • Access: public

Parameters:

string   $query   —  the SQL query
string   $type   —  string that contains the type of the column in the result set
array   $params   —  array if supplied, prepare/execute will be used with this array as execute parameters
array   $param_types   —  array that contains the types of the values defined in $params
mixed   $colnum   —  which column to return(integer [column number, starting at 0] or string [column name])

[ Top ]

getColumnNames   [line 2529]

mixed getColumnNames( resource $result)

Retrieve the names of columns returned by the DBMS in a query result.
  • Return: associative array variable that holds the names of columns. The indexes of the array are the column names mapped to lower case and the values are the respective numbers of the columns starting from 0. Some DBMS may not return any columns when the result set does not contain any rows. a MDB error on failure
  • Access: public

Overridden in child classes as:

MDB_xxx::getColumnNames()
Retrieve the names of columns returned by the DBMS in a query result.
MDB_ibase::getColumnNames()
Retrieve the names of columns returned by the DBMS in a query result.
MDB_mysql::getColumnNames()
Retrieve the names of columns returned by the DBMS in a query result.
MDB_querysim::getColumnNames()
Retrieve the names of columns returned by the DBMS in a query result.
MDB_fbsql::getColumnNames()
Retrieve the names of columns returned by the DBMS in a query result.
MDB_oci8::getColumnNames()
Retrieve the names of columns returned by the DBMS in a query result.
MDB_pgsql::getColumnNames()
Retrieve the names of columns returned by the DBMS in a query result.
MDB_mssql::getColumnNames()
Retrieve the names of columns returned by the DBMS in a query result.

Parameters:

resource   $result   —  result identifier

[ Top ]

getDateDeclaration   [line 3207]

string getDateDeclaration( string $name, string $field)

Obtain DBMS specific SQL code portion needed to declare a date type field to be used in statements like CREATE TABLE.
  • Return: DBMS specific SQL code portion that should be used to declare the specified field.
  • Access: public

Overridden in child classes as:

MDB_ibase::getDateDeclaration()
Obtain DBMS specific SQL code portion needed to declare a date type field to be used in statements like CREATE TABLE.
MDB_mysql::getDateDeclaration()
Obtain DBMS specific SQL code portion needed to declare an date type field to be used in statements like CREATE TABLE.
MDB_fbsql::getDateDeclaration()
Obtain DBMS specific SQL code portion needed to declare an date type field to be used in statements like CREATE TABLE.
MDB_oci8::getDateDeclaration()
Obtain DBMS specific SQL code portion needed to declare a date type field to be used in statements like CREATE TABLE.
MDB_pgsql::getDateDeclaration()
Obtain DBMS specific SQL code portion needed to declare a date type field to be used in statements like CREATE TABLE.
MDB_mssql::getDateDeclaration()
Obtain DBMS specific SQL code portion needed to declare an date type field to be used in statements like CREATE TABLE.

Parameters:

string   $name   —  name the field to be declared.
string   $field   — 

associative array with the name of the properties of the field being declared as array indexes. Currently, the types of supported field properties are as follows:

default Date value to be used as default for this field.

notnull Boolean flag that indicates whether this field is constrained to not be set to NULL.


[ Top ]

getDateValue   [line 3453]

string getDateValue( string $value)

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

Overridden in child classes as:

MDB_fbsql::getDateValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.
MDB_oci8::getDateValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.

Parameters:

string   $value   —  text string value that is intended to be converted.

[ Top ]

getDecimalDeclaration   [line 3315]

string getDecimalDeclaration( string $name, string $field)

Obtain DBMS specific SQL code portion needed to declare a decimal type field to be used in statements like CREATE TABLE.
  • Return: DBMS specific SQL code portion that should be used to declare the specified field.
  • Access: public

Overridden in child classes as:

MDB_ibase::getDecimalDeclaration()
Obtain DBMS specific SQL code portion needed to declare a decimal type field to be used in statements like CREATE TABLE.
MDB_mysql::getDecimalDeclaration()
Obtain DBMS specific SQL code portion needed to declare an decimal type field to be used in statements like CREATE TABLE.
MDB_fbsql::getDecimalDeclaration()
Obtain DBMS specific SQL code portion needed to declare an decimal type field to be used in statements like CREATE TABLE.
MDB_oci8::getDecimalDeclaration()
Obtain DBMS specific SQL code portion needed to declare a decimal type field to be used in statements like CREATE TABLE.
MDB_pgsql::getDecimalDeclaration()
Obtain DBMS specific SQL code portion needed to declare a decimal type field to be used in statements like CREATE TABLE.
MDB_mssql::getDecimalDeclaration()
Obtain DBMS specific SQL code portion needed to declare an decimal type field to be used in statements like CREATE TABLE.

Parameters:

string   $name   —  name the field to be declared.
string   $field   — 

associative array with the name of the properties of the field being declared as array indexes. Currently, the types of supported field properties are as follows:

default Decimal value to be used as default for this field.

notnull Boolean flag that indicates whether this field is constrained to not be set to NULL.


[ Top ]

getDecimalValue   [line 3521]

string getDecimalValue( string $value)

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

Overridden in child classes as:

MDB_ibase::getDecimalValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.
MDB_mysql::getDecimalValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.
MDB_fbsql::getDecimalValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.
MDB_oci8::getDecimalValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.
MDB_pgsql::getDecimalValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.
MDB_mssql::getDecimalValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.

Parameters:

string   $value   —  text string value that is intended to be converted.

[ Top ]

getDSN   [line 925]

mixed getDSN( [string $type = 'string'])

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

Parameters:

string   $type   —  type to return

[ Top ]

getFieldDeclaration   [line 1299]

mixed getFieldDeclaration( string $field_name, string $field)

get declaration of a field
  • Return: string on success, a MDB error on failure
  • Access: public

Parameters:

string   $field_name   —  name of the field to be created
string   $field   — 

associative array with the name of the properties of the field being declared as array indexes. Currently, the types of supported field properties are as follows:

default Boolean value to be used as default for this field.

notnull Boolean flag that indicates whether this field is constrained to not be set to NULL.


[ Top ]

getFieldDeclarationList   [line 1336]

mixed getFieldDeclarationList( string $fields)

get declaration of a number of field in bulk
  • Return: string on success, a MDB error on failure
  • Access: public

Parameters:

string   $fields   — 

a multidimensional associative array. The first dimension determines the field name, while the second dimension is keyed with the name of the properties of the field being declared as array indexes. Currently, the types of supported field properties are as follows:

default Boolean value to be used as default for this field.

notnull Boolean flag that indicates whether this field is constrained to not be set to NULL.

default Boolean value to be used as default for this field.

notnull Boolean flag that indicates whether this field is constrained to not be set to NULL.


[ Top ]

getFloatDeclaration   [line 3288]

string getFloatDeclaration( string $name, string $field)

Obtain DBMS specific SQL code portion needed to declare a float type field to be used in statements like CREATE TABLE.
  • Return: DBMS specific SQL code portion that should be used to declare the specified field.
  • Access: public

Overridden in child classes as:

MDB_ibase::getFloatDeclaration()
Obtain DBMS specific SQL code portion needed to declare a float type field to be used in statements like CREATE TABLE.
MDB_mysql::getFloatDeclaration()
Obtain DBMS specific SQL code portion needed to declare an float type field to be used in statements like CREATE TABLE.
MDB_fbsql::getFloatDeclaration()
Obtain DBMS specific SQL code portion needed to declare an float type field to be used in statements like CREATE TABLE.
MDB_oci8::getFloatDeclaration()
Obtain DBMS specific SQL code portion needed to declare a float type field to be used in statements like CREATE TABLE.
MDB_pgsql::getFloatDeclaration()
Obtain DBMS specific SQL code portion needed to declare a float type field to be used in statements like CREATE TABLE.
MDB_mssql::getFloatDeclaration()
Obtain DBMS specific SQL code portion needed to declare an float type field to be used in statements like CREATE TABLE.

Parameters:

string   $name   —  name the field to be declared.
string   $field   — 

associative array with the name of the properties of the field being declared as array indexes. Currently, the types of supported field properties are as follows:

default Float value to be used as default for this field.

notnull Boolean flag that indicates whether this field is constrained to not be set to NULL.


[ Top ]

getFloatValue   [line 3504]

string getFloatValue( string $value)

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

Overridden in child classes as:

MDB_ibase::getFloatValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.
MDB_mysql::getFloatValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.
MDB_fbsql::getFloatValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.
MDB_oci8::getFloatValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.
MDB_pgsql::getFloatValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.
MDB_mssql::getFloatValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.

Parameters:

string   $value   —  text string value that is intended to be converted.

[ Top ]

getIntegerDeclaration   [line 3059]

string getIntegerDeclaration( string $name, string $field)

Obtain DBMS specific SQL code portion needed to declare an integer type field to be used in statements like CREATE TABLE.
  • Return: DBMS specific SQL code portion that should be used to declare the specified field.
  • Access: public

Overridden in child classes as:

MDB_mysql::getIntegerDeclaration()
Obtain DBMS specific SQL code portion needed to declare an integer type field to be used in statements like CREATE TABLE.
MDB_fbsql::getIntegerDeclaration()
Obtain DBMS specific SQL code portion needed to declare an integer type field to be used in statements like CREATE TABLE.
MDB_oci8::getIntegerDeclaration()
Obtain DBMS specific SQL code portion needed to declare an integer type field to be used in statements like CREATE TABLE.
MDB_mssql::getIntegerDeclaration()
Obtain DBMS specific SQL code portion needed to declare an integer type field to be used in statements like CREATE TABLE.

Parameters:

string   $name   —  name the field to be declared.
string   $field   — 

associative array with the name of the properties of the field being declared as array indexes. Currently, the types of supported field properties are as follows:

unsigned Boolean flag that indicates whether the field should be declared as unsigned integer if possible.

default Integer value to be used as default for this field.

notnull Boolean flag that indicates whether this field is constrained to not be set to NULL.


[ Top ]

getIntegerValue   [line 3332]

string getIntegerValue( string $value)

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.

[ Top ]

getOne   [line 3977]

mixed getOne( string $query, [string $type = NULL], [array $params = array()], [array $param_types = NULL])

Fetch the first column of the first row of data returned from a query. Takes care of doing the query and freeing the results when finished.
  • Return: MDB_Error or the returned value of the query
  • Access: public

Parameters:

string   $query   —  the SQL query
string   $type   —  string that contains the type of the column in the result set
array   $params   —  if supplied, prepare/execute will be used with this array as execute parameters
array   $param_types   —  array that contains the types of the values defined in $params

[ Top ]

getOption   [line 491]

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 ]

getRow   [line 4031]

array getRow( string $query, [array $types = NULL], [array $params = array()], [array $param_types = NULL], [integer $fetchmode = MDB_FETCHMODE_DEFAULT])

Fetch the first row of data returned from a query. Takes care of doing the query and freeing the results when finished.
  • Return: the first row of results as an array indexed from 0, or a MDB error code.
  • Access: public

Parameters:

string   $query   —  the SQL query
array   $types   —  array that contains the types of the columns in the result set
array   $params   —  array if supplied, prepare/execute will be used with this array as execute parameters
array   $param_types   —  array that contains the types of the values defined in $params
integer   $fetchmode   —  the fetch mode to use

[ Top ]

getSequenceDefinition   [line 1534]

mixed getSequenceDefinition( string $sequence)

get the stucture of a sequence into an array
  • Return: data array on success, a MDB error on failure
  • Access: public

Parameters:

string   $sequence   —  name of sequence that should be used in method

[ Top ]

getSequenceName   [line 3577]

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 ]

getTableFieldDefinition   [line 1270]

mixed getTableFieldDefinition( string $table, $field, string $fields)

get the stucture of a field into an array
  • Return: data array on success, a MDB error on failure
  • Access: public

Parameters:

string   $table   —  name of table that should be used in method
string   $fields   —  name of field that should be used in method
   $field   — 

[ Top ]

getTableIndexDefinition   [line 1458]

mixed getTableIndexDefinition( string $table, string $index)

get the stucture of an index into an array
  • Return: data array on success, a MDB error on failure
  • Access: public

Parameters:

string   $table   —  name of table that should be used in method
string   $index   —  name of index that should be used in method

[ Top ]

getTextDeclaration   [line 3095]

string getTextDeclaration( string $name, string $field)

Obtain DBMS specific SQL code portion needed to declare an text type field to be used in statements like CREATE TABLE.
  • Return: DBMS specific SQL code portion that should be used to declare the specified field.
  • Access: public

Overridden in child classes as:

MDB_ibase::getTextDeclaration()
Obtain DBMS specific SQL code portion needed to declare an text type field to be used in statements like CREATE TABLE.
MDB_fbsql::getTextDeclaration()
Obtain DBMS specific SQL code portion needed to declare an text type field to be used in statements like CREATE TABLE.
MDB_oci8::getTextDeclaration()
Obtain DBMS specific SQL code portion needed to declare an text type field to be used in statements like CREATE TABLE.
MDB_pgsql::getTextDeclaration()
Obtain DBMS specific SQL code portion needed to declare an text type field to be used in statements like CREATE TABLE.
MDB_mssql::getTextDeclaration()
Obtain DBMS specific SQL code portion needed to declare an text type field to be used in statements like CREATE TABLE.

Parameters:

string   $name   —  name the field to be declared.
string   $field   — 

associative array with the name of the properties of the field being declared as array indexes. Currently, the types of supported field properties are as follows:

length Integer value that determines the maximum length of the text field. If this argument is missing the field should be declared to have the longest length allowed by the DBMS.

default Text value to be used as default for this field.

notnull Boolean flag that indicates whether this field is constrained to not be set to NULL.


[ Top ]

getTextValue   [line 3349]

string getTextValue( string $value)

Convert a text value into a DBMS specific format that is suitable to compose query statements.
  • Return: text string that already contains any DBMS specific escaped character sequences.
  • Access: public

Parameters:

string   $value   —  text string value that is intended to be converted.

[ Top ]

getTimeDeclaration   [line 3261]

string getTimeDeclaration( string $name, string $field)

Obtain DBMS specific SQL code portion needed to declare a time field to be used in statements like CREATE TABLE.
  • Return: DBMS specific SQL code portion that should be used to declare the specified field.
  • Access: public

Overridden in child classes as:

MDB_ibase::getTimeDeclaration()
Obtain DBMS specific SQL code portion needed to declare a time field to be used in statements like CREATE TABLE.
MDB_mysql::getTimeDeclaration()
Obtain DBMS specific SQL code portion needed to declare an time type field to be used in statements like CREATE TABLE.
MDB_fbsql::getTimeDeclaration()
Obtain DBMS specific SQL code portion needed to declare an time type field to be used in statements like CREATE TABLE.
MDB_oci8::getTimeDeclaration()
Obtain DBMS specific SQL code portion needed to declare a time field to be used in statements like CREATE TABLE.
MDB_pgsql::getTimeDeclaration()
Obtain DBMS specific SQL code portion needed to declare a time field to be used in statements like CREATE TABLE.
MDB_mssql::getTimeDeclaration()
Obtain DBMS specific SQL code portion needed to declare an time type field to be used in statements like CREATE TABLE.

Parameters:

string   $name   —  name the field to be declared.
string   $field   — 

associative array with the name of the properties of the field being declared as array indexes. Currently, the types of supported field properties are as follows:

default Time value to be used as default for this field.

notnull Boolean flag that indicates whether this field is constrained to not be set to NULL.


[ Top ]

getTimestampDeclaration   [line 3234]

string getTimestampDeclaration( string $name, string $field)

Obtain DBMS specific SQL code portion needed to declare a timestamp field to be used in statements like CREATE TABLE.
  • Return: DBMS specific SQL code portion that should be used to declare the specified field.
  • Access: public

Overridden in child classes as:

MDB_mysql::getTimestampDeclaration()
Obtain DBMS specific SQL code portion needed to declare an timestamp type field to be used in statements like CREATE TABLE.
MDB_fbsql::getTimestampDeclaration()
Obtain DBMS specific SQL code portion needed to declare an timestamp type field to be used in statements like CREATE TABLE.
MDB_oci8::getTimestampDeclaration()
Obtain DBMS specific SQL code portion needed to declare a timestamp field to be used in statements like CREATE TABLE.
MDB_mssql::getTimestampDeclaration()
Obtain DBMS specific SQL code portion needed to declare an timestamp type field to be used in statements like CREATE TABLE.

Parameters:

string   $name   —  name the field to be declared.
string   $field   — 

associative array with the name of the properties of the field being declared as array indexes. Currently, the types of supported field properties are as follows:

default Timestamp value to be used as default for this field.

notnull Boolean flag that indicates whether this field is constrained to not be set to NULL.


[ Top ]

getTimestampValue   [line 3470]

string getTimestampValue( string $value)

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

Overridden in child classes as:

MDB_fbsql::getTimestampValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.
MDB_oci8::getTimestampValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.

Parameters:

string   $value   —  text string value that is intended to be converted.

[ Top ]

getTimeValue   [line 3487]

string getTimeValue( string $value)

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

Overridden in child classes as:

MDB_fbsql::getTimeValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.
MDB_oci8::getTimeValue()
Convert a text value into a DBMS specific format that is suitable to compose query statements.

Parameters:

string   $value   —  text string value that is intended to be converted.

[ Top ]

getValue   [line 3539]

string getValue( string $type, string $value)

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   $type   —  type to which the value should be converted to
string   $value   —  text string value that is intended to be converted.

[ Top ]

getWarnings   [line 456]

array getWarnings( )

get all warnings in reverse order.

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


[ Top ]

limitQuery   [line 1607]

mixed limitQuery( string $query, [mixed $types = NULL], integer $from, integer $count)

Generates a limited query
  • Return: a valid ressource pointer or a MDB_Error
  • Access: public

Parameters:

string   $query   —  query
mixed   $types   —  array that contains the types of the columns in the result set
integer   $from   —  the row to start to fetching
integer   $count   —  the numbers of rows to fetch

[ Top ]

listDatabases   [line 1159]

mixed listDatabases( )

list all databases
  • Return: data array on success, a MDB error on failure
  • Access: public

[ Top ]

listFunctions   [line 1213]

mixed listFunctions( )

list all functions in the current database
  • Return: data array on success, a MDB error on failure
  • Access: public

[ Top ]

listSequences   [line 1515]

mixed listSequences( )

list all tables in the current database
  • Return: data array on success, a MDB error on failure
  • Access: public

[ Top ]

listTableFields   [line 1250]

mixed listTableFields( string $table)

list all fields in a tables in the current database
  • Return: data array on success, a MDB error on failure
  • Access: public

Parameters:

string   $table   —  name of table that should be used in method

[ Top ]

listTableIndexes   [line 1438]

mixed listTableIndexes( string $table)

list all indexes in a table
  • Return: data array on success, a MDB error on failure
  • Access: public

Parameters:

string   $table   —  name of table that should be used in method

[ Top ]

listTables   [line 1231]

mixed listTables( )

list all tables in the current database
  • Return: data array on success, a MDB error on failure
  • Access: public

[ Top ]

listUsers   [line 1177]

mixed listUsers( )

list all users
  • Return: data array on success, a MDB error on failure
  • Access: public

[ Top ]

listViews   [line 1195]

mixed listViews( )

list all viewes in the current database
  • Return: data array on success, a MDB error on failure
  • Access: public

[ Top ]

loadLob   [line 733]

void loadLob( [string $scope = ''])

loads the LOB module
  • Access: public

Parameters:

string   $scope   —  information about what method is being loaded, that is used for error messages

[ Top ]

loadManager   [line 756]

void loadManager( [string $scope = ''])

loads the Manager module
  • Access: public

Parameters:

string   $scope   —  information about what method is being loaded, that is used for error messages

[ Top ]

nextId   [line 3596]

mixed nextId( string $seq_name, [boolean $ondemand = FALSE])

returns the next free id of a sequence
  • Return: MDB_Error or id
  • Access: public

Overridden in child classes as:

MDB_xxx::nextId()
returns the next free id of a sequence
MDB_ibase::nextId()
returns the next free id of a sequence
MDB_mysql::nextId()
returns the next free id of a sequence
MDB_fbsql::nextId()
returns the next free id of a sequence
MDB_oci8::nextId()
returns the next free id of a sequence
MDB_pgsql::nextId()
returns the next free id of a sequence
MDB_mssql::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 ]

numCols   [line 2546]

mixed numCols( resource $result)

Count the number of columns returned by the DBMS in a query result.
  • Return: integer value with the number of columns, a MDB error on failure
  • Access: public

Overridden in child classes as:

MDB_xxx::numCols()
Count the number of columns returned by the DBMS in a query result.
MDB_ibase::numCols()
Count the number of columns returned by the DBMS in a query result.
MDB_mysql::numCols()
Count the number of columns returned by the DBMS in a query result.
MDB_querysim::numCols()
Count the number of columns returned by the DBMS in a query result.
MDB_fbsql::numCols()
Count the number of columns returned by the DBMS in a query result.
MDB_oci8::numCols()
Count the number of columns returned by the DBMS in a query result.
MDB_pgsql::numCols()
Count the number of columns returned by the DBMS in a query result.
MDB_mssql::numCols()
Count the number of columns returned by the DBMS in a query result.

Parameters:

resource   $result   —  result identifier

[ Top ]

numRows   [line 3013]

mixed numRows( ressource $result)

returns the number of rows in a result object
  • Return: MDB_Error or the number of rows
  • Access: public

Overridden in child classes as:

MDB_xxx::numRows()
returns the number of rows in a result object
MDB_ibase::numRows()
returns the number of rows in a result object
MDB_mysql::numRows()
returns the number of rows in a result object
MDB_querysim::numRows()
returns the number of rows in a result object
MDB_fbsql::numRows()
returns the number of rows in a result object
MDB_oci8::numRows()
returns the number of rows in a result object
MDB_pgsql::numRows()
returns the number of rows in a result object
MDB_mssql::numRows()
returns the number of rows in a result object

Parameters:

ressource   $result   —  a valid result ressouce pointer

[ Top ]

prepareQuery   [line 1815]

mixed prepareQuery( $query, string $)

Prepares a query for multiple execution with execute().

With some database backends, this is emulated. prepareQuery() requires a generic query as string like 'INSERT INTO numbers VALUES(?,?,?)'. The ? are wildcards. Types of wildcards: ? - a quoted scalar value, i.e. strings, integers

  • Return: resource handle for the prepared query on success, a DB error on failure
  • See: MDB_Common::execute()
  • Access: public

Parameters:

string   $   —  the query to prepare
   $query   — 

[ Top ]

query   [line 1555]

mixed query( string $query, [mixed $types = NULL])

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

Overridden in child classes as:

MDB_xxx::query()
Send a query to the database and return any results
MDB_ibase::query()
Send a query to the database and return any results
MDB_mysql::query()
Send a query to the database and return any results
MDB_querysim::query()
Get QuerySim text from appropriate source and return the parsed text.
MDB_fbsql::query()
Send a query to the database and return any results
MDB_oci8::query()
Send a query to the database and return any results
MDB_pgsql::query()
Send a query to the database and return any results
MDB_mssql::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

[ Top ]

queryAll   [line 3950]

mixed queryAll( string $query, [array $types = NULL], [int $fetchmode = MDB_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: data array on success, a MDB 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 3913]

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: data array on success, a MDB 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 3859]

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: field value on success, a MDB 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 3888]

mixed queryRow( string $query, [array $types = NULL], [int $fetchmode = MDB_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: data array on success, a MDB 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 ]

quoteIdentifier   [line 685]

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:

MDB_mysql::quoteIdentifier()
Quote a string so it can be safely used as a table or column name
MDB_mssql::quoteIdentifier()
Quote a string so it can be safely used as a table / column name

Parameters:

string   $str   —  identifier name to be quoted

[ Top ]

raiseError   [line 391]

object a &raiseError( [mixed $code = MDB_ERROR], [int $mode = NULL], [mixed $options = NULL], [string $userinfo = NULL], [mixed $nativecode = 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
  • Access: public

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.
mixed   $nativecode   —  Native error code, integer or string depending the backend.

[ Top ]

readLob   [line 4494]

mixed readLob( integer $lob, &$data, integer $length, string $data)

Read data from large object input stream.
  • Return: the effective number of bytes read from the large object input stream on sucess or an MDB error object.
  • See: MDB_Common::endOfLob()
  • Access: public

Parameters:

integer   $lob   —  argument handle that is returned by the MDB::createLob() method.
string   $data   —  reference to a variable that will hold data to be read from the large object input stream
integer   $length   —  value that indicates the largest ammount ofdata to be read from the large object input stream.
   &$data   — 

[ Top ]

replace   [line 1704]

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: MDB_OK on success, a MDB error on failure
  • Access: public

Overridden in child classes as:

MDB_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.
MDB_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.

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 440]

void resetWarnings( )

reset the warning array
  • Access: public

[ Top ]

resultIsNull   [line 2781]

mixed resultIsNull( resource $result, int $row, int $field)

Determine whether the value of a query result located in given row and field is a NULL.
  • Return: TRUE or FALSE on success, a MDB error on failure
  • Access: public

Overridden in child classes as:

MDB_xxx::resultIsNull()
Determine whether the value of a query result located in given row and field is a NULL.
MDB_ibase::resultIsNull()
Determine whether the value of a query result located in given row and field is a NULL.
MDB_oci8::resultIsNull()
Determine whether the value of a query result located in given row and field is a NULL.
MDB_pgsql::resultIsNull()
Determine whether the value of a query result located in given row and field is a NULL.

Parameters:

resource   $result   —  result identifier
int   $row   —  number of the row where the data can be found
int   $field   —  field number where the data can be found

[ Top ]

rollback   [line 829]

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: MDB_OK on success, a MDB error on failure
  • Access: public

Overridden in child classes as:

MDB_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.
MDB_ibase::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.
MDB_mysql::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.
MDB_fbsql::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.
MDB_oci8::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.
MDB_pgsql::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.
MDB_mssql::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 877]

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 894]

MDB_OK setDSN( $dsn, mixed $dsninfo)

set the DSN
  • Access: public

Parameters:

mixed   $dsninfo   —  DSN string or array
   $dsn   — 

[ Top ]

setErrorHandler   [line 603]

string setErrorHandler( string $function)

Specify a function that is called when an error occurs.
  • Return: name of last function
  • Access: public

Parameters:

string   $function   — 

Name of the function that will be called on error. If an empty string is specified, no handler function is called on error. The error handler function receives two arguments. The first argument a reference to the driver class object that triggered the error.

The second argument is a reference to an associative array that provides details about the error that occured. These details provide more information than it is returned by the MetabaseError function.

These are the currently supported error detail entries:

Scope String that indicates the scope of the driver object class within which the error occured.

Message Error message as is returned by the MetabaseError function.


[ Top ]

setFetchMode   [line 2582]

void setFetchMode( integer $fetchmode)

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

Parameters:

integer   $fetchmode   —  MDB_FETCHMODE_ORDERED or MDB_FETCHMODE_ASSOC, possibly bit-wise OR'ed with MDB_FETCHMODE_FLIPPED.

[ Top ]

setOption   [line 472]

mixed setOption( string $option, mixed $value)

set the option for the db class
  • Return: MDB_OK or MDB_Error
  • Access: public

Overridden in child classes as:

MDB_querysim::setOption()
Set the option for the MDB class

Parameters:

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

[ Top ]

setParam   [line 2098]

mixed setParam( int $prepared_query, int $parameter, string $type, mixed $value, [boolean $is_null = 0], [string $field = ''])

Set the value of a parameter of a prepared query.
  • Return: MDB_OK on success, a MDB error on failure
  • Access: public

Parameters:

int   $prepared_query   —  argument is a handle that was returned by the function prepareQuery()
int   $parameter   —  the order number of the parameter in the query statement. The order number of the first parameter is 1.
string   $type   —  designation of the type of the parameter to be set. The designation of the currently supported types is as follows: text, boolean, integer, decimal, float, date, time, timestamp, clob, blob
mixed   $value   —  value that is meant to be assigned to specified parameter. The type of the value depends on the $type argument.
boolean   $is_null   —  flag that indicates whether whether the parameter is a NULL
string   $field   —  name of the field that is meant to be assigned with this parameter value when it is of type clob or blob

[ Top ]

setParamArray   [line 2132]

mixed setParamArray( int $prepared_query, array $params, [array $types = NULL])

Set the values of multiple a parameter of a prepared query in bulk.

Parameters:

int   $prepared_query   —  argument is a handle that was returned by the function prepareQuery()
array   $params   —  array thats specifies all necessary infromation for setParam() the array elements must use keys corresponding to the number of the position of the parameter.
array   $types   —  array thats specifies the types of the fields

[ Top ]

setParamBlob   [line 2280]

mixed setParamBlob( int $prepared_query, int $parameter, int $value, string $field)

Set a parameter of a prepared query with a binary large object value.

Parameters:

int   $prepared_query   —  argument is a handle that was returned by the function prepareQuery()
int   $parameter   —  order number of the parameter in the query statement. The order number of the first parameter is 1.
int   $value   —  handle of large object created with createLOB() function from which it will be read the data value that is meant to be assigned to specified parameter.
string   $field   —  name of the field of a INSERT or UPDATE query to which it will be assigned the value to specified parameter.

[ Top ]

setParamBoolean   [line 2322]

mixed setParamBoolean( int $prepared_query, int $parameter, boolean $value)

Set a parameter of a prepared query with a boolean value.

Parameters:

int   $prepared_query   —  argument is a handle that was returned by the function prepareQuery()
int   $parameter   —  order number of the parameter in the query statement. The order number of the first parameter is 1.
boolean   $value   —  boolean value that is meant to be assigned to specified parameter.

[ Top ]

setParamClob   [line 2256]

mixed setParamClob( int $prepared_query, int $parameter, int $value, string $field)

Set a parameter of a prepared query with a character large object value.

Parameters:

int   $prepared_query   —  argument is a handle that was returned by the function prepareQuery()
int   $parameter   —  order number of the parameter in the query statement. The order number of the first parameter is 1.
int   $value   —  handle of large object created with createLOB() function from which it will be read the data value that is meant to be assigned to specified parameter.
string   $field   —  name of the field of a INSERT or UPDATE query to which it will be assigned the value to specified parameter.

[ Top ]

setParamDate   [line 2343]

mixed setParamDate( int $prepared_query, int $parameter, string $value)

Set a parameter of a prepared query with a date value.

Parameters:

int   $prepared_query   —  argument is a handle that was returned by the function prepareQuery()
int   $parameter   —  order number of the parameter in the query statement. The order number of the first parameter is 1.
string   $value   —  date value that is meant to be assigned to specified parameter.

[ Top ]

setParamDecimal   [line 2427]

mixed setParamDecimal( int $prepared_query, int $parameter, string $value)

Set a parameter of a prepared query with a decimal value.

Parameters:

int   $prepared_query   —  argument is a handle that was returned by the function prepareQuery()
int   $parameter   —  order number of the parameter in the query statement. The order number of the first parameter is 1.
string   $value   —  decimal value that is meant to be assigned to specified parameter.

[ Top ]

setParamFloat   [line 2406]

mixed setParamFloat( int $prepared_query, int $parameter, string $value)

Set a parameter of a prepared query with a float value.

Parameters:

int   $prepared_query   —  argument is a handle that was returned by the function prepareQuery()
int   $parameter   —  order number of the parameter in the query statement. The order number of the first parameter is 1.
string   $value   —  float value that is meant to be assigned to specified parameter.

[ Top ]

setParamInteger   [line 2301]

mixed setParamInteger( int $prepared_query, int $parameter, int $value)

Set a parameter of a prepared query with a text value.

Parameters:

int   $prepared_query   —  argument is a handle that was returned by the function prepareQuery()
int   $parameter   —  order number of the parameter in the query statement. The order number of the first parameter is 1.
int   $value   —  an integer value that is meant to be assigned to specified parameter.

[ Top ]

setParamNull   [line 2211]

mixed setParamNull( int $prepared_query, int $parameter, string $type)

Set the value of a parameter of a prepared query to NULL.

Parameters:

int   $prepared_query   —  argument is a handle that was returned by the function prepareQuery()
int   $parameter   —  order number of the parameter in the query statement. The order number of the first parameter is 1.
string   $type   —  designation of the type of the parameter to be set. The designation of the currently supported types is list in the usage of the function setParam()

[ Top ]

setParamText   [line 2232]

mixed setParamText( int $prepared_query, int $parameter, string $value)

Set a parameter of a prepared query with a text value.

Parameters:

int   $prepared_query   —  argument is a handle that was returned by the function prepareQuery()
int   $parameter   —  order number of the parameter in the query statement. The order number of the first parameter is 1.
string   $value   —  text value that is meant to be assigned to specified parameter.

[ Top ]

setParamTime   [line 2385]

mixed setParamTime( int $prepared_query, int $parameter, string $value)

Set a parameter of a prepared query with a time value.

Parameters:

int   $prepared_query   —  argument is a handle that was returned by the function prepareQuery()
int   $parameter   —  order number of the parameter in the query statement. The order number of the first parameter is 1.
string   $value   —  time value that is meant to be assigned to specified parameter.

[ Top ]

setParamTimestamp   [line 2364]

mixed setParamTimestamp( int $prepared_query, int $parameter, string $value)

Set a parameter of a prepared query with a time stamp value.

Parameters:

int   $prepared_query   —  argument is a handle that was returned by the function prepareQuery()
int   $parameter   —  order number of the parameter in the query statement. The order number of the first parameter is 1.
string   $value   —  time stamp value that is meant to be assigned to specified parameter.

[ Top ]

setResultTypes   [line 2455]

mixed setResultTypes( resource $result, string $types)

Define the list of types to be associated with the columns of a given result set.

This function may be called before invoking fetchInto(), fetchOne(), fetchRow(), fetchCol() and fetchAll() so that the necessary data type conversions are performed on the data to be retrieved by them. If this function is not called, the type of all result set columns is assumed to be text, thus leading to not perform any conversions.

  • Return: MDB_OK on success, a MDB error on failure
  • Access: public

Parameters:

resource   $result   —  result identifier
string   $types   —  array variable that lists the data types to be expected in the result set columns. If this array contains less types than the number of columns that are returned in the result set, the remaining columns are assumed to be of the type text. Currently, the types clob and blob are not fully supported.

[ Top ]

setSelectedRowRange   [line 1572]

mixed setSelectedRowRange( string $first, string $limit)

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

Parameters:

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

[ Top ]

subSelect   [line 1632]

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

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

Overridden in child classes as:

MDB_xxx::subSelect()
simple subselect emulation for Mysql
MDB_mysql::subSelect()
simple subselect emulation for Mysql

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 ]

support   [line 3562]

boolean support( 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 MDB class doc)

[ Top ]

tableInfo   [line 4284]

array tableInfo( resource $result, [mixed $mode = NULL])

returns meta data about the result set
  • Return: an nested array, or a MDB error
  • Access: public

Overridden in child classes as:

MDB_xxx::tableInfo()
returns meta data about the result set
MDB_ibase::tableInfo()
returns meta data about the result set
MDB_mysql::tableInfo()
returns meta data about the result set
MDB_fbsql::tableInfo()
returns meta data about the result set
MDB_oci8::tableInfo()
returns meta data about the result set
MDB_pgsql::tableInfo()
returns meta data about the result set
MDB_mssql::tableInfo()
Returns information about a table or a result set

Parameters:

resource   $result   —  result identifier
mixed   $mode   —  depends on implementation

[ Top ]

__toString   [line 317]

string __toString( )

String conversation
  • Access: public

[ Top ]


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