DatabaseOracle Class Reference
[Database]

Inherits Database.

List of all members.

Public Member Functions

 DatabaseOracle ($server=false, $user=false, $password=false, $dbName=false, $failFunction=false, $flags=0)
 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.
 open ($server, $user, $password, $dbName)
 Usually aborts on failure If the failFunction is set to a non-zero integer, returns success.
 close ()
 Closes a database connection, if it is open Returns success, true if already closed.
 execFlags ()
 doQuery ($sql)
 The DBMS-dependent part of query().
 queryIgnore ($sql, $fname= '')
 freeResult ($res)
 Free a result object.
 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.
 numRows ($res)
 Get the number of rows in a result object.
 numFields ($res)
 Get the number of fields in a result object See documentation for mysql_num_fields().
 fieldName ($stmt, $n)
 Get a field name in a result object See documentation for mysql_field_name(): http://www.php.net/mysql_field_name.
 insertId ()
 This must be called after nextSequenceVal.
 dataSeek ($res, $row)
 Change the position of the cursor in a result object See mysql_data_seek().
 lastError ()
 Get a description of the last error See mysql_error() for more details.
 lastErrno ()
 Get the last error number See mysql_errno().
 affectedRows ()
 Get the number of rows affected by the last write query See mysql_affected_rows() for more details.
 indexInfo ($table, $index, $fname= 'Database::indexExists')
 Returns information about an index If errors are explicitly ignored, returns NULL on failure.
 indexUnique ($table, $index, $fname= 'Database::indexUnique')
 insert ($table, $a, $fname= 'Database::insert', $options=array())
 INSERT wrapper, inserts an array into a table.
 insertOneRow ($table, $row, $fname)
 tableName ($name)
 Format a table name ready for use in constructing an SQL query.
 nextSequenceValue ($seqName)
 Return the next in a sequence, save the value for retrieval via insertId().
 useIndexClause ($index)
 Oracle does not have a "USE INDEX" clause, so return an empty string.
 replace ($table, $uniqueIndexes, $rows, $fname= 'Database::replace')
 REPLACE query wrapper PostgreSQL simulates this with a DELETE followed by INSERT $row is the row to insert, an associative array $uniqueIndexes is an array of indexes.
 deleteJoin ($delTable, $joinTable, $delVar, $joinVar, $conds, $fname="Database::deleteJoin")
 DELETE where the condition is a join MySQL does this with a multi-table DELETE syntax, PostgreSQL does it with sub-selects.
 textFieldSize ($table, $field)
 Returns the size of a text field, or -1 for "unlimited".
 lowPriorityOption ()
 limitResult ($sql, $limit, $offset)
 Construct a LIMIT query with optional offset This is used for query pages.
 conditional ($cond, $trueVal, $falseVal)
 Returns an SQL expression for a simple conditional.
 wasDeadlock ()
 Determines if the last failure was due to a deadlock.
 timestamp ($ts=0)
 Return MW-style timestamp used for MySQL schema.
 aggregateValue ($valuedata, $valuename='value')
 Return aggregated value function call.
 reportQueryError ($error, $errno, $sql, $fname, $tempIgnore=false)
 getSoftwareLink ()
 getServerVersion ()
 tableExists ($table)
 Query whether a given table exists (in the given schema, or the default mw one if not given).
 fieldExists ($table, $field)
 Query whether a given column exists in the mediawiki schema.
 fieldInfo ($table, $field)
 mysql_fetch_field() wrapper Returns false if the field doesn't exist
 begin ($fname= '')
 Begin a transaction, committing any previously open transaction.
 immediateCommit ($fname= '')
 Commit transaction, if one is open.
 commit ($fname= '')
 End a transaction.
 limitResultForUpdate ($sql, $num)
 strencode ($s)
 Wrapper for addslashes().
 encodeBlob ($b)
 decodeBlob ($b)
 addQuotes ($s)
 If it's a string, adds quotes and backslashes Otherwise returns as-is.
 quote_ident ($s)
 selectDB ($db)
 Change the current database.
 makeSelectOptions ($options)
 Returns an optional USE INDEX clause to go after the table, and a string to go at the end of the query.
 setTimeout ($timeout)
 Override database's default connection timeout.
 ping ()
 Ping the server and try to reconnect if it there is no connection.
 getLag ()
 How lagged is this slave?
 setFakeSlaveLag ($lag)
 Set lag time in seconds for a fake slave.
 setFakeMaster ($enabled=true)
 Make this connection a fake master.
 getDBname ()
 Get the current DB name.
 getServer ()
 Get the server hostname or IP address.
 lock ($lockName, $method)
 No-op lock functions.
 unlock ($lockName, $method)
 Release a lock.
 getSearchEngine ()
 Get search engine class.

