MediaWiki  REL1_19
DatabaseIbm_db2 Class Reference

Primary database interface. More...

Inheritance diagram for DatabaseIbm_db2:
Collaboration diagram for DatabaseIbm_db2:

List of all members.

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.

Detailed Description

Primary database interface.

Definition at line 251 of file DatabaseIbm_db2.php.


Constructor & Destructor Documentation

DatabaseIbm_db2::__construct ( server = false,
user = false,
password = false,
dbName = false,
flags = 0,
schema = self::USE_GLOBAL 
)
Parameters:
$serverString: hostname of database server
$userString: username
$passwordString: password
$dbNameString: database name on the server
$flagsInteger: database behaviour flags (optional, unused)
$schemaString

Reimplemented from DatabaseBase.

Definition at line 412 of file DatabaseIbm_db2.php.

References $user, $wgDBmwschema, and setDB2Option().

Here is the call graph for this function:


Member Function Documentation

Escapes strings Doesn't escape numbers.

Parameters:
$sString: string to escape
Returns:
escaped string

Reimplemented from DatabaseBase.

Definition at line 720 of file DatabaseIbm_db2.php.

References decodeBlob(), and strencode().

Here is the call graph for this function:

Returns the number of rows affected by the last query or 0.

Returns:
Integer: the number of rows affected by the last query

Implements DatabaseType.

Definition at line 1176 of file DatabaseIbm_db2.php.

Switch into the database schema.

Definition at line 780 of file DatabaseIbm_db2.php.

References begin(), commit(), and doQuery().

Referenced by doQuery(), and open().

Here is the call graph for this function:

Here is the caller graph for this function:

Start a transaction (mandatory)

Reimplemented from DatabaseBase.

Definition at line 792 of file DatabaseIbm_db2.php.

Referenced by applySchema(), and insert().

Here is the caller graph for this function:

DatabaseIbm_db2::bitAnd ( fieldLeft,
fieldRight 
)

Bitwise AND of two columns or values in SQL Same as (fieldLeft & fieldRight) in C.

Parameters:
$fieldLeftString
$fieldRightString
Returns:
String

Reimplemented from DatabaseBase.

Definition at line 1702 of file DatabaseIbm_db2.php.

Bitwise negation of a column or value in SQL Same as (~field) in C.

Parameters:
$fieldString
Returns:
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.

Parameters:
$fieldLeftString
$fieldRightString
Returns:
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.

Parameters:
$stringListArray: strings that need to be joined together by the SQL engine
Returns:
String: joined by the concatenation operator

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.

Parameters:
$tableString: sanitized table name
$primaryKeyMixed: string name of the primary key
$stmtResource: 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().

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

DatabaseIbm_db2::dataSeek ( res,
row 
)

Moves the row pointer of the result set.

Parameters:
$resObject: result set
$rowInteger: row number
Returns:
success or failure

Implements DatabaseType.

Definition at line 1211 of file DatabaseIbm_db2.php.

References $res, and wfDebug().

Here is the call graph for this function:

Description is left as an exercise for the reader.

Parameters:
$bIBM_DB2Blob: data to be decoded
Returns:
mixed

Reimplemented from DatabaseBase.

Definition at line 1564 of file DatabaseIbm_db2.php.

Referenced by addQuotes().

Here is the caller graph for this function:

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().

Here is the call graph for this function:

DatabaseIbm_db2::doQuery ( sql) [protected]

The DBMS-dependent part of query()

Parameters:
$sqlString: SQL query.
Returns:
object Result object for fetch functions or false on failure

Reimplemented from DatabaseBase.

Definition at line 609 of file DatabaseIbm_db2.php.

References applySchema(), and installPrint().

Referenced by applySchema(), and removeNullPrimaryKeys().

Here is the call graph for this function:

Here is the caller graph for this function:

Description is left as an exercise for the reader.

Parameters:
$bMixed: data to be encoded
Returns:
IBM_DB2Blob

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.

Parameters:
$preparedString: the prepared sql
$argsMixed: either an array here, or put scalars as varargs
Returns:
Resource: results object

Reimplemented from DatabaseBase.

Definition at line 1625 of file DatabaseIbm_db2.php.

References $res, and installPrint().

