MediaWiki  REL1_20
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.
 bitAnd ($fieldLeft, $fieldRight)
 Bitwise AND of two columns or values in SQL Same as (fieldLeft & fieldRight) in C.
 bitNot ($field)
 Bitwise negation of a column or value in SQL Same as (~field) in C.
 bitOr ($fieldLeft, $fieldRight)
 Bitwise OR of two columns or values in SQL Same as (fieldLeft | fieldRight) in C.
 buildConcat ($stringList)
 Convert into a list of string being concatenated.
 cascadingDeletes ()
 Returns true if this database supports (and uses) cascading deletes.
 cleanupTriggers ()
 Returns true if this database supports (and uses) triggers (e.g.
 dataSeek ($res, $row)
 Moves the row pointer of the result set.
 decodeBlob ($b)
 Description is left as an exercise for the reader.
 delete ($table, $conds, $fname= 'DatabaseIbm_db2::delete')
 DELETE query wrapper.
 encodeBlob ($b)
 Description is left as an exercise for the reader.
 execute ($prepared, $args=null)
 Execute a prepared query with the various arguments.
 extractUnixEpoch ($column)
 Generates the SQL required to convert a DB2 timestamp into a Unix epoch.
 fetchObject ($res)
 Fetch the next row from the given result object, in object form.
 fetchRow ($res)
 Fetch the next row from the given result object, in associative array form.
 fieldInfo ($table, $field)
 Returns an information object on a table column.
 fieldName ($res, $n)
 Returns the nth column name.
 fieldType ($res, $index)
 db2_field_type() wrapper
 fillPrepared ($preparedQuery, $args)
 For faking prepared SQL statements on DBs that don't support it directly.
 fillPreparedArg ($matches)
 Only useful with fake prepare like in base Database class.
 freePrepared ($prepared)
 Frees resources associated with a prepared statement.
 freeResult ($res)
 Frees memory associated with a statement resource.
 functionalIndexes ()
 Returns true if this database can use functional indexes.
 getDb ()
 Returns the database connection object.
 getSearchEngine ()
 Get search engine class.
 getServerVersion ()
 getType ()
 Returns the database software identifieir.
 getWikiID ()
 Returns a unique string representing the wiki on the server.
 implicitGroupby ()
 Returns true if this database does an implicit sort when doing GROUP BY.
 implicitOrderby ()
 Returns true if this database does an implicit order by when the column has an index For example: SELECT page_title FROM page LIMIT 1.
 indexInfo ($table, $index, $fname= 'DatabaseIbm_db2::indexExists')
 Returns information about an index If errors are explicitly ignored, returns NULL on failure.
 indexUnique ($table, $index, $fname= 'DatabaseIbm_db2::indexUnique')
 Verifies that an index was created as unique.
 insert ($table, $args, $fname= 'DatabaseIbm_db2::insert', $options=array())
 INSERT wrapper, inserts an array into a table.
 insertId ()
 This must be called after nextSequenceVal.
 is_numeric_type ($type)
 Verifies that a DB2 column/field type is numeric.
 isOpen ()
 Is a database connection open?
 lastErrno ()
 Get the last error number Return 0 if no error.
 lastError ()
 Retrieves the most current database error Forces a database rollback.
 limitResult ($sql, $limit, $offset=false)
 Construct a LIMIT query with optional offset This is used for query pages.
 makeList ($a, $mode=LIST_COMMA)
 Makes an encoded list of strings from an array $mode: LIST_COMMA - comma separated, no field names LIST_AND - ANDed WHERE clause (without the WHERE) LIST_OR - ORed WHERE clause (without the WHERE) LIST_SET - comma separated with field names, like a SET clause LIST_NAMES - comma separated field names LIST_SET_PREPARED - like LIST_SET, except with ? tokens as values.
 makeSelectOptions ($options)
 Handles ordering, grouping, and having options ('GROUP BY' => colname) Has limited support for per-column options (colnum => 'DISTINCT')
 nextSequenceValue ($seqName)
 Return the next in a sequence, save the value for retrieval via insertId()
 numFields ($res)
 Returns the number of columns in a resource.
 numRows ($res)
 Returns the number of rows in the result set Has to be called right after the corresponding select query.
 open ($server, $user, $password, $dbName)
 Opens a database connection and returns it Closes any existing connection.
 ping ()
 Ping the server and try to reconnect if it there is no connection The connection may be closed and reopened while this happens.
 prepare ($sql, $func= 'DB2::prepare')
 Intended to be compatible with the PEAR::DB wrapper functions.
 realTimestamps ()
 Returns true if this database uses timestamps rather than integers.
 searchableIPs ()
 Returns true if this database can do a native search on IP columns e.g.
 select ($table, $vars, $conds= '', $fname= 'DatabaseIbm_db2::select', $options=array(), $join_conds=array())
 SELECT wrapper.
 setMode ($mode)
 Switches module between regular and install modes.
 strencode ($s)
 Alias for addQuotes()
 strictIPs ()
 Returns true if this database is strict about what can be put into an IP field.
 tableExists ($table, $fname=__METHOD__)
 Queries whether a given table exists.
 tableName ($name, $format= 'quoted')
 Handle reserved keyword replacement in table names.
 textFieldSize ($table, $field)
 Returns the size of a text field, or -1 for "unlimited".
 timestamp ($ts=0)
 Generates a timestamp in an insertable format.
 update ($table, $values, $conds, $fname= 'DatabaseIbm_db2::update', $options=array())
 UPDATE wrapper, takes a condition array and a SET array.
 wasDeadlock ()
 Did the last database access fail because of deadlock?

Static Public Member Functions

static getSoftwareLink ()
 Returns link to IBM DB2 free download.

Public Attributes

 $mConnOptions = array()
 Connection config options - see constructor.
 $mStmtOptions = array()
 Statement config options -- see constructor.
const CONN_OPTION = 0x01
 Option that applies to connection objects.
const INSTALL_MODE = 'install'
 Installation mode -- lots of debug messages.
const NONE_OPTION = 0x00
 Option that applies to nothing.
const REGULAR_MODE = 'regular'
 Regular operation mode -- minimal debug messages.
const STMT_OPTION = 0x02
 Option that applies to statement objects.
const USE_GLOBAL = 'get from global'
 Default schema.

Protected Member Functions

 applySchema ()
 Switch into the database schema.
 closeConnection ()
 Closes a database connection, if it is open Returns success, true if already closed.
 doBegin ($fname= 'DatabaseIbm_db2::begin')
 Start a transaction (mandatory)
 doCommit ($fname= 'DatabaseIbm_db2::commit')
 End a transaction Must have a preceding begin()
 doQuery ($sql)
 The DBMS-dependent part of query()
 doRollback ($fname= 'DatabaseIbm_db2::rollback')
 Cancel a transaction.
 openCataloged ($dbName, $user, $password)
 Opens a cataloged database connection, sets mConn.
 openUncataloged ($dbName, $user, $password, $server, $port)
 Opens an uncataloged database connection, sets mConn.

Protected Attributes

 $currentRow = 0
 Current row number on the cursor of the last SELECT.
 $mAffectedRows = null
 Number of rows affected by last INSERT/UPDATE/DELETE.
 $mInsertId = null
 Last sequence value used for a primary key.
 $mLastResult = null
 Result of last query.
 $mMode = self::REGULAR_MODE
 Controls the level of debug message output.
 $mNumRows = null
 Number of rows returned by last SELECT.
 $mPort = null
 Database server port.
 $mSchema = null
 Schema for tables, stored procedures, triggers.
 $mSchemaSet = false
 Whether the schema has been applied in this session.

Private Member Functions

 calcInsertId ($table, $primaryKey, $stmt)
 Updates the mInsertId property with the value of the last insert into a generated column.
 installPrint ($string)
 Outputs debug information in the appropriate place.
 removeNullPrimaryKeys ($table, $args)
 Given a table name and a hash of columns with values Removes primary key columns from the hash where the value is NULL.
 setDB2Option ($name, $const, $type)
 Enables options only if the ibm_db2 extension version supports them.

Detailed Description

Primary database interface.

Definition at line 266 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 436 of file DatabaseIbm_db2.php.

References $user, and setDB2Option().


Member Function Documentation

Escapes strings Doesn't escape numbers.

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

Reimplemented from DatabaseBase.

Definition at line 738 of file DatabaseIbm_db2.php.

References $s, decodeBlob(), and strencode().

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

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

Implements DatabaseType.

Definition at line 1197 of file DatabaseIbm_db2.php.

Switch into the database schema.

Definition at line 798 of file DatabaseIbm_db2.php.

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

Referenced by doQuery(), and open().

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 1697 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 1685 of file DatabaseIbm_db2.php.

DatabaseIbm_db2::bitOr ( fieldLeft,
fieldRight 
)

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

Parameters:
$fieldLeftString
$fieldRightString
Returns:
String

Reimplemented from DatabaseBase.

Definition at line 1708 of file DatabaseIbm_db2.php.

DatabaseIbm_db2::buildConcat ( stringList)

Convert into a list of string being concatenated.

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 1587 of file DatabaseIbm_db2.php.

DatabaseIbm_db2::calcInsertId ( table,
primaryKey,
stmt 
) [private]

Updates the mInsertId property with the value of the last insert into a generated column.

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 972 of file DatabaseIbm_db2.php.

Referenced by insert().

Returns true if this database supports (and uses) cascading deletes.

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 333 of file DatabaseIbm_db2.php.

Returns true if this database supports (and uses) triggers (e.g.

on the page table)

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 342 of file DatabaseIbm_db2.php.

Closes a database connection, if it is open Returns success, true if already closed.

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 575 of file DatabaseIbm_db2.php.

DatabaseIbm_db2::dataSeek ( res,
row 
)

Moves the row pointer of the result set.

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

Implements DatabaseType.

Definition at line 1232 of file DatabaseIbm_db2.php.

References $res, and wfDebug().

Description is left as an exercise for the reader.

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

Reimplemented from DatabaseBase.

Definition at line 1577 of file DatabaseIbm_db2.php.

Referenced by addQuotes().

DatabaseIbm_db2::delete ( table,
conds,
fname = 'DatabaseIbm_db2::delete' 
)

DELETE query wrapper.

Use $conds == "*" to delete all rows

Returns:
bool|

Reimplemented from DatabaseBase.

Definition at line 1178 of file DatabaseIbm_db2.php.

References $fname, $result, makeList(), DatabaseBase\query(), and tableName().

DatabaseIbm_db2::doBegin ( fname = 'DatabaseIbm_db2::begin') [protected]

Start a transaction (mandatory)

Reimplemented from DatabaseBase.

Definition at line 810 of file DatabaseIbm_db2.php.

DatabaseIbm_db2::doCommit ( fname = 'DatabaseIbm_db2::commit') [protected]

End a transaction Must have a preceding begin()

Reimplemented from DatabaseBase.

Definition at line 826 of file DatabaseIbm_db2.php.

DatabaseIbm_db2::doQuery ( sql) [protected]

The DBMS-dependent part of query()

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

Reimplemented from DatabaseBase.

Definition at line 627 of file DatabaseIbm_db2.php.

References applySchema(), and installPrint().

Referenced by applySchema(), and removeNullPrimaryKeys().

Cancel a transaction.

Reimplemented from DatabaseBase.

Definition at line 840 of file DatabaseIbm_db2.php.

Description is left as an exercise for the reader.

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

Reimplemented from DatabaseBase.

Definition at line 1568 of file DatabaseIbm_db2.php.

DatabaseIbm_db2::execute ( prepared,
args = null 
)

Execute a prepared query with the various arguments.

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 1638 of file DatabaseIbm_db2.php.

References $res, and installPrint().

Referenced by insert(), and update().

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 1598 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:
$resarray|ResultWrapper SQL 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 692 of file DatabaseIbm_db2.php.

References $res, lastErrno(), lastError(), wfRestoreWarnings(), and wfSuppressWarnings().

Referenced by indexInfo(), indexUnique(), select(), and textFieldSize().

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

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

Parameters:
$resarray|ResultWrapper SQL result object as returned from Database::query(), etc.
Returns:
ResultWrapper row object
Exceptions:
DBUnexpectedErrorThrown if the database returns an error

Implements DatabaseType.

Definition at line 714 of file DatabaseIbm_db2.php.

References $res, lastErrno(), lastError(), wfRestoreWarnings(), and wfSuppressWarnings().

Referenced by removeNullPrimaryKeys(), and tableExists().

DatabaseIbm_db2::fieldInfo ( table,
field 
)

Returns an information object on a table column.

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

Implements DatabaseType.

Definition at line 1494 of file DatabaseIbm_db2.php.

References IBM_DB2Field\fromText().

DatabaseIbm_db2::fieldName ( res,
n 
)

Returns the nth column name.

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

Implements DatabaseType.

Definition at line 1285 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 1504 of file DatabaseIbm_db2.php.

References $res.

DatabaseIbm_db2::fillPrepared ( preparedQuery,
args 
)

For faking prepared SQL statements on DBs that don't support it directly.

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

Reimplemented from DatabaseBase.

Definition at line 1658 of file DatabaseIbm_db2.php.

Only useful with fake prepare like in base Database class.

Returns:
string

Reimplemented from DatabaseBase.

Definition at line 1449 of file DatabaseIbm_db2.php.

References installPrint().

Frees resources associated with a prepared statement.

Returns:
Boolean success or failure

Reimplemented from DatabaseBase.

Definition at line 1628 of file DatabaseIbm_db2.php.

Referenced by insert(), and update().

Frees memory associated with a statement resource.

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

Reimplemented from DatabaseBase.

Definition at line 1252 of file DatabaseIbm_db2.php.

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

Returns true if this database can use functional indexes.

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 395 of file DatabaseIbm_db2.php.

Returns the database connection object.

Returns:
Object

Definition at line 423 of file DatabaseIbm_db2.php.

Get search engine class.

All subclasses of this need to implement this if they wish to use searching.

Returns:
String

Reimplemented from DatabaseBase.

Definition at line 1405 of file DatabaseIbm_db2.php.

Returns:
string Version information from the database

Implements DatabaseType.

Definition at line 652 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 1395 of file DatabaseIbm_db2.php.

Returns the database software identifieir.

Returns:
string

Implements DatabaseType.

Definition at line 415 of file DatabaseIbm_db2.php.

Returns a unique string representing the wiki on the server.

Returns:
string

Reimplemented from DatabaseBase.

Definition at line 403 of file DatabaseIbm_db2.php.

Returns true if this database does an implicit sort when doing GROUP BY.

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 368 of file DatabaseIbm_db2.php.

Returns true if this database does an implicit order by when the column has an index For example: SELECT page_title FROM page LIMIT 1.

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 378 of file DatabaseIbm_db2.php.

DatabaseIbm_db2::indexInfo ( table,
index,
fname = 'DatabaseIbm_db2::indexExists' 
)

Returns information about an index If errors are explicitly ignored, returns NULL on failure.

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 1466 of file DatabaseIbm_db2.php.

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

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

Verifies that an index was created as unique.

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

Definition at line 1521 of file DatabaseIbm_db2.php.

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

DatabaseIbm_db2::insert ( table,
args,
fname = 'DatabaseIbm_db2::insert',
options = array() 
)

INSERT wrapper, inserts an array into a table.

$args may be a single associative array, or an array of arrays with numeric keys, for multi-row insert

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 991 of file DatabaseIbm_db2.php.

References $ignore, $keys, $options, $res, DatabaseBase\begin(), calcInsertId(), DatabaseBase\commit(), execute(), freePrepared(), installPrint(), lastErrno(), lastError(), IBM_DB2Helper\makeArray(), prepare(), removeNullPrimaryKeys(), and tableName().

This must be called after nextSequenceVal.

Returns:
int Last sequence value used as a primary key

Implements DatabaseType.

Definition at line 959 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 483 of file DatabaseIbm_db2.php.

References print, and wfDebug().

Referenced by doQuery(), execute(), fillPreparedArg(), insert(), open(), setDB2Option(), update(), and wasDeadlock().

Verifies that a DB2 column/field type is numeric.

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

Definition at line 761 of file DatabaseIbm_db2.php.

Is a database connection open?

Returns:

Reimplemented from DatabaseBase.

Definition at line 620 of file DatabaseIbm_db2.php.

Get the last error number Return 0 if no error.

Returns:
integer

Implements DatabaseType.

Definition at line 604 of file DatabaseIbm_db2.php.

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

Retrieves the most current database error Forces a database rollback.

Returns:
bool|string

Implements DatabaseType.

Definition at line 584 of file DatabaseIbm_db2.php.

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

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

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

Parameters:
$sqlstring SQL query we will append the limit too
$limitinteger the SQL limit
$offsetinteger the SQL offset (default false)
Returns:
string

Reimplemented from DatabaseBase.

Definition at line 897 of file DatabaseIbm_db2.php.

References $limit.

DatabaseIbm_db2::makeList ( a,
mode = LIST_COMMA 
)

Makes an encoded list of strings from an array $mode: LIST_COMMA - comma separated, no field names LIST_AND - ANDed WHERE clause (without the WHERE) LIST_OR - ORed WHERE clause (without the WHERE) LIST_SET - comma separated with field names, like a SET clause LIST_NAMES - comma separated field names LIST_SET_PREPARED - like LIST_SET, except with ? tokens as values.

Returns:
string

Reimplemented from DatabaseBase.

Definition at line 859 of file DatabaseIbm_db2.php.

References $value.

Referenced by delete(), and update().

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

Access:
private
Parameters:
$optionsarray Associative 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 1361 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:
int next value in that sequence

Reimplemented from DatabaseBase.

Definition at line 940 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 1269 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 1214 of file DatabaseIbm_db2.php.

References $res.

DatabaseIbm_db2::open ( server,
user,
password,
dbName 
)

Opens a database connection and returns it Closes any existing connection.

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

Implements DatabaseType.

Definition at line 501 of file DatabaseIbm_db2.php.

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

DatabaseIbm_db2::openCataloged ( dbName,
user,
password 
) [protected]

Opens a cataloged database connection, sets mConn.

Definition at line 553 of file DatabaseIbm_db2.php.

References $user, wfRestoreWarnings(), and wfSuppressWarnings().

DatabaseIbm_db2::openUncataloged ( dbName,
user,
password,
server,
port 
) [protected]

Opens an uncataloged database connection, sets mConn.

Definition at line 562 of file DatabaseIbm_db2.php.

References wfRestoreWarnings(), and wfSuppressWarnings().

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.

Returns:
Boolean: whether the connection exists

Reimplemented from DatabaseBase.

Definition at line 1432 of file DatabaseIbm_db2.php.

References DatabaseBase\close(), and openUncataloged().

DatabaseIbm_db2::prepare ( sql,
func = 'DB2::prepare' 
)

Intended to be compatible with the PEAR::DB wrapper functions.

http://pear.php.net/manual/en/package.database.db.intro-execute.php

? = scalar value, quoted as necessary ! = raw SQL bit (a function for instance) & = filename; reads the file and inserts as a blob (we don't use this though...)

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 1619 of file DatabaseIbm_db2.php.

Referenced by insert(), and update().

Returns true if this database uses timestamps rather than integers.

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 360 of file DatabaseIbm_db2.php.

DatabaseIbm_db2::removeNullPrimaryKeys ( table,
args 
) [private]

Given a table name and a hash of columns with values Removes primary key columns from the hash where the value is NULL.

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 1108 of file DatabaseIbm_db2.php.

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

Referenced by insert().

Returns true if this database can do a native search on IP columns e.g.

this works as expected: .. WHERE rc_ip = '127.42.12.102/32';

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 387 of file DatabaseIbm_db2.php.

DatabaseIbm_db2::select ( table,
vars,
conds = '',
fname = 'DatabaseIbm_db2::select',
options = array(),
join_conds = array() 
)

SELECT wrapper.

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
$optionsarray Associative array of options (e.g. array( 'GROUP BY' => 'page_title' )), see Database::makeSelectOptions code for list of supported stuff
$join_condsarray Associative 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 1313 of file DatabaseIbm_db2.php.

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

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

Enables options only if the ibm_db2 extension version supports them.

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 465 of file DatabaseIbm_db2.php.

References installPrint().

Referenced by __construct().

Switches module between regular and install modes.

Returns:
string

Definition at line 1673 of file DatabaseIbm_db2.php.

Alias for addQuotes()

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

Implements DatabaseType.

Definition at line 781 of file DatabaseIbm_db2.php.

References $s.

Referenced by addQuotes().

Returns true if this database is strict about what can be put into an IP field.

Specifically, it uses a NULL value instead of an empty string.

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 352 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 661 of file DatabaseIbm_db2.php.

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

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

Handle reserved keyword replacement in table names.

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

Reimplemented from DatabaseBase.

Definition at line 919 of file DatabaseIbm_db2.php.

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

DatabaseIbm_db2::textFieldSize ( table,
field 
)

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

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

Reimplemented from DatabaseBase.

Definition at line 1549 of file DatabaseIbm_db2.php.

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

Generates a timestamp in an insertable format.

Parameters:
$tsstring timestamp
Returns:
String: timestamp value

Reimplemented from DatabaseBase.

Definition at line 930 of file DatabaseIbm_db2.php.

References wfTimestamp().

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

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

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

Reimplemented from DatabaseBase.

Definition at line 1152 of file DatabaseIbm_db2.php.

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

Did the last database access fail because of deadlock?

Returns:
Boolean

Reimplemented from DatabaseBase.

Definition at line 1413 of file DatabaseIbm_db2.php.

References installPrint(), and lastErrno().


Member Data Documentation

DatabaseIbm_db2::$currentRow = 0 [protected]

Current row number on the cursor of the last SELECT.

Definition at line 297 of file DatabaseIbm_db2.php.

DatabaseIbm_db2::$mAffectedRows = null [protected]

Number of rows affected by last INSERT/UPDATE/DELETE.

Definition at line 293 of file DatabaseIbm_db2.php.

DatabaseIbm_db2::$mConnOptions = array()

Connection config options - see constructor.

Definition at line 300 of file DatabaseIbm_db2.php.

DatabaseIbm_db2::$mInsertId = null [protected]

Last sequence value used for a primary key.

Definition at line 323 of file DatabaseIbm_db2.php.

DatabaseIbm_db2::$mLastResult = null [protected]

Result of last query.

Definition at line 291 of file DatabaseIbm_db2.php.

DatabaseIbm_db2::$mMode = self::REGULAR_MODE [protected]

Controls the level of debug message output.

Definition at line 320 of file DatabaseIbm_db2.php.

DatabaseIbm_db2::$mNumRows = null [protected]

Number of rows returned by last SELECT.

Definition at line 295 of file DatabaseIbm_db2.php.

DatabaseIbm_db2::$mPort = null [protected]

Database server port.

Definition at line 285 of file DatabaseIbm_db2.php.

DatabaseIbm_db2::$mSchema = null [protected]

Schema for tables, stored procedures, triggers.

Definition at line 287 of file DatabaseIbm_db2.php.

DatabaseIbm_db2::$mSchemaSet = false [protected]

Whether the schema has been applied in this session.

Definition at line 289 of file DatabaseIbm_db2.php.

DatabaseIbm_db2::$mStmtOptions = array()

Statement config options -- see constructor.

Definition at line 302 of file DatabaseIbm_db2.php.

Option that applies to connection objects.

Definition at line 310 of file DatabaseIbm_db2.php.

const DatabaseIbm_db2::INSTALL_MODE = 'install'

Installation mode -- lots of debug messages.

Definition at line 317 of file DatabaseIbm_db2.php.

Option that applies to nothing.

Definition at line 308 of file DatabaseIbm_db2.php.

const DatabaseIbm_db2::REGULAR_MODE = 'regular'

Regular operation mode -- minimal debug messages.

Definition at line 315 of file DatabaseIbm_db2.php.

Option that applies to statement objects.

Definition at line 312 of file DatabaseIbm_db2.php.

const DatabaseIbm_db2::USE_GLOBAL = 'get from global'

Default schema.

Definition at line 305 of file DatabaseIbm_db2.php.


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