BlueSpice MediaWiki REL1_27
 All Classes Namespaces Files Functions Variables Groups Pages
DatabasePostgres Class Reference
Inheritance diagram for DatabasePostgres:
Collaboration diagram for DatabasePostgres:

Public Member Functions

 getType ()
 
 cascadingDeletes ()
 
 cleanupTriggers ()
 
 strictIPs ()
 
 realTimestamps ()
 
 implicitGroupby ()
 
 implicitOrderby ()
 
 searchableIPs ()
 
 functionalIndexes ()
 
 hasConstraint ($name)
 
 open ($server, $user, $password, $dbName)
 
 selectDB ($db)
 
 makeConnectionString ($vars)
 
 doQuery ($sql)
 
 reportQueryError ($error, $errno, $sql, $fname, $tempIgnore=false)
 
 queryIgnore ($sql, $fname=__METHOD__)
 
 freeResult ($res)
 
 fetchObject ($res)
 
 fetchRow ($res)
 
 numRows ($res)
 
 numFields ($res)
 
 fieldName ($res, $n)
 
 insertId ()
 
 dataSeek ($res, $row)
 
 lastError ()
 
 lastErrno ()
 
 affectedRows ()
 
 estimateRowCount ($table, $vars= '*', $conds= '', $fname=__METHOD__, $options=[])
 
 indexInfo ($table, $index, $fname=__METHOD__)
 
 indexAttributes ($index, $schema=false)
 
 indexUnique ($table, $index, $fname=__METHOD__)
 
 selectSQLText ($table, $vars, $conds= '', $fname=__METHOD__, $options=[], $join_conds=[])
 
 insert ($table, $args, $fname=__METHOD__, $options=[])
 
 insertSelect ($destTable, $srcTable, $varMap, $conds, $fname=__METHOD__, $insertOptions=[], $selectOptions=[])
 
 tableName ($name, $format= 'quoted')
 
 realTableName ($name, $format= 'quoted')
 
 nextSequenceValue ($seqName)
 
 currentSequenceValue ($seqName)
 
 textFieldSize ($table, $field)
 
 limitResult ($sql, $limit, $offset=false)
 
 wasDeadlock ()
 
 duplicateTableStructure ($oldName, $newName, $temporary=false, $fname=__METHOD__)
 
 listTables ($prefix=null, $fname=__METHOD__)
 
 timestamp ($ts=0)
 
 pg_array_parse ($text, &$output, $limit=false, $offset=1)
 
 aggregateValue ($valuedata, $valuename= 'value')
 
 getSoftwareLink ()
 
 getCurrentSchema ()
 
 getSchemas ()
 
 getSearchPath ()
 
 setSearchPath ($search_path)
 
 determineCoreSchema ($desiredSchema)
 
 getCoreSchema ()
 
 getServerVersion ()
 
 relationExists ($table, $types, $schema=false)
 
 tableExists ($table, $fname=__METHOD__, $schema=false)
 
 sequenceExists ($sequence, $schema=false)
 
 triggerExists ($table, $trigger)
 
 ruleExists ($table, $rule)
 
 constraintExists ($table, $constraint)
 
 schemaExists ($schema)
 
 roleExists ($roleName)
 
 fieldInfo ($table, $field)
 
 fieldType ($res, $index)
 
 encodeBlob ($b)
 
 decodeBlob ($b)
 
 strencode ($s)
 
 addQuotes ($s)
 
 makeSelectOptions ($options)
 
 getDBname ()
 
 getServer ()
 
 buildConcat ($stringList)
 
 buildGroupConcatField ($delimiter, $table, $field, $conds= '', $options=[], $join_conds=[])
 
 getSearchEngine ()
 
 streamStatementEnd (&$sql, &$newLine)
 
 lockIsFree ($lockName, $method)
 
 lock ($lockName, $method, $timeout=5)
 
 unlock ($lockName, $method)
 