Static Public Member Functions

static newFromParams ($server=false, $user=false, $password=false, $dbName=false, $failFunction=false, $flags=0)
 Same as new Database( .

Public Attributes

 $mInsertId = NULL
 $mLastResult = NULL
 $numeric_version = NULL
 $lastResult = null
 $cursor = 0
 $mAffectedRows


Detailed Description

Definition at line 96 of file DatabaseOracle.php.


Member Function Documentation

DatabaseOracle::addQuotes ( s  ) 

If it's a string, adds quotes and backslashes Otherwise returns as-is.

Reimplemented from Database.

Definition at line 622 of file DatabaseOracle.php.

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

Referenced by replace(), and tableExists().

DatabaseOracle::affectedRows (  ) 

Get the number of rows affected by the last write query See mysql_affected_rows() for more details.

Reimplemented from Database.

Definition at line 279 of file DatabaseOracle.php.

DatabaseOracle::aggregateValue ( valuedata,
valuename = 'value' 
)

Return aggregated value function call.

Reimplemented from Database.

Definition at line 532 of file DatabaseOracle.php.

DatabaseOracle::begin ( fname = ''  ) 

Begin a transaction, committing any previously open transaction.

Reimplemented from Database.

Definition at line 595 of file DatabaseOracle.php.

DatabaseOracle::cascadingDeletes (  ) 

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

Reimplemented from Database.

Definition at line 120 of file DatabaseOracle.php.

DatabaseOracle::cleanupTriggers (  ) 

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

on the page table)

Reimplemented from Database.

Definition at line 123 of file DatabaseOracle.php.

DatabaseOracle::close (  ) 

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

Reimplemented from Database.

Definition at line 188 of file DatabaseOracle.php.

Referenced by open().

DatabaseOracle::commit ( fname = ''  ) 

End a transaction.

Reimplemented from Database.

Definition at line 601 of file DatabaseOracle.php.

DatabaseOracle::conditional ( cond,
trueVal,
falseVal 
)

Returns an SQL expression for a simple conditional.

Uses CASE on Oracle

Parameters:
$cond String: SQL expression which will result in a boolean value
$trueVal String: SQL expression to return if true
$falseVal String: SQL expression to return if false
Returns:
String: SQL fragment

Reimplemented from Database.

Definition at line 517 of file DatabaseOracle.php.

DatabaseOracle::DatabaseOracle ( server = false,
user = false,
password = false,
dbName = false,
failFunction = false,
flags = 0 
)

Definition at line 104 of file DatabaseOracle.php.

References $flags, $password, $user, $wgOut, and open().

Referenced by newFromParams().

DatabaseOracle::dataSeek ( res,
row 
)

Change the position of the cursor in a result object See mysql_data_seek().

Parameters:
$res Mixed: A SQL result
$row Mixed: Either MySQL row or ResultWrapper

Reimplemented from Database.

Definition at line 259 of file DatabaseOracle.php.

References $res, and $row.

DatabaseOracle::decodeBlob ( b  ) 

Reimplemented from Database.

Definition at line 618 of file DatabaseOracle.php.

DatabaseOracle::deleteJoin ( delTable,
joinTable,
delVar,
joinVar,
conds,
fname = "Database::deleteJoin" 
)

DELETE where the condition is a join MySQL does this with a multi-table DELETE syntax, PostgreSQL does it with sub-selects.

For safety, an empty $conds will not delete everything. If you want to delete all rows where the join condition matches, set $conds='*'

DO NOT put the join condition in $conds

Parameters:
$delTable String: The table to delete from.
$joinTable String: The other table.
$delVar String: The variable to join on, in the first table.
$joinVar String: The variable to join on, in the second table.
$conds Array: Condition array of field names mapped to variables, ANDed together in the WHERE clause
$fname String: Calling function name (use __METHOD__) for logs/profiling

Reimplemented from Database.

Definition at line 464 of file DatabaseOracle.php.

References $conds, $fname, $sql, Database::makeList(), Database::query(), and tableName().

DatabaseOracle::doQuery ( sql  ) 

The DBMS-dependent part of query().

Parameters:
$sql String: SQL query.
Returns:
Result object to feed to fetchObject, fetchRow, ...; or false on failure

Reimplemented from Database.

Definition at line 201 of file DatabaseOracle.php.

References $sql, execFlags(), reportQueryError(), and wfDebug().

DatabaseOracle::encodeBlob ( b  ) 

Reimplemented from Database.

Definition at line 615 of file DatabaseOracle.php.

DatabaseOracle::execFlags (  ) 

Definition at line 197 of file DatabaseOracle.php.

Referenced by doQuery().

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

Parameters:
$res SQL result object as returned from Database::query(), etc.
Returns:
MySQL row object
Exceptions:
DBUnexpectedError Thrown if the database returns an error

Reimplemented from Database.

Definition at line 232 of file DatabaseOracle.php.

References $res.

Referenced by textFieldSize().

DatabaseOracle::fetchRow ( res  ) 

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

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

Parameters:
$res SQL result object as returned from Database::query(), etc.
Returns:
MySQL row object
Exceptions:
DBUnexpectedError Thrown if the database returns an error

Reimplemented from Database.

Definition at line 236 of file DatabaseOracle.php.

References $res.

Referenced by nextSequenceValue().

DatabaseOracle::fieldExists ( table,
field 
)

Query whether a given column exists in the mediawiki schema.

Definition at line 587 of file DatabaseOracle.php.

DatabaseOracle::fieldInfo ( table,
field 
)

mysql_fetch_field() wrapper Returns false if the field doesn't exist

Parameters:
$table 
$field 

Reimplemented from Database.

Definition at line 591 of file DatabaseOracle.php.

DatabaseOracle::fieldName ( res,
n 
)

Get a field name in a result object See documentation for mysql_field_name(): http://www.php.net/mysql_field_name.

Parameters:
$res Mixed: A SQL result
$n Integer

Reimplemented from Database.

Definition at line 248 of file DatabaseOracle.php.

References $n.

DatabaseOracle::freeResult ( res  ) 

Free a result object.

Parameters:
$res Mixed: A SQL result

Reimplemented from Database.

Definition at line 228 of file DatabaseOracle.php.

References $res.

Referenced by nextSequenceValue(), tableExists(), and textFieldSize().

DatabaseOracle::getDBname (  ) 

Get the current DB name.

Reimplemented from Database.

Definition at line 702 of file DatabaseOracle.php.

DatabaseOracle::getLag (  ) 

How lagged is this slave?

Returns:
int

Reimplemented from Database.

Definition at line 694 of file DatabaseOracle.php.

DatabaseOracle::getSearchEngine (  ) 

Get search engine class.

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

Returns:
String

Reimplemented from Database.

Definition at line 720 of file DatabaseOracle.php.

DatabaseOracle::getServer (  ) 

Get the server hostname or IP address.

Reimplemented from Database.

Definition at line 706 of file DatabaseOracle.php.

DatabaseOracle::getServerVersion (  ) 

Returns:
string Version information from the database

Reimplemented from Database.

Definition at line 567 of file DatabaseOracle.php.

DatabaseOracle::getSoftwareLink (  ) 

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

Reimplemented from Database.

Definition at line 560 of file DatabaseOracle.php.

DatabaseOracle::immediateCommit ( fname = ''  ) 

Commit transaction, if one is open.

Deprecated:
use commit()

Reimplemented from Database.

Definition at line 598 of file DatabaseOracle.php.

DatabaseOracle::implicitGroupby (  ) 

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

Reimplemented from Database.

Definition at line 132 of file DatabaseOracle.php.

DatabaseOracle::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 Database.

Definition at line 135 of file DatabaseOracle.php.

DatabaseOracle::indexInfo ( table,
index,
fname = 'Database::indexExists' 
)

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

Reimplemented from Database.

Definition at line 287 of file DatabaseOracle.php.

DatabaseOracle::indexUnique ( table,
index,
fname = 'Database::indexUnique' 
)

Definition at line 291 of file DatabaseOracle.php.

DatabaseOracle::insert ( table,
a,
fname = 'Database::insert',
options = array() 
)

INSERT wrapper, inserts an array into a table.

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

Usually aborts on failure If errors are explicitly ignored, returns success

Reimplemented from Database.

Definition at line 295 of file DatabaseOracle.php.

References $fname, $options, $row, and insertOneRow().

DatabaseOracle::insertId (  ) 

This must be called after nextSequenceVal.

Reimplemented from Database.

Definition at line 255 of file DatabaseOracle.php.

DatabaseOracle::insertOneRow ( table,
row,
fname 
)

Definition at line 320 of file DatabaseOracle.php.

References $row, $sql, lastErrno(), lastError(), reportQueryError(), and tableName().

