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

Class: MDB2_Driver_Common

Source Location: /MDB2-2.5.0b5/MDB2.php

Class Overview


MDB2_Driver_Common: Base class that is extended by each MDB2 driver


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

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


[ Top ]


Class Variables

$as_keyword =  ' AS '

[line 1253]

column alias keyword
  • Access: public

Type:   string


[ Top ]

$connected_database_name =  ''

[line 1076]

the name of the database currently selected
  • Access: public

Type:   string


[ Top ]

$connected_dsn = array()

[line 1048]

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

Type:   array


[ Top ]

$connected_server_info =  ''

[line 1083]

server version information
  • Access: public

Type:   string


[ Top ]

$connection =  0

[line 1055]

connection resource
  • Access: public

Type:   mixed


[ Top ]

$database_name =  ''

[line 1069]

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

Type:   string


[ Top ]

$datatype =

[line 1002]

  • Access: public



[ Top ]

$dbsyntax =

[line 1316]

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

Type:   string


[ Top ]

$db_index =  0

[line 1034]

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

Type:   int


[ Top ]

$debug_output =  ''

[line 1267]

string with the debugging information
  • Access: public

Type:   string


[ Top ]

$destructor_registered =  true

[line 1344]

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

Type:   array


[ Top ]

$dsn = array()

[line 1041]

DSN used for the next query
  • Access: public

Type:   array


[ Top ]

$extended =

[line 1007]

  • Access: public

Type:   MDB2_Extended


[ Top ]

$fetchmode =  MDB2_FETCHMODE_ORDERED

[line 1330]

the default fetchmode used
  • Access: public

Type:   int


[ Top ]

$function =

[line 1012]

  • Access: public



[ Top ]

$has_transaction_error =  false

[line 1288]

the first error that occured inside a nested transaction
  • Access: protected

Type:   MDB2_Error|bool


[ Top ]

$identifier_quoting = array(
        'start'  => '"',
        'end'    => '"',
        'escape' => '"',
    )

[line 1225]

identifier quoting
  • Access: public

Type:   array


[ Top ]

$in_transaction =  false

[line 1274]

determine if there is an open transaction
  • Access: public

Type:   bool


[ Top ]

$last_query =

[line 1323]

the last query sent to the driver
  • Access: public

Type:   string


[ Top ]

$limit =  0

[line 1302]

result limit used in the next query
  • Access: public

Type:   int


[ Top ]

$manager =

[line 1017]

  • Access: public



[ Top ]

$modules = array()

[line 1337]

array of module instances
  • Access: protected

Type:   array


[ Top ]

$native =

[line 1022]

  • Access: public

Type:   MDB2_Driver_Native_Commonn


[ Top ]

$nested_transaction_counter =  null

[line 1281]

the smart transaction nesting depth
  • Access: public

Type:   int


[ Top ]

$offset =  0

[line 1295]

result offset used in the next query
  • Access: public

Type:   int


[ Top ]

$opened_persistent =

[line 1062]

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

Type:   bool


[ Top ]

$options = array(
        'ssl' => false,
        'field_case' => CASE_LOWER,
        'disable_query' => false,
        'result_class' => 'MDB2_Result_%s',
        'buffered_result_class' => 'MDB2_BufferedResult_%s',
        'result_wrap_class' => false,
        'result_buffering' => true,
        'fetch_class' => 'stdClass',
        'persistent' => false,
        'debug' => 0,
        'debug_handler' => 'MDB2_defaultDebugOutput',
        'debug_expanded_output' => false,
        'default_text_field_length' => 4096,
        'lob_buffer_length' => 8192,
        'log_line_break' => "\n",
        'idxname_format' => '%s_idx',
        'seqname_format' => '%s_seq',
        'savepoint_format' => 'MDB2_SAVEPOINT_%s',
        'statement_format' => 'MDB2_STATEMENT_%1$s_%2$s',
        'seqcol_name' => 'sequence',
        'quote_identifier' => false,
        'use_transactions' => true,
        'decimal_places' => 2,
        'portability' => MDB2_PORTABILITY_ALL,
        'modules' => array(
            'ex' => 'Extended',
            'dt' => 'Datatype',
            'mg' => 'Manager',
            'rv' => 'Reverse',
            'na' => 'Native',
            'fc' => 'Function',
        ),'emulate_prepared'=>false,'datatype_map'=>array(),'datatype_map_callback'=>array(),'nativetype_map_callback'=>array(),'lob_allow_url_include'=>false,'bindname_format'=>'(?:\d+)|(?:[a-zA-Z][a-zA-Z0-9_]*)','max_identifiers_length'=>30,'default_fk_action_onupdate'=>'RESTRICT','default_fk_action_ondelete'=>'RESTRICT',)

[line 1164]

Array of supported options that can be passed to the MDB2 instance.

The options can be set during object creation, using MDB2::connect(), MDB2::factory() or MDB2::singleton(). The options can also be set after the object is created, using MDB2::setOptions() or MDB2_Driver_Common::setOption(). The list of available option includes:

  • $options['ssl'] -> boolean: determines if ssl should be used for connections
  • $options['field_case'] -> CASE_LOWER|CASE_UPPER: determines what case to force on field/table names
  • $options['disable_query'] -> boolean: determines if queries should be executed
  • $options['result_class'] -> string: class used for result sets
  • $options['buffered_result_class'] -> string: class used for buffered result sets
  • $options['result_wrap_class'] -> string: class used to wrap result sets into
  • $options['result_buffering'] -> boolean should results be buffered or not?
  • $options['fetch_class'] -> string: class to use when fetch mode object is used
  • $options['persistent'] -> boolean: persistent connection?
  • $options['debug'] -> integer: numeric debug level
  • $options['debug_handler'] -> string: function/method that captures debug messages
  • $options['debug_expanded_output'] -> bool: BC option to determine if more context information should be send to the debug handler
  • $options['default_text_field_length'] -> integer: default text field length to use
  • $options['lob_buffer_length'] -> integer: LOB buffer length
  • $options['log_line_break'] -> string: line-break format
  • $options['idxname_format'] -> string: pattern for index name
  • $options['seqname_format'] -> string: pattern for sequence name
  • $options['savepoint_format'] -> string: pattern for auto generated savepoint names
  • $options['statement_format'] -> string: pattern for prepared statement names
  • $options['seqcol_name'] -> string: sequence column name
  • $options['quote_identifier'] -> boolean: if identifier quoting should be done when check_option is used
  • $options['use_transactions'] -> boolean: if transaction use should be enabled
  • $options['decimal_places'] -> integer: number of decimal places to handle
  • $options['portability'] -> integer: portability constant
  • $options['modules'] -> array: short to long module name mapping for __call()
  • $options['emulate_prepared'] -> boolean: force prepared statements to be emulated
  • $options['datatype_map'] -> array: map user defined datatypes to other primitive datatypes
  • $options['datatype_map_callback'] -> array: callback function/method that should be called
  • $options['bindname_format'] -> string: regular expression pattern for named parameters
  • $options['multi_query'] -> boolean: determines if queries returning multiple result sets should be executed
  • $options['max_identifiers_length'] -> integer: max identifier length
  • $options['default_fk_action_onupdate'] -> string: default FOREIGN KEY ON UPDATE action ['RESTRICT'|'NO ACTION'|'SET DEFAULT'|'SET NULL'|'CASCADE']
  • $options['default_fk_action_ondelete'] -> string: default FOREIGN KEY ON DELETE action ['RESTRICT'|'NO ACTION'|'SET DEFAULT'|'SET NULL'|'CASCADE']


Type:   array


[ Top ]

$pear =

[line 1349]

  • Access: protected

Type:   PEAR


[ Top ]

$phptype =

[line 1309]

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

Type:   string


[ Top ]

$reverse =

[line 1027]

  • Access: public



[ Top ]

$sql_comments = array(
        array('start' => '--', 'end' => "\n", 'escape' => false),array('start'=>'/*','end'=>'*/','escape'=>false),)

[line 1236]

sql comments
  • Access: public

Type:   array


[ Top ]

$string_quoting = array(
        'start'  => "'",
        'end'    => "'",
        'escape' => false,
        'escape_pattern' => false,
    )

[line 1213]

string array
  • Access: public

Type:   string


[ Top ]

$supported = array(
        'sequences' => false,
        'indexes' => false,
        'affected_rows' => false,
        'summary_functions' => false,
        'order_by_text' => false,
        'transactions' => false,
        'savepoints' => false,
        'current_id' => false,
        'limit_queries' => false,
        'LOBs' => false,
        'replace' => false,
        'sub_selects' => false,
        'triggers' => false,
        'auto_increment' => false,
        'primary_key' => false,
        'result_introspection' => false,
        'prepared_statements' => false,
        'identifier_quoting' => false,
        'pattern_escaping' => false,
        'new_link' => false,
    )

[line 1090]

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

Type:   array


[ Top ]

$warnings = array()

[line 1260]

warnings
  • Access: public

Type:   array


[ Top ]

$wildcards = array('%', '_')

[line 1246]

comparision wildcards
  • Access: protected

Type:   array


[ Top ]



Method Detail

__construct (Constructor)   [line 1357]

MDB2_Driver_Common __construct( )

Constructor

[ Top ]

__destruct (Destructor)   [line 1372]

void __destruct( )

Destructor

[ Top ]

beginNestedTransaction   [line 2155]

mixed beginNestedTransaction( )

Start a nested transaction.
  • Return: MDB2_OK on success/savepoint name, a MDB2 error on failure
  • Since: 2.1.1
  • Access: public

[ Top ]

beginTransaction   [line 2047]

mixed beginTransaction( [string $savepoint = null])

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

Parameters:

string   $savepoint   —  name of a savepoint to set

[ Top ]

commit   [line 2068]

mixed commit( [string $savepoint = null])

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

Parameters:

string   $savepoint   —  name of a savepoint to release

[ Top ]

compareDefinition   [line 3194]

array compareDefinition( array $current, array $previous)

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

Parameters:

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

[ Top ]

completeNestedTransaction   [line 2186]

mixed completeNestedTransaction( [bool $force_rollback = false])

Finish a nested transaction by rolling back if an error occured or committing otherwise.
  • Return: MDB_OK on commit/counter decrementing, false on rollback and a MDB2 error on failure
  • Since: 2.1.1
  • Access: public

Parameters:

bool   $force_rollback   —  if the transaction should be rolled back regardless even if no error was set within the nested transaction

[ Top ]

connect   [line 2276]

true connect( )

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

[ Top ]

currID   [line 3314]

mixed currID( string $seq_name)

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

Parameters:

string   $seq_name   —  name of the sequence

[ Top ]

databaseExists   [line 2293]

mixed databaseExists( string $name)

check if given database name is exists?
  • Return: true/false on success, a MDB2 error on failure
  • Access: public

Parameters:

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

[ Top ]

debug   [line 1640]

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

set a debug message
  • Access: public

Parameters:

string   $message   —  message that should be appended to the debug variable
string   $scope   —  usually the method name that triggered the debug call: for example 'query', 'prepare', 'execute', 'parameters', 'beginTransaction', 'commit', 'rollback'
array   $context   —  contains context information about the debug() call common keys are: is_manip, time, result etc.

[ Top ]

delExpect   [line 3464]

mixed delExpect( mixed $error_code)

This method deletes all occurences of the specified element from the expected error codes stack.
  • Return: list of error codes that were deleted or error
  • Access: public
  • Uses: PEAR::delExpect()

Parameters:

mixed   $error_code   —  error code that should be deleted

[ Top ]

disconnect   [line 2329]

mixed disconnect( [boolean $force = true])

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

Parameters:

boolean   $force   —  whether the disconnect should be forced even if the connection is opened persistently

[ Top ]

errorInfo   [line 1426]

array errorInfo( [mixed $error = null])

This method is used to collect information about an error
  • Return: with MDB2 errorcode, native error code, native message
  • Access: public

Parameters:

mixed   $error   —  error code or resource

[ Top ]

escape   [line 1683]

string escape( string $text, [bool $escape_wildcards = false])

Quotes a string so it can be safely used in a query. It will quote the text so it can safely be used within a query.
  • Return: quoted string
  • Access: public

Parameters:

string   $text   —  the input string to quote
bool   $escape_wildcards   —  escape wildcards

[ Top ]