- Public Member Functions inherited from DatabaseBase
 getServerInfo ()
 
 getDelimiter ()
 
 debug ($debug=null)
 
 bufferResults ($buffer=null)
 
 trxLevel ()
 
 trxTimestamp ()
 
 tablePrefix ($prefix=null)
 
 dbSchema ($schema=null)
 
 setFileHandle ($fh)
 
 getLBInfo ($name=null)
 
 setLBInfo ($name, $value=null)
 
 setLazyMasterHandle (IDatabase $conn)
 
 getLazyMasterHandle ()
 
 setTransactionProfiler (TransactionProfiler $profiler)
 
 cascadingDeletes ()
 
 cleanupTriggers ()
 
 strictIPs ()
 
 realTimestamps ()
 
 implicitGroupby ()
 
 implicitOrderby ()
 
 searchableIPs ()
 
 functionalIndexes ()
 
 lastQuery ()
 
 doneWrites ()
 
 lastDoneWrites ()
 
 writesPending ()
 
 writesOrCallbacksPending ()
 
 pendingWriteQueryDuration ()
 
 pendingWriteCallers ()
 
 isOpen ()
 
 setFlag ($flag)
 
 clearFlag ($flag)
 
 getFlag ($flag)
 
 getProperty ($name)
 
 getWikiID ()
 
 getSchemaPath ()
 
 getUpdateKeysPath ()
 
 indexInfo ($table, $index, $fname=__METHOD__)
 
 strencode ($s)
 
 __construct (array $params)
 
 __sleep ()
 
 connectionErrorHandler ($errno, $errstr)
 
 close ()
 
 reportConnectionError ($error= 'Unknown error')
 
 query ($sql, $fname=__METHOD__, $tempIgnore=false)
 
 reportQueryError ($error, $errno, $sql, $fname, $tempIgnore=false)
 
 execute ($prepared, $args=null)
 
 fillPrepared ($preparedQuery, $args)
 
 freeResult ($res)
 
 selectField ($table, $var, $cond= '', $fname=__METHOD__, $options=[])
 
 selectFieldValues ($table, $var, $cond= '', $fname=__METHOD__, $options=[], $join_conds=[])
 
 makeSelectOptions ($options)
 
 makeGroupByWithHaving ($options)
 
 makeOrderBy ($options)
 
 select ($table, $vars, $conds= '', $fname=__METHOD__, $options=[], $join_conds=[])
 
 selectSQLText ($table, $vars, $conds= '', $fname=__METHOD__, $options=[], $join_conds=[])
 
 selectRow ($table, $vars, $conds, $fname=__METHOD__, $options=[], $join_conds=[])
 
 estimateRowCount ($table, $vars= '*', $conds= '', $fname=__METHOD__, $options=[])
 
 selectRowCount ($tables, $vars= '*', $conds= '', $fname=__METHOD__, $options=[], $join_conds=[])
 
 fieldExists ($table, $field, $fname=__METHOD__)
 
 indexExists ($table, $index, $fname=__METHOD__)
 
 tableExists ($table, $fname=__METHOD__)
 
 indexUnique ($table, $index)
 
 insert ($table, $a, $fname=__METHOD__, $options=[])
 
 update ($table, $values, $conds, $fname=__METHOD__, $options=[])
 
 makeList ($a, $mode=LIST_COMMA)
 
 makeWhereFrom2d ($data, $baseKey, $subKey)
 
 aggregateValue ($valuedata, $valuename= 'value')
 
 bitNot ($field)
 
 bitAnd ($fieldLeft, $fieldRight)
 
 bitOr ($fieldLeft, $fieldRight)
 
 buildConcat ($stringList)
 
 buildGroupConcatField ($delim, $table, $field, $conds= '', $join_conds=[])
 
 selectDB ($db)
 
 getDBname ()
 
 getServer ()
 
 tableName ($name, $format= 'quoted')
 
 tableNames ()
 
 tableNamesN ()
 
 tableNameWithAlias ($name, $alias=false)
 
 tableNamesWithAlias ($tables)
 
 fieldNameWithAlias ($name, $alias=false)
 
 fieldNamesWithAlias ($fields)
 
 addQuotes ($s)
 
 addIdentifierQuotes ($s)
 
 isQuotedIdentifier ($name)
 
 buildLike ()
 
 anyChar ()
 
 anyString ()
 
 nextSequenceValue ($seqName)
 
 useIndexClause ($index)
 
 replace ($table, $uniqueIndexes, $rows, $fname=__METHOD__)
 
 upsert ($table, array $rows, array $uniqueIndexes, array $set, $fname=__METHOD__)
 
 deleteJoin ($delTable, $joinTable, $delVar, $joinVar, $conds, $fname=__METHOD__)
 
 textFieldSize ($table, $field)
 
 lowPriorityOption ()
 
 delete ($table, $conds, $fname=__METHOD__)
 
 insertSelect ($destTable, $srcTable, $varMap, $conds, $fname=__METHOD__, $insertOptions=[], $selectOptions=[])
 
 limitResult ($sql, $limit, $offset=false)
 
 unionSupportsOrderAndLimit ()
 
 unionQueries ($sqls, $all)
 
 conditional ($cond, $trueVal, $falseVal)
 
 strreplace ($orig, $old, $new)
 
 getServerUptime ()
 
 wasDeadlock ()
 
 wasLockTimeout ()
 
 wasErrorReissuable ()
 
 wasReadOnlyError ()
 
 wasConnectionError ($errno)
 
 masterPosWait (DBMasterPos $pos, $timeout)
 
 getSlavePos ()
 
 getMasterPos ()
 
 onTransactionIdle ($callback)
 
 onTransactionPreCommitOrIdle ($callback)
 
 startAtomic ($fname=__METHOD__)
 
 endAtomic ($fname=__METHOD__)
 
 doAtomicSection ($fname, $callback)
 
 begin ($fname=__METHOD__)
 
 commit ($fname=__METHOD__, $flush= '')
 
 rollback ($fname=__METHOD__, $flush= '')
 
 duplicateTableStructure ($oldName, $newName, $temporary=false, $fname=__METHOD__)
 
 listTables ($prefix=null, $fname=__METHOD__)
 
 clearViewsCache ()
 
 listViews ($prefix=null, $fname=__METHOD__)
 
 isView ($name)
 
 timestamp ($ts=0)
 
 timestampOrNull ($ts=null)
 
 ping ()
 
 getSessionLagStatus ()
 
 getTransactionLagStatus ()
 
 getApproximateLagStatus ()
 
 getLag ()
 
 maxListLen ()
 
 encodeBlob ($b)
 
 decodeBlob ($b)
 
 setSessionOptions (array $options)
 
 sourceFile ($filename, $lineCallback=false, $resultCallback=false, $fname=false, $inputCallback=false)
 
 patchPath ($patch)
 
 setSchemaVars ($vars)
 
 sourceStream ($fp, $lineCallback=false, $resultCallback=false, $fname=__METHOD__, $inputCallback=false)
 
 streamStatementEnd (&$sql, &$newLine)
 
 lockIsFree ($lockName, $method)
 
 lock ($lockName, $method, $timeout=5)
 
 unlock ($lockName, $method)
 
 getScopedLockAndFlush ($lockKey, $fname, $timeout)
 
 namedLocksEnqueue ()
 
 lockTables ($read, $write, $method, $lowPriority=true)
 
 unlockTables ($method)
 
 dropTable ($tableName, $fName=__METHOD__)
 
 getSearchEngine ()
 
 getInfinity ()
 
 encodeExpiry ($expiry)
 
 decodeExpiry ($expiry, $format=TS_MW)
 
 setBigSelects ($value=true)
 
 isReadOnly ()
 
 __toString ()
 
 __destruct ()
 
- Public Member Functions inherited from IDatabase
 selectFieldValues ($table, $var, $cond= '', $fname=__METHOD__, $options=[])
 

Protected Member Functions

 closeConnection ()
 
 dumpError ()
 
 replaceVars ($ins)
 
- Protected Member Functions inherited from DatabaseBase
 ignoreErrors ($ignoreErrors=null)
 
 getTransactionProfiler ()
 
 installErrorHandler ()
 
 restoreErrorHandler ()
 
 getLogContext (array $extras=[])
 
 assertOpen ()
 
 closeConnection ()
 
 doQuery ($sql)
 
 isWriteQuery ($sql)
 
 isTransactableQuery ($sql)
 
 prepare ($sql, $func= 'DatabaseBase::prepare')
 
 freePrepared ($prepared)
 
 fillPreparedArg ($matches)
 
 makeInsertOptions ($options)
 
 makeUpdateOptionsArray ($options)
 
 makeUpdateOptions ($options)
 
 tableNamesWithUseIndexOrJOIN ($tables, $use_index=[], $join_conds=[])
 
 indexName ($index)
 
 escapeLikeInternal ($s)
 
 nativeReplace ($table, $rows, $fname)
 
 runOnTransactionIdleCallbacks ()
 
 runOnTransactionPreCommitCallbacks ()
 
 doBegin ($fname)
 
 doCommit ($fname)
 
 doRollback ($fname)
 
 resultObject ($result)
 
 replaceVars ($ins)
 
 getSchemaVars ()
 
 getDefaultSchemaVars ()
 
 getReadOnlyReason ()
 

Protected Attributes

 $mLastResult = null
 
 $mAffectedRows = null
 
- Protected Attributes inherited from DatabaseBase
 $mLastQuery = ''
 
 $mDoneWrites = false
 
 $mPHPError = false
 
 $mServer
 
 $srvCache
 
 $mConn = null
 
 $mOpened = false
 
 $mTrxIdleCallbacks = []
 
 $mTrxPreCommitCallbacks = []
 
 $mTablePrefix
 
 $mSchema
 
 $mFlags
 
 $mForeign
 
 $mLBInfo = []
 
 $mDefaultBigSelects = null
 
 $mSchemaVars = false
 
 $mSessionVars = []
 
 $preparedArgs
 
 $htmlErrors
 
 $delimiter = ';'
 
 $mTrxLevel = 0
 
 $mTrxShortId = ''
 
 $fileHandle = null
 
 $allViews = null
 
 $trxProfiler
 

Additional Inherited Members

- Static Public Member Functions inherited from DatabaseBase
static factory ($dbType, $p=[])
 
- Public Attributes inherited from DatabaseBase
const DEADLOCK_TRIES = 4
 
const DEADLOCK_DELAY_MIN = 500000
 
const DEADLOCK_DELAY_MAX = 1500000
 
 $mUser
 
 $mPassword
 
 $mDBname
 
- Static Protected Member Functions inherited from DatabaseBase
static generalizeSQL ($sql)
 

Member Function Documentation

DatabasePostgres::addQuotes (   $s)
Parameters
null | bool | Blob$s
Returns
int|string

Implements IDatabase.

DatabasePostgres::affectedRows ( )

Get the number of rows affected by the last write query

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

Implements IDatabase.

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

Return aggregated value function call

Parameters
array$valuedata
string$valuename
Returns
array
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

Implements IDatabase.

DatabasePostgres::closeConnection ( )
protected

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

Returns
bool
DatabasePostgres::currentSequenceValue (   $seqName)

Return the current value of a sequence. Assumes it has been nextval'ed in this session.

Parameters
string$seqName
Returns
int
DatabasePostgres::dataSeek (   $res,
  $row 
)
Parameters
mixed$res
int$row
Returns
bool

Implements IDatabase.

DatabasePostgres::decodeBlob (   $b)

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
string | Blob$b
Returns
string

Implements IDatabase.

DatabasePostgres::determineCoreSchema (   $desiredSchema)

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
string$desiredSchema

Prepend our schema (e.g. 'mediawiki') in front of the search path Fixes bug 15816

DatabasePostgres::encodeBlob (   $b)
Parameters
string$b
Returns
Blob

Implements IDatabase.

DatabasePostgres::estimateRowCount (   $table,
  $vars = '*',
  $conds = '',
  $fname = __METHOD__,
  $options = [] 
)

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

Parameters
string$table
string$vars
string$conds
string$fname
array$options
Returns
int

Implements IDatabase.

DatabasePostgres::fetchObject (   $res)
Parameters
ResultWrapper | stdClass$res
Returns
stdClass
Exceptions
DBUnexpectedError

Implements IDatabase.

DatabasePostgres::fetchRow (   $res)

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
ResultWrapper$resResult object as returned from IDatabase::query(), etc.
Returns
array|bool
Exceptions
DBUnexpectedErrorThrown if the database returns an error

Implements IDatabase.

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

DatabasePostgres::fieldName (   $res,
  $n 
)

Get a field name in a result object

See Also
http://www.php.net/mysql_field_name
Parameters
mixed$resA SQL result
int$n
Returns
string

Implements IDatabase.

DatabasePostgres::fieldType (   $res,
  $index 
)

pg_field_type() wrapper

Parameters
ResultWrapper | resource$resResultWrapper or PostgreSQL query result resource
int$indexField number, starting from 0
Returns
string
DatabasePostgres::freeResult (   $res)
Parameters
stdClass | ResultWrapper$res
Exceptions
DBUnexpectedError

Implements IDatabase.

DatabasePostgres::getCoreSchema ( )

Return schema name fore core MediaWiki tables

Since
1.19
Returns
string Core schema name
DatabasePostgres::getCurrentSchema ( )

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

Since
1.19
Returns
string Default schema for the current session
DatabasePostgres::getDBname ( )

Get the current DB name

Returns
string

Implements IDatabase.

DatabasePostgres::getSchemas ( )

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
DatabasePostgres::getSearchPath ( )

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
DatabasePostgres::getServer ( )

Get the server hostname or IP address

Returns
string

Implements IDatabase.

DatabasePostgres::getServerVersion ( )
Returns
string Version information from the database

Implements IDatabase.

DatabasePostgres::getSoftwareLink ( )
Returns
string Wikitext of a link to the server software's web site

Implements IDatabase.

DatabasePostgres::getType ( )

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

Returns
string

Implements IDatabase.

DatabasePostgres::implicitGroupby ( )

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

Returns
bool

Implements IDatabase.

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

Returns
bool

Implements IDatabase.

DatabasePostgres::indexAttributes (   $index,
  $schema = false 
)

Returns is of attributes used in index