Referenced by insert().

DatabaseOracle::lastErrno (  ) 

Get the last error number See mysql_errno().

Reimplemented from Database.

Definition at line 271 of file DatabaseOracle.php.

Referenced by insertOneRow(), and wasDeadlock().

DatabaseOracle::lastError (  ) 

Get a description of the last error See mysql_error() for more details.

Reimplemented from Database.

Definition at line 263 of file DatabaseOracle.php.

Referenced by insertOneRow(), and open().

DatabaseOracle::limitResult ( sql,
limit,
offset 
)

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

Parameters:
$sql String: SQL query we will append the limit too
$limit Integer: the SQL limit
$offset Integer the SQL offset (default false)

Reimplemented from Database.

Definition at line 502 of file DatabaseOracle.php.

References $offset.

DatabaseOracle::limitResultForUpdate ( sql,
num 
)

Reimplemented from Database.

Definition at line 607 of file DatabaseOracle.php.

References $sql.

DatabaseOracle::lock ( lockName,
method 
)

No-op lock functions.

Reimplemented from Database.

Definition at line 713 of file DatabaseOracle.php.

DatabaseOracle::lowPriorityOption (  ) 

Returns:
string Returns the text of the low priority option if it is supported, or a blank string otherwise

Reimplemented from Database.

Definition at line 498 of file DatabaseOracle.php.

DatabaseOracle::makeSelectOptions ( options  ) 

Returns an optional USE INDEX clause to go after the table, and a string to go at the end of the query.

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

Reimplemented from Database.

Definition at line 647 of file DatabaseOracle.php.

References $key, $options, and useIndexClause().

static DatabaseOracle::newFromParams ( server = false,
user = false,
password = false,
dbName = false,
failFunction = false,
flags = 0 
) [static]

Same as new Database( .

.. ), kept for backward compatibility

Parameters:
$server String: database server host
$user String: database user name
$password String: database user password
$dbName String: database name
failFunction 
$flags 

Reimplemented from Database.

Definition at line 142 of file DatabaseOracle.php.

References $flags, $password, $user, and DatabaseOracle().

DatabaseOracle::nextSequenceValue ( seqName  ) 

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

Reimplemented from Database.

Definition at line 390 of file DatabaseOracle.php.

References $res, $row, fetchRow(), freeResult(), and Database::query().

DatabaseOracle::numFields ( res  ) 

Get the number of fields in a result object See documentation for mysql_num_fields().

Parameters:
$res Mixed: A SQL result

Reimplemented from Database.

Definition at line 244 of file DatabaseOracle.php.

References $res.

DatabaseOracle::numRows ( res  ) 

Get the number of rows in a result object.

Parameters:
$res Mixed: A SQL result

Reimplemented from Database.

Definition at line 240 of file DatabaseOracle.php.

References $res.

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

Usually aborts on failure If the failFunction is set to a non-zero integer, returns success.

Reimplemented from Database.

Definition at line 152 of file DatabaseOracle.php.

References $password, $user, close(), is(), lastError(), and wfDebug().

Referenced by DatabaseOracle().

DatabaseOracle::ping (  ) 

Ping the server and try to reconnect if it there is no connection.

Reimplemented from Database.

Definition at line 684 of file DatabaseOracle.php.

References wfDebug().

DatabaseOracle::queryIgnore ( sql,
fname = '' 
)

Definition at line 224 of file DatabaseOracle.php.

References $fname, $sql, and Database::query().

DatabaseOracle::quote_ident ( s  ) 

Definition at line 628 of file DatabaseOracle.php.

References $s.

DatabaseOracle::realTimestamps (  ) 

Returns true if this database uses timestamps rather than integers.

Reimplemented from Database.

Definition at line 129 of file DatabaseOracle.php.

DatabaseOracle::replace ( table,
uniqueIndexes,
rows,
fname = 'Database::replace' 
)

REPLACE query wrapper PostgreSQL simulates this with a DELETE followed by INSERT $row is the row to insert, an associative array $uniqueIndexes is an array of indexes.

Each element may be either a field name or an array of field names

It may be more efficient to leave off unique indexes which are unlikely to collide. However if you do this, you run the risk of encountering errors which wouldn't have occurred in MySQL

Todo:
migrate comment to phodocumentor format

Reimplemented from Database.

Definition at line 414 of file DatabaseOracle.php.

References $fname, $row, $rows, $sql, addQuotes(), Database::makeList(), Database::query(), and tableName().