escapePattern   [line 1705]

string escapePattern( string $text)

Quotes pattern (% and _) characters in a string)
  • Return: quoted string
  • Access: public

Parameters:

string   $text   —  the input string to quote

[ Top ]

exec   [line 2580]

mixed exec( string $query)

Execute a manipulation query to the database and return the number of affected rows
  • Return: number of affected rows on success, a MDB2 error on failure
  • Access: public

Parameters:

string   $query   —  the SQL query

[ Top ]

expectError   [line 3488]

int expectError( [mixed $code = '*'])

This method is used to tell which errors you expect to get.

Expected errors are always returned with error mode PEAR_ERROR_RETURN. Expected error codes are stored in a stack, and this method pushes a new element onto it. The list of expected errors are in effect until they are popped off the stack with the popExpect() method.

Note that this method can not be called statically

  • Return: the new depth of the "expected errors" stack
  • Access: public
  • Uses: PEAR::expectError()

Parameters:

mixed   $code   —  a single error code or an array of error codes to expect

[ Top ]

failNestedTransaction   [line 2238]

bool failNestedTransaction( [mixed $error = null], [bool $immediately = false])

Force setting nested transaction to failed.
  • Return: MDB2_OK
  • Since: 2.1.1
  • Access: public

Parameters:

mixed   $error   —  value to return in getNestededTransactionError()
bool   $immediately   —  if the transaction should be rolled back immediately

[ Top ]

free   [line 1387]

bool free( )

Free the internal references so that the instance can be destroyed
  • Return: true on success, false if result is invalid
  • Access: public

[ Top ]

getAsKeyword   [line 1777]

string getAsKeyword( )

Gets the string to alias column
  • Return: to use when aliasing a column

[ Top ]

getConnection   [line 1793]

mixed getConnection( )

Returns a native connection
  • Return: a valid MDB2 connection object, or a MDB2 error object on error
  • Access: public

[ Top ]

getDatabase   [line 2373]

string getDatabase( )

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

[ Top ]

getDebugOutput   [line 1664]

string getDebugOutput( )

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

[ Top ]

getDeclaration   [line 3172]

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

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

Parameters:

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

[ Top ]

getDSN   [line 2415]

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

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

Parameters:

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

[ Top ]

getIndexName   [line 3257]

string getIndexName( string $idx)

adds index name formatting to a index name
  • Return: formatted index name
  • Access: public

Parameters:

string   $idx   —  name of the index

[ Top ]

getNestedTransactionError   [line 2263]

MDB2_Error|bool getNestedTransactionError( )

The first error that occured since the transaction start.
  • Return: MDB2 error object if an error occured or false.
  • Since: 2.1.1
  • Access: public

[ Top ]

getOption   [line 1614]

mixed getOption( string $option)

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

Parameters:

string   $option   —  option name

[ Top ]

getSequenceName   [line 3239]

string getSequenceName( string $sqn)

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

Parameters:

string   $sqn   —  name of the sequence

[ Top ]

getServerVersion   [line 2741]

mixed getServerVersion( [bool $native = false])

return version information about the server
  • Return: array with version information or row string
  • Access: public

Parameters:

bool   $native   —  determines if the raw version string should be returned

[ Top ]

getStaticProperty   [line 3509]

mixed &getStaticProperty( string $class, string $var)

If you have a class that's mostly/entirely static, and you need static

properties, you can use this method to simulate them. Eg. in your method(s) do this: $myVar = &PEAR::getStaticProperty('myclass', 'myVar'); You MUST use a reference, or they will not persist!

  • Return: A reference to the variable. If not set it will be auto initialised to NULL.
  • Access: public
  • Uses: PEAR::getStaticProperty()

Parameters:

string   $class   —  The calling classname, to prevent clashes
string   $var   —  The variable to retrieve.

[ Top ]

getWarnings   [line 1535]

array getWarnings( )

Get all warnings in reverse order.

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


[ Top ]

inTransaction   [line 2110]

int|bool inTransaction( [bool $ignore_nested = false])

If a transaction is currently open.
  • Return: - an integer with the nesting depth is returned if a nested transaction is open
    • true is returned for a normal open transaction
    • false is returned if no transaction is open
  • Access: public