Since
1.19
Parameters
string$index
bool | string$schema
Returns
array
DatabasePostgres::indexInfo (   $table,
  $index,
  $fname = __METHOD__ 
)

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

Parameters
string$table
string$index
string$fname
Returns
bool|null
DatabasePostgres::insert (   $table,
  $args,
  $fname = __METHOD__,
  $options = [] 
)

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
string$tableName of the table to insert to.
array$argsItems to insert into the table.
string$fnameName of the function, for profiling
array | string$optionsString or array. Valid options: IGNORE
Returns
bool Success of insert operation. IGNORE always returns true.

Implements IDatabase.

DatabasePostgres::insertId ( )

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

Returns
int|null

Implements IDatabase.

DatabasePostgres::insertSelect (   $destTable,
  $srcTable,
  $varMap,
  $conds,
  $fname = __METHOD__,
  $insertOptions = [],
  $selectOptions = [] 
)

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)?
Parameters
string$destTable
array | string$srcTable
array$varMap
array$conds
string$fname
array$insertOptions
array$selectOptions
Returns
bool

Implements IDatabase.

DatabasePostgres::lastErrno ( )

Get the last error number

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

Implements IDatabase.

DatabasePostgres::lastError ( )

Get a description of the last error

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

Implements IDatabase.

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
Returns
array

Implements IDatabase.

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

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

Parameters
string$lockName
string$method
int$timeout
Returns
bool

Implements IDatabase.

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
bool
Since
1.20

Implements IDatabase.

DatabasePostgres::makeSelectOptions (   $options)

Various select options

Parameters
array$optionsAn associative array of options to be turned into an SQL query, valid keys are listed in the function.
Returns
array
DatabasePostgres::nextSequenceValue (   $seqName)

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

Parameters
string$seqName
Returns
int|null

Implements IDatabase.

DatabasePostgres::numFields (   $res)

Get the number of fields in a result object

See Also
http://www.php.net/mysql_num_fields
Parameters
mixed$resA SQL result
Returns
int

Implements IDatabase.

DatabasePostgres::numRows (   $res)

Get the number of rows in a result object

Parameters
mixed$resA SQL result
Returns
int

Implements IDatabase.

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

Usually aborts on failure

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

Implements IDatabase.

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

Posted by cc[plus]php[at]c2se[dot]com on 25-Mar-2009 09:12 to http://www.php.net/manual/en/ref.pgsql.php

Parsing a postgres array can be a tricky problem, he's my take on this, it handles multi-dimensional arrays plus escaping using a nasty regexp to determine the limits of each data-item.

This should really be handled by PHP PostgreSQL module

Since
1.19
Parameters
string$textPostgreql array returned in a text form like {a,b}
string$output
int$limit
int$offset
Returns
string
DatabasePostgres::relationExists (   $table,
  $types,
  $schema = false 
)

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

Parameters
string$table
array | string$types
bool | string$schema
Returns
bool
DatabasePostgres::replaceVars (   $ins)
protected

Postgres specific version of replaceVars. Calls the parent version in Database.php

Parameters
string$insSQL string, read from a stream (usually tables.sql)
Returns
string SQL string
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
string$error
int$errno
string$sql
string$fname
bool$tempIgnore
Exceptions
DBQueryError

Implements IDatabase.

DatabasePostgres::roleExists (   $roleName)

Returns true if a given role (i.e. user) exists, false otherwise.

Parameters
string$roleName
Returns
bool
DatabasePostgres::schemaExists (   $schema)

Query whether a given schema exists. Returns true if it does, false if it doesn't.

Parameters
string$schema
Returns
bool
DatabasePostgres::selectDB (   $db)

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

Parameters
string$db
Returns
bool

Implements IDatabase.

DatabasePostgres::selectSQLText (   $table,
  $vars,
  $conds = '',
  $fname = __METHOD__,
  $options = [],
  $join_conds = [] 
)

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.

MySQL uses "ORDER BY NULL" as an optimization hint, but that syntax is illegal in PostgreSQL.

See Also
DatabaseBase::selectSQLText

Implements IDatabase.

DatabasePostgres::setSearchPath (   $search_path)

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

Since
1.19
Parameters
array$search_pathList of schemas to be searched by default
DatabasePostgres::tableExists (   $table,
  $fname = __METHOD__,
  $schema = false 
)

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

Parameters
string$table
string$fname
bool | string$schema
Returns
bool
DatabasePostgres::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.

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

Parameters
string | int$ts
Returns
string

Implements IDatabase.

DatabasePostgres::unlock (   $lockName,
  $method 
)
DatabasePostgres::wasDeadlock ( )

Determines if the last failure was due to a deadlock STUB

Returns
bool

Implements IDatabase.


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