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

Class: MDB2_Driver_mysqli

Source Location: /MDB2_Driver_mysqli-1.5.0b4/MDB2/Driver/mysqli.php

Class Overview

MDB2_Driver_Common
   |
   --MDB2_Driver_mysqli

MDB2 MySQLi driver


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 56]
MDB2 MySQLi driver


[ Top ]


Class Variables

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

[line 67]

  • Access: public

Type:   mixed


[ Top ]

$server_capabilities_checked =  false

[line 91]

  • Access: protected

Type:   mixed


[ Top ]

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

[line 85]

  • Access: public

Type:   mixed


[ Top ]

$start_transaction =  false

[line 93]

  • Access: protected

Type:   mixed


[ Top ]

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

[line 60]

  • Access: public

Type:   mixed


[ Top ]

$varchar_max_length =  255

[line 95]

  • Access: public

Type:   mixed


[ Top ]

$_query_errno =

[line 77]

The ouptut of mysqli_errno() in _doQuery(), if any.
  • Access: protected

Type:   integer


[ Top ]

$_query_error =

[line 83]

The ouptut of mysqli_error() in _doQuery(), if any.
  • Access: protected

Type:   string


[ Top ]



Method Detail

__construct (Constructor)   [line 103]

MDB2_Driver_mysqli __construct( )

Constructor

[ Top ]

beginTransaction   [line 343]

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

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 ]

connect   [line 581]

true connect( )

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

[ Top ]

currID   [line 1371]

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

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 ]

disconnect   [line 688]

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     if the disconnect should be forced even if the connection is opened persistently

[ Top ]

errorInfo   [line 204]

array errorInfo( [integer $error = null])

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

Parameters:

integer   $error     

[ Top ]

escape   [line 319]

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 ]

getServerVersion   [line 923]

mixed getServerVersion( [bool $native = false])

return version information about the server
  • Return: array/string with version information or MDB2 error object
  • Access: public

Parameters:

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

[ Top ]

lastInsertID   [line 1354]

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 ]

nextID   [line 1308]

mixed nextID( string $seq_name, [boolean $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
boolean   $ondemand     when true the sequence is automatic created, if it not exists

[ Top ]

prepare   [line 1066]

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 ]

replace   [line 1245]

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


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 ]

rollback   [line 439]

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

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 (or array(charset, collation))
resource   $connection     connection handle

[ Top ]

setOption   [line 188]

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

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

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

execute a query as DBA
  • 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
boolean   $is_manip     if the query is a manipulation query

[ Top ]

_doConnect   [line 522]

connection _doConnect( $username, $password, [ $persistent = false])

do the grunt work of the connect
  • Return: on success or MDB2 Error Object on failure
  • Access: protected

Parameters:

   $username     
   $password     
   $persistent     

[ Top ]

_doQuery   [line 765]

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

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

Parameters:

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

[ Top ]

_modifyQuery   [line 872]

string _modifyQuery( string $query, boolean $is_manip, integer $limit, integer $offset)

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

Parameters:

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

[ Top ]

_skipUserDefinedVariable   [line 1028]

integer _skipUserDefinedVariable( string $query, integer $position)

Utility method, used by prepare() to avoid misinterpreting MySQL user defined variables (SELECT @x:=5) for placeholders.

Check if the placeholder is a false positive, i.e. if it is an user defined variable instead. If so, skip it and advance the position, otherwise return the current position, which is valid

  • Access: protected

Parameters:

string   $query     
integer   $position     current string cursor position

[ Top ]


Documentation generated on Tue, 23 Oct 2012 18:30:44 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.