Parameters:

bool   $ignore_nested   —  if the nested transaction count should be ignored

[ Top ]

lastInsertID   [line 3296]

mixed lastInsertID( [string $table = null], [string $field = null])

Returns the autoincrement ID if supported or $id or fetches the current ID in a sequence called: $table.(empty($field) ? '' : '_'.$field)
  • Return: MDB2 Error Object or id
  • Access: public

Parameters:

string   $table   —  name of the table into which a new row was inserted
string   $field   —  name of the field into which a new row was inserted

[ Top ]

loadModule   [line 1900]

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

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

Parameters:

string   $module   —  name of the module that should be loaded (only used for error messages)
string   $property   —  name of the property into which the class will be loaded
bool   $phptype_specific   —  if the class to load for the module is specific to the phptype

[ Top ]

nextID   [line 3276]

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

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

Parameters:

string   $seq_name   —  name of the sequence
bool   $ondemand   —  when true missing sequences are automatic created

[ Top ]

popErrorHandling   [line 3526]

bool popErrorHandling( )

Pop the last error handler used
  • Return: Always true
  • See: PEAR::pushErrorHandling
  • Access: public
  • Uses: PEAR::popErrorHandling()

[ Top ]

popExpect   [line 3542]

array popExpect( )

This method pops one element off the expected error codes stack.
  • Return: the list of error codes that were popped
  • Access: public
  • Uses: PEAR::popExpect()

[ Top ]

prepare   [line 2987]

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

Prepares a query for multiple execution with execute().

With some database backends, this is emulated. prepare() requires a generic query as string like 'INSERT INTO numbers VALUES(?,?)' or 'INSERT INTO numbers VALUES(:foo,:bar)'. The ? and :name and are placeholders which can be set using bindParam() and the query can be sent off using the execute() method. The allowed format for :name can be set with the 'bindname_format' option.

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

Parameters:

string   $query   —  the query to prepare
mixed   $types   —  array that contains the types of the placeholders
mixed   $result_types   —  array that contains the types of the columns in the result set or MDB2_PREPARE_RESULT, if set to MDB2_PREPARE_MANIP the query is handled as a manipulation query
mixed   $lobs   —  key (field) value (parameter) pair for all lob placeholders

[ Top ]

pushErrorHandling   [line 3563]

bool pushErrorHandling( mixed $mode, [mixed $options = null])

Push a new error handler on top of the error handler options stack. With this you can easily override the actual error handler for some code and restore it later with popErrorHandling.
  • Return: Always true
  • See: PEAR::setErrorHandling
  • Access: public
  • Uses: PEAR::pushErrorHandling()

Parameters:

mixed   $mode   —  (same as setErrorHandling)
mixed   $options   —  (same as setErrorHandling)

[ Top ]

query   [line 2617]

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

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

Parameters:

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

[ Top ]

queryAll   [line 3439]

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

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

Parameters:

string   $query   —  the SELECT query statement to be executed.
array   $types   —  optional array argument that specifies a list of expected datatypes of the result set columns, so that the eventual conversions may be performed. The default list of datatypes is empty, meaning that no conversion is performed.
int   $fetchmode   —  how the array data should be indexed
bool   $rekey   —  if set to true, the $all will have the first column as its first dimension
bool   $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.
bool   $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 3400]

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

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

Parameters:

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

[ Top ]

queryOne   [line 3340]

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

Execute the specified query, fetch the value from the first column of the first row of the result set and then frees the result set.
  • Return: MDB2_OK or field value on success, a MDB2 error on failure
  • Access: public

Parameters:

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

[ Top ]

queryRow   [line 3371]

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

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

Parameters:

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

[ Top ]

quote   [line 3146]

string quote( string $value, [string $type = null], [bool $quote = true], [bool $escape_wildcards = false])

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

Parameters:

string   $value   —  text string value that is intended to be converted.
string   $type   —  type to which the value should be converted to
bool   $quote   —  quote
bool   $escape_wildcards   —  escape wildcards

[ Top ]

quoteIdentifier   [line 1756]

string quoteIdentifier( string $str, [bool $check_option = false])

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.