Referenced by insert(), safeQuery(), and update().

Here is the call graph for this function:

Here is the caller graph for this function:

Generates the SQL required to convert a DB2 timestamp into a Unix epoch.

Parameters:
$columnString: name of timestamp column
Returns:
String: SQL code

Definition at line 1585 of file DatabaseIbm_db2.php.

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.

Parameters:
$resSQL result object as returned from Database::query(), etc.
Returns:
DB2 row object
Exceptions:
DBUnexpectedErrorThrown 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().

Here is the call graph for this function:

Here is the caller graph for this function:

Fetch the next row from the given result object, in associative array form.

Fields are retrieved with $row['fieldname'].

Parameters:
$resSQL result object as returned from Database::query(), etc.
Returns:
DB2 row object
Exceptions:
DBUnexpectedErrorThrown 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().

Here is the call graph for this function:

Here is the caller graph for this function:

DatabaseIbm_db2::fieldInfo ( table,
field 
)

Returns an information object on a table column.

Parameters:
$tableString: table name
$fieldString: column name
Returns:
IBM_DB2Field

Implements DatabaseType.

Definition at line 1481 of file DatabaseIbm_db2.php.

References IBM_DB2Field\fromText().

Here is the call graph for this function:

DatabaseIbm_db2::fieldName ( res,
n 
)

Returns the nth column name.

Parameters:
$resObject: statement resource
$nInteger: Index of field or column
Returns:
String name of nth column

Implements DatabaseType.

Definition at line 1264 of file DatabaseIbm_db2.php.

References $n, and $res.

DatabaseIbm_db2::fieldType ( res,
index 
)

db2_field_type() wrapper

Parameters:
$resObject: result of executed statement
$indexMixed: number or name of the column
Returns:
String column type

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.

Parameters:
$preparedQueryString: a 'preparable' SQL statement
$argsArray of arguments to fill it with
Returns:
String: executable statement

Reimplemented from DatabaseBase.

Definition at line 1664 of file DatabaseIbm_db2.php.

Only useful with fake prepare like in base Database class.

Returns:
string

Reimplemented from DatabaseBase.

Definition at line 1436 of file DatabaseIbm_db2.php.

References installPrint().

Here is the call graph for this function:

Frees resources associated with a prepared statement.

Returns:
Boolean success or failure

Reimplemented from DatabaseBase.

Definition at line 1615 of file DatabaseIbm_db2.php.

Referenced by insert(), safeQuery(), and update().

Here is the caller graph for this function:

Frees memory associated with a statement resource.

Parameters:
$resObject: statement resource to free
Returns:
Boolean success or failure

Reimplemented from DatabaseBase.

Definition at line 1231 of file DatabaseIbm_db2.php.

References $ok, $res, wfRestoreWarnings(), and wfSuppressWarnings().

Here is the call graph for this function:

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.

Returns:
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.

Returns:
String

Reimplemented from DatabaseBase.

Definition at line 1384 of file DatabaseIbm_db2.php.

Returns:
string Version information from the database

Implements DatabaseType.

Definition at line 634 of file DatabaseIbm_db2.php.

static DatabaseIbm_db2::getSoftwareLink ( ) [static]

Returns link to IBM DB2 free download.

Returns:
String: wikitext of a link to the server software's web site

Implements DatabaseType.

Definition at line 1374 of file DatabaseIbm_db2.php.

Returns the database software identifieir.

Returns:
string

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.

Parameters:
$tableString: table name
$indexString: index name
$fnameString: function name for logging and profiling
Returns:
Object query row in object form

Implements DatabaseType.

Definition at line 1453 of file DatabaseIbm_db2.php.

References $fname, $res, fetchObject(), DatabaseBase\query(), and tableName().

Here is the call graph for this function:

DatabaseIbm_db2::indexUnique ( table,
index,
fname = 'DatabaseIbm_db2::indexUnique' 
)

Verifies that an index was created as unique.

Parameters:
$tableString: table name
$indexString: index name
$fnamefunction name for profiling
Returns:
Bool

Definition at line 1508 of file DatabaseIbm_db2.php.

References $fname, $res, fetchObject(), DatabaseBase\query(), and tableName().

Here is the call graph for this function:

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

