DatabasePostgres Class Reference
[Database]

Inherits DatabaseBase.

List of all members.

Public Member Functions

 DatabasePostgres ($server=false, $user=false, $password=false, $dbName=false, $failFunction=false, $flags=0)
 getType ()
 Get the type of the DBMS, as it appears in $wgDBtype.
 cascadingDeletes ()
 Returns true if this database supports (and uses) cascading deletes.
 cleanupTriggers ()
 Returns true if this database supports (and uses) triggers (e.g.
 strictIPs ()
 Returns true if this database is strict about what can be put into an IP field.
 realTimestamps ()
 Returns true if this database uses timestamps rather than integers.
 implicitGroupby ()
 Returns true if this database does an implicit sort when doing GROUP BY.
 implicitOrderby ()
 Returns true if this database does an implicit order by when the column has an index For example: SELECT page_title FROM page LIMIT 1.
 searchableIPs ()
 Returns true if this database can do a native search on IP columns e.g.
 functionalIndexes ()
 Returns true if this database can use functional indexes.
 hasConstraint ($name)
 open ($server, $user, $password, $dbName)
 Usually aborts on failure If the failFunction is set to a non-zero integer, returns success.
 makeConnectionString ($vars)
 initial_setup ($password, $dbName)
 setup_plpgsql ()
 close ()
 Closes a database connection, if it is open Returns success, true if already closed.
 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 ($res, $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.
 estimateRowCount ($table, $vars='*', $conds='', $fname= 'DatabasePostgres::estimateRowCount', $options=array())
 Estimate rows in dataset Returns estimated count, based on EXPLAIN output This is not necessarily an accurate estimate, so use sparingly Returns -1 if count cannot be found Takes same arguments as Database::select().
 indexInfo ($table, $index, $fname= 'DatabasePostgres::indexInfo')
 Returns information about an index If errors are explicitly ignored, returns NULL on failure.
 indexUnique ($table, $index, $fname= 'DatabasePostgres::indexUnique')
 insert ($table, $args, $fname= 'DatabasePostgres::insert', $options=array())
 INSERT wrapper, inserts an array into a table.
 insertSelect ($destTable, $srcTable, $varMap, $conds, $fname= 'DatabasePostgres::insertSelect', $insertOptions=array(), $selectOptions=array())
 INSERT SELECT wrapper $varMap must be an associative array of the form array( 'dest1' => 'source1', .
 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().
 currentSequenceValue ($seqName)
 Return the current value of a sequence.
 replace ($table, $uniqueIndexes, $rows, $fname= 'DatabasePostgres::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= 'DatabasePostgres::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".
 limitResult ($sql, $limit, $offset=false)
 Construct a LIMIT query with optional offset.
 wasDeadlock ()
 Determines if the last failure was due to a deadlock STUB.
 duplicateTableStructure ($oldName, $newName, $temporary=false, $fname= 'DatabasePostgres::duplicateTableStructure')
 Creates a new table with structure copied from existing table Note that unlike most database abstraction functions, this function does not automatically append database prefix, because it works at a lower abstraction level.
 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 ()
 relationExists ($table, $types, $schema=false)
 Query whether a given relation exists (in the given schema, or the default mw one if not given).
 tableExists ($table, $schema=false)
 sequenceExists ($sequence, $schema=false)
 triggerExists ($table, $trigger)
 ruleExists ($table, $rule)
 constraintExists ($table, $constraint)
 schemaExists ($schema)
 Query whether a given schema exists.
 fieldExists ($table, $field, $fname= 'DatabasePostgres::fieldExists')
 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
 fieldType ($res, $index)
 pg_field_type() wrapper
 begin ($fname= 'DatabasePostgres::begin')
 Begin a transaction, committing any previously open transaction.
 immediateCommit ($fname= 'DatabasePostgres::immediateCommit')
 Commit transaction, if one is open.
 commit ($fname= 'DatabasePostgres::commit')
 End a transaction.
 limitResultForUpdate ($sql, $num)
 setup_database ()
 encodeBlob ($b)
 decodeBlob ($b)
 strencode ($s)
 Wrapper for addslashes().
 addQuotes ($s)
 If it's a string, adds quotes and backslashes Otherwise returns as-is.
 quote_ident ($s)
 makeSelectOptions ($options)
 Various select options.
 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.
 buildConcat ($stringList)
 Build a concatenation list to feed into a SQL query.
 getSearchEngine ()
 Get search engine class.

Static Public Member Functions

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

Public Attributes

 $mInsertId = null
 $mLastResult = null
 $numeric_version = null
 $mAffectedRows = null

Protected Member Functions

 replaceVars ($ins)
 Postgres specific version of replaceVars.


Detailed Description

Definition at line 71 of file DatabasePostgres.php.


Member Function Documentation

DatabasePostgres::addQuotes ( s  ) 

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

Reimplemented from DatabaseBase.

Definition at line 1380 of file DatabasePostgres.php.

References $s.

Referenced by constraintExists(), initial_setup(), relationExists(), replace(), setup_database(), and triggerExists().

DatabasePostgres::affectedRows (  ) 

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

Reimplemented from DatabaseBase.

Definition at line 678 of file DatabasePostgres.php.

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

Return aggregated value function call.

Reimplemented from DatabaseBase.

Definition at line 1103 of file DatabasePostgres.php.

DatabasePostgres::begin ( fname = 'DatabasePostgres::begin'  ) 

Begin a transaction, committing any previously open transaction.

Reimplemented from DatabaseBase.

Definition at line 1280 of file DatabasePostgres.php.

References $fname, and DatabaseBase::query().

Referenced by insert(), and insertSelect().

DatabasePostgres::buildConcat ( stringList  ) 

Build a concatenation list to feed into a SQL query.

Parameters:
$stringList Array: list of raw SQL expressions; caller is responsible for any quoting
Returns:
String

Reimplemented from DatabaseBase.

Definition at line 1478 of file DatabasePostgres.php.

DatabasePostgres::cascadingDeletes (  ) 

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

Reimplemented from DatabaseBase.

Definition at line 91 of file DatabasePostgres.php.

DatabasePostgres::cleanupTriggers (  ) 

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

on the page table)

Reimplemented from DatabaseBase.

Definition at line 94 of file DatabasePostgres.php.

DatabasePostgres::close (  ) 

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

Reimplemented from DatabaseBase.

Definition at line 571 of file DatabasePostgres.php.

Referenced by open(), and setup_database().

DatabasePostgres::commit ( fname = 'DatabasePostgres::commit'  ) 

End a transaction.

Reimplemented from DatabaseBase.

Definition at line 1287 of file DatabasePostgres.php.

References $fname, and DatabaseBase::query().

Referenced by insert(), and insertSelect().

DatabasePostgres::constraintExists ( table,
constraint 
)

DatabasePostgres::currentSequenceValue ( seqName  ) 

Return the current value of a sequence.

Assumes it has been nextval'ed in this session.

Definition at line 982 of file DatabasePostgres.php.

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

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

Definition at line 77 of file DatabasePostgres.php.

References open().

Referenced by newFromParams().

DatabasePostgres::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 DatabaseBase.

Definition at line 659 of file DatabasePostgres.php.

References $res.

DatabasePostgres::decodeBlob ( b  ) 

Reimplemented from DatabaseBase.

Definition at line 1369 of file DatabasePostgres.php.

DatabasePostgres::deleteJoin ( delTable,
joinTable,
delVar,
joinVar,
conds,
fname = 'DatabasePostgres::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 DatabaseBase.

Definition at line 1050 of file DatabasePostgres.php.

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

DatabasePostgres::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 DatabaseBase.

Definition at line 580 of file DatabasePostgres.php.

Referenced by hasConstraint(), initial_setup(), open(), setup_database(), and setup_plpgsql().

DatabasePostgres::duplicateTableStructure ( oldName,
newName,
temporary = false,
fname = 'DatabasePostgres::duplicateTableStructure' 
)

Creates a new table with structure copied from existing table Note that unlike most database abstraction functions, this function does not automatically append database prefix, because it works at a lower abstraction level.

Parameters:
$oldName String: name of table whose structure should be copied
$newName String: name of table to be created
$temporary Boolean: whether the new table should be temporary
Returns:
Boolean: true if operation was successful

Reimplemented from DatabaseBase.

Definition at line 1092 of file DatabasePostgres.php.

References $fname, and DatabaseBase::query().

DatabasePostgres::encodeBlob ( b  ) 

Reimplemented from DatabaseBase.

Definition at line 1365 of file DatabasePostgres.php.

DatabasePostgres::estimateRowCount ( table,
vars = '*',
conds = '',
fname = 'DatabasePostgres::estimateRowCount',
options = array() 
)

Estimate rows in dataset Returns estimated count, based on EXPLAIN output This is not necessarily an accurate estimate, so use sparingly Returns -1 if count cannot be found Takes same arguments as Database::select().

Reimplemented from DatabaseBase.

Definition at line 696 of file DatabasePostgres.php.

References $fname, $options, $res, $rows, fetchRow(), freeResult(), and DatabaseBase::select().

DatabasePostgres::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 DatabaseBase.

Definition at line 602 of file DatabasePostgres.php.

References $res.

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

DatabasePostgres::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 DatabaseBase.

Definition at line 618 of file DatabasePostgres.php.

References $res.

Referenced by currentSequenceValue(), estimateRowCount(), and nextSequenceValue().

DatabasePostgres::fieldExists ( table,
field,
fname = 'DatabasePostgres::fieldExists' 
)

Query whether a given column exists in the mediawiki schema.

Reimplemented from DatabaseBase.

Definition at line 1251 of file DatabasePostgres.php.

References $fname, $res, $wgDBmwschema, freeResult(), and DatabaseBase::query().

DatabasePostgres::fieldInfo ( table,
field 
)

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

Parameters:
$table 
$field 

Reimplemented from DatabaseBase.

Definition at line 1266 of file DatabasePostgres.php.

References PostgresField::fromText().

DatabasePostgres::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 DatabaseBase.

Definition at line 645 of file DatabasePostgres.php.

References $n, and $res.

DatabasePostgres::fieldType ( res,
index 
)

pg_field_type() wrapper

Reimplemented from DatabaseBase.

Definition at line 1273 of file DatabasePostgres.php.

References $res.

DatabasePostgres::freeResult ( res  ) 

Free a result object.

Parameters:
$res Mixed: A SQL result

Reimplemented from DatabaseBase.

Definition at line 593 of file DatabasePostgres.php.

References $res.

Referenced by constraintExists(), currentSequenceValue(), estimateRowCount(), fieldExists(), nextSequenceValue(), relationExists(), schemaExists(), textFieldSize(), and triggerExists().

DatabasePostgres::functionalIndexes (  ) 

Returns true if this database can use functional indexes.

Reimplemented from DatabaseBase.

Definition at line 112 of file DatabasePostgres.php.

DatabasePostgres::getDBname (  ) 

Get the current DB name.

Reimplemented from DatabaseBase.

Definition at line 1470 of file DatabasePostgres.php.

DatabasePostgres::getLag (  ) 

How lagged is this slave?

Reimplemented from DatabaseBase.

Definition at line 1462 of file DatabasePostgres.php.

DatabasePostgres::getSearchEngine (  ) 

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 1482 of file DatabasePostgres.php.

DatabasePostgres::getServer (  ) 

Get the server hostname or IP address.

Reimplemented from DatabaseBase.

Definition at line 1474 of file DatabasePostgres.php.

DatabasePostgres::getServerVersion (  ) 

Returns:
string Version information from the database

Reimplemented from DatabaseBase.

Definition at line 1136 of file DatabasePostgres.php.

Referenced by initial_setup(), insert(), and setup_database().

DatabasePostgres::getSoftwareLink (  ) 

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

Reimplemented from DatabaseBase.

Definition at line 1129 of file DatabasePostgres.php.

DatabasePostgres::getType (  ) 

Get the type of the DBMS, as it appears in $wgDBtype.

Reimplemented from DatabaseBase.

Definition at line 87 of file DatabasePostgres.php.

DatabasePostgres::hasConstraint ( name  ) 

Definition at line 116 of file DatabasePostgres.php.

References $name, $res, $wgDBmwschema, doQuery(), and numRows().

DatabasePostgres::immediateCommit ( fname = 'DatabasePostgres::immediateCommit'  ) 

Commit transaction, if one is open.

Deprecated:
use commit()

Reimplemented from DatabaseBase.

Definition at line 1284 of file DatabasePostgres.php.

DatabasePostgres::implicitGroupby (  ) 

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

Reimplemented from DatabaseBase.

Definition at line 103 of file DatabasePostgres.php.

DatabasePostgres::implicitOrderby (  ) 

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

Reimplemented from DatabaseBase.

Definition at line 106 of file DatabasePostgres.php.

DatabasePostgres::indexInfo ( table,
index,
fname = 'DatabasePostgres::indexInfo' 
)

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

Reimplemented from DatabaseBase.

Definition at line 716 of file DatabasePostgres.php.

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

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

DatabasePostgres::initial_setup ( password,
dbName 
)

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

INSERT wrapper, inserts an array into a table.

$args may be a single associative array, or an array of these with numeric keys, for multi-row insert (Postgres version 8.2 and above only).

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

Reimplemented from DatabaseBase.

Definition at line 757 of file DatabasePostgres.php.

References $fname, $ignore, $keys, $options, $res, begin(), commit(), getServerVersion(), DatabaseBase::makeList(), DatabaseBase::query(), and tableName().

DatabasePostgres::insertId (  ) 

This must be called after nextSequenceVal.

Reimplemented from DatabaseBase.

Definition at line 655 of file DatabasePostgres.php.

DatabasePostgres::insertSelect ( destTable,
srcTable,
varMap,
conds,
fname = 'DatabasePostgres::insertSelect',
insertOptions = array(),
selectOptions = array() 
)

INSERT SELECT wrapper $varMap must be an associative array of the form array( 'dest1' => 'source1', .

..) Source items may be literals rather then field names, but strings should be quoted with Database::addQuotes() $conds may be "*" to copy the whole table srcTable may be an array of tables.

Todo:
FIXME: implement this a little better (seperate select/insert)?

Reimplemented from DatabaseBase.

Definition at line 888 of file DatabasePostgres.php.

References $fname, $ignore, $res, begin(), commit(), DatabaseBase::makeList(), makeSelectOptions(), DatabaseBase::query(), and tableName().

DatabasePostgres::lastErrno (  ) 

Get the last error number See mysql_errno().

Reimplemented from DatabaseBase.

Definition at line 674 of file DatabasePostgres.php.

Referenced by wasDeadlock().

DatabasePostgres::lastError (  ) 

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

Reimplemented from DatabaseBase.

Definition at line 666 of file DatabasePostgres.php.

Referenced by open().

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

Construct a LIMIT query with optional offset.

This is used for query pages. The SQL should be adjusted so that only the first $limit rows are returned. If $offset is provided as well, then the first $offset rows should be discarded, and the next $limit rows should be returned. If the result of the query is not ordered, then the rows to be returned are theoretically arbitrary.

$sql is expected to be a SELECT, if that makes a difference. For UPDATE, limitResultForUpdate should be used.

The version provided by default works in MySQL and SQLite. It will very likely need to be overridden for most other DBMSes.

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

Definition at line 1084 of file DatabasePostgres.php.

DatabasePostgres::limitResultForUpdate ( sql,
num 
)

Reimplemented from DatabaseBase.

Definition at line 1293 of file DatabasePostgres.php.

DatabasePostgres::makeConnectionString ( vars  ) 

Definition at line 200 of file DatabasePostgres.php.

References $name, and $s.

Referenced by initial_setup(), and open().

DatabasePostgres::makeSelectOptions ( options  ) 

Various select options.

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

Definition at line 1430 of file DatabasePostgres.php.

References $options.

Referenced by insertSelect().

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

Same as new DatabaseMysql( .

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

Definition at line 122 of file DatabasePostgres.php.

References DatabasePostgres().

DatabasePostgres::nextSequenceValue ( seqName  ) 

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

Reimplemented from DatabaseBase.

Definition at line 970 of file DatabasePostgres.php.

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

DatabasePostgres::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 DatabaseBase.

Definition at line 639 of file DatabasePostgres.php.

References $res.

DatabasePostgres::numRows ( res  ) 

Get the number of rows in a result object.

Parameters:
$res Mixed: A SQL result

Reimplemented from DatabaseBase.

Definition at line 629 of file DatabasePostgres.php.

References $n, and $res.

Referenced by hasConstraint(), initial_setup(), and setup_plpgsql().

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

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

Reimplemented from DatabaseBase.

Definition at line 131 of file DatabasePostgres.php.

References $wgCommandLineMode, $wgDBmwschema, $wgDBport, $wgDBts2schema, close(), doQuery(), DatabaseBase::installErrorHandler(), lastError(), makeConnectionString(), quote_ident(), DatabaseBase::restoreErrorHandler(), and wfDebug().

Referenced by DatabasePostgres().

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

Definition at line 589 of file DatabasePostgres.php.

References $fname, and DatabaseBase::query().

DatabasePostgres::quote_ident ( s  ) 

Definition at line 1391 of file DatabasePostgres.php.

References $s.

Referenced by initial_setup(), open(), and setup_database().

DatabasePostgres::realTimestamps (  ) 

Returns true if this database uses timestamps rather than integers.

Reimplemented from DatabaseBase.

Definition at line 100 of file DatabasePostgres.php.

DatabasePostgres::relationExists ( table,
types,
schema = false 
)

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

Definition at line 1155 of file DatabasePostgres.php.

References $res, $wgDBmwschema, addQuotes(), freeResult(), and DatabaseBase::query().

Referenced by sequenceExists(), and tableExists().

DatabasePostgres::replace ( table,
uniqueIndexes,
rows,
fname = 'DatabasePostgres::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 DatabaseBase.

Definition at line 1000 of file DatabasePostgres.php.

References $fname, $rows, addQuotes(), DatabaseBase::makeList(), DatabaseBase::query(), and tableName().

DatabasePostgres::replaceVars ( ins  )  [protected]

Postgres specific version of replaceVars.

Calls the parent version in Database.php

Access:
private
Parameters:
$ins String: SQL string, read from a stream (usually tables.sql)
Returns:
string SQL string

Reimplemented from DatabaseBase.

Definition at line 1405 of file DatabasePostgres.php.

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

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

Reimplemented from DatabaseBase.

Definition at line 1108 of file DatabasePostgres.php.

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

DatabasePostgres::ruleExists ( table,
rule 
)

Definition at line 1205 of file DatabasePostgres.php.

References $wgDBmwschema, and DatabaseBase::selectField().

DatabasePostgres::schemaExists ( schema  ) 

Query whether a given schema exists.

Returns the name of the owner

Definition at line 1232 of file DatabasePostgres.php.

References $res, freeResult(), and DatabaseBase::query().

Referenced by initial_setup().

DatabasePostgres::searchableIPs (  ) 

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

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

Reimplemented from DatabaseBase.

Definition at line 109 of file DatabasePostgres.php.

DatabasePostgres::sequenceExists ( sequence,
schema = false 
)

Definition at line 1181 of file DatabasePostgres.php.

References relationExists().

DatabasePostgres::setFakeMaster ( enabled = true  ) 

Make this connection a fake master.

Reimplemented from DatabaseBase.

Definition at line 1468 of file DatabasePostgres.php.

DatabasePostgres::setFakeSlaveLag ( lag  ) 

Set lag time in seconds for a fake slave.

Reimplemented from DatabaseBase.

Definition at line 1467 of file DatabasePostgres.php.

DatabasePostgres::setup_database (  ) 

DatabasePostgres::setup_plpgsql (  ) 

Definition at line 536 of file DatabasePostgres.php.

References $result, $rows, $wgDBname, doQuery(), numRows(), and print.

Referenced by initial_setup().

DatabasePostgres::strencode ( s  ) 

Wrapper for addslashes().

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

Reimplemented from DatabaseBase.

Definition at line 1376 of file DatabasePostgres.php.

References $s.

Referenced by indexUnique().

DatabasePostgres::strictIPs (  ) 

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

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

Reimplemented from DatabaseBase.

Definition at line 97 of file DatabasePostgres.php.

DatabasePostgres::tableExists ( table,
schema = false 
)

Definition at line 1177 of file DatabasePostgres.php.

References relationExists().

Referenced by initial_setup(), and setup_database().

DatabasePostgres::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 DatabaseBase.

Definition at line 955 of file DatabasePostgres.php.

References $name.

Referenced by deleteJoin(), insert(), insertSelect(), replace(), and textFieldSize().

DatabasePostgres::textFieldSize ( table,
field 
)

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

Reimplemented from DatabaseBase.

Definition at line 1067 of file DatabasePostgres.php.

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

DatabasePostgres::timestamp ( ts = 0  ) 

Return MW-style timestamp used for MySQL schema.

Reimplemented from DatabaseBase.

Definition at line 1096 of file DatabasePostgres.php.

References wfTimestamp().

DatabasePostgres::triggerExists ( table,
trigger 
)

DatabasePostgres::wasDeadlock (  ) 

Determines if the last failure was due to a deadlock STUB.

Reimplemented from DatabaseBase.

Definition at line 1088 of file DatabasePostgres.php.

References lastErrno().


Member Data Documentation

DatabasePostgres::$mAffectedRows = null

Definition at line 75 of file DatabasePostgres.php.

DatabasePostgres::$mInsertId = null

Definition at line 72 of file DatabasePostgres.php.

DatabasePostgres::$mLastResult = null

Definition at line 73 of file DatabasePostgres.php.

DatabasePostgres::$numeric_version = null

Definition at line 74 of file DatabasePostgres.php.


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

Generated on Sat Apr 30 22:57:35 2011 for MediaWiki by  doxygen 1.5.9