NOTE: if you have table names containing periods, don't use this method (@see bug #11906)

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
  • pgsql
  • sqlite
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

Parameters:

string   $str   —  identifier name to be quoted
bool   $check_option   —  check the 'quote_identifier' option

[ Top ]

raiseError   [line 1459]

PEAR_Error &raiseError( [mixed $code = null], [int $mode = null], [mixed $options = null], [string $userinfo = null], [string $method = null], [string $dummy1 = null], [bool $dummy2 = false])

This method is used to communicate an error and invoke error callbacks etc. Basically a wrapper for PEAR::raiseError without the message string.
  • Return: instance of a 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.
string   $method   —  name of the method that triggered the error
string   $dummy1   —  not used
bool   $dummy2   —  not used

[ Top ]

registerShutdownFunc   [line 3581]

void registerShutdownFunc( mixed $func, [mixed $args = array()])

Use this function to register a shutdown method for static classes.
  • Access: public
  • Uses: PEAR::registerShutdownFunc()

Parameters:

mixed   $func   —  The function name (or array of class/method) to call
mixed   $args   —  The arguments to pass to the function

[ Top ]

replace   [line 2888]

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 old row is deleted before the new row is inserted.

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

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

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 MDB2 are supported except for clob and blob.

Default: no type conversion

null bool 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 bool 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 1518]

void resetWarnings( )

reset the warning array
  • Access: public

[ Top ]

rollback   [line 2089]

mixed rollback( [string $savepoint = null])

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

Parameters:

string   $savepoint   —  name of a savepoint to rollback to

[ Top ]

setCharset   [line 2310]

true setCharset( string $charset, [resource $connection = null])

Set the charset on the current connection
  • Return: on success, MDB2 Error Object on failure

Parameters:

string   $charset   —  charset
resource   $connection   —  connection handle

[ Top ]

setDatabase   [line 2353]

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

MDB2_OK setDSN( mixed $dsn)

set the DSN
  • Access: public

Parameters:

mixed   $dsn   —  DSN string or array

[ Top ]

setErrorHandling   [line 3628]

void setErrorHandling( [int $mode = null], [mixed $options = null])

Sets how errors generated by this object should be handled.

Can be invoked both in objects and statically. If called statically, setErrorHandling sets the default behaviour for all PEAR objects. If called in an object, setErrorHandling sets the default behaviour for that object.

  • See: PEAR_ERROR_RETURN
  • See: PEAR_ERROR_EXCEPTION
  • See: PEAR_ERROR_DIE
  • See: PEAR_ERROR_CALLBACK
  • See: PEAR_ERROR_PRINT
  • See: PEAR_ERROR_TRIGGER
  • Since: PHP 4.0.5
  • Access: public
  • Uses: PEAR::setErrorHandling($mode, - $options)

Parameters:

int   $mode   —  One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT, PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE, PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION.
mixed   $options   — 

When $mode is PEAR_ERROR_TRIGGER, this is the error level (one of E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR).

When $mode is PEAR_ERROR_CALLBACK, this parameter is expected to be the callback function or method. A callback function is a string with the name of the function, a callback method is an array of two elements: the element at index 0 is the object, and the element at index 1 is the name of the method to call in the object.

When $mode is PEAR_ERROR_PRINT or PEAR_ERROR_DIE, this is a printf format string used when printing the error message.


[ Top ]

setFetchMode   [line 1562]

mixed setFetchMode( int $fetchmode, [string $object_class = 'stdClass'])

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

Parameters:

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

[ Top ]

setLimit   [line 2760]

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

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

Parameters:

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

[ Top ]

setOption   [line 1592]

mixed setOption( string $option, mixed $value)

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

Parameters:

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

[ Top ]

setTransactionIsolation   [line 2137]

mixed setTransactionIsolation( string $isolation, [array $options = array()])

Set the transacton isolation level.
  • Return: MDB2_OK on success, a MDB2 error on failure
  • Since: 2.1.1
  • Access: public

Parameters:

string   $isolation   —  standard isolation level READ UNCOMMITTED (allows dirty reads) READ COMMITTED (prevents dirty reads) REPEATABLE READ (prevents nonrepeatable reads) SERIALIZABLE (prevents phantom reads)
array   $options   —  some transaction options: 'wait' => 'WAIT' | 'NO WAIT' 'rw' => 'READ WRITE' | 'READ ONLY'

