MediaWiki
REL1_19
|
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. | |
begin ($fname= 'DatabaseIbm_db2::begin') | |
Start a transaction (mandatory) | |
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. | |
close () | |
Closes a database connection, if it is open Returns success, true if already closed. | |
commit ($fname= 'DatabaseIbm_db2::commit') | |
End a transaction Must have a preceding begin() | |
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. | |
limitResultForUpdate ($sql, $num) | |
Not implemented. | |
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. | |
rollback ($fname= 'DatabaseIbm_db2::rollback') | |
Cancel a transaction. | |
safeQuery ($query, $args=null) | |
Prepare & execute an SQL statement, quoting and inserting arguments in the appropriate places. | |
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. | |
doQuery ($sql) | |
The DBMS-dependent part of query() | |
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 251 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 412 of file DatabaseIbm_db2.php.
References $user, $wgDBmwschema, and setDB2Option().
DatabaseIbm_db2::addQuotes | ( | $ | s | ) |
Escapes strings Doesn't escape numbers.
$s | String: string to escape |
Reimplemented from DatabaseBase.
Definition at line 720 of file DatabaseIbm_db2.php.
References decodeBlob(), and strencode().
Returns the number of rows affected by the last query or 0.
Implements DatabaseType.
Definition at line 1176 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::applySchema | ( | ) | [protected] |
DatabaseIbm_db2::begin | ( | $ | fname = 'DatabaseIbm_db2::begin' | ) |
Start a transaction (mandatory)
Reimplemented from DatabaseBase.
Definition at line 792 of file DatabaseIbm_db2.php.
Referenced by applySchema(), and insert().
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 1702 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 1690 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 1713 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 1574 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 952 of file DatabaseIbm_db2.php.
Referenced by insert().
Returns true if this database supports (and uses) cascading deletes.
Reimplemented from DatabaseBase.
Definition at line 317 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 325 of file DatabaseIbm_db2.php.
Closes a database connection, if it is open Returns success, true if already closed.
Reimplemented from DatabaseBase.
Definition at line 550 of file DatabaseIbm_db2.php.
References commit(), and DatabaseBase\trxLevel().
Referenced by open(), and ping().
DatabaseIbm_db2::commit | ( | $ | fname = 'DatabaseIbm_db2::commit' | ) |
End a transaction Must have a preceding begin()
Reimplemented from DatabaseBase.
Definition at line 808 of file DatabaseIbm_db2.php.
Referenced by applySchema(), close(), and insert().
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 1211 of file DatabaseIbm_db2.php.
References $res, and wfDebug().
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 1564 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 1157 of file DatabaseIbm_db2.php.
References $fname, $result, makeList(), DatabaseBase\query(), and tableName().
DatabaseIbm_db2::doQuery | ( | $ | sql | ) | [protected] |
The DBMS-dependent part of query()
$sql | String: SQL query. |
Reimplemented from DatabaseBase.
Definition at line 609 of file DatabaseIbm_db2.php.
References applySchema(), and installPrint().
Referenced by applySchema(), and removeNullPrimaryKeys().
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 1555 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 1625 of file DatabaseIbm_db2.php.
References $res, and installPrint().
Referenced by insert(), safeQuery(), and update().
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 1585 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 | SQL result object as returned from Database::query(), etc. |
DBUnexpectedError | Thrown if the database returns an error |
Implements DatabaseType.
Definition at line 674 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 | SQL result object as returned from Database::query(), etc. |
DBUnexpectedError | Thrown if the database returns an error |
Implements DatabaseType.
Definition at line 696 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 1481 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 1264 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 1491 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 1664 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 1436 of file DatabaseIbm_db2.php.
References installPrint().
DatabaseIbm_db2::freePrepared | ( | $ | prepared | ) |
Frees resources associated with a prepared statement.
Reimplemented from DatabaseBase.
Definition at line 1615 of file DatabaseIbm_db2.php.
Referenced by insert(), safeQuery(), and update().
DatabaseIbm_db2::freeResult | ( | $ | res | ) |
Frees memory associated with a statement resource.
$res | Object: statement resource to free |
Reimplemented from DatabaseBase.
Definition at line 1231 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 372 of file DatabaseIbm_db2.php.
Returns the database connection object.
Definition at line 399 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 1384 of file DatabaseIbm_db2.php.
Implements DatabaseType.
Definition at line 634 of file DatabaseIbm_db2.php.
static DatabaseIbm_db2::getSoftwareLink | ( | ) | [static] |
Returns link to IBM DB2 free download.
Implements DatabaseType.
Definition at line 1374 of file DatabaseIbm_db2.php.
Returns the database software identifieir.
Implements DatabaseType.
Definition at line 391 of file DatabaseIbm_db2.php.
Returns a unique string representing the wiki on the server.
Reimplemented from DatabaseBase.
Definition at line 379 of file DatabaseIbm_db2.php.
Returns true if this database does an implicit sort when doing GROUP BY.
Reimplemented from DatabaseBase.
Definition at line 348 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 357 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 1453 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 | function name for profiling |
Definition at line 1508 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 971 of file DatabaseIbm_db2.php.
References $ignore, $keys, $options, $res, begin(), calcInsertId(), commit(), execute(), freePrepared(), installPrint(), lastErrno(), lastError(), IBM_DB2Helper\makeArray(), prepare(), removeNullPrimaryKeys(), and tableName().
This must be called after nextSequenceVal.
Implements DatabaseType.
Definition at line 939 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 459 of file DatabaseIbm_db2.php.
References print, and wfDebug().
Referenced by doQuery(), execute(), fillPreparedArg(), insert(), limitResultForUpdate(), 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 743 of file DatabaseIbm_db2.php.
Is a database connection open?
Reimplemented from DatabaseBase.
Definition at line 602 of file DatabaseIbm_db2.php.
Get the last error number Return 0 if no error.
Implements DatabaseType.
Definition at line 586 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 566 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 877 of file DatabaseIbm_db2.php.
References $limit.
DatabaseIbm_db2::limitResultForUpdate | ( | $ | sql, |
$ | num | ||
) |
Not implemented.
Reimplemented from DatabaseBase.
Definition at line 1427 of file DatabaseIbm_db2.php.
References installPrint().
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 840 of file DatabaseIbm_db2.php.
Referenced by delete(), and update().
DatabaseIbm_db2::makeSelectOptions | ( | $ | options | ) |
Handles ordering, grouping, and having options ('GROUP BY' => colname) Has limited support for per-column options (colnum => 'DISTINCT')
$options | Associative array of options to be turned into an SQL query, valid keys are listed in the function. |
Reimplemented from DatabaseBase.
Definition at line 1340 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 920 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 1248 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 1193 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 477 of file DatabaseIbm_db2.php.
References $user, $wgDBport, applySchema(), 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 529 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 538 of file DatabaseIbm_db2.php.
References wfRestoreWarnings(), and wfSuppressWarnings().
Referenced by open(), and ping().
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 1411 of file DatabaseIbm_db2.php.
References 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 1606 of file DatabaseIbm_db2.php.
Referenced by insert(), safeQuery(), and update().
Returns true if this database uses timestamps rather than integers.
Reimplemented from DatabaseBase.
Definition at line 341 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 1088 of file DatabaseIbm_db2.php.
References $keys, doQuery(), and fetchRow().
Referenced by insert().
DatabaseIbm_db2::rollback | ( | $ | fname = 'DatabaseIbm_db2::rollback' | ) |
Cancel a transaction.
Reimplemented from DatabaseBase.
Definition at line 822 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::safeQuery | ( | $ | query, |
$ | args = null |
||
) |
Prepare & execute an SQL statement, quoting and inserting arguments in the appropriate places.
$query | String |
$args | ... |
Reimplemented from DatabaseBase.
Definition at line 1644 of file DatabaseIbm_db2.php.
References execute(), freePrepared(), and prepare().
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 365 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 | Associative array of options (e.g. array( 'GROUP BY' => 'page_title' )), see Database::makeSelectOptions code for list of supported stuff |
$join_conds | Associative array of table join conditions (optional) (e.g. array( 'page' => array('LEFT JOIN', 'page_latest=rev_id') ) |
Reimplemented from DatabaseBase.
Definition at line 1292 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 441 of file DatabaseIbm_db2.php.
References installPrint().
Referenced by __construct().
DatabaseIbm_db2::setMode | ( | $ | mode | ) |
Switches module between regular and install modes.
Definition at line 1678 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::strencode | ( | $ | s | ) |
Alias for addQuotes()
$s | String: string to escape |
Implements DatabaseType.
Definition at line 763 of file DatabaseIbm_db2.php.
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 334 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::tableExists | ( | $ | table, |
$ | fname = __METHOD__ |
||
) |
Queries whether a given table exists.
Reimplemented from DatabaseBase.
Definition at line 643 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 899 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 1536 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 | timestamp |
Reimplemented from DatabaseBase.
Definition at line 910 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 | An array of values to SET |
$conds | An array of conditions ( WHERE ). Use '*' to update all rows. |
$fname | String: The Class::Function calling this function ( for the log ) |
$options | An array of UPDATE options, can be one or more of IGNORE, LOW_PRIORITY |
Reimplemented from DatabaseBase.
Definition at line 1132 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 1392 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 282 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::$mAffectedRows = null [protected] |
Number of rows affected by last INSERT/UPDATE/DELETE.
Definition at line 278 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::$mConnOptions = array() |
Connection config options - see constructor.
Definition at line 285 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::$mInsertId = null [protected] |
Last sequence value used for a primary key.
Definition at line 308 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::$mLastResult = null [protected] |
Result of last query.
Definition at line 276 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::$mMode = self::REGULAR_MODE [protected] |
Controls the level of debug message output.
Definition at line 305 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::$mNumRows = null [protected] |
Number of rows returned by last SELECT.
Definition at line 280 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::$mPort = null [protected] |
Database server port.
Definition at line 270 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::$mSchema = null [protected] |
Schema for tables, stored procedures, triggers.
Definition at line 272 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::$mSchemaSet = false [protected] |
Whether the schema has been applied in this session.
Definition at line 274 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::$mStmtOptions = array() |
Statement config options -- see constructor.
Definition at line 287 of file DatabaseIbm_db2.php.
const DatabaseIbm_db2::CONN_OPTION = 0x01 |
Option that applies to connection objects.
Definition at line 295 of file DatabaseIbm_db2.php.
const DatabaseIbm_db2::INSTALL_MODE = 'install' |
Installation mode -- lots of debug messages.
Definition at line 302 of file DatabaseIbm_db2.php.
const DatabaseIbm_db2::NONE_OPTION = 0x00 |
Option that applies to nothing.
Definition at line 293 of file DatabaseIbm_db2.php.
const DatabaseIbm_db2::REGULAR_MODE = 'regular' |
Regular operation mode -- minimal debug messages.
Definition at line 300 of file DatabaseIbm_db2.php.
const DatabaseIbm_db2::STMT_OPTION = 0x02 |
Option that applies to statement objects.
Definition at line 297 of file DatabaseIbm_db2.php.
const DatabaseIbm_db2::USE_GLOBAL = 'get from global' |
Default schema.
Definition at line 290 of file DatabaseIbm_db2.php.