29use Wikimedia\WaitConditionLoop;
42 private $numericVersion;
45 private $lastResultHandle;
56 $this->port = intval(
$params[
'port'] ??
null );
76 protected function open( $server, $user, $password, $db, $schema, $tablePrefix ) {
77 if ( !function_exists(
'pg_connect' ) ) {
79 "Postgres functions missing, have you compiled PHP with the --with-pgsql\n" .
80 "option? (Note: if you recently installed PHP, you may need to restart your\n" .
81 "webserver and database)"
85 $this->
close( __METHOD__ );
90 'dbname' => ( $db !==
null && $db !==
'' ) ? $db :
'postgres',
92 'password' => $password
94 if ( $server !==
null && $server !==
'' ) {
95 $connectVars[
'host'] = $server;
97 if ( $this->port > 0 ) {
98 $connectVars[
'port'] = $this->port;
101 $connectVars[
'sslmode'] =
'require';
103 $connectString = $this->makeConnectionString( $connectVars );
107 $this->conn = pg_connect( $connectString, PGSQL_CONNECT_FORCE_NEW ) ?:
null;
108 }
catch ( RuntimeException $e ) {
114 if ( !$this->conn ) {
123 'client_encoding' =>
'UTF8',
124 'datestyle' =>
'ISO, YMD',
126 'standard_conforming_strings' =>
'on',
127 'bytea_output' =>
'escape',
128 'client_min_messages' =>
'ERROR'
130 foreach ( $variables as $var => $val ) {
131 $sql =
'SET ' . $this->
platform->addIdentifierQuotes( $var ) .
' = ' . $this->
addQuotes( $val );
132 $query =
new Query( $sql, self::QUERY_NO_RETRY | self::QUERY_CHANGE_TRX,
'SET' );
133 $this->
query( $query, __METHOD__ );
138 }
catch ( RuntimeException $e ) {
149 if ( $database ===
null ) {
153 $domain->
getSchema() ?? $this->currentDomain->getSchema(),
157 } elseif ( $this->
getDBname() !== $database ) {
170 $this->
platform->setCurrentDomain( $domain );
180 private function makeConnectionString( $vars ) {
182 foreach ( $vars as $name => $value ) {
183 $s .=
"$name='" . str_replace( [
"\\",
"'" ], [
"\\\\",
"\\'" ], $value ) .
"' ";
190 return $this->conn ? pg_close( $this->conn ) :
true;
196 $sql = mb_convert_encoding( $sql,
'UTF-8' );
199 while ( $priorRes = pg_get_result(
$conn ) ) {
200 pg_free_result( $priorRes );
203 if ( pg_send_query(
$conn, $sql ) ===
false ) {
204 throw new DBUnexpectedError( $this,
"Unable to post new query to PostgreSQL\n" );
209 $pgRes = pg_get_result(
$conn );
212 $this->lastResultHandle = $pgRes;
213 $res = pg_result_error( $pgRes ) ? false : $pgRes;
215 return new QueryStatus(
217 is_bool( $res ) ? $res : new PostgresResultWrapper( $this,
$conn, $res ),
218 $pgRes ? pg_affected_rows( $pgRes ) : 0,
228 PGSQL_DIAG_MESSAGE_PRIMARY,
229 PGSQL_DIAG_MESSAGE_DETAIL,
230 PGSQL_DIAG_MESSAGE_HINT,
231 PGSQL_DIAG_STATEMENT_POSITION,
232 PGSQL_DIAG_INTERNAL_POSITION,
233 PGSQL_DIAG_INTERNAL_QUERY,
235 PGSQL_DIAG_SOURCE_FILE,
236 PGSQL_DIAG_SOURCE_LINE,
237 PGSQL_DIAG_SOURCE_FUNCTION
239 foreach ( $diags as $d ) {
240 $this->logger->debug( sprintf(
"PgSQL ERROR(%d): %s",
242 $d, pg_result_error_field( $this->lastResultHandle, $d ) ) );
251 $qs = $this->doSingleStatementQuery(
"SELECT lastval() AS id" );
253 return $qs->res ? (int)$qs->res->fetchRow()[
'id'] : 0;
258 if ( $this->lastResultHandle ) {
260 return pg_result_error( $this->lastResultHandle );
262 return pg_last_error() ?: $this->lastConnectError;
266 return $this->getLastPHPError() ?:
'No database connection';
270 if ( $this->lastResultHandle ) {
272 $lastErrno = pg_result_error_field( $this->lastResultHandle, PGSQL_DIAG_SQLSTATE );
273 if ( $lastErrno !==
false ) {
282 $fname = __METHOD__, $options = [], $join_conds = []
284 $conds = $this->platform->normalizeConditions( $conds, $fname );
285 $column = $this->platform->extractSingleFieldFromList( $var );
286 if ( is_string( $column ) && !in_array( $column, [
'*',
'1' ] ) ) {
287 $conds[] =
"$column IS NOT NULL";
290 $options[
'EXPLAIN'] =
true;
291 $res = $this->select( $table, $var, $conds, $fname, $options, $join_conds );
294 $row = $res->fetchRow();
296 if ( preg_match(
'/rows=(\d+)/', $row[0], $count ) ) {
297 $rows = (int)$count[1];
304 public function indexInfo( $table, $index, $fname = __METHOD__ ) {
305 $components = $this->platform->qualifiedTableComponents( $table );
306 if ( count( $components ) === 1 ) {
307 $schema = $this->getCoreSchema();
308 $tableComponent = $components[0];
309 } elseif ( count( $components ) === 2 ) {
310 [ $schema, $tableComponent ] = $components;
312 [ , $schema, $tableComponent ] = $components;
314 $encSchema = $this->addQuotes( $schema );
315 $encTable = $this->addQuotes( $tableComponent );
316 $encIndex = $this->addQuotes( $this->platform->indexName( $index ) );
318 "SELECT indexname,indexdef FROM pg_indexes " .
319 "WHERE schemaname=$encSchema AND tablename=$encTable AND indexname=$encIndex",
320 self::QUERY_IGNORE_DBO_TRX | self::QUERY_CHANGE_NONE,
323 $res = $this->query( $query );
324 $row = $res->fetchObject();
327 return [
'unique' => ( strpos( $row->indexdef,
'CREATE UNIQUE ' ) === 0 ) ];
334 if ( $schema ===
false ) {
335 $schemas = $this->getCoreSchemas();
337 $schemas = [ $schema ];
340 $eindex = $this->addQuotes( $index );
342 $flags = self::QUERY_IGNORE_DBO_TRX | self::QUERY_CHANGE_NONE;
343 foreach ( $schemas as $schema ) {
344 $eschema = $this->addQuotes( $schema );
349 $sql = <<<__INDEXATTR__
353 i.indoption[s.g] as option,
356 (SELECT generate_series(array_lower(isub.indkey,1), array_upper(isub.indkey,1)) AS g
360 ON cis.oid=isub.indexrelid
362 ON cis.relnamespace = ns.oid
363 WHERE cis.relname=$eindex AND ns.nspname=$eschema) AS s,
369 ON ci.oid=i.indexrelid
371 ON ct.oid = i.indrelid
373 ON ci.relnamespace = n.oid
375 ci.relname=$eindex AND n.nspname=$eschema
376 AND attrelid = ct.oid
377 AND i.indkey[s.g] = attnum
378 AND i.indclass[s.g] = opcls.oid
379 AND pg_am.oid = opcls.opcmethod
381 $query =
new Query( $sql, $flags,
'SELECT' );
382 $res = $this->query( $query, __METHOD__ );
385 foreach ( $res as $row ) {
404 array $insertOptions,
405 array $selectOptions,
408 if ( in_array(
'IGNORE', $insertOptions ) ) {
410 $destTableEnc = $this->tableName( $destTable );
412 $selectSql = $this->selectSQLText(
414 array_values( $varMap ),
421 $sql =
"INSERT INTO $destTableEnc (" . implode(
',', array_keys( $varMap ) ) .
') ' .
422 $selectSql .
' ON CONFLICT DO NOTHING';
423 $query =
new Query( $sql, self::QUERY_CHANGE_ROWS,
'INSERT', $destTable );
424 $this->query( $query, $fname );
426 parent::doInsertSelectNative( $destTable, $srcTable, $varMap, $conds, $fname,
427 $insertOptions, $selectOptions, $selectJoinConds );
434 $flags = self::QUERY_IGNORE_DBO_TRX | self::QUERY_CHANGE_NONE;
435 $encTable = $this->addQuotes( $table );
436 foreach ( $this->getCoreSchemas() as $schema ) {
437 $encSchema = $this->addQuotes( $schema );
438 $sql =
"SELECT column_name,udt_name " .
439 "FROM information_schema.columns " .
440 "WHERE table_name = $encTable AND table_schema = $encSchema";
441 $query =
new Query( $sql, $flags,
'SELECT' );
442 $res = $this->query( $query, __METHOD__ );
443 if ( $res->numRows() ) {
444 foreach ( $res as $row ) {
445 $typesByColumn[$row->column_name] = $row->udt_name;
451 return $typesByColumn;
456 static $codes = [
'08000',
'08003',
'08006',
'08001',
'08004',
'57P01',
'57P03',
'53300' ];
458 return in_array( $errno, $codes,
true );
463 return ( $errno ===
'57014' );
471 $oldName, $newName, $temporary =
false, $fname = __METHOD__
473 $newNameE = $this->platform->addIdentifierQuotes( $newName );
474 $oldNameE = $this->platform->addIdentifierQuotes( $oldName );
476 $temporary = $temporary ?
'TEMPORARY' :
'';
478 "CREATE $temporary TABLE $newNameE " .
479 "(LIKE $oldNameE INCLUDING DEFAULTS INCLUDING INDEXES)",
480 self::QUERY_PSEUDO_PERMANENT | self::QUERY_CHANGE_SCHEMA,
481 $temporary ?
'CREATE TEMPORARY' :
'CREATE',
485 $ret = $this->query( $query, $fname );
490 $sql =
'SELECT attname FROM pg_class c'
491 .
' JOIN pg_namespace n ON (n.oid = c.relnamespace)'
492 .
' JOIN pg_attribute a ON (a.attrelid = c.oid)'
493 .
' JOIN pg_attrdef d ON (c.oid=d.adrelid and a.attnum=d.adnum)'
494 .
' WHERE relkind = \'r\''
495 .
' AND nspname = ' . $this->addQuotes( $this->getCoreSchema() )
496 .
' AND relname = ' . $this->addQuotes( $oldName )
497 .
' AND pg_get_expr(adbin, adrelid) LIKE \'nextval(%\'';
500 self::QUERY_IGNORE_DBO_TRX | self::QUERY_CHANGE_NONE,
504 $res = $this->query( $query, $fname );
505 $row = $res->fetchObject();
507 $field = $row->attname;
508 $newSeq =
"{$newName}_{$field}_seq";
509 $fieldE = $this->platform->addIdentifierQuotes( $field );
510 $newSeqE = $this->platform->addIdentifierQuotes( $newSeq );
511 $newSeqQ = $this->addQuotes( $newSeq );
513 "CREATE $temporary SEQUENCE $newSeqE OWNED BY $newNameE.$fieldE",
514 self::QUERY_CHANGE_SCHEMA,
519 $this->query( $query, $fname );
521 "ALTER TABLE $newNameE ALTER COLUMN $fieldE SET DEFAULT nextval({$newSeqQ}::regclass)",
522 self::QUERY_CHANGE_SCHEMA,
527 $this->query( $query, $fname );
534 $sql =
"TRUNCATE TABLE " . $this->tableName( $table ) .
" RESTART IDENTITY";
535 $query =
new Query( $sql, self::QUERY_CHANGE_SCHEMA,
'TRUNCATE', $table );
536 $this->query( $query, $fname );
545 public function listTables( $prefix =
'', $fname = __METHOD__ ) {
546 $eschemas = implode(
',', array_map( [ $this,
'addQuotes' ], $this->getCoreSchemas() ) );
548 "SELECT DISTINCT tablename FROM pg_tables WHERE schemaname IN ($eschemas)",
549 self::QUERY_IGNORE_DBO_TRX | self::QUERY_CHANGE_NONE,
552 $result = $this->query( $query, $fname );
555 foreach ( $result as $table ) {
556 $vars = get_object_vars( $table );
557 $table = array_pop( $vars );
558 if ( $prefix ==
'' || strpos( $table, $prefix ) === 0 ) {
559 $endArray[] = $table;
584 private function pg_array_parse( $text, &$output, $limit =
false, $offset = 1 ) {
585 if ( $limit ===
false ) {
586 $limit = strlen( $text ) - 1;
589 if ( $text ==
'{}' ) {
593 if ( $text[$offset] !=
'{' ) {
594 preg_match(
"/(\\{?\"([^\"\\\\]|\\\\.)*\"|[^,{}]+)+([,}]+)/",
595 $text, $match, 0, $offset );
596 $offset += strlen( $match[0] );
597 $output[] = ( $match[1][0] !=
'"'
599 : stripcslashes( substr( $match[1], 1, -1 ) ) );
600 if ( $match[3] ==
'},' ) {
604 $offset = $this->pg_array_parse( $text, $output, $limit, $offset + 1 );
606 }
while ( $limit > $offset );
612 return '[{{int:version-db-postgres-url}} PostgreSQL]';
624 "SELECT current_schema()",
625 self::QUERY_IGNORE_DBO_TRX | self::QUERY_CHANGE_NONE,
628 $res = $this->query( $query, __METHOD__ );
629 $row = $res->fetchRow();
646 "SELECT current_schemas(false)",
647 self::QUERY_IGNORE_DBO_TRX | self::QUERY_CHANGE_NONE,
650 $res = $this->query( $query, __METHOD__ );
651 $row = $res->fetchRow();
656 return $this->pg_array_parse( $row[0], $schemas );
671 self::QUERY_IGNORE_DBO_TRX | self::QUERY_CHANGE_NONE,
674 $res = $this->query( $query, __METHOD__ );
675 $row = $res->fetchRow();
679 return explode(
",", $row[0] );
689 private function setSearchPath( $search_path ) {
691 "SET search_path = " . implode(
", ", $search_path ),
692 self::QUERY_CHANGE_TRX,
695 $this->query( $query, __METHOD__ );
713 if ( $this->trxLevel() ) {
718 __METHOD__ .
": a transaction is currently active"
722 if ( $this->schemaExists( $desiredSchema ) ) {
723 if ( in_array( $desiredSchema, $this->getSchemas() ) ) {
724 $this->platform->setCoreSchema( $desiredSchema );
725 $this->logger->debug(
726 "Schema \"" . $desiredSchema .
"\" already in the search path\n" );
729 $search_path = $this->getSearchPath();
730 array_unshift( $search_path, $this->platform->addIdentifierQuotes( $desiredSchema ) );
731 $this->setSearchPath( $search_path );
732 $this->platform->setCoreSchema( $desiredSchema );
733 $this->logger->debug(
734 "Schema \"" . $desiredSchema .
"\" added to the search path\n" );
737 $this->platform->setCoreSchema( $this->getCurrentSchema() );
738 $this->logger->debug(
739 "Schema \"" . $desiredSchema .
"\" not found, using current \"" .
740 $this->getCoreSchema() .
"\"\n" );
751 return $this->platform->getCoreSchema();
761 if ( $this->tempSchema ) {
762 return [ $this->tempSchema, $this->getCoreSchema() ];
765 "SELECT nspname FROM pg_catalog.pg_namespace n WHERE n.oid = pg_my_temp_schema()",
766 self::QUERY_IGNORE_DBO_TRX | self::QUERY_CHANGE_NONE,
769 $res = $this->query( $query, __METHOD__ );
770 $row = $res->fetchObject();
772 $this->tempSchema = $row->nspname;
773 return [ $this->tempSchema, $this->getCoreSchema() ];
776 return [ $this->getCoreSchema() ];
780 if ( !isset( $this->numericVersion ) ) {
782 $this->numericVersion = pg_version( $this->getBindingHandle() )[
'server'];
785 return $this->numericVersion;
795 private function relationExists( $table, $types ) {
796 if ( !is_array( $types ) ) {
799 $schemas = $this->getCoreSchemas();
800 $components = $this->platform->qualifiedTableComponents( $table );
801 $etable = $this->addQuotes( end( $components ) );
802 foreach ( $schemas as $schema ) {
803 $eschema = $this->addQuotes( $schema );
804 $sql =
"SELECT 1 FROM pg_catalog.pg_class c, pg_catalog.pg_namespace n "
805 .
"WHERE c.relnamespace = n.oid AND c.relname = $etable AND n.nspname = $eschema "
806 .
"AND c.relkind IN ('" . implode(
"','", $types ) .
"')";
809 self::QUERY_IGNORE_DBO_TRX | self::QUERY_CHANGE_NONE,
812 $res = $this->query( $query, __METHOD__ );
813 if ( $res && $res->numRows() ) {
822 return $this->relationExists( $table, [
'r',
'v' ] );
826 return $this->relationExists( $sequence,
'S' );
830 foreach ( $this->getCoreSchemas() as $schema ) {
831 $sql = sprintf(
"SELECT 1 FROM information_schema.table_constraints " .
832 "WHERE constraint_schema = %s AND table_name = %s AND constraint_name = %s",
833 $this->addQuotes( $schema ),
834 $this->addQuotes( $table ),
835 $this->addQuotes( $constraint )
839 self::QUERY_IGNORE_DBO_TRX | self::QUERY_CHANGE_NONE,
842 $res = $this->query( $query, __METHOD__ );
843 if ( $res && $res->numRows() ) {
856 if ( !strlen( $schema ??
'' ) ) {
860 "SELECT 1 FROM pg_catalog.pg_namespace " .
861 "WHERE nspname = " . $this->addQuotes( $schema ) .
" LIMIT 1",
862 self::QUERY_IGNORE_DBO_TRX | self::QUERY_CHANGE_NONE,
865 $res = $this->query( $query, __METHOD__ );
867 return ( $res->numRows() > 0 );
877 "SELECT 1 FROM pg_catalog.pg_roles " .
878 "WHERE rolname = " . $this->addQuotes( $roleName ) .
" LIMIT 1",
879 self::QUERY_IGNORE_DBO_TRX | self::QUERY_CHANGE_NONE,
882 $res = $this->query( $query, __METHOD__ );
884 return ( $res->numRows() > 0 );
893 return PostgresField::fromText( $this, $table, $field );
897 $conn = $this->getBindingHandle();
899 return new PostgresBlob( pg_escape_bytea( $conn, $b ) );
905 } elseif ( $b instanceof
Blob ) {
909 return pg_unescape_bytea( $b );
914 return pg_escape_string( $this->getBindingHandle(), (
string)$s );
921 $conn = $this->getBindingHandle();
925 } elseif ( is_bool( $s ) ) {
926 return (
string)intval( $s );
927 } elseif ( is_int( $s ) ) {
929 } elseif ( $s instanceof
Blob ) {
933 $s = pg_escape_bytea( $conn, $s->fetch() );
938 return "'" . pg_escape_string( $conn, (
string)$s ) .
"'";
942 # Allow dollar quoting for function declarations
943 if ( str_starts_with( $newLine,
'$mw$' ) ) {
944 if ( $this->delimiter ) {
945 $this->delimiter =
false;
947 $this->delimiter =
';';
951 return parent::streamStatementEnd( $sql, $newLine );
956 $this->platform->lockIsFreeSQLText( $lockName ),
957 self::QUERY_CHANGE_LOCKS,
960 $res = $this->query( $query, $method );
961 $row = $res->fetchObject();
963 return (
bool)$row->unlocked;
966 public function doLock(
string $lockName,
string $method,
int $timeout ) {
968 $this->platform->lockSQLText( $lockName, $timeout ),
969 self::QUERY_CHANGE_LOCKS,
974 $loop =
new WaitConditionLoop(
975 function () use ( $query, $method, &$acquired ) {
976 $res = $this->query( $query, $method );
977 $row = $res->fetchObject();
979 if ( $row->acquired !==
null ) {
980 $acquired = (float)$row->acquired;
982 return WaitConditionLoop::CONDITION_REACHED;
985 return WaitConditionLoop::CONDITION_CONTINUE;
994 public function doUnlock(
string $lockName,
string $method ) {
996 $this->platform->unlockSQLText( $lockName ),
997 self::QUERY_CHANGE_LOCKS,
1000 $result = $this->query( $query, $method );
1001 $row = $result->fetchObject();
1003 return (
bool)$row->released;
1007 $flags = self::QUERY_CHANGE_LOCKS | self::QUERY_NO_RETRY;
1010 $sql =
"SELECT pg_advisory_unlock_all()";
1011 $query =
new Query( $sql, $flags,
'UNLOCK' );
1012 $qs = $this->executeQuery( $query, __METHOD__, $flags );
1013 if ( $qs->res ===
false ) {
1014 $this->reportQueryError( $qs->message, $qs->code, $sql, $fname,
true );
1020 "SHOW default_transaction_read_only",
1021 self::QUERY_IGNORE_DBO_TRX | self::QUERY_CHANGE_NONE,
1024 $res = $this->query( $query, __METHOD__ );
1025 $row = $res->fetchObject();
1027 return $row && strtolower( $row->default_transaction_read_only ) ===
'on';
1033 $flags = self::QUERY_IGNORE_DBO_TRX | self::QUERY_CHANGE_NONE;
1034 $components = $this->platform->qualifiedTableComponents( $table );
1035 $encTable = $this->addQuotes( end( $components ) );
1036 foreach ( $this->getCoreSchemas() as $schema ) {
1037 $encSchema = $this->addQuotes( $schema );
1039 "SELECT column_name,data_type,column_default " .
1040 "FROM information_schema.columns " .
1041 "WHERE table_name = $encTable AND table_schema = $encSchema",
1042 self::QUERY_IGNORE_DBO_TRX | self::QUERY_CHANGE_NONE,
1045 $res = $this->query( $query, __METHOD__ );
1046 if ( $res->numRows() ) {
1047 foreach ( $res as $row ) {
1049 $row->column_default !==
null &&
1050 str_starts_with( $row->column_default,
"nextval(" ) &&
1051 in_array( $row->data_type, [
'integer',
'bigint' ],
true )
1053 $column = $row->column_name;
1064 return [ self::ATTR_SCHEMAS_AS_TABLE_GROUPS => true ];
array $params
The job parameters.
Class to handle database/schema/prefix specifications for IDatabase.
Postgres database abstraction layer.
truncateTable( $table, $fname=__METHOD__)
Delete all data in a table and reset any sequences owned by that table.
getCoreSchemas()
Return schema names for temporary tables and core application tables.
determineCoreSchema( $desiredSchema)
Determine default schema for the current application Adjust this session schema search path if desire...
duplicateTableStructure( $oldName, $newName, $temporary=false, $fname=__METHOD__)
Creates a new table with structure copied from existing table.
isQueryTimeoutError( $errno)
Checks whether the cause of the error is detected to be a timeout.
fieldInfo( $table, $field)
doLock(string $lockName, string $method, int $timeout)
isKnownStatementRollbackError( $errno)
indexAttributes( $index, $schema=false)
PostgresPlatform $platform
databasesAreIndependent()
Returns true if DBs are assumed to be on potentially different servers.
doUnlock(string $lockName, string $method)
doSingleStatementQuery(string $sql)
Run a query and return a QueryStatus instance with the query result information.
streamStatementEnd(&$sql, &$newLine)
Called by sourceStream() to check if we've reached a statement end.
doLockIsFree(string $lockName, string $method)
doSelectDomain(DatabaseDomain $domain)
roleExists( $roleName)
Returns true if a given role (i.e.
getSchemas()
Return list of schemas which are accessible without schema name This is list does not contain magic k...
indexInfo( $table, $index, $fname=__METHOD__)
Get information about an index into an object.
schemaExists( $schema)
Query whether a given schema exists.
estimateRowCount( $table, $var=' *', $conds='', $fname=__METHOD__, $options=[], $join_conds=[])
Estimate the number of rows in dataset.MySQL allows you to estimate the number of rows that would be ...
getInsertIdColumnForUpsert( $table)
lastError()
Get the RDBMS-specific error description from the last attempted query statement.
addQuotes( $s)
Escape and quote a raw value string for use in a SQL query.
__construct(array $params)
tableExists( $table, $fname=__METHOD__)
Query whether a given table exists.
lastErrno()
Get the RDBMS-specific error code from the last attempted query statement.
getCoreSchema()
Return schema name for core application tables.
strencode( $s)
Wrapper for addslashes()
lastInsertId()
Get a row ID from the last insert statement to implicitly assign one within the session.
isConnectionError( $errno)
Do not use this method outside of Database/DBError classes.
sequenceExists( $sequence)
open( $server, $user, $password, $db, $schema, $tablePrefix)
Open a new connection to the database (closing any existing one)
getServerVersion()
A string describing the current software version.
getCurrentSchema()
Return current schema (executes SELECT current_schema()) Needs transaction.
getSearchPath()
Return search patch for schemas This is different from getSchemas() since it contain magic keywords (...
decodeBlob( $b)
Some DBMSs return a special placeholder object representing blob fields in result objects.
encodeBlob( $b)
Some DBMSs have a special format for inserting into blob fields, they don't allow simple quoted strin...
closeConnection()
Closes underlying database connection.
getValueTypesForWithClause( $table)
constraintExists( $table, $constraint)
getType()
Get the RDBMS type of the server (e.g.
doFlushSession( $fname)
Reset the server-side session state for named locks and table locks.
listTables( $prefix='', $fname=__METHOD__)
getSoftwareLink()
Returns a wikitext style link to the DB's website (e.g.
doInsertSelectNative( $destTable, $srcTable, array $varMap, $conds, $fname, array $insertOptions, array $selectOptions, $selectJoinConds)
Native server-side implementation of insertSelect() for situations where we don't want to select ever...
serverIsReadOnly()
bool Whether this DB server is running in server-side read-only mode query} 1.28