[ Top ]

standaloneQuery   [line 2475]

mixed standaloneQuery( string $query, [mixed $types = null], [bool $is_manip = false])

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

Parameters:

string   $query   —  the SQL query
mixed   $types   —  array that contains the types of the columns in the result set
bool   $is_manip   —  if the query is a manipulation query

[ Top ]

staticPopErrorHandling   [line 3636]

void staticPopErrorHandling( )

  • Access: public
  • Uses: PEAR::staticPopErrorHandling()

[ Top ]

staticPushErrorHandling   [line 3647]

void staticPushErrorHandling( $mode, [ $options = null])

  • Access: public
  • Uses: PEAR::staticPushErrorHandling($mode, - $options)

Parameters:

   $mode   — 
   $options   — 

[ Top ]

subSelect   [line 2798]

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

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

Parameters:

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

[ Top ]

supports   [line 3218]

bool|string supports( string $feature)

Tell whether a DB implementation or its backend extension supports a given feature.
  • Return: if this DB implementation supports a given feature false means no, true means native, 'emulated' means emulated
  • Access: public

Parameters:

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

[ Top ]

throwError   [line 3671]

object a &throwError( [mixed $message = null], [int $code = null], [string $userinfo = null])

Simpler form of raiseError with fewer options. In most cases message, code and userinfo are enough.
  • Return: PEAR error object
  • See: PEAR::raiseError
  • Access: public
  • Uses: PEAR::&throwError()

Parameters:

mixed   $message   —  a text error message or a PEAR error object
int   $code   —  a numeric error code (it is up to your class to define these if you want to use codes)
string   $userinfo   —  If you need to pass along for example debug information, this parameter is meant for that.

[ Top ]

_doQuery   [line 2534]

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

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

Parameters:

string   $query   —  query
bool   $is_manip   —  if the query is a manipulation query
resource   $connection   —  connection handle
string   $database_name   —  database name

[ Top ]

_fixResultArrayValues   [line 1815]

void _fixResultArrayValues( array &$row, array $mode)

Do all necessary conversions on result arrays to fix DBMS quirks
  • Access: protected

Parameters:

array   &$row   —  the array to be fixed (passed by reference)
array   $mode   —  bit-wise addition of the required portability modes

[ Top ]

_isNewLinkSet   [line 2450]

boolean _isNewLinkSet( )

Check if the 'new_link' option is set
  • Access: protected

[ Top ]

_modifyQuery   [line 2515]

string _modifyQuery( string $query, bool $is_manip, int $limit, int $offset)

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

Parameters:

string   $query   —  query to modify
bool   $is_manip   —  if it is a DML query
int   $limit   —  limit the number of rows
int   $offset   —  start reading from given offset

[ Top ]

_skipDelimitedStrings   [line 3093]

mixed _skipDelimitedStrings( string $query, integer $position, integer $p_position)

Utility method, used by prepare() to avoid replacing placeholders within delimited strings.

Check if the placeholder is contained within a delimited string. If so, skip it and advance the position, otherwise return the current position, which is valid

  • Return: integer $new_position on success MDB2_Error on failure
  • Access: protected

Parameters:

string   $query   — 
integer   $position   —  current string cursor position
integer   $p_position   —  placeholder position

[ Top ]

_wrapResult   [line 2656]

mixed _wrapResult( resource $result_resource, [mixed $types = array()], [mixed $result_class = true], [mixed $result_wrap_class = true], [string $limit = null], [string $offset = null])

wrap a result set into the correct class
  • Return: an MDB2_Result, a MDB2 error on failure
  • Access: protected

Parameters:

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

[ Top ]

__call   [line 1969]

mixed __call( string $method, array $params)

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

Parameters:

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

[ Top ]

__callStatic   [line 2021]

mixed __callStatic( string $method, array $params)

Calls a module method using the __callStatic magic method
  • Return: Returned value.
  • Access: public

Parameters:

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

[ Top ]

__toString   [line 1404]

string __toString( )

String conversation
  • Return: representation of the object
  • Access: public

[ Top ]


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