Parameters:
$tableString: Name of the table to insert to.
$argsArray: Items to insert into the table.
$fnameString: Name of the function, for profiling
$optionsString or Array. Valid options: IGNORE
Returns:
bool Success of insert operation. IGNORE always returns true.

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().

Here is the call graph for this function:

This must be called after nextSequenceVal.

Returns:
Last sequence value used as a primary key

Implements DatabaseType.

Definition at line 939 of file DatabaseIbm_db2.php.

DatabaseIbm_db2::installPrint ( string) [private]

Outputs debug information in the appropriate place.

Parameters:
$stringString: 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().

Here is the call graph for this function:

Here is the caller graph for this function:

Verifies that a DB2 column/field type is numeric.

Parameters:
$typeString: DB2 column type
Returns:
Boolean: true if numeric

Definition at line 743 of file DatabaseIbm_db2.php.

Is a database connection open?

Returns:

Reimplemented from DatabaseBase.

Definition at line 602 of file DatabaseIbm_db2.php.

Get the last error number Return 0 if no error.

Returns:
integer

Implements DatabaseType.

Definition at line 586 of file DatabaseIbm_db2.php.

Referenced by fetchObject(), fetchRow(), insert(), and wasDeadlock().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

DatabaseIbm_db2::limitResult ( sql,
limit,
offset = false 
)

Construct a LIMIT query with optional offset This is used for query pages.

Parameters:
$sqlstring SQL query we will append the limit too
$limitinteger the SQL limit
$offsetinteger 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.

Returns:
string $sql

Reimplemented from DatabaseBase.

Definition at line 1427 of file DatabaseIbm_db2.php.

References installPrint().

Here is the call graph for this function:

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().

Here is the caller graph for this function:

Handles ordering, grouping, and having options ('GROUP BY' => colname) Has limited support for per-column options (colnum => 'DISTINCT')

Access:
private
Parameters:
$optionsAssociative array of options to be turned into an SQL query, valid keys are listed in the function.
Returns:
Array

Reimplemented from DatabaseBase.

Definition at line 1340 of file DatabaseIbm_db2.php.

References $options.

Return the next in a sequence, save the value for retrieval via insertId()

Parameters:
$seqNameString: name of a defined sequence in the database
Returns:
next value in that sequence

Reimplemented from DatabaseBase.

Definition at line 920 of file DatabaseIbm_db2.php.

Returns the number of columns in a resource.

Parameters:
$resObject: statement resource
Returns:
Number of fields/columns in resource

Implements DatabaseType.

Definition at line 1248 of file DatabaseIbm_db2.php.

References $res.

Returns the number of rows in the result set Has to be called right after the corresponding select query.

Parameters:
$resObject result set
Returns:
Integer: number of rows

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.

Parameters:
$serverString: hostname
$userString
$passwordString
$dbNameString: database name
Returns:
a fresh connection

Implements DatabaseType.

Definition at line 477 of file DatabaseIbm_db2.php.

References $user, $wgDBport, applySchema(), close(), installPrint(), lastError(), openUncataloged(), wfDebug(), wfDl(), wfProfileIn(), and wfProfileOut().

Here is the call graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

Ping the server and try to reconnect if it there is no connection The connection may be closed and reopened while this happens.

Returns:
Boolean: whether the connection exists

Reimplemented from DatabaseBase.

Definition at line 1411 of file DatabaseIbm_db2.php.

References close(), and openUncataloged().

Here is the call graph for this function:

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...)

Parameters:
$sqlString: SQL statement with appropriate markers
$funcString: Name of the function, for profiling
Returns:
resource a prepared DB2 SQL statement

Reimplemented from DatabaseBase.

Definition at line 1606 of file DatabaseIbm_db2.php.

Referenced by insert(), safeQuery(), and update().

Here is the caller graph for this function:

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.

Parameters:
$tableString: name of the table
$argsArray of hashes of column names with values
Returns:
Array: tuple( filtered array of columns, array of primary keys )

Definition at line 1088 of file DatabaseIbm_db2.php.

References $keys, doQuery(), and fetchRow().

Referenced by insert().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
$queryString
$args...

Reimplemented from DatabaseBase.

Definition at line 1644 of file DatabaseIbm_db2.php.

References execute(), freePrepared(), and prepare().

Here is the call graph for this function:

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.

Parameters:
$tableArray or string, table name(s) (prefix auto-added)
$varsArray or string, field name(s) to be retrieved
$condsArray or string, condition(s) for WHERE
$fnameString: calling function name (use __METHOD__) for logs/profiling
$optionsAssociative array of options (e.g. array( 'GROUP BY' => 'page_title' )), see Database::makeSelectOptions code for list of supported stuff
$join_condsAssociative array of table join conditions (optional) (e.g. array( 'page' => array('LEFT JOIN', 'page_latest=rev_id') )
Returns:
Mixed: database result resource for fetch functions or false on failure

Reimplemented from DatabaseBase.

Definition at line 1292 of file DatabaseIbm_db2.php.

References $fname, $limit, $options, $res, fetchObject(), and DatabaseBase\selectSQLText().

Here is the call graph for this function:

DatabaseIbm_db2::setDB2Option ( name,
const,
type 
) [private]

Enables options only if the ibm_db2 extension version supports them.

Parameters:
$nameString: name of the option in the options array
$constString: name of the constant holding the right option value
$typeInteger: whether this is a Connection or Statement otion

Definition at line 441 of file DatabaseIbm_db2.php.

References installPrint().

Referenced by __construct().

Here is the call graph for this function:

Here is the caller graph for this function:

Switches module between regular and install modes.

Definition at line 1678 of file DatabaseIbm_db2.php.

Alias for addQuotes()

Parameters:
$sString: string to escape
Returns:
escaped string

Implements DatabaseType.

Definition at line 763 of file DatabaseIbm_db2.php.

Referenced by addQuotes().

Here is the caller graph for this function:

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.

Returns:
boolean

Reimplemented from DatabaseBase.

Definition at line 643 of file DatabaseIbm_db2.php.

References $count, $res, fetchRow(), and DatabaseBase\query().

Here is the call graph for this function:

DatabaseIbm_db2::tableName ( name,
format = 'quoted' 
)

Handle reserved keyword replacement in table names.

Parameters:
$nameObject
$formatString Ignored parameter Default 'quoted'Boolean
Returns:
String

Reimplemented from DatabaseBase.

Definition at line 899 of file DatabaseIbm_db2.php.

Referenced by delete(), indexInfo(), indexUnique(), insert(), textFieldSize(), and update().

Here is the caller graph for this function:

DatabaseIbm_db2::textFieldSize ( table,
field 
)

Returns the size of a text field, or -1 for "unlimited".

Parameters:
$tableString: table name
$fieldString: column name
Returns:
Integer: length or -1 for unlimited

Reimplemented from DatabaseBase.

Definition at line 1536 of file DatabaseIbm_db2.php.

References $res, $size, fetchObject(), DatabaseBase\query(), and tableName().

Here is the call graph for this function:

Generates a timestamp in an insertable format.

Parameters:
$tstimestamp
Returns:
String: timestamp value

Reimplemented from DatabaseBase.

Definition at line 910 of file DatabaseIbm_db2.php.

References wfTimestamp().

Here is the call graph for this function:

DatabaseIbm_db2::update ( table,
values,
conds,
fname = 'DatabaseIbm_db2::update',
options = array() 
)

UPDATE wrapper, takes a condition array and a SET array.

Parameters:
$tableString: The table to UPDATE
$valuesAn array of values to SET
$condsAn array of conditions ( WHERE ). Use '*' to update all rows.
$fnameString: The Class::Function calling this function ( for the log )
$optionsAn array of UPDATE options, can be one or more of IGNORE, LOW_PRIORITY
Returns:
Boolean

Reimplemented from DatabaseBase.

Definition at line 1132 of file DatabaseIbm_db2.php.

References $options, $result, execute(), freePrepared(), installPrint(), makeList(), DatabaseBase\makeUpdateOptions(), prepare(), and tableName().

Here is the call graph for this function:

Did the last database access fail because of deadlock?

Returns:
Boolean

Reimplemented from DatabaseBase.

Definition at line 1392 of file DatabaseIbm_db2.php.

References installPrint(), and lastErrno().

Here is the call graph for this function:


Member Data Documentation

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.

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.

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.

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.


The documentation for this class was generated from the following file: