MediaWiki
REL1_20
|
Primary database interface. More...
Public Member Functions | |
__construct ($server=false, $user=false, $password=false, $dbName=false, $flags=0, $schema=self::USE_GLOBAL) | |
addQuotes ($s) | |
Escapes strings Doesn't escape numbers. | |
affectedRows () | |
Returns the number of rows affected by the last query or 0. | |
bitAnd ($fieldLeft, $fieldRight) | |
Bitwise AND of two columns or values in SQL Same as (fieldLeft & fieldRight) in C. | |
bitNot ($field) | |
Bitwise negation of a column or value in SQL Same as (~field) in C. | |
bitOr ($fieldLeft, $fieldRight) | |
Bitwise OR of two columns or values in SQL Same as (fieldLeft | fieldRight) in C. | |
buildConcat ($stringList) | |
Convert into a list of string being concatenated. | |
cascadingDeletes () | |
Returns true if this database supports (and uses) cascading deletes. | |
cleanupTriggers () | |
Returns true if this database supports (and uses) triggers (e.g. | |
dataSeek ($res, $row) | |
Moves the row pointer of the result set. | |
decodeBlob ($b) | |
Description is left as an exercise for the reader. | |
delete ($table, $conds, $fname= 'DatabaseIbm_db2::delete') | |
DELETE query wrapper. | |
encodeBlob ($b) | |
Description is left as an exercise for the reader. | |
execute ($prepared, $args=null) | |
Execute a prepared query with the various arguments. | |
extractUnixEpoch ($column) | |
Generates the SQL required to convert a DB2 timestamp into a Unix epoch. | |
fetchObject ($res) | |
Fetch the next row from the given result object, in object form. | |
fetchRow ($res) | |
Fetch the next row from the given result object, in associative array form. | |
fieldInfo ($table, $field) | |
Returns an information object on a table column. | |
fieldName ($res, $n) | |
Returns the nth column name. | |
fieldType ($res, $index) | |
db2_field_type() wrapper | |
fillPrepared ($preparedQuery, $args) | |
For faking prepared SQL statements on DBs that don't support it directly. | |
fillPreparedArg ($matches) | |
Only useful with fake prepare like in base Database class. | |
freePrepared ($prepared) | |
Frees resources associated with a prepared statement. | |
freeResult ($res) | |
Frees memory associated with a statement resource. | |
functionalIndexes () | |
Returns true if this database can use functional indexes. | |
getDb () | |
Returns the database connection object. | |
getSearchEngine () | |
Get search engine class. | |
getServerVersion () | |
getType () | |
Returns the database software identifieir. | |
getWikiID () | |
Returns a unique string representing the wiki on the server. | |
implicitGroupby () | |
Returns true if this database does an implicit sort when doing GROUP BY. | |
implicitOrderby () | |
Returns true if this database does an implicit order by when the column has an index For example: SELECT page_title FROM page LIMIT 1. | |
indexInfo ($table, $index, $fname= 'DatabaseIbm_db2::indexExists') | |
Returns information about an index If errors are explicitly ignored, returns NULL on failure. | |
indexUnique ($table, $index, $fname= 'DatabaseIbm_db2::indexUnique') | |
Verifies that an index was created as unique. | |
insert ($table, $args, $fname= 'DatabaseIbm_db2::insert', $options=array()) | |
INSERT wrapper, inserts an array into a table. | |
insertId () | |
This must be called after nextSequenceVal. | |
is_numeric_type ($type) | |
Verifies that a DB2 column/field type is numeric. | |
isOpen () | |
Is a database connection open? | |
lastErrno () | |
Get the last error number Return 0 if no error. | |
lastError () | |
Retrieves the most current database error Forces a database rollback. | |
limitResult ($sql, $limit, $offset=false) | |
Construct a LIMIT query with optional offset This is used for query pages. | |
makeList ($a, $mode=LIST_COMMA) | |
Makes an encoded list of strings from an array $mode: LIST_COMMA - comma separated, no field names LIST_AND - ANDed WHERE clause (without the WHERE) LIST_OR - ORed WHERE clause (without the WHERE) LIST_SET - comma separated with field names, like a SET clause LIST_NAMES - comma separated field names LIST_SET_PREPARED - like LIST_SET, except with ? tokens as values. | |
makeSelectOptions ($options) | |
Handles ordering, grouping, and having options ('GROUP BY' => colname) Has limited support for per-column options (colnum => 'DISTINCT') | |
nextSequenceValue ($seqName) | |
Return the next in a sequence, save the value for retrieval via insertId() | |
numFields ($res) | |
Returns the number of columns in a resource. | |
numRows ($res) | |
Returns the number of rows in the result set Has to be called right after the corresponding select query. | |
open ($server, $user, $password, $dbName) | |
Opens a database connection and returns it Closes any existing connection. | |
ping () | |
Ping the server and try to reconnect if it there is no connection The connection may be closed and reopened while this happens. | |
prepare ($sql, $func= 'DB2::prepare') | |
Intended to be compatible with the PEAR::DB wrapper functions. | |
realTimestamps () | |
Returns true if this database uses timestamps rather than integers. | |
searchableIPs () | |
Returns true if this database can do a native search on IP columns e.g. | |
select ($table, $vars, $conds= '', $fname= 'DatabaseIbm_db2::select', $options=array(), $join_conds=array()) | |
SELECT wrapper. | |
setMode ($mode) | |
Switches module between regular and install modes. | |
strencode ($s) | |
Alias for addQuotes() | |
strictIPs () | |
Returns true if this database is strict about what can be put into an IP field. | |
tableExists ($table, $fname=__METHOD__) | |
Queries whether a given table exists. | |
tableName ($name, $format= 'quoted') | |
Handle reserved keyword replacement in table names. | |
textFieldSize ($table, $field) | |
Returns the size of a text field, or -1 for "unlimited". | |
timestamp ($ts=0) | |
Generates a timestamp in an insertable format. | |
update ($table, $values, $conds, $fname= 'DatabaseIbm_db2::update', $options=array()) | |
UPDATE wrapper, takes a condition array and a SET array. | |
wasDeadlock () | |
Did the last database access fail because of deadlock? | |
Static Public Member Functions | |
static | getSoftwareLink () |
Returns link to IBM DB2 free download. | |
Public Attributes | |
$mConnOptions = array() | |
Connection config options - see constructor. | |
$mStmtOptions = array() | |
Statement config options -- see constructor. | |
const | CONN_OPTION = 0x01 |
Option that applies to connection objects. | |
const | INSTALL_MODE = 'install' |
Installation mode -- lots of debug messages. | |
const | NONE_OPTION = 0x00 |
Option that applies to nothing. | |
const | REGULAR_MODE = 'regular' |
Regular operation mode -- minimal debug messages. | |
const | STMT_OPTION = 0x02 |
Option that applies to statement objects. | |
const | USE_GLOBAL = 'get from global' |
Default schema. | |
Protected Member Functions | |
applySchema () | |
Switch into the database schema. | |
closeConnection () | |
Closes a database connection, if it is open Returns success, true if already closed. | |
doBegin ($fname= 'DatabaseIbm_db2::begin') | |
Start a transaction (mandatory) | |
doCommit ($fname= 'DatabaseIbm_db2::commit') | |
End a transaction Must have a preceding begin() | |
doQuery ($sql) | |
The DBMS-dependent part of query() | |
doRollback ($fname= 'DatabaseIbm_db2::rollback') | |
Cancel a transaction. | |
openCataloged ($dbName, $user, $password) | |
Opens a cataloged database connection, sets mConn. | |
openUncataloged ($dbName, $user, $password, $server, $port) | |
Opens an uncataloged database connection, sets mConn. | |
Protected Attributes | |
$currentRow = 0 | |
Current row number on the cursor of the last SELECT. | |
$mAffectedRows = null | |
Number of rows affected by last INSERT/UPDATE/DELETE. | |
$mInsertId = null | |
Last sequence value used for a primary key. | |
$mLastResult = null | |
Result of last query. | |
$mMode = self::REGULAR_MODE | |
Controls the level of debug message output. | |
$mNumRows = null | |
Number of rows returned by last SELECT. | |
$mPort = null | |
Database server port. | |
$mSchema = null | |
Schema for tables, stored procedures, triggers. | |
$mSchemaSet = false | |
Whether the schema has been applied in this session. | |
Private Member Functions | |
calcInsertId ($table, $primaryKey, $stmt) | |
Updates the mInsertId property with the value of the last insert into a generated column. | |
installPrint ($string) | |
Outputs debug information in the appropriate place. | |
removeNullPrimaryKeys ($table, $args) | |
Given a table name and a hash of columns with values Removes primary key columns from the hash where the value is NULL. | |
setDB2Option ($name, $const, $type) | |
Enables options only if the ibm_db2 extension version supports them. |
Primary database interface.
Definition at line 266 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::__construct | ( | $ | server = false , |
$ | user = false , |
||
$ | password = false , |
||
$ | dbName = false , |
||
$ | flags = 0 , |
||
$ | schema = self::USE_GLOBAL |
||
) |
$server | String: hostname of database server |
$user | String: username |
$password | String: password |
$dbName | String: database name on the server |
$flags | Integer: database behaviour flags (optional, unused) |
$schema | String |
Reimplemented from DatabaseBase.
Definition at line 436 of file DatabaseIbm_db2.php.
References $user, and setDB2Option().
DatabaseIbm_db2::addQuotes | ( | $ | s | ) |
Escapes strings Doesn't escape numbers.
$s | String: string to escape |
Reimplemented from DatabaseBase.
Definition at line 738 of file DatabaseIbm_db2.php.
References $s, decodeBlob(), and strencode().
Returns the number of rows affected by the last query or 0.
Implements DatabaseType.
Definition at line 1197 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::applySchema | ( | ) | [protected] |
Switch into the database schema.
Definition at line 798 of file DatabaseIbm_db2.php.
References DatabaseBase\begin(), DatabaseBase\commit(), and doQuery().
DatabaseIbm_db2::bitAnd | ( | $ | fieldLeft, |
$ | fieldRight | ||
) |
Bitwise AND of two columns or values in SQL Same as (fieldLeft & fieldRight) in C.
$fieldLeft | String |
$fieldRight | String |
Reimplemented from DatabaseBase.
Definition at line 1697 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::bitNot | ( | $ | field | ) |
Bitwise negation of a column or value in SQL Same as (~field) in C.
$field | String |
Reimplemented from DatabaseBase.
Definition at line 1685 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::bitOr | ( | $ | fieldLeft, |
$ | fieldRight | ||
) |
Bitwise OR of two columns or values in SQL Same as (fieldLeft | fieldRight) in C.
$fieldLeft | String |
$fieldRight | String |
Reimplemented from DatabaseBase.
Definition at line 1708 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::buildConcat | ( | $ | stringList | ) |
Convert into a list of string being concatenated.
$stringList | Array: strings that need to be joined together by the SQL engine |
Reimplemented from DatabaseBase.
Definition at line 1587 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::calcInsertId | ( | $ | table, |
$ | primaryKey, | ||
$ | stmt | ||
) | [private] |
Updates the mInsertId property with the value of the last insert into a generated column.
$table | String: sanitized table name |
$primaryKey | Mixed: string name of the primary key |
$stmt | Resource: prepared statement resource of the SELECT primary_key FROM FINAL TABLE ( INSERT ... ) form |
Definition at line 972 of file DatabaseIbm_db2.php.
Referenced by insert().
Returns true if this database supports (and uses) cascading deletes.
Reimplemented from DatabaseBase.
Definition at line 333 of file DatabaseIbm_db2.php.
Returns true if this database supports (and uses) triggers (e.g.
on the page table)
Reimplemented from DatabaseBase.
Definition at line 342 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::closeConnection | ( | ) | [protected] |
Closes a database connection, if it is open Returns success, true if already closed.
Reimplemented from DatabaseBase.
Definition at line 575 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::dataSeek | ( | $ | res, |
$ | row | ||
) |
Moves the row pointer of the result set.
$res | Object: result set |
$row | Integer: row number |
Implements DatabaseType.
Definition at line 1232 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::decodeBlob | ( | $ | b | ) |
Description is left as an exercise for the reader.
$b | IBM_DB2Blob: data to be decoded |
Reimplemented from DatabaseBase.
Definition at line 1577 of file DatabaseIbm_db2.php.
Referenced by addQuotes().
DatabaseIbm_db2::delete | ( | $ | table, |
$ | conds, | ||
$ | fname = 'DatabaseIbm_db2::delete' |
||
) |
DELETE query wrapper.
Use $conds == "*" to delete all rows
Reimplemented from DatabaseBase.
Definition at line 1178 of file DatabaseIbm_db2.php.
References $fname, $result, makeList(), DatabaseBase\query(), and tableName().
DatabaseIbm_db2::doBegin | ( | $ | fname = 'DatabaseIbm_db2::begin' | ) | [protected] |
Start a transaction (mandatory)
Reimplemented from DatabaseBase.
Definition at line 810 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::doCommit | ( | $ | fname = 'DatabaseIbm_db2::commit' | ) | [protected] |
End a transaction Must have a preceding begin()
Reimplemented from DatabaseBase.
Definition at line 826 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::doQuery | ( | $ | sql | ) | [protected] |
The DBMS-dependent part of query()
$sql | String: SQL query. |
Reimplemented from DatabaseBase.
Definition at line 627 of file DatabaseIbm_db2.php.
References applySchema(), and installPrint().
Referenced by applySchema(), and removeNullPrimaryKeys().
DatabaseIbm_db2::doRollback | ( | $ | fname = 'DatabaseIbm_db2::rollback' | ) | [protected] |
Cancel a transaction.
Reimplemented from DatabaseBase.
Definition at line 840 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::encodeBlob | ( | $ | b | ) |
Description is left as an exercise for the reader.
$b | Mixed: data to be encoded |
Reimplemented from DatabaseBase.
Definition at line 1568 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::execute | ( | $ | prepared, |
$ | args = null |
||
) |
Execute a prepared query with the various arguments.
$prepared | String: the prepared sql |
$args | Mixed: either an array here, or put scalars as varargs |
Reimplemented from DatabaseBase.
Definition at line 1638 of file DatabaseIbm_db2.php.
References $res, and installPrint().
DatabaseIbm_db2::extractUnixEpoch | ( | $ | column | ) |
Generates the SQL required to convert a DB2 timestamp into a Unix epoch.
$column | String: name of timestamp column |
Definition at line 1598 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::fetchObject | ( | $ | res | ) |
Fetch the next row from the given result object, in object form.
Fields can be retrieved with $row->fieldname, with fields acting like member variables.
$res | array|ResultWrapper SQL result object as returned from Database::query(), etc. |
DBUnexpectedError | Thrown if the database returns an error |
Implements DatabaseType.
Definition at line 692 of file DatabaseIbm_db2.php.
References $res, lastErrno(), lastError(), wfRestoreWarnings(), and wfSuppressWarnings().
Referenced by indexInfo(), indexUnique(), select(), and textFieldSize().
DatabaseIbm_db2::fetchRow | ( | $ | res | ) |
Fetch the next row from the given result object, in associative array form.
Fields are retrieved with $row['fieldname'].
$res | array|ResultWrapper SQL result object as returned from Database::query(), etc. |
DBUnexpectedError | Thrown if the database returns an error |
Implements DatabaseType.
Definition at line 714 of file DatabaseIbm_db2.php.
References $res, lastErrno(), lastError(), wfRestoreWarnings(), and wfSuppressWarnings().
Referenced by removeNullPrimaryKeys(), and tableExists().
DatabaseIbm_db2::fieldInfo | ( | $ | table, |
$ | field | ||
) |
Returns an information object on a table column.
$table | String: table name |
$field | String: column name |
Implements DatabaseType.
Definition at line 1494 of file DatabaseIbm_db2.php.
References IBM_DB2Field\fromText().
DatabaseIbm_db2::fieldName | ( | $ | res, |
$ | n | ||
) |
Returns the nth column name.
$res | Object: statement resource |
$n | Integer: Index of field or column |
Implements DatabaseType.
Definition at line 1285 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::fieldType | ( | $ | res, |
$ | index | ||
) |
db2_field_type() wrapper
$res | Object: result of executed statement |
$index | Mixed: number or name of the column |
Reimplemented from DatabaseBase.
Definition at line 1504 of file DatabaseIbm_db2.php.
References $res.
DatabaseIbm_db2::fillPrepared | ( | $ | preparedQuery, |
$ | args | ||
) |
For faking prepared SQL statements on DBs that don't support it directly.
$preparedQuery | String: a 'preparable' SQL statement |
$args | Array of arguments to fill it with |
Reimplemented from DatabaseBase.
Definition at line 1658 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::fillPreparedArg | ( | $ | matches | ) |
Only useful with fake prepare like in base Database class.
Reimplemented from DatabaseBase.
Definition at line 1449 of file DatabaseIbm_db2.php.
References installPrint().
DatabaseIbm_db2::freePrepared | ( | $ | prepared | ) |
Frees resources associated with a prepared statement.
Reimplemented from DatabaseBase.
Definition at line 1628 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::freeResult | ( | $ | res | ) |
Frees memory associated with a statement resource.
$res | Object: statement resource to free |
Reimplemented from DatabaseBase.
Definition at line 1252 of file DatabaseIbm_db2.php.
References $ok, $res, wfRestoreWarnings(), and wfSuppressWarnings().
Returns true if this database can use functional indexes.
Reimplemented from DatabaseBase.
Definition at line 395 of file DatabaseIbm_db2.php.
Returns the database connection object.
Definition at line 423 of file DatabaseIbm_db2.php.
Get search engine class.
All subclasses of this need to implement this if they wish to use searching.
Reimplemented from DatabaseBase.
Definition at line 1405 of file DatabaseIbm_db2.php.
Implements DatabaseType.
Definition at line 652 of file DatabaseIbm_db2.php.
static DatabaseIbm_db2::getSoftwareLink | ( | ) | [static] |
Returns link to IBM DB2 free download.
Implements DatabaseType.
Definition at line 1395 of file DatabaseIbm_db2.php.
Returns the database software identifieir.
Implements DatabaseType.
Definition at line 415 of file DatabaseIbm_db2.php.
Returns a unique string representing the wiki on the server.
Reimplemented from DatabaseBase.
Definition at line 403 of file DatabaseIbm_db2.php.
Returns true if this database does an implicit sort when doing GROUP BY.
Reimplemented from DatabaseBase.
Definition at line 368 of file DatabaseIbm_db2.php.
Returns true if this database does an implicit order by when the column has an index For example: SELECT page_title FROM page LIMIT 1.
Reimplemented from DatabaseBase.
Definition at line 378 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::indexInfo | ( | $ | table, |
$ | index, | ||
$ | fname = 'DatabaseIbm_db2::indexExists' |
||
) |
Returns information about an index If errors are explicitly ignored, returns NULL on failure.
$table | String: table name |
$index | String: index name |
$fname | String: function name for logging and profiling |
Implements DatabaseType.
Definition at line 1466 of file DatabaseIbm_db2.php.
References $fname, $res, fetchObject(), DatabaseBase\query(), and tableName().
DatabaseIbm_db2::indexUnique | ( | $ | table, |
$ | index, | ||
$ | fname = 'DatabaseIbm_db2::indexUnique' |
||
) |
Verifies that an index was created as unique.
$table | String: table name |
$index | String: index name |
$fname | string function name for profiling |
Definition at line 1521 of file DatabaseIbm_db2.php.
References $fname, $res, fetchObject(), DatabaseBase\query(), and tableName().
DatabaseIbm_db2::insert | ( | $ | table, |
$ | args, | ||
$ | fname = 'DatabaseIbm_db2::insert' , |
||
$ | options = array() |
||
) |
INSERT wrapper, inserts an array into a table.
$args may be a single associative array, or an array of arrays with numeric keys, for multi-row insert
$table | String: Name of the table to insert to. |
$args | Array: Items to insert into the table. |
$fname | String: Name of the function, for profiling |
$options | String or Array. Valid options: IGNORE |
Reimplemented from DatabaseBase.
Definition at line 991 of file DatabaseIbm_db2.php.
References $ignore, $keys, $options, $res, DatabaseBase\begin(), calcInsertId(), DatabaseBase\commit(), execute(), freePrepared(), installPrint(), lastErrno(), lastError(), IBM_DB2Helper\makeArray(), prepare(), removeNullPrimaryKeys(), and tableName().
This must be called after nextSequenceVal.
Implements DatabaseType.
Definition at line 959 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::installPrint | ( | $ | string | ) | [private] |
Outputs debug information in the appropriate place.
$string | String: the relevant debug message |
Definition at line 483 of file DatabaseIbm_db2.php.
References print, and wfDebug().
Referenced by doQuery(), execute(), fillPreparedArg(), insert(), open(), setDB2Option(), update(), and wasDeadlock().
DatabaseIbm_db2::is_numeric_type | ( | $ | type | ) |
Verifies that a DB2 column/field type is numeric.
$type | String: DB2 column type |
Definition at line 761 of file DatabaseIbm_db2.php.
Is a database connection open?
Reimplemented from DatabaseBase.
Definition at line 620 of file DatabaseIbm_db2.php.
Get the last error number Return 0 if no error.
Implements DatabaseType.
Definition at line 604 of file DatabaseIbm_db2.php.
Referenced by fetchObject(), fetchRow(), insert(), and wasDeadlock().
Retrieves the most current database error Forces a database rollback.
Implements DatabaseType.
Definition at line 584 of file DatabaseIbm_db2.php.
Referenced by fetchObject(), fetchRow(), insert(), and open().
DatabaseIbm_db2::limitResult | ( | $ | sql, |
$ | limit, | ||
$ | offset = false |
||
) |
Construct a LIMIT query with optional offset This is used for query pages.
$sql | string SQL query we will append the limit too |
$limit | integer the SQL limit |
$offset | integer the SQL offset (default false) |
Reimplemented from DatabaseBase.
Definition at line 897 of file DatabaseIbm_db2.php.
References $limit.
DatabaseIbm_db2::makeList | ( | $ | a, |
$ | mode = LIST_COMMA |
||
) |
Makes an encoded list of strings from an array $mode: LIST_COMMA - comma separated, no field names LIST_AND - ANDed WHERE clause (without the WHERE) LIST_OR - ORed WHERE clause (without the WHERE) LIST_SET - comma separated with field names, like a SET clause LIST_NAMES - comma separated field names LIST_SET_PREPARED - like LIST_SET, except with ? tokens as values.
Reimplemented from DatabaseBase.
Definition at line 859 of file DatabaseIbm_db2.php.
References $value.
DatabaseIbm_db2::makeSelectOptions | ( | $ | options | ) |
Handles ordering, grouping, and having options ('GROUP BY' => colname) Has limited support for per-column options (colnum => 'DISTINCT')
$options | array Associative array of options to be turned into an SQL query, valid keys are listed in the function. |
Reimplemented from DatabaseBase.
Definition at line 1361 of file DatabaseIbm_db2.php.
References $options.
DatabaseIbm_db2::nextSequenceValue | ( | $ | seqName | ) |
Return the next in a sequence, save the value for retrieval via insertId()
$seqName | String: name of a defined sequence in the database |
Reimplemented from DatabaseBase.
Definition at line 940 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::numFields | ( | $ | res | ) |
Returns the number of columns in a resource.
$res | Object: statement resource |
Implements DatabaseType.
Definition at line 1269 of file DatabaseIbm_db2.php.
References $res.
DatabaseIbm_db2::numRows | ( | $ | res | ) |
Returns the number of rows in the result set Has to be called right after the corresponding select query.
$res | Object result set |
Implements DatabaseType.
Definition at line 1214 of file DatabaseIbm_db2.php.
References $res.
DatabaseIbm_db2::open | ( | $ | server, |
$ | user, | ||
$ | password, | ||
$ | dbName | ||
) |
Opens a database connection and returns it Closes any existing connection.
$server | String: hostname |
$user | String |
$password | String |
$dbName | String: database name |
Implements DatabaseType.
Definition at line 501 of file DatabaseIbm_db2.php.
References $user, applySchema(), DatabaseBase\close(), installPrint(), lastError(), openUncataloged(), wfDebug(), wfDl(), wfProfileIn(), and wfProfileOut().
DatabaseIbm_db2::openCataloged | ( | $ | dbName, |
$ | user, | ||
$ | password | ||
) | [protected] |
Opens a cataloged database connection, sets mConn.
Definition at line 553 of file DatabaseIbm_db2.php.
References $user, wfRestoreWarnings(), and wfSuppressWarnings().
DatabaseIbm_db2::openUncataloged | ( | $ | dbName, |
$ | user, | ||
$ | password, | ||
$ | server, | ||
$ | port | ||
) | [protected] |
Opens an uncataloged database connection, sets mConn.
Definition at line 562 of file DatabaseIbm_db2.php.
References wfRestoreWarnings(), and wfSuppressWarnings().
Ping the server and try to reconnect if it there is no connection The connection may be closed and reopened while this happens.
Reimplemented from DatabaseBase.
Definition at line 1432 of file DatabaseIbm_db2.php.
References DatabaseBase\close(), and openUncataloged().
DatabaseIbm_db2::prepare | ( | $ | sql, |
$ | func = 'DB2::prepare' |
||
) |
Intended to be compatible with the PEAR::DB wrapper functions.
http://pear.php.net/manual/en/package.database.db.intro-execute.php
? = scalar value, quoted as necessary ! = raw SQL bit (a function for instance) & = filename; reads the file and inserts as a blob (we don't use this though...)
$sql | String: SQL statement with appropriate markers |
$func | String: Name of the function, for profiling |
Reimplemented from DatabaseBase.
Definition at line 1619 of file DatabaseIbm_db2.php.
Returns true if this database uses timestamps rather than integers.
Reimplemented from DatabaseBase.
Definition at line 360 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::removeNullPrimaryKeys | ( | $ | table, |
$ | args | ||
) | [private] |
Given a table name and a hash of columns with values Removes primary key columns from the hash where the value is NULL.
$table | String: name of the table |
$args | Array of hashes of column names with values |
Definition at line 1108 of file DatabaseIbm_db2.php.
References $keys, doQuery(), and fetchRow().
Referenced by insert().
Returns true if this database can do a native search on IP columns e.g.
this works as expected: .. WHERE rc_ip = '127.42.12.102/32';
Reimplemented from DatabaseBase.
Definition at line 387 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::select | ( | $ | table, |
$ | vars, | ||
$ | conds = '' , |
||
$ | fname = 'DatabaseIbm_db2::select' , |
||
$ | options = array() , |
||
$ | join_conds = array() |
||
) |
SELECT wrapper.
$table | Array or string, table name(s) (prefix auto-added) |
$vars | Array or string, field name(s) to be retrieved |
$conds | Array or string, condition(s) for WHERE |
$fname | String: calling function name (use __METHOD__) for logs/profiling |
$options | array Associative array of options (e.g. array( 'GROUP BY' => 'page_title' )), see Database::makeSelectOptions code for list of supported stuff |
$join_conds | array Associative array of table join conditions (optional) (e.g. array( 'page' => array('LEFT JOIN', 'page_latest=rev_id') ) |
Reimplemented from DatabaseBase.
Definition at line 1313 of file DatabaseIbm_db2.php.
References $fname, $limit, $options, $res, fetchObject(), and DatabaseBase\selectSQLText().
DatabaseIbm_db2::setDB2Option | ( | $ | name, |
$ | const, | ||
$ | type | ||
) | [private] |
Enables options only if the ibm_db2 extension version supports them.
$name | String: name of the option in the options array |
$const | String: name of the constant holding the right option value |
$type | Integer: whether this is a Connection or Statement otion |
Definition at line 465 of file DatabaseIbm_db2.php.
References installPrint().
Referenced by __construct().
DatabaseIbm_db2::setMode | ( | $ | mode | ) |
Switches module between regular and install modes.
Definition at line 1673 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::strencode | ( | $ | s | ) |
Alias for addQuotes()
$s | String: string to escape |
Implements DatabaseType.
Definition at line 781 of file DatabaseIbm_db2.php.
References $s.
Referenced by addQuotes().
Returns true if this database is strict about what can be put into an IP field.
Specifically, it uses a NULL value instead of an empty string.
Reimplemented from DatabaseBase.
Definition at line 352 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::tableExists | ( | $ | table, |
$ | fname = __METHOD__ |
||
) |
Queries whether a given table exists.
Reimplemented from DatabaseBase.
Definition at line 661 of file DatabaseIbm_db2.php.
References $count, $res, fetchRow(), and DatabaseBase\query().
DatabaseIbm_db2::tableName | ( | $ | name, |
$ | format = 'quoted' |
||
) |
Handle reserved keyword replacement in table names.
$name | Object |
$format | String Ignored parameter Default 'quoted'Boolean |
Reimplemented from DatabaseBase.
Definition at line 919 of file DatabaseIbm_db2.php.
Referenced by delete(), indexInfo(), indexUnique(), insert(), textFieldSize(), and update().
DatabaseIbm_db2::textFieldSize | ( | $ | table, |
$ | field | ||
) |
Returns the size of a text field, or -1 for "unlimited".
$table | String: table name |
$field | String: column name |
Reimplemented from DatabaseBase.
Definition at line 1549 of file DatabaseIbm_db2.php.
References $res, $size, fetchObject(), DatabaseBase\query(), and tableName().
DatabaseIbm_db2::timestamp | ( | $ | ts = 0 | ) |
Generates a timestamp in an insertable format.
$ts | string timestamp |
Reimplemented from DatabaseBase.
Definition at line 930 of file DatabaseIbm_db2.php.
References wfTimestamp().
DatabaseIbm_db2::update | ( | $ | table, |
$ | values, | ||
$ | conds, | ||
$ | fname = 'DatabaseIbm_db2::update' , |
||
$ | options = array() |
||
) |
UPDATE wrapper, takes a condition array and a SET array.
$table | String: The table to UPDATE |
$values | array An array of values to SET |
$conds | array An array of conditions ( WHERE ). Use '*' to update all rows. |
$fname | String: The Class::Function calling this function ( for the log ) |
$options | array An array of UPDATE options, can be one or more of IGNORE, LOW_PRIORITY |
Reimplemented from DatabaseBase.
Definition at line 1152 of file DatabaseIbm_db2.php.
References $options, $result, execute(), freePrepared(), installPrint(), makeList(), DatabaseBase\makeUpdateOptions(), prepare(), and tableName().
Did the last database access fail because of deadlock?
Reimplemented from DatabaseBase.
Definition at line 1413 of file DatabaseIbm_db2.php.
References installPrint(), and lastErrno().
DatabaseIbm_db2::$currentRow = 0 [protected] |
Current row number on the cursor of the last SELECT.
Definition at line 297 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::$mAffectedRows = null [protected] |
Number of rows affected by last INSERT/UPDATE/DELETE.
Definition at line 293 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::$mConnOptions = array() |
Connection config options - see constructor.
Definition at line 300 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::$mInsertId = null [protected] |
Last sequence value used for a primary key.
Definition at line 323 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::$mLastResult = null [protected] |
Result of last query.
Definition at line 291 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::$mMode = self::REGULAR_MODE [protected] |
Controls the level of debug message output.
Definition at line 320 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::$mNumRows = null [protected] |
Number of rows returned by last SELECT.
Definition at line 295 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::$mPort = null [protected] |
Database server port.
Definition at line 285 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::$mSchema = null [protected] |
Schema for tables, stored procedures, triggers.
Definition at line 287 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::$mSchemaSet = false [protected] |
Whether the schema has been applied in this session.
Definition at line 289 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::$mStmtOptions = array() |
Statement config options -- see constructor.
Definition at line 302 of file DatabaseIbm_db2.php.
const DatabaseIbm_db2::CONN_OPTION = 0x01 |
Option that applies to connection objects.
Definition at line 310 of file DatabaseIbm_db2.php.
const DatabaseIbm_db2::INSTALL_MODE = 'install' |
Installation mode -- lots of debug messages.
Definition at line 317 of file DatabaseIbm_db2.php.
const DatabaseIbm_db2::NONE_OPTION = 0x00 |
Option that applies to nothing.
Definition at line 308 of file DatabaseIbm_db2.php.
const DatabaseIbm_db2::REGULAR_MODE = 'regular' |
Regular operation mode -- minimal debug messages.
Definition at line 315 of file DatabaseIbm_db2.php.
const DatabaseIbm_db2::STMT_OPTION = 0x02 |
Option that applies to statement objects.
Definition at line 312 of file DatabaseIbm_db2.php.
const DatabaseIbm_db2::USE_GLOBAL = 'get from global' |
Default schema.
Definition at line 305 of file DatabaseIbm_db2.php.