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

Class: MDB2_Driver_mysql

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

Class Overview

PEAR
   |
   --MDB2_Driver_Common
      |
      --MDB2_Driver_mysql

MDB2 MySQL driver


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods

Class: MDB2_Driver_Common

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

Class Details

[line 56]
MDB2 MySQL driver


[ Top ]


Class Variables

$dummy_primary_key =  'dummy_primary_key'

[line 61]


Type:   mixed


[ Top ]

$escape_quotes =  "\\"

[line 59]


Type:   mixed
Overrides:   Array


[ Top ]



Method Detail

__construct (Constructor)   [line 69]

MDB2_Driver_mysql __construct( )

Constructor

Overrides MDB2_Driver_Common::__construct() (Constructor)
[ Top ]

beginTransaction   [line 205]

mixed beginTransaction( )

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

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

commit   [line 237]

mixed commit( )

Commit the database changes done during a transaction that is in progress.
  • Return: MDB2_OK on success, a MDB2 error on failure
  • Access: public

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

connect   [line 302]

true connect( )

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

[ Top ]

currID   [line 718]

mixed currID( string $seq_name)

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

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

Parameters:

string   $seq_name   —  name of the sequence

[ Top ]

disconnect   [line 406]

mixed disconnect( [ $force = true])

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

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

Parameters:

   $force   — 

[ Top ]

errorInfo   [line 102]

array errorInfo( [integer $error = null])

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

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

Parameters:

integer   $error   — 

[ Top ]

escape   [line 168]

string escape( string $text)

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

Overrides MDB2_Driver_Common::escape() (Quotes a string so it can be safely used in a query. It will quote the text so it can safely be used within a query.)

Parameters:

string   $text   —  the input string to quote

[ Top ]

getAfterID   [line 702]

mixed getAfterID( mixed $id, string $table)

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

Overrides MDB2_Driver_Common::getAfterID() (returns the autoincrement ID if supported or $id)

Parameters:

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

[ Top ]

nextID   [line 656]

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

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

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

Parameters:

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

[ Top ]

quoteIdentifier   [line 191]

string quoteIdentifier( string $str)

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

Quoting style depends on which database driver is being used.

MySQL can't handle the backtick character (`) in table or column names.

  • Return: quoted identifier string
  • Access: public

Overrides MDB2_Driver_Common::quoteIdentifier() (Quote a string so it can be safely used as a table or column name)

Parameters:

string   $str   —  identifier name to be quoted

[ Top ]

replace   [line 606]

mixed replace( string $table, array $fields)

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

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

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

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

Parameters:

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

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

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

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

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

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

Default: 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 270]

mixed rollback( )

Cancel any database changes done during a transaction that is in progress.
  • Return: MDB2_OK on success, a MDB2 error on failure
  • Access: public

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

subSelect   [line 523]

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

simple subselect emulation for Mysql
  • Return: comma seperated values
  • Access: public

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

Parameters:

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

[ Top ]

_doQuery   [line 429]

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

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

Overrides MDB2_Driver_Common::_doQuery() (Execute a query)

Parameters:

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

[ Top ]

_modifyQuery   [line 483]

the _modifyQuery( string $query, $isManip, $limit, $offset)

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

Overrides MDB2_Driver_Common::_modifyQuery() (Changes a query string for various DBMS specific reasons)

Parameters:

string   $query   —  query to modify
   $isManip   — 
   $limit   — 
   $offset   — 

[ Top ]


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