MediaWiki  REL1_22
DatabasePostgres Class Reference
Inheritance diagram for DatabasePostgres:
Collaboration diagram for DatabasePostgres:

List of all members.

Public Member Functions

 addQuotes ($s)
 affectedRows ()
 Get the number of rows affected by the last write query.
 aggregateValue ($valuedata, $valuename= 'value')
 Return aggregated value function call.
 buildConcat ($stringList)
 Build a concatenation list to feed into a SQL query.
 cascadingDeletes ()
 Returns true if this database supports (and uses) cascading deletes.
 cleanupTriggers ()
 Returns true if this database supports (and uses) triggers (e.g.
 constraintExists ($table, $constraint)
 currentSequenceValue ($seqName)
 Return the current value of a sequence.
 dataSeek ($res, $row)
 Change the position of the cursor in a result object.
 decodeBlob ($b)
 Some DBMSs return a special placeholder object representing blob fields in result objects.
 determineCoreSchema ($desired_schema)
 Determine default schema for MediaWiki core Adjust this session schema search path if desired schema exists and is not alread there.
 doQuery ($sql)
 The DBMS-dependent part of query()
 duplicateTableStructure ($oldName, $newName, $temporary=false, $fname=__METHOD__)
 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.
 encodeBlob ($b)
 estimateRowCount ($table, $vars= '*', $conds= '', $fname=__METHOD__, $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()
 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)
 mysql_fetch_field() wrapper Returns false if the field doesn't exist
 fieldName ($res, $n)
 Get a field name in a result object.
 fieldType ($res, $index)
 pg_field_type() wrapper
 freeResult ($res)
 Free a result object returned by query() or select().
 functionalIndexes ()
 Returns true if this database can use functional indexes.
 getCoreSchema ()
 Return schema name fore core MediaWiki tables.
 getCurrentSchema ()
 Return current schema (executes SELECT current_schema()) Needs transaction.
 getDBname ()
 Get the current DB name.
 getSchemas ()
 Return list of schemas which are accessible without schema name This is list does not contain magic keywords like "$user" Needs transaction.
 getSearchEngine ()
 Get search engine class.
 getSearchPath ()
 Return search patch for schemas This is different from getSchemas() since it contain magic keywords (like "$user").
 getServer ()
 Get the server hostname or IP address.
 getServerVersion ()
 getSoftwareLink ()
 getType ()
 Get the type of the DBMS, as it appears in $wgDBtype.
 hasConstraint ($name)
 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.
 indexAttributes ($index, $schema=false)
 Returns is of attributes used in index.
 indexInfo ($table, $index, $fname=__METHOD__)
 Returns information about an index If errors are explicitly ignored, returns NULL on failure.
 indexUnique ($table, $index, $fname=__METHOD__)
 insert ($table, $args, $fname=__METHOD__, $options=array())
 INSERT wrapper, inserts an array into a table.
 insertId ()
 Return the result of the last call to nextSequenceValue(); This must be called after nextSequenceValue().
 insertSelect ($destTable, $srcTable, $varMap, $conds, $fname=__METHOD__, $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.
 lastErrno ()
 Get the last error number.
 lastError ()
 Get a description of the last error.
 limitResult ($sql, $limit, $offset=false)
 Construct a LIMIT query with optional offset.
 listTables ($prefix=null, $fname=__METHOD__)
 List all tables on the database.
 lock ($lockName, $method, $timeout=5)
 See http://www.postgresql.org/docs/8.2/static/functions-admin.html#FUNCTIONS-ADVISORY-LOCKS.
 lockIsFree ($lockName, $method)
 Check to see if a named lock is available.
 makeConnectionString ($vars)
 makeSelectOptions ($options)
 Various select options.
 nextSequenceValue ($seqName)
 Return the next in a sequence, save the value for retrieval via insertId()
 numFields ($res)
 Get the number of fields in a result object.
 numRows ($res)
 Get the number of rows in a result object.
 open ($server, $user, $password, $dbName)
 Usually aborts on failure.
 pg_array_parse ($text, &$output, $limit=false, $offset=1)
 queryIgnore ($sql, $fname=__METHOD__)
 realTableName ($name, $format= 'quoted')
 realTimestamps ()
 Returns true if this database uses timestamps rather than integers.
 relationExists ($table, $types, $schema=false)
 Query whether a given relation exists (in the given schema, or the default mw one if not given)
 reportQueryError ($error, $errno, $sql, $fname, $tempIgnore=false)
 Report a query error.
 roleExists ($roleName)
 Returns true if a given role (i.e.
 ruleExists ($table, $rule)
 schemaExists ($schema)
 Query whether a given schema exists.
 searchableIPs ()
 Returns true if this database can do a native search on IP columns e.g.
 selectDB ($db)
 Postgres doesn't support selectDB in the same way MySQL does.
 selectSQLText ($table, $vars, $conds= '', $fname=__METHOD__, $options=array(), $join_conds=array())
 Change the FOR UPDATE option as necessary based on the join conditions.
 sequenceExists ($sequence, $schema=false)
 setFakeMaster ($enabled=true)
 Make this connection a fake master.
 setSearchPath ($search_path)
 Update search_path, values should already be sanitized Values may contain magic keywords like "$user".
 streamStatementEnd (&$sql, &$newLine)
 Called by sourceStream() to check if we've reached a statement end.
 strencode ($s)
 Wrapper for addslashes()
 strictIPs ()
 Returns true if this database is strict about what can be put into an IP field.
 tableExists ($table, $fname=__METHOD__, $schema=false)
 For backward compatibility, this function checks both tables and views.
 tableName ($name, $format= 'quoted')
 Format a table name ready for use in constructing an SQL query.
 textFieldSize ($table, $field)
 Returns the size of a text field, or -1 for "unlimited".
 timestamp ($ts=0)
 Convert a timestamp in one of the formats accepted by wfTimestamp() to the format used for inserting into timestamp fields in this DBMS.
 triggerExists ($table, $trigger)
 unlock ($lockName, $method)
 See http://www.postgresql.org/docs/8.2/static/functions-admin.html#FUNCTIONS-ADVISORY-LOCKSFROM PG DOCS: http://www.postgresql.org/docs/8.2/static/functions-admin.html#FUNCTIONS-ADVISORY-LOCKS.
 wasDeadlock ()
 Determines if the last failure was due to a deadlock STUB.

Public Attributes

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

Protected Member Functions

 closeConnection ()
 Closes a database connection, if it is open Returns success, true if already closed.
 dumpError ()
 replaceVars ($ins)
 Postgres specific version of replaceVars.

Private Member Functions

 bigintFromLockName ($lockName)

Detailed Description

Definition at line 286 of file DatabasePostgres.php.


Member Function Documentation

Parameters:
$snull|bool|Blob
Returns:
int|string

Reimplemented from DatabaseBase.

Definition at line 1361 of file DatabasePostgres.php.

References $s.

Referenced by constraintExists(), listTables(), lock(), lockIsFree(), relationExists(), triggerExists(), and unlock().

Get the number of rows affected by the last write query.

See also:
http://www.php.net/mysql_affected_rows
Returns:
int

Implements DatabaseType.

Definition at line 594 of file DatabasePostgres.php.

References empty.

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

Return aggregated value function call.

Reimplemented from DatabaseBase.

Definition at line 1080 of file DatabasePostgres.php.

DatabasePostgres::bigintFromLockName ( lockName) [private]
Parameters:
string$lockName
Returns:
string Integer

Definition at line 1529 of file DatabasePostgres.php.

References wfBaseConvert().

Referenced by lock(), lockIsFree(), and unlock().

DatabasePostgres::buildConcat ( stringList)

Build a concatenation list to feed into a SQL query.

Parameters:
array$stringListlist of raw SQL expressions; caller is responsible for any quoting
Returns:
String

Reimplemented from DatabaseBase.

Definition at line 1451 of file DatabasePostgres.php.

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

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 296 of file DatabasePostgres.php.

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

on the page table)

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 299 of file DatabasePostgres.php.

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

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 432 of file DatabasePostgres.php.

DatabasePostgres::constraintExists ( table,
constraint 
)

Definition at line 1288 of file DatabasePostgres.php.

References $res, addQuotes(), getCoreSchema(), and DatabaseBase\query().

Return the current value of a sequence.

Assumes it has been nextval'ed in this session.

Returns:

Definition at line 974 of file DatabasePostgres.php.

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

DatabasePostgres::dataSeek ( res,
row 
)

Change the position of the cursor in a result object.

See also:
http://www.php.net/mysql_data_seek
Parameters:
$resMixed: A SQL result
$rowMixed: Either MySQL row or ResultWrapper

Implements DatabaseType.

Definition at line 568 of file DatabasePostgres.php.

References $res.

Some DBMSs return a special placeholder object representing blob fields in result objects.

Pass the object through this function to return the original string.

Parameters:
$bstring
Returns:
string

Reimplemented from DatabaseBase.

Definition at line 1346 of file DatabasePostgres.php.

Determine default schema for MediaWiki core Adjust this session schema search path if desired schema exists and is not alread there.

We need to have name of the core schema stored to be able to query database metadata.

This will be also called by the installer after the schema is created

Since:
1.19
Parameters:
$desired_schemastring

Definition at line 1162 of file DatabasePostgres.php.

References DatabaseBase\addIdentifierQuotes(), DatabaseBase\begin(), DatabaseBase\commit(), getCurrentSchema(), getSchemas(), getSearchPath(), schemaExists(), setSearchPath(), and wfDebug().

Referenced by open().

The DBMS-dependent part of query()

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

Reimplemented from DatabaseBase.

Definition at line 436 of file DatabasePostgres.php.

Referenced by hasConstraint(), and open().

DatabasePostgres::dumpError ( ) [protected]

Definition at line 453 of file DatabasePostgres.php.

References array(), as, and wfDebug().

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

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.

The table names passed to this function shall not be quoted (this function calls addIdentifierQuotes when needed).

Parameters:
string$oldNamename of table whose structure should be copied
string$newNamename of table to be created
$temporaryBoolean: whether the new table should be temporary
string$fnamecalling function name
Exceptions:
MWException
Returns:
Boolean: true if operation was successful

Reimplemented from DatabaseBase.

Definition at line 1007 of file DatabasePostgres.php.

References $fname, DatabaseBase\addIdentifierQuotes(), and DatabaseBase\query().

Parameters:
$b
Returns:
Blob

Reimplemented from DatabaseBase.

Definition at line 1342 of file DatabasePostgres.php.

DatabasePostgres::estimateRowCount ( table,
vars = '*',
conds = '',
fname = __METHOD__,
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()

Returns:
int

Reimplemented from DatabaseBase.

Definition at line 613 of file DatabasePostgres.php.

References $count, $fname, $options, $res, $vars, array(), fetchRow(), and DatabaseBase\select().

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. If no more rows are available, false is returned.

Parameters:
$resResultWrapper|object as returned from DatabaseBase::query(), etc.
Returns:
object|bool
Exceptions:
DBUnexpectedErrorThrown if the database returns an error

Implements DatabaseType.

Definition at line 501 of file DatabasePostgres.php.

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

Referenced by lock(), lockIsFree(), textFieldSize(), and unlock().

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

Fields are retrieved with $row['fieldname']. If no more rows are available, false is returned.

Parameters:
$resResultWrapper result object as returned from DatabaseBase::query(), etc.
Returns:
array|bool
Exceptions:
DBUnexpectedErrorThrown if the database returns an error

Implements DatabaseType.

Definition at line 518 of file DatabasePostgres.php.

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

Referenced by currentSequenceValue(), estimateRowCount(), getCurrentSchema(), getSchemas(), getSearchPath(), and nextSequenceValue().

DatabasePostgres::fieldInfo ( table,
field 
)

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

Parameters:
string$tabletable name
string$fieldfield name
Returns:
Field

Implements DatabaseType.

Definition at line 1323 of file DatabasePostgres.php.

References PostgresField\fromText().

DatabasePostgres::fieldName ( res,
n 
)

Get a field name in a result object.

See also:
http://www.php.net/mysql_field_name
Parameters:
$resMixed: A SQL result
$nInteger
Returns:
string

Implements DatabaseType.

Definition at line 551 of file DatabasePostgres.php.

References $n, and $res.

DatabasePostgres::fieldType ( res,
index 
)

pg_field_type() wrapper

Returns:
string

Reimplemented from DatabaseBase.

Definition at line 1331 of file DatabasePostgres.php.

References $res.

Free a result object returned by query() or select().

It's usually not necessary to call this, just use unset() or let the variable holding the result object go out of scope.

Parameters:
$resMixed: A SQL result

Reimplemented from DatabaseBase.

Definition at line 489 of file DatabasePostgres.php.

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

Returns true if this database can use functional indexes.

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 317 of file DatabasePostgres.php.

Return schema name fore core MediaWiki tables.

Since:
1.19
Returns:
string core schema name

Definition at line 1195 of file DatabasePostgres.php.

Referenced by constraintExists(), hasConstraint(), indexAttributes(), listTables(), relationExists(), ruleExists(), and triggerExists().

Return current schema (executes SELECT current_schema()) Needs transaction.

Since:
1.19
Returns:
string return default schema for the current session

Definition at line 1098 of file DatabasePostgres.php.

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

Referenced by determineCoreSchema().

Get the current DB name.

Reimplemented from DatabaseBase.

Definition at line 1443 of file DatabasePostgres.php.

Return list of schemas which are accessible without schema name This is list does not contain magic keywords like "$user" Needs transaction.

See also:
getSearchPath()
setSearchPath()
Since:
1.19
Returns:
array list of actual schemas for the current sesson

Definition at line 1114 of file DatabasePostgres.php.

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

Referenced by determineCoreSchema().

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

Return search patch for schemas This is different from getSchemas() since it contain magic keywords (like "$user").

Needs transaction

Since:
1.19
Returns:
array how to search for table names schemas for the current user

Definition at line 1131 of file DatabasePostgres.php.

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

Referenced by determineCoreSchema().

Get the server hostname or IP address.

Reimplemented from DatabaseBase.

Definition at line 1447 of file DatabasePostgres.php.

Returns:
string Version information from the database

Implements DatabaseType.

Definition at line 1202 of file DatabasePostgres.php.

Referenced by insert(), and open().

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

Implements DatabaseType.

Definition at line 1087 of file DatabasePostgres.php.

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

Returns:
string

Implements DatabaseType.

Definition at line 292 of file DatabasePostgres.php.

Definition at line 321 of file DatabasePostgres.php.

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

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

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 308 of file DatabasePostgres.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 311 of file DatabasePostgres.php.

DatabasePostgres::indexAttributes ( index,
schema = false 
)

Returns is of attributes used in index.

Since:
1.19
Returns:
Array

Definition at line 652 of file DatabasePostgres.php.

References $res, array(), as, getCoreSchema(), i, n, and DatabaseBase\query().

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

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

Returns:
bool|null

Implements DatabaseType.

Definition at line 632 of file DatabasePostgres.php.

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

DatabasePostgres::indexUnique ( table,
index,
fname = __METHOD__ 
)
DatabasePostgres::insert ( table,
args,
fname = __METHOD__,
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:
$tableString: Name of the table to insert to.
$argsArray: Items to insert into the table.
$fnameString: Name of the function, for profiling
string$optionsor Array. Valid options: IGNORE
Returns:
bool Success of insert operation. IGNORE always returns true.

Reimplemented from DatabaseBase.

Definition at line 761 of file DatabasePostgres.php.

References $fname, $keys, $options, $res, array(), as, getServerVersion(), DatabaseBase\makeList(), DatabaseBase\query(), and tableName().

Return the result of the last call to nextSequenceValue(); This must be called after nextSequenceValue().

Returns:
integer|null

Implements DatabaseType.

Definition at line 564 of file DatabasePostgres.php.

DatabasePostgres::insertSelect ( destTable,
srcTable,
varMap,
conds,
fname = __METHOD__,
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)?
Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 878 of file DatabasePostgres.php.

References $fname, $res, array(), list, DatabaseBase\makeList(), makeSelectOptions(), DatabaseBase\query(), and tableName().

Get the last error number.

See also:
http://www.php.net/mysql_errno
Returns:
int

Implements DatabaseType.

Definition at line 586 of file DatabasePostgres.php.

Referenced by wasDeadlock().

Get a description of the last error.

See also:
http://www.php.net/mysql_error
Returns:
string

Implements DatabaseType.

Definition at line 575 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.

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

Parameters:
string$sqlSQL query we will append the limit too
$limitInteger the SQL limit
$offsetInteger|bool the SQL offset (default false)
Exceptions:
DBUnexpectedError
Returns:
string

Reimplemented from DatabaseBase.

Definition at line 999 of file DatabasePostgres.php.

DatabasePostgres::listTables ( prefix = null,
fname = __METHOD__ 
)

List all tables on the database.

Parameters:
string$prefixOnly show tables with this prefix, e.g. mw_
string$fnamecalling function name
Exceptions:
MWException

Reimplemented from DatabaseBase.

Definition at line 1013 of file DatabasePostgres.php.

References $fname, $result, $vars, addQuotes(), array(), as, getCoreSchema(), and DatabaseBase\query().

DatabasePostgres::lock ( lockName,
method,
timeout = 5 
)

See http://www.postgresql.org/docs/8.2/static/functions-admin.html#FUNCTIONS-ADVISORY-LOCKS.

Parameters:
$lockNamestring
$methodstring
$timeoutint
Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 1496 of file DatabasePostgres.php.

References $key, $result, addQuotes(), bigintFromLockName(), fetchObject(), DatabaseBase\query(), and wfDebug().

DatabasePostgres::lockIsFree ( lockName,
method 
)

Check to see if a named lock is available.

This is non-blocking. See http://www.postgresql.org/docs/8.2/static/functions-admin.html#FUNCTIONS-ADVISORY-LOCKS

Parameters:
string$lockNamename of lock to poll
string$methodname of method calling us
Returns:
Boolean
Since:
1.20

Reimplemented from DatabaseBase.

Definition at line 1481 of file DatabasePostgres.php.

References $key, $result, addQuotes(), bigintFromLockName(), fetchObject(), and DatabaseBase\query().

Definition at line 419 of file DatabasePostgres.php.

References $name, $s, $value, $vars, and as.

Referenced by open().

Various select options.

Access:
private
Parameters:
array$optionsan 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 1406 of file DatabasePostgres.php.

References $key, $options, array(), as, DatabaseBase\makeGroupByWithHaving(), and DatabaseBase\makeOrderBy().

Referenced by insertSelect().

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

Returns:
null

Reimplemented from DatabaseBase.

Definition at line 962 of file DatabasePostgres.php.

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

Get the number of fields in a result object.

See also:
http://www.php.net/mysql_num_fields
Parameters:
$resMixed: A SQL result
Returns:
int

Implements DatabaseType.

Definition at line 544 of file DatabasePostgres.php.

References $res.

Get the number of rows in a result object.

Parameters:
$resMixed: A SQL result
Returns:
int

Implements DatabaseType.

Definition at line 531 of file DatabasePostgres.php.

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

Referenced by hasConstraint().

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

Usually aborts on failure.

Parameters:
string$server
string$user
string$password
string$dbName
Exceptions:
DBConnectionError
Returns:
DatabaseBase|null

Implements DatabaseType.

Definition at line 337 of file DatabasePostgres.php.

References $password, $user, $wgCommandLineMode, array(), DatabaseBase\close(), determineCoreSchema(), doQuery(), e, getServerVersion(), global, DatabaseBase\installErrorHandler(), is, lastError(), makeConnectionString(), DatabaseBase\query(), DatabaseBase\restoreErrorHandler(), and wfDebug().

Referenced by selectDB().

DatabasePostgres::pg_array_parse ( text,
&$  output,
limit = false,
offset = 1 
)

Definition at line 1051 of file DatabasePostgres.php.

References $limit, $output, and array().

Referenced by getSchemas().

DatabasePostgres::queryIgnore ( sql,
fname = __METHOD__ 
)

Definition at line 485 of file DatabasePostgres.php.

References $fname, and DatabaseBase\query().

DatabasePostgres::realTableName ( name,
format = 'quoted' 
)

Definition at line 954 of file DatabasePostgres.php.

References $name, and tableName().

Referenced by relationExists(), and tableName().

Returns true if this database uses timestamps rather than integers.

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 305 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)

Returns:
bool

Definition at line 1224 of file DatabasePostgres.php.

References $count, $res, addQuotes(), array(), getCoreSchema(), DatabaseBase\query(), and realTableName().

Referenced by sequenceExists(), and tableExists().

DatabasePostgres::replaceVars ( ins) [protected]

Postgres specific version of replaceVars.

Calls the parent version in Database.php

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

Reimplemented from DatabaseBase.

Definition at line 1382 of file DatabasePostgres.php.

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

Report a query error.

Log the error, and if neither the object ignore flag nor the $tempIgnore flag is set, throw a DBQueryError.

Parameters:
$errorString
$errnoInteger
$sqlString
$fnameString
$tempIgnoreBoolean
Exceptions:
DBQueryError

Reimplemented from DatabaseBase.

Definition at line 471 of file DatabasePostgres.php.

References $error, $fname, and DatabaseBase\rollback().

Returns true if a given role (i.e.

user) exists, false otherwise.

Returns:
bool

Definition at line 1317 of file DatabasePostgres.php.

References array(), and DatabaseBase\selectField().

DatabasePostgres::ruleExists ( table,
rule 
)

Definition at line 1277 of file DatabasePostgres.php.

References array(), getCoreSchema(), and DatabaseBase\selectField().

Query whether a given schema exists.

Returns true if it does, false if it doesn't.

Returns:
bool

Definition at line 1307 of file DatabasePostgres.php.

References array(), and DatabaseBase\selectField().

Referenced by determineCoreSchema().

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

Postgres doesn't support selectDB in the same way MySQL does.

So if the DB name doesn't match the open connection, open a new one

Returns:

Reimplemented from DatabaseBase.

Definition at line 411 of file DatabasePostgres.php.

References open().

DatabasePostgres::selectSQLText ( table,
vars,
conds = '',
fname = __METHOD__,
options = array(),
join_conds = array() 
)

Change the FOR UPDATE option as necessary based on the join conditions.

Then pass to the parent function to get the actual SQL text.

In Postgres when using FOR UPDATE, only the main table and tables that are inner joined can be locked. That means tables in an outer join cannot be FOR UPDATE locked. Trying to do so causes a DB error. This wrapper checks which tables can be locked and adjusts it accordingly.

Reimplemented from DatabaseBase.

Definition at line 731 of file DatabasePostgres.php.

References $fname, $options, $vars, and as.

DatabasePostgres::sequenceExists ( sequence,
schema = false 
)

Definition at line 1251 of file DatabasePostgres.php.

References relationExists().

Make this connection a fake master.

Parameters:
$enabledbool

Reimplemented from DatabaseBase.

Definition at line 1440 of file DatabasePostgres.php.

DatabasePostgres::setSearchPath ( search_path)

Update search_path, values should already be sanitized Values may contain magic keywords like "$user".

Since:
1.19
Parameters:
$search_patharray list of schemas to be searched by default

Definition at line 1145 of file DatabasePostgres.php.

References DatabaseBase\query().

Referenced by determineCoreSchema().

DatabasePostgres::streamStatementEnd ( &$  sql,
&$  newLine 
)

Called by sourceStream() to check if we've reached a statement end.

Parameters:
string$sqlSQL assembled so far
string$newLineNew line about to be added to $sql
Returns:
Bool Whether $newLine contains end of the statement

Reimplemented from DatabaseBase.

Definition at line 1459 of file DatabasePostgres.php.

Wrapper for addslashes()

Parameters:
string$sto be slashed.
Returns:
string: slashed string.

Implements DatabaseType.

Definition at line 1353 of file DatabasePostgres.php.

References $s.

Referenced by indexUnique().

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

DatabasePostgres::tableExists ( table,
fname = __METHOD__,
schema = false 
)

For backward compatibility, this function checks both tables and views.

Returns:
bool

Definition at line 1247 of file DatabasePostgres.php.

References array(), and relationExists().

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

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:
string$namedatabase table name
string$formatOne of: quoted - Automatically pass the table name through addIdentifierQuotes() so that it can be used in a query. raw - Do not add identifier quotes to the table name
Returns:
String: full database name

Reimplemented from DatabaseBase.

Definition at line 941 of file DatabasePostgres.php.

References $name, and realTableName().

Referenced by insert(), insertSelect(), realTableName(), and textFieldSize().

DatabasePostgres::textFieldSize ( table,
field 
)

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

Parameters:
$tablestring
$fieldstring
Returns:
int

Reimplemented from DatabaseBase.

Definition at line 983 of file DatabasePostgres.php.

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

Convert a timestamp in one of the formats accepted by wfTimestamp() to the format used for inserting into timestamp fields in this DBMS.

The result is unquoted, and needs to be passed through addQuotes() before it can be included in raw SQL.

Parameters:
$tsstring|int
Returns:
string

Reimplemented from DatabaseBase.

Definition at line 1029 of file DatabasePostgres.php.

References wfTimestamp().

DatabasePostgres::triggerExists ( table,
trigger 
)

Definition at line 1255 of file DatabasePostgres.php.

References $res, addQuotes(), getCoreSchema(), and DatabaseBase\query().

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

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 1003 of file DatabasePostgres.php.

References lastErrno().


Member Data Documentation

DatabasePostgres::$mAffectedRows = null

Definition at line 290 of file DatabasePostgres.php.

DatabasePostgres::$mInsertId = null

Definition at line 287 of file DatabasePostgres.php.

DatabasePostgres::$mLastResult = null

Definition at line 288 of file DatabasePostgres.php.

DatabasePostgres::$numeric_version = null

Definition at line 289 of file DatabasePostgres.php.


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