DatabaseOracle::reportQueryError ( error,
errno,
sql,
fname,
tempIgnore = false 
)

Parameters:
$error String
$errno Integer
$sql String
$fname String
$tempIgnore Boolean

Reimplemented from Database.

Definition at line 536 of file DatabaseOracle.php.

References $ignore, Database::ignoreErrors(), and wfDebug().

Referenced by doQuery(), and insertOneRow().

DatabaseOracle::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 Database.

Definition at line 138 of file DatabaseOracle.php.

DatabaseOracle::selectDB ( db  ) 

Change the current database.

Reimplemented from Database.

Definition at line 633 of file DatabaseOracle.php.

DatabaseOracle::setFakeMaster ( enabled = true  ) 

Make this connection a fake master.

Reimplemented from Database.

Definition at line 700 of file DatabaseOracle.php.

DatabaseOracle::setFakeSlaveLag ( lag  ) 

Set lag time in seconds for a fake slave.

Reimplemented from Database.

Definition at line 699 of file DatabaseOracle.php.

DatabaseOracle::setTimeout ( timeout  ) 

Override database's default connection timeout.

May be useful for very long batch queries such as full-wiki dumps, where a single query reads out over hours or days.

Parameters:
$timeout Integer in seconds

Reimplemented from Database.

Definition at line 680 of file DatabaseOracle.php.

DatabaseOracle::strencode ( s  ) 

Wrapper for addslashes().

Parameters:
$s String: to be slashed.
Returns:
String: slashed string.

Reimplemented from Database.

Definition at line 611 of file DatabaseOracle.php.

References $s.

Referenced by addQuotes().

DatabaseOracle::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 Database.

Definition at line 126 of file DatabaseOracle.php.

DatabaseOracle::tableExists ( table  ) 

Query whether a given table exists (in the given schema, or the default mw one if not given).

Reimplemented from Database.

Definition at line 574 of file DatabaseOracle.php.

References $count, $res, addQuotes(), freeResult(), and Database::query().

DatabaseOracle::tableName ( name  ) 

Format a table name ready for use in constructing an SQL query.

This does two important things: it quotes the table names to clean them up, and it adds a table prefix if only given a table name with no quotes.

All functions of this object which require a table name call this function themselves. Pass the canonical name to such functions. This is only needed when calling query() directly.

Parameters:
$name String: database table name
Returns:
String: full database name

Reimplemented from Database.

Definition at line 375 of file DatabaseOracle.php.

References $name.

Referenced by deleteJoin(), insertOneRow(), replace(), and textFieldSize().

DatabaseOracle::textFieldSize ( table,
field 
)

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

Reimplemented from Database.

Definition at line 481 of file DatabaseOracle.php.

References $res, $row, $size, $sql, fetchObject(), freeResult(), Database::query(), and tableName().

DatabaseOracle::timestamp ( ts = 0  ) 

Return MW-style timestamp used for MySQL schema.

Reimplemented from Database.

Definition at line 525 of file DatabaseOracle.php.

References $ts, and wfTimestamp().

DatabaseOracle::unlock ( lockName,
method 
)

Release a lock.

Todo:
fixme - Figure out a way to return a bool based on successful lock release.
Parameters:
$lockName String: Name of lock to release
$method String: Name of method calling us

Reimplemented from Database.

Definition at line 716 of file DatabaseOracle.php.

DatabaseOracle::useIndexClause ( index  ) 

Oracle does not have a "USE INDEX" clause, so return an empty string.

Reimplemented from Database.

Definition at line 401 of file DatabaseOracle.php.

Referenced by makeSelectOptions().

DatabaseOracle::wasDeadlock (  ) 

Determines if the last failure was due to a deadlock.

Reimplemented from Database.

Definition at line 521 of file DatabaseOracle.php.

References lastErrno().


Member Data Documentation

DatabaseOracle::$cursor = 0

Definition at line 101 of file DatabaseOracle.php.

DatabaseOracle::$lastResult = null

Definition at line 100 of file DatabaseOracle.php.

DatabaseOracle::$mAffectedRows

Definition at line 102 of file DatabaseOracle.php.

DatabaseOracle::$mInsertId = NULL

Definition at line 97 of file DatabaseOracle.php.

DatabaseOracle::$mLastResult = NULL

Definition at line 98 of file DatabaseOracle.php.

DatabaseOracle::$numeric_version = NULL

Definition at line 99 of file DatabaseOracle.php.


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

Generated on Sat Sep 5 02:08:35 2009 for MediaWiki by  doxygen 1.5.9