Inherits DatabaseBase.
Public Member Functions | |
cascadingDeletes () | |
Returns true if this database supports (and uses) cascading deletes. | |
cleanupTriggers () | |
Returns true if this database supports (and uses) triggers (e.g. | |
strictIPs () | |
Returns true if this database is strict about what can be put into an IP field. | |
realTimestamps () | |
Returns true if this database uses timestamps rather than integers. | |
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. | |
searchableIPs () | |
Returns true if this database can do a native search on IP columns e.g. | |
functionalIndexes () | |
Returns true if this database can use functional indexes. | |
getWikiID () | |
Returns a unique string representing the wiki on the server. | |
getType () | |
Get the type of the DBMS, as it appears in $wgDBtype. | |
DatabaseIbm_db2 ($server=false, $user=false, $password=false, $dbName=false, $failFunction=false, $flags=0, $schema=self::USE_GLOBAL) | |
open ($server, $user, $password, $dbName) | |
Opens a database connection and returns it Closes any existing connection. | |
close () | |
Closes a database connection, if it is open Returns success, true if already closed. | |
lastError () | |
Retrieves the most current database error Forces a database rollback. | |
lastErrno () | |
Get the last error number Return 0 if no error. | |
isOpen () | |
Is a database connection open? | |
doQuery ($sql) | |
The DBMS-dependent part of query(). | |
getServerVersion () | |
tableExists ($table) | |
Queries whether a given table exists. | |
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. | |
initial_setup () | |
Override if introduced to base Database class. | |
setup_database () | |
Create tables, stored procedures, and so on. | |
addQuotes ($s) | |
Escapes strings Doesn't escape numbers. | |
is_numeric_type ($type) | |
Verifies that a DB2 column/field type is numeric. | |
strencode ($s) | |
Alias for addQuotes(). | |
begin ($fname= 'DatabaseIbm_db2::begin') | |
Start a transaction (mandatory). | |
commit ($fname= 'DatabaseIbm_db2::commit') | |
End a transaction Must have a preceding begin(). | |
rollback ($fname= 'DatabaseIbm_db2::rollback') | |
Cancel a transaction. | |
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. | |
limitResult ($sql, $limit, $offset=false) | |
Construct a LIMIT query with optional offset This is used for query pages. | |
tableName ($name) | |
Handle reserved keyword replacement in table names. | |
timestamp ($ts=0) | |
Generates a timestamp in an insertable format. | |
nextSequenceValue ($seqName) | |
Return the next in a sequence, save the value for retrieval via insertId(). | |
insertId () | |
This must be called after nextSequenceVal. | |
insert ($table, $args, $fname= 'DatabaseIbm_db2::insert', $options=array()) | |
INSERT wrapper, inserts an array into a table. | |
update ($table, $values, $conds, $fname= 'Database::update', $options=array()) | |
UPDATE wrapper, takes a condition array and a SET array. | |
delete ($table, $conds, $fname= 'Database::delete') | |
DELETE query wrapper. | |
affectedRows () | |
Returns the number of rows affected by the last query or 0. | |
replace ($table, $uniqueIndexes, $rows, $fname= 'DatabaseIbm_db2::replace') | |
Simulates REPLACE with a DELETE followed by INSERT. | |
numRows ($res) | |
Returns the number of rows in the result set Has to be called right after the corresponding select query. | |
dataSeek ($res, $row) | |
Moves the row pointer of the result set. | |
freeResult ($res) | |
Frees memory associated with a statement resource. | |
numFields ($res) | |
Returns the number of columns in a resource. | |
fieldName ($res, $n) | |
Returns the nth column name. | |
select ($table, $vars, $conds='', $fname= 'DatabaseIbm_db2::select', $options=array(), $join_conds=array()) | |
SELECT wrapper. | |
makeSelectOptions ($options) | |
Handles ordering, grouping, and having options ('GROUP BY' => colname) Has limited support for per-column options (colnum => 'DISTINCT'). | |
getSoftwareLink () | |
Returns link to IBM DB2 free download. | |
getSearchEngine () | |
Get search engine class. | |
wasDeadlock () | |
Did the last database access fail because of deadlock? | |
ping () | |
Ping the server and try to reconnect if it there is no connection The connection may be closed and reopened while this happens. | |
getStatus ($which="%") | |
Not implemented. | |
setFakeSlaveLag ($lag) | |
Not implemented TODO. | |
setFakeMaster ($enabled=true) | |
Not implemented. | |
limitResultForUpdate ($sql, $num) | |
Not implemented. | |
fillPreparedArg ($matches) | |
Only useful with fake prepare like in base Database class. | |
fieldExists ($table, $field, $fname= 'DatabaseIbm_db2::fieldExists') | |
Query whether a given column exists in the mediawiki schema. | |
indexInfo ($table, $index, $fname= 'DatabaseIbm_db2::indexExists') | |
Returns information about an index If errors are explicitly ignored, returns NULL on failure. | |
fieldInfo ($table, $field) | |
Returns an information object on a table column. | |
fieldType ($res, $index) | |
db2_field_type() wrapper | |
indexUnique ($table, $index, $fname= 'Database::indexUnique') | |
Verifies that an index was created as unique. | |
textFieldSize ($table, $field) | |
Returns the size of a text field, or -1 for "unlimited". | |
deleteJoin ($delTable, $joinTable, $delVar, $joinVar, $conds, $fname="DatabaseIbm_db2::deleteJoin") | |
DELETE where the condition is a join. | |
encodeBlob ($b) | |
Description is left as an exercise for the reader. | |
decodeBlob ($b) | |
Description is left as an exercise for the reader. | |
buildConcat ($stringList) | |
Convert into a list of string being concatenated. | |
extractUnixEpoch ($column) | |
Generates the SQL required to convert a DB2 timestamp into a Unix epoch. | |
prepare ($sql, $func= 'DB2::prepare') | |
Intended to be compatible with the PEAR::DB wrapper functions. | |
freePrepared ($prepared) | |
Frees resources associated with a prepared statement. | |
execute ($prepared, $args=null) | |
Execute a prepared query with the various arguments. | |
safeQuery ($query, $args=null) | |
Prepare & execute an SQL statement, quoting and inserting arguments in the appropriate places. | |
fillPrepared ($preparedQuery, $args) | |
For faking prepared SQL statements on DBs that don't support it directly. | |
setMode ($mode) | |
Switches module between regular and install modes. | |
bitNot ($field) | |
Bitwise negation of a column or value in SQL Same as (~field) in C. | |
bitAnd ($fieldLeft, $fieldRight) | |
Bitwise AND of two columns or values in SQL Same as (fieldLeft & fieldRight) in C. | |
bitOr ($fieldLeft, $fieldRight) | |
Bitwise OR of two columns or values in SQL Same as (fieldLeft | fieldRight) in C. | |
Static Public Member Functions | |
static | newFromParams ($server, $user, $password, $dbName, $failFunction=false, $flags=0) |
Returns a fresh instance of this class. | |
Public Attributes | |
$mConnOptions = array() | |
Connection config options - see constructor. | |
$mStmtOptions = array() | |
Statement config options -- see constructor. | |
const | CATALOGED = "cataloged" |
const | UNCATALOGED = "uncataloged" |
const | USE_GLOBAL = "get from global" |
const | NONE_OPTION = 0x00 |
const | CONN_OPTION = 0x01 |
const | STMT_OPTION = 0x02 |
const | REGULAR_MODE = 'regular' |
const | INSTALL_MODE = 'install' |
Protected Member Functions | |
openCataloged ($dbName, $user, $password) | |
Opens a cataloged database connection, sets mConn. | |
openUncataloged ($dbName, $user, $password, $server, $port) | |
Opens an uncataloged database connection, sets mConn. | |
applySchema () | |
Switch into the database schema. | |
Protected Attributes | |
$mPort = null | |
Server port for uncataloged connections. | |
$mCataloged = null | |
Whether connection is cataloged. | |
$mSchema = null | |
Schema for tables, stored procedures, triggers. | |
$mSchemaSet = false | |
Whether the schema has been applied in this session. | |
$mLastResult = null | |
Result of last query. | |
$mAffectedRows = null | |
Number of rows affected by last INSERT/UPDATE/DELETE. | |
$mNumRows = null | |
Number of rows returned by last SELECT. | |
$mMode = self::REGULAR_MODE | |
$mInsertId = null | |
Last sequence value used for a primary key. | |
Private Member Functions | |
setDB2Option ($name, $const, $type) | |
Enables options only if the ibm_db2 extension version supports them. | |
installPrint ($string) | |
Outputs debug information in the appropriate place. | |
calcInsertId ($table, $primaryKey, $stmt) | |
Updates the mInsertId property with the value of the last insert into a generated column. | |
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. |
Definition at line 106 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::addQuotes | ( | $ | s | ) |
Escapes strings Doesn't escape numbers.
$s | String: string to escape |
Reimplemented from DatabaseBase.
Definition at line 781 of file DatabaseIbm_db2.php.
References $s, and strencode().
Referenced by makeList(), and replace().
DatabaseIbm_db2::affectedRows | ( | ) |
Returns the number of rows affected by the last query or 0.
Reimplemented from DatabaseBase.
Definition at line 1227 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::applySchema | ( | ) | [protected] |
Switch into the database schema.
Definition at line 841 of file DatabaseIbm_db2.php.
References begin(), commit(), and doQuery().
Referenced by doQuery(), open(), and setup_database().
DatabaseIbm_db2::begin | ( | $ | fname = 'DatabaseIbm_db2::begin' |
) |
Start a transaction (mandatory).
Reimplemented from DatabaseBase.
Definition at line 853 of file DatabaseIbm_db2.php.
Referenced by applySchema(), insert(), and setup_database().
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 1830 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 1818 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 1841 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 1705 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 or a bool if this call is a do-nothing | |
$stmt | Resource: prepared statement resource of the SELECT primary_key FROM FINAL TABLE ( INSERT ... ) form |
Definition at line 1034 of file DatabaseIbm_db2.php.
References fetchRow().
Referenced by insert().
DatabaseIbm_db2::cascadingDeletes | ( | ) |
Returns true if this database supports (and uses) cascading deletes.
Reimplemented from DatabaseBase.
Definition at line 328 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::cleanupTriggers | ( | ) |
Returns true if this database supports (and uses) triggers (e.g.
on the page table)
Reimplemented from DatabaseBase.
Definition at line 335 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::close | ( | ) |
Closes a database connection, if it is open Returns success, true if already closed.
Reimplemented from DatabaseBase.
Definition at line 565 of file DatabaseIbm_db2.php.
References commit(), and DatabaseBase::trxLevel().
DatabaseIbm_db2::commit | ( | $ | fname = 'DatabaseIbm_db2::commit' |
) |
End a transaction Must have a preceding begin().
Reimplemented from DatabaseBase.
Definition at line 863 of file DatabaseIbm_db2.php.
Referenced by applySchema(), close(), insert(), and setup_database().
DatabaseIbm_db2::DatabaseIbm_db2 | ( | $ | server = false , |
|
$ | user = false , |
|||
$ | password = false , |
|||
$ | dbName = false , |
|||
$ | failFunction = 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 | |
$failFunction | Callback (optional) | |
$flags | Integer: database behaviour flags (optional, unused) | |
$schema | String |
Definition at line 414 of file DatabaseIbm_db2.php.
References $wgDBmwschema, $wgOut, open(), and setDB2Option().
Referenced by newFromParams().
DatabaseIbm_db2::dataSeek | ( | $ | res, | |
$ | row | |||
) |
Moves the row pointer of the result set.
$res | Object: result set | |
$row | Integer: row number |
Reimplemented from DatabaseBase.
Definition at line 1318 of file DatabaseIbm_db2.php.
References $res.
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 1696 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::delete | ( | $ | table, | |
$ | conds, | |||
$ | fname = 'Database::delete' | |||
) |
DELETE query wrapper.
Use $conds == "*" to delete all rows
Reimplemented from DatabaseBase.
Definition at line 1211 of file DatabaseIbm_db2.php.
References $fname, makeList(), DatabaseBase::query(), and tableName().
DatabaseIbm_db2::deleteJoin | ( | $ | delTable, | |
$ | joinTable, | |||
$ | delVar, | |||
$ | joinVar, | |||
$ | conds, | |||
$ | fname = "DatabaseIbm_db2::deleteJoin" | |||
) |
DELETE where the condition is a join.
$delTable | String: deleting from this table | |
$joinTable | String: using data from this table | |
$delVar | String: variable in deleteable table | |
$joinVar | String: variable in data table | |
$conds | Array: conditionals for join table | |
$fname | String: function name for profiling |
Reimplemented from DatabaseBase.
Definition at line 1666 of file DatabaseIbm_db2.php.
References $fname, makeList(), DatabaseBase::query(), and tableName().
DatabaseIbm_db2::doQuery | ( | $ | sql | ) |
The DBMS-dependent part of query().
$sql | String: SQL query. |
Reimplemented from DatabaseBase.
Definition at line 639 of file DatabaseIbm_db2.php.
References applySchema(), and print.
Referenced by applySchema().
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 1687 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 1756 of file DatabaseIbm_db2.php.
References $res.
Referenced by insert(), and safeQuery().
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 1716 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 |
Reimplemented from DatabaseBase.
Definition at line 697 of file DatabaseIbm_db2.php.
References $res, lastErrno(), and lastError().
Referenced by indexInfo(), indexUnique(), removeNullPrimaryKeys(), 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 |
Reimplemented from DatabaseBase.
Definition at line 716 of file DatabaseIbm_db2.php.
References $res, lastErrno(), and lastError().
Referenced by calcInsertId(), removeNullPrimaryKeys(), and tableExists().
DatabaseIbm_db2::fieldExists | ( | $ | table, | |
$ | field, | |||
$ | fname = 'DatabaseIbm_db2::fieldExists' | |||
) |
Query whether a given column exists in the mediawiki schema.
$table | String: name of the table | |
$field | String: name of the column | |
$fname | String: function name for logging and profiling |
Reimplemented from DatabaseBase.
Definition at line 1546 of file DatabaseIbm_db2.php.
References $fname, $res, freeResult(), numRows(), DatabaseBase::query(), and tableName().
DatabaseIbm_db2::fieldInfo | ( | $ | table, | |
$ | field | |||
) |
Returns an information object on a table column.
$table | String: table name | |
$field | String: column name |
Reimplemented from DatabaseBase.
Definition at line 1594 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 |
Reimplemented from DatabaseBase.
Definition at line 1361 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 1604 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 1792 of file DatabaseIbm_db2.php.
References $i.
DatabaseIbm_db2::fillPreparedArg | ( | $ | matches | ) |
Only useful with fake prepare like in base Database class.
Reimplemented from DatabaseBase.
Definition at line 1534 of file DatabaseIbm_db2.php.
References installPrint().
DatabaseIbm_db2::freePrepared | ( | $ | prepared | ) |
Frees resources associated with a prepared statement.
Reimplemented from DatabaseBase.
Definition at line 1746 of file DatabaseIbm_db2.php.
Referenced by safeQuery().
DatabaseIbm_db2::freeResult | ( | $ | res | ) |
Frees memory associated with a statement resource.
$res | Object: statement resource to free |
Reimplemented from DatabaseBase.
Definition at line 1334 of file DatabaseIbm_db2.php.
References $res.
Referenced by fieldExists(), and textFieldSize().
DatabaseIbm_db2::functionalIndexes | ( | ) |
Returns true if this database can use functional indexes.
Reimplemented from DatabaseBase.
Definition at line 380 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::getSearchEngine | ( | ) |
Get search engine class.
All subclasses of this need to implement this if they wish to use searching.
Reimplemented from DatabaseBase.
Definition at line 1458 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::getServerVersion | ( | ) |
Reimplemented from DatabaseBase.
Definition at line 660 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::getSoftwareLink | ( | ) |
Returns link to IBM DB2 free download.
Reimplemented from DatabaseBase.
Definition at line 1448 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::getStatus | ( | $ | which = "%" |
) |
Not implemented.
Reimplemented from DatabaseBase.
Definition at line 1507 of file DatabaseIbm_db2.php.
References installPrint().
DatabaseIbm_db2::getType | ( | ) |
Get the type of the DBMS, as it appears in $wgDBtype.
Reimplemented from DatabaseBase.
Definition at line 395 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::getWikiID | ( | ) |
Returns a unique string representing the wiki on the server.
Reimplemented from DatabaseBase.
Definition at line 387 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::implicitGroupby | ( | ) |
Returns true if this database does an implicit sort when doing GROUP BY.
Reimplemented from DatabaseBase.
Definition at line 357 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::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.
Reimplemented from DatabaseBase.
Definition at line 365 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 |
Reimplemented from DatabaseBase.
Definition at line 1572 of file DatabaseIbm_db2.php.
References $fname, $res, fetchObject(), DatabaseBase::query(), and tableName().
DatabaseIbm_db2::indexUnique | ( | $ | table, | |
$ | index, | |||
$ | fname = 'Database::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 1618 of file DatabaseIbm_db2.php.
References $fname, $res, fetchObject(), DatabaseBase::query(), and tableName().
DatabaseIbm_db2::initial_setup | ( | ) |
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 these 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 1054 of file DatabaseIbm_db2.php.
References $ignore, $keys, $options, $res, begin(), calcInsertId(), commit(), execute(), lastErrno(), prepare(), removeNullPrimaryKeys(), and tableName().
DatabaseIbm_db2::insertId | ( | ) |
This must be called after nextSequenceVal.
Reimplemented from DatabaseBase.
Definition at line 1023 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 463 of file DatabaseIbm_db2.php.
References print, and wfDebug().
Referenced by fillPreparedArg(), getStatus(), limitResult(), limitResultForUpdate(), open(), setDB2Option(), setFakeMaster(), setFakeSlaveLag(), 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 804 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::isOpen | ( | ) |
Is a database connection open?
Reimplemented from DatabaseBase.
Definition at line 630 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::lastErrno | ( | ) |
Get the last error number Return 0 if no error.
Reimplemented from DatabaseBase.
Definition at line 618 of file DatabaseIbm_db2.php.
Referenced by fetchObject(), fetchRow(), insert(), and wasDeadlock().
DatabaseIbm_db2::lastError | ( | ) |
Retrieves the most current database error Forces a database rollback.
Reimplemented from DatabaseBase.
Definition at line 598 of file DatabaseIbm_db2.php.
Referenced by fetchObject(), fetchRow(), open(), and setup_database().
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 959 of file DatabaseIbm_db2.php.
References installPrint().
DatabaseIbm_db2::limitResultForUpdate | ( | $ | sql, | |
$ | num | |||
) |
Not implemented.
Reimplemented from DatabaseBase.
Definition at line 1528 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.
Reimplemented from DatabaseBase.
Definition at line 890 of file DatabaseIbm_db2.php.
References $mode, and addQuotes().
Referenced by delete(), deleteJoin(), replace(), 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 1424 of file DatabaseIbm_db2.php.
References $options.
static DatabaseIbm_db2::newFromParams | ( | $ | server, | |
$ | user, | |||
$ | password, | |||
$ | dbName, | |||
$ | failFunction = false , |
|||
$ | flags = 0 | |||
) | [static] |
Returns a fresh instance of this class.
$server | String: hostname of database server | |
$user | String: username | |
$password | String | |
$dbName | String: database name on the server | |
$failFunction | Callback (optional) | |
$flags | Integer: database behaviour flags (optional, unused) |
Reimplemented from DatabaseBase.
Definition at line 589 of file DatabaseIbm_db2.php.
References DatabaseIbm_db2().
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 1005 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::numFields | ( | $ | res | ) |
Returns the number of columns in a resource.
$res | Object: statement resource |
Reimplemented from DatabaseBase.
Definition at line 1348 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 |
Reimplemented from DatabaseBase.
Definition at line 1300 of file DatabaseIbm_db2.php.
References $res.
Referenced by fieldExists().
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 |
Reimplemented from DatabaseBase.
Definition at line 480 of file DatabaseIbm_db2.php.
References applySchema(), close(), installPrint(), lastError(), openCataloged(), openUncataloged(), DatabaseBase::reportConnectionError(), wfProfileIn(), and wfProfileOut().
Referenced by DatabaseIbm_db2().
DatabaseIbm_db2::openCataloged | ( | $ | dbName, | |
$ | user, | |||
$ | password | |||
) | [protected] |
Opens a cataloged database connection, sets mConn.
Definition at line 540 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::openUncataloged | ( | $ | dbName, | |
$ | user, | |||
$ | password, | |||
$ | server, | |||
$ | port | |||
) | [protected] |
Opens an uncataloged database connection, sets mConn.
Definition at line 548 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::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 1484 of file DatabaseIbm_db2.php.
References close(), openCataloged(), 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 1737 of file DatabaseIbm_db2.php.
Referenced by insert(), and safeQuery().
DatabaseIbm_db2::realTimestamps | ( | ) |
Returns true if this database uses timestamps rather than integers.
Reimplemented from DatabaseBase.
Definition at line 350 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 1163 of file DatabaseIbm_db2.php.
References $keys, fetchObject(), and fetchRow().
Referenced by insert().
DatabaseIbm_db2::replace | ( | $ | table, | |
$ | uniqueIndexes, | |||
$ | rows, | |||
$ | fname = 'DatabaseIbm_db2::replace' | |||
) |
Simulates REPLACE with a DELETE followed by INSERT.
$table | Object | |
$uniqueIndexes | Array consisting of indexes and arrays of indexes | |
$rows | Array: rows to insert | |
$fname | String: name of the function for profiling |
Reimplemented from DatabaseBase.
Definition at line 1245 of file DatabaseIbm_db2.php.
References $fname, $rows, addQuotes(), makeList(), DatabaseBase::query(), and tableName().
DatabaseIbm_db2::rollback | ( | $ | fname = 'DatabaseIbm_db2::rollback' |
) |
Cancel a transaction.
Reimplemented from DatabaseBase.
Definition at line 873 of file DatabaseIbm_db2.php.
Referenced by setup_database().
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 1772 of file DatabaseIbm_db2.php.
References execute(), freePrepared(), and prepare().
DatabaseIbm_db2::searchableIPs | ( | ) |
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 373 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 1381 of file DatabaseIbm_db2.php.
References $fname, $options, $res, and fetchObject().
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 449 of file DatabaseIbm_db2.php.
References $name, and installPrint().
Referenced by DatabaseIbm_db2().
DatabaseIbm_db2::setFakeMaster | ( | $ | enabled = true |
) |
Not implemented.
Reimplemented from DatabaseBase.
Definition at line 1522 of file DatabaseIbm_db2.php.
References installPrint().
DatabaseIbm_db2::setFakeSlaveLag | ( | $ | lag | ) |
Not implemented TODO.
Reimplemented from DatabaseBase.
Definition at line 1517 of file DatabaseIbm_db2.php.
References installPrint().
DatabaseIbm_db2::setMode | ( | $ | mode | ) |
Switches module between regular and install modes.
Definition at line 1806 of file DatabaseIbm_db2.php.
References $mode.
DatabaseIbm_db2::setup_database | ( | ) |
Create tables, stored procedures, and so on.
Definition at line 737 of file DatabaseIbm_db2.php.
References $res, applySchema(), begin(), commit(), lastError(), print, rollback(), and DatabaseBase::sourceFile().
DatabaseIbm_db2::strencode | ( | $ | s | ) |
Alias for addQuotes().
$s | String: string to escape |
Reimplemented from DatabaseBase.
Definition at line 824 of file DatabaseIbm_db2.php.
References $s.
Referenced by addQuotes().
DatabaseIbm_db2::strictIPs | ( | ) |
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 343 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::tableExists | ( | $ | table | ) |
Queries whether a given table exists.
Reimplemented from DatabaseBase.
Definition at line 669 of file DatabaseIbm_db2.php.
References $res, fetchRow(), and DatabaseBase::query().
DatabaseIbm_db2::tableName | ( | $ | name | ) |
Handle reserved keyword replacement in table names.
$name | Object |
Reimplemented from DatabaseBase.
Definition at line 976 of file DatabaseIbm_db2.php.
References $name.
Referenced by delete(), deleteJoin(), fieldExists(), indexInfo(), indexUnique(), insert(), replace(), 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 1643 of file DatabaseIbm_db2.php.
References $res, $size, fetchObject(), freeResult(), DatabaseBase::query(), and tableName().
DatabaseIbm_db2::timestamp | ( | $ | ts = 0 |
) |
Generates a timestamp in an insertable format.
$ts | timestamp |
Reimplemented from DatabaseBase.
Definition at line 995 of file DatabaseIbm_db2.php.
References wfTimestamp().
DatabaseIbm_db2::update | ( | $ | table, | |
$ | values, | |||
$ | conds, | |||
$ | fname = 'Database::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 1196 of file DatabaseIbm_db2.php.
References $fname, $options, makeList(), DatabaseBase::makeUpdateOptions(), DatabaseBase::query(), and tableName().
DatabaseIbm_db2::wasDeadlock | ( | ) |
Did the last database access fail because of deadlock?
Reimplemented from DatabaseBase.
Definition at line 1466 of file DatabaseIbm_db2.php.
References installPrint(), and lastErrno().
DatabaseIbm_db2::$mAffectedRows = null [protected] |
Number of rows affected by last INSERT/UPDATE/DELETE.
Definition at line 136 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::$mCataloged = null [protected] |
DatabaseIbm_db2::$mConnOptions = array() |
DatabaseIbm_db2::$mInsertId = null [protected] |
DatabaseIbm_db2::$mLastResult = null [protected] |
DatabaseIbm_db2::$mMode = self::REGULAR_MODE [protected] |
Definition at line 158 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::$mNumRows = null [protected] |
DatabaseIbm_db2::$mPort = null [protected] |
DatabaseIbm_db2::$mSchema = null [protected] |
DatabaseIbm_db2::$mSchemaSet = false [protected] |
Whether the schema has been applied in this session.
Definition at line 132 of file DatabaseIbm_db2.php.
DatabaseIbm_db2::$mStmtOptions = array() |
const DatabaseIbm_db2::CATALOGED = "cataloged" |
Definition at line 146 of file DatabaseIbm_db2.php.
const DatabaseIbm_db2::CONN_OPTION = 0x01 |
Definition at line 151 of file DatabaseIbm_db2.php.
const DatabaseIbm_db2::INSTALL_MODE = 'install' |
Definition at line 155 of file DatabaseIbm_db2.php.
const DatabaseIbm_db2::NONE_OPTION = 0x00 |
Definition at line 150 of file DatabaseIbm_db2.php.
const DatabaseIbm_db2::REGULAR_MODE = 'regular' |
Definition at line 154 of file DatabaseIbm_db2.php.
const DatabaseIbm_db2::STMT_OPTION = 0x02 |
Definition at line 152 of file DatabaseIbm_db2.php.
const DatabaseIbm_db2::UNCATALOGED = "uncataloged" |
Definition at line 147 of file DatabaseIbm_db2.php.
const DatabaseIbm_db2::USE_GLOBAL = "get from global" |
Definition at line 148 of file DatabaseIbm_db2.php.