Class: MDB2_Driver_Common
Source Location: /MDB2-2.0.0RC1/MDB2.php
PEAR
|
--MDB2_Driver_Common
MDB2_Driver_Common: Base class that is extended by each MDB2 driver
Author(s):
|
|
|
Child classes:
|
Inherited Variables
|
Inherited Methods
|
Class Details
Class Variables
$connected_database_name = ''
[line 941]
the name of the database currrently selected
$connected_dsn = array()
[line 913]
DSN that was used to create the current connection
$connection = 0
[line 920]
connection resource
$database_name = ''
[line 934]
the name of the database for the next query
$dbsyntax =
[line 1074]
Database used with regards to SQL syntax etc.
$db_index = 0
[line 899]
index of the MDB2 object within the $GLOBALS['_MDB2_databases'] array
$debug_output = ''
[line 1039]
string with the debugging information
$destructor_registered = true
[line 1102]
determines of the PHP4 destructor emulation has been enabled yet
$dsn = array()
[line 906]
DSN used for the next query
$escape_quotes = ''
[line 1025]
escape character
$fetchmode = MDB2_FETCHMODE_ORDERED
[line 1088]
the default fetchmode used
$in_transaction = false
[line 1046]
determine if there is an open transaction
$last_query =
[line 1081]
the last query sent to the driver
$modules = array()
[line 1095]
array of module instances
$opened_persistent =
[line 927]
if the current opened connection is a persistent connection
$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',
'lob_buffer_length' => 8192,
'log_line_break' => "\n",
'idxname_format' => '%s_idx',
'seqname_format' => '%s_seq',
'seqcol_name' => 'sequence',
'quote_identifier' => false,
'use_transactions' => false,
'decimal_places' => 2,
'portability' => MDB2_PORTABILITY_ALL,
'modules' => array(
'ex' => 'Extended',
'dt' => 'Datatype',
'mg' => 'Manager',
'rv' => 'Reverse',
'na' => 'Native',
'fc' => 'Function',
),)
[line 989]
$options['ssl'] -> determines if ssl should be used for connections $options['field_case'] -> determines what case to force on field/table names $options['disable_query'] -> determines if querys should be executed $options['result_class'] -> class used for result sets $options['buffered_result_class'] -> class used for buffered result sets $options['result_wrap_class'] -> class used to wrap result sets into $options['result_buffering'] -> boolean|integer should results be buffered or not? $options['fetch_class'] -> class to use when fetch mode object is used $options['persistent'] -> boolean persistent connection? $options['debug'] -> integer numeric debug level $options['debug_handler'] -> string function/meothd that captures debug messages $options['lob_buffer_length'] -> integer LOB buffer length $options['log_line_break'] -> string line-break format $options['idxname_format'] -> string pattern for index name $options['seqname_format'] -> string pattern for sequence name $options['seqcol_name'] -> string sequence column name $options['quote_identifier'] -> if identifier quoting should be done when check_option is used $options['use_transactions'] -> boolean $options['decimal_places'] -> integer $options['portability'] -> portability constant $options['modules'] -> short to long module name mapping for __call()
$phptype =
[line 1067]
Database backend used in PHP (mysql, odbc etc.)
$row_limit = 0
[line 1060]
result limit used in the next query
$row_offset = 0
[line 1053]
result offset used in the next query
$supported = array(
'sequences' => false,
'indexes' => false,
'affected_rows' => false,
'summary_functions' => false,
'order_by_text' => false,
'transactions' => false,
'current_id' => false,
'limit_queries' => false,
'LOBs' => false,
'replace' => false,
'sub_selects' => false,
'auto_increment' => false,
'primary_key' => false,
)
[line 948]
list of all supported features of the given driver
$warnings = array()
[line 1032]
warnings
Method Detail
MDB2_Driver_Common (Constructor) [line 1124]
MDB2_Driver_Common MDB2_Driver_Common(
)
|
|
PHP 4 Constructor
beginTransaction [line 1685]
mixed beginTransaction(
)
|
|
Start a transaction.
Overridden in child classes as:
- MDB2_xxx::beginTransaction()
- Define whether database changes done on the database be automatically committed. This function may also implicitly start or end a transaction.
commit [line 1704]
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.
Overridden in child classes as:
- MDB2_xxx::commit()
- Commit the database changes done during a transaction that is in progress. This function may only be called when auto-committing is disabled, otherwise it will fail. Therefore, a new transaction is implicitly started after committing the pending changes.
compareDefinition [line 2434]
array compareDefinition(
array
$current, array
$previous)
|
|
Obtain an array of changes that may need to applied
Parameters:
currID [line 2542]
mixed currID(
string
$seq_name)
|
|
returns the current id of a sequence
Overridden in child classes as:
- MDB2_xxx::currID()
- returns the current id of a sequence
Parameters:
debug [line 1377]
void debug(
string
$message, [mixed
$scope = ''])
|
|
set a debug message
Parameters:
disconnect [line 1740]
Log out and disconnect from the database.
Overridden in child classes as:
- MDB2_xxx::disconnect()
- Log out and disconnect from the database.
errorInfo [line 1186]
array errorInfo(
[integer
$error = null])
|
|
This method is used to collect information about an error
Overridden in child classes as:
- MDB2_xxx::errorInfo()
- This method is used to collect information about an error
Parameters:
errorNative [line 1260]
returns an errormessage, provides by the database
escape [line 1409]
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.
Parameters:
exec [line 1932]
mixed exec(
string
$query)
|
|
Execute a manipulation query to the database and return any the affected rows
Parameters:
free [line 1150]
Free the internal references so that the instance can be destroyed
getConnection [line 1475]
Returns a native connection
getDatabase [line 1771]
getDebugOutput [line 1393]
getDeclaration [line 2414]
string getDeclaration(
string
$type, string
$name, string
$field)
|
|
Obtain DBMS specific SQL code portion needed to declare of the given type
Parameters:
getDSN [line 1809]
mixed getDSN(
[string
$type = 'string'], [string
$hidepw = false])
|
|
return the DSN as a string
Parameters:
getIndexName [line 2490]
string getIndexName(
string
$idx)
|
|
adds index name formatting to a index name
Parameters:
getOption [line 1359]
mixed getOption(
string
$option)
|
|
returns the value of an option
Parameters:
getSequenceName [line 2474]
string getSequenceName(
string
$sqn)
|
|
adds sequence name formatting to a sequence name
Parameters:
getServerVersion [line 2065]
mixed getServerVersion(
[string
$native = false])
|
|
return version information about the server
Parameters:
getWarnings [line 1289]
get all warnings in reverse order. This means that the last warning is the first element in the array
lastInsertID [line 2526]
mixed lastInsertID(
[string
$table = null], [mixed
$field = null], mixed
$id)
|
|
returns the autoincrement ID if supported or $id
Parameters:
loadModule [line 1570]
object on &loadModule(
string
$module, [string
$property = null], [boolean
$phptype_specific = null])
|
|
loads a module
Parameters:
nextID [line 2509]
mixed nextID(
string
$seq_name, [boolean
$ondemand = true])
|
|
returns the next free id of a sequence
Overridden in child classes as:
- MDB2_xxx::nextID()
- returns the next free id of a sequence
Parameters:
prepare [line 2304]
mixed &prepare(
string
$query, [mixed
$types = null], [mixed
$result_types = null])
|
|
Prepares a query for multiple execution with execute(). With some database backends, this is emulated. prepare() requires a generic query as string like 'INSERT INTO numbers VALUES(?,?)' or 'INSERT INTO numbers VALUES(:foo,:bar)'. The ? and :[a-zA-Z] and are placeholders which can be set using bindParam() and the query can be send off using the execute() method.
Parameters:
query [line 1966]
object a &query(
string
$query, [mixed
$types = null], [mixed
$result_class = true], [mixed
$result_wrap_class = false])
|
|
Send a query to the database and return any results
Overridden in child classes as:
- MDB2_xxx::query()
- Send a query to the database and return any results
Parameters:
queryAll [line 2658]
mixed queryAll(
string
$query, [array
$types = null], [int
$fetchmode = MDB2_FETCHMODE_DEFAULT], [boolean
$rekey = false], [boolean
$force_array = false], [boolean
$group = false])
|
|
Execute the specified query, fetch all the rows of the result set into a two dimensional array and then frees the result set.
Parameters:
queryCol [line 2621]
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.
Parameters:
queryOne [line 2564]
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.
Parameters:
queryRow [line 2593]
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.
Parameters:
quote [line 2391]
string quote(
string
$value, [string
$type = null], [mixed
$quote = true])
|
|
Convert a text value into a DBMS specific format that is suitable to compose query statements.
Parameters:
quoteIdentifier [line 1457]
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. 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.
Parameters:
raiseError [line 1219]
object a &raiseError(
[mixed
$code = null], [int
$mode = null], [mixed
$options = null], [string
$userinfo = null])
|
|
This method is used to communicate an error and invoke error callbacks etc. Basically a wrapper for PEAR::raiseError without the message string.
Parameters:
replace [line 2209]
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.
Overridden in child classes as:
- MDB2_xxx::replace()
- Execute a SQL REPLACE query. A REPLACE query is identical to a INSERT query, except that if there is already a row in the table with the same key field values, the REPLACE query just updates its values instead of inserting a new row.
Parameters:
resetWarnings [line 1273]
rollback [line 1723]
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.
Overridden in child classes as:
- MDB2_xxx::rollback()
- Cancel any database changes done during a transaction that is in progress. This function may only be called when auto-committing is disabled, otherwise it will fail. Therefore, a new transaction is implicitly started after canceling the pending changes.
setDatabase [line 1755]
string setDatabase(
string
$name)
|
|
Select a different database
Parameters:
setDSN [line 1786]
MDB2_OK setDSN(
mixed
$dsn)
|
|
set the DSN
Parameters:
setFetchMode [line 1314]
void setFetchMode(
integer
$fetchmode, [string
$object_class = 'stdClass'])
|
|
Sets which fetch mode should be used by default on queries on this connection
Parameters:
setLimit [line 2082]
mixed setLimit(
string
$limit, [string
$offset = null])
|
|
set the range of the next query
Parameters:
setOption [line 1339]
mixed setOption(
string
$option, mixed
$value)
|
|
set the option for the db class
Parameters:
standaloneQuery [line 1845]
mixed &standaloneQuery(
string
$query, [mixed
$types = null], [boolean
$is_manip = false])
|
|
execute a query as database administrator
Parameters:
subSelect [line 2120]
string subSelect(
string
$query, [string
$type = false])
|
|
simple subselect emulation: leaves the query untouched for all RDBMS that support subselects
Overridden in child classes as:
- MDB2_xxx::subSelect()
- simple subselect emulation for Mysql
Parameters:
supports [line 2455]
boolean|string supports(
string
$feature)
|
|
Tell whether a DB implementation or its backend extension supports a given feature.
Parameters:
_doQuery [line 1897]
result _doQuery(
string
$query, [boolean
$is_manip = false], [resource
$connection = null], [string
$database_name = null])
|
|
Execute a query
Parameters:
_fixResultArrayValues [line 1494]
void _fixResultArrayValues(
array
&$array, mixed
$mode)
|
|
Do all necessary conversions on result arrays to fix DBMS quirks
Parameters:
_modifyQuery [line 1880]
the _modifyQuery(
string
$query)
|
|
Changes a query string for various DBMS specific reasons
Parameters:
_wrapResult [line 2003]
mixed &_wrapResult(
ressource
$result, [mixed
$types = array()], [mixed
$result_class = true], [mixed
$result_wrap_class = false], [string
$limit = null], [string
$offset = null])
|
|
wrap a result set into the correct class
Parameters:
__toString [line 1166]
Documentation generated on Wed, 21 Dec 2005 06:31:15 -0500 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.
|
|