MediaWiki
REL1_19
|
Public Member Functions | |
addIdentifierQuotes ($s) | |
Quotes an identifier using `backticks` or "double quotes" depending on the database type. | |
addQuotes ($s) | |
If it's a string, adds quotes and backslashes Otherwise returns as-is. | |
affectedRows () | |
Get the number of rows affected by the last write query. | |
begin ($fname= 'DatabaseMssql::begin') | |
Begin a transaction, committing any previously open transaction. | |
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. | |
close () | |
Closes a database connection, if it is open Returns success, true if already closed. | |
commit ($fname= 'DatabaseMssql::commit') | |
End a transaction. | |
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. | |
encodeBlob ($b) | |
Some DBMSs have a special format for inserting into blob fields, they don't allow simple quoted strings to be inserted. | |
estimateRowCount ($table, $vars= '*', $conds= '', $fname= 'DatabaseMssql::estimateRowCount', $options=array()) | |
Estimate rows in dataset Returns estimated count, based on SHOWPLAN_ALL 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. | |
fieldExists ($table, $field, $fname= 'DatabaseMssql::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 | |
fieldName ($res, $n) | |
Get a field name in a result object. | |
freeResult ($res) | |
Free a result object returned by query() or select(). | |
functionalIndexes () | |
Returns true if this database can use functional indexes. | |
getErrors () | |
getInfinity () | |
Since MSSQL doesn't recognize the infinity keyword, set date manually. | |
getSearchEngine () | |
Get search engine class. | |
getServerVersion () | |
getType () | |
Get the type of the DBMS, as it appears in $wgDBtype. | |
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. | |
indexInfo ($table, $index, $fname= 'DatabaseMssql::indexExists') | |
Returns information about an index If errors are explicitly ignored, returns NULL on failure. | |
initial_setup ($dbName, $newUser, $loginPassword) | |
Initial setup. | |
insert ($table, $arrToInsert, $fname= 'DatabaseMssql::insert', $options=array()) | |
INSERT wrapper, inserts an array into a table. | |
insertId () | |
This must be called after nextSequenceVal. | |
insertSelect ($destTable, $srcTable, $varMap, $conds, $fname= 'DatabaseMssql::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 than 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. | |
isQuotedIdentifier ($name) | |
Returns if the given identifier looks quoted or not according to the database convention for quoting identifiers . | |
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 This is used for query pages $sql string SQL query we will append the limit too $limit integer the SQL limit $offset integer the SQL offset (default false) | |
limitResultForUpdate ($sql, $num) | |
LimitToTopN ($sql) | |
makeSelectOptions ($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. | |
realTimestamps () | |
Returns true if this database uses timestamps rather than integers. | |
rollback ($fname= 'DatabaseMssql::rollback') | |
Rollback a transaction. | |
select ($table, $vars, $conds= '', $fname= 'DatabaseMssql::select', $options=array(), $join_conds=array()) | |
SELECT wrapper. | |
selectDB ($db) | |
Change the current database. | |
selectSQLText ($table, $vars, $conds= '', $fname= 'DatabaseMssql::select', $options=array(), $join_conds=array()) | |
SELECT wrapper. | |
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) | |
tableNamesWithUseIndexOrJOIN ($tables, $use_index=array(), $join_conds=array()) | |
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. | |
unionSupportsOrderAndLimit () | |
Returns true if current database backend supports ORDER BY or LIMIT for separate subqueries within the UNION construct. | |
Static Public Member Functions | |
static | getSoftwareLink () |
Public Attributes | |
$mAffectedRows = NULL | |
$mInsertId = NULL | |
$mLastResult = NULL | |
$mPort | |
Protected Member Functions | |
doQuery ($sql) | |
The DBMS-dependent part of query() | |
Private Member Functions | |
escapeIdentifier ($identifier) | |
Escapes a identifier for use inm SQL. |
Definition at line 15 of file DatabaseMssql.php.
Quotes an identifier using `backticks` or "double quotes" depending on the database type.
MySQL uses `backticks` while basically everything else uses double quotes. Since MySQL is the odd one out here the double quotes are our generic and we implement backticks in DatabaseMysql.
$s | string |
Reimplemented from DatabaseBase.
Definition at line 845 of file DatabaseMssql.php.
DatabaseMssql::addQuotes | ( | $ | s | ) |
If it's a string, adds quotes and backslashes Otherwise returns as-is.
$s | string |
Reimplemented from DatabaseBase.
Definition at line 837 of file DatabaseMssql.php.
Referenced by initial_setup(), and insert().
Get the number of rows affected by the last write query.
Implements DatabaseType.
Definition at line 258 of file DatabaseMssql.php.
DatabaseMssql::begin | ( | $ | fname = 'DatabaseMssql::begin' | ) |
Begin a transaction, committing any previously open transaction.
Reimplemented from DatabaseBase.
Definition at line 684 of file DatabaseMssql.php.
DatabaseMssql::buildConcat | ( | $ | stringList | ) |
Build a concatenation list to feed into a SQL query.
$stringList | Array: list of raw SQL expressions; caller is responsible for any quoting |
Reimplemented from DatabaseBase.
Definition at line 901 of file DatabaseMssql.php.
Returns true if this database supports (and uses) cascading deletes.
Reimplemented from DatabaseBase.
Definition at line 22 of file DatabaseMssql.php.
Returns true if this database supports (and uses) triggers (e.g.
on the page table)
Reimplemented from DatabaseBase.
Definition at line 25 of file DatabaseMssql.php.
Closes a database connection, if it is open Returns success, true if already closed.
Reimplemented from DatabaseBase.
Definition at line 111 of file DatabaseMssql.php.
Referenced by open().
DatabaseMssql::commit | ( | $ | fname = 'DatabaseMssql::commit' | ) |
End a transaction.
Reimplemented from DatabaseBase.
Definition at line 692 of file DatabaseMssql.php.
DatabaseMssql::currentSequenceValue | ( | $ | seqName | ) |
Return the current value of a sequence.
Assumes it has ben nextval'ed in this session.
Definition at line 531 of file DatabaseMssql.php.
References nextSequenceValue().
DatabaseMssql::dataSeek | ( | $ | res, |
$ | row | ||
) |
Change the position of the cursor in a result object.
$res | Mixed: A SQL result |
$row | Mixed: Either MySQL row or ResultWrapper |
Implements DatabaseType.
Definition at line 234 of file DatabaseMssql.php.
References $res.
DatabaseMssql::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.
$b | string |
Reimplemented from DatabaseBase.
Definition at line 791 of file DatabaseMssql.php.
DatabaseMssql::doQuery | ( | $ | sql | ) | [protected] |
The DBMS-dependent part of query()
$sql | String: SQL query. |
Reimplemented from DatabaseBase.
Definition at line 120 of file DatabaseMssql.php.
References $matches, $res, LimitToTopN(), and wfDebug().
Referenced by initial_setup(), and insert().
DatabaseMssql::encodeBlob | ( | $ | b | ) |
Some DBMSs have a special format for inserting into blob fields, they don't allow simple quoted strings to be inserted.
To insert into such a field, pass the data through this function before passing it to DatabaseBase::insert().
$b | string |
Reimplemented from DatabaseBase.
Definition at line 786 of file DatabaseMssql.php.
DatabaseMssql::escapeIdentifier | ( | $ | identifier | ) | [private] |
Escapes a identifier for use inm SQL.
Throws an exception if it is invalid. Reference: http://msdn.microsoft.com/en-us/library/aa224033%28v=SQL.80%29.aspx
Definition at line 711 of file DatabaseMssql.php.
Referenced by initial_setup().
DatabaseMssql::estimateRowCount | ( | $ | table, |
$ | vars = '*' , |
||
$ | conds = '' , |
||
$ | fname = 'DatabaseMssql::estimateRowCount' , |
||
$ | options = array() |
||
) |
Estimate rows in dataset Returns estimated count, based on SHOWPLAN_ALL 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 314 of file DatabaseMssql.php.
References $fname, $options, $res, $rows, fetchRow(), and select().
DatabaseMssql::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.
$res | ResultWrapper|object as returned from DatabaseBase::query(), etc. |
DBUnexpectedError | Thrown if the database returns an error |
Implements DatabaseType.
Definition at line 175 of file DatabaseMssql.php.
References $res.
DatabaseMssql::fetchRow | ( | $ | res | ) |
Fetch the next row from the given result object, in associative array form.
Fields are retrieved with $row['fieldname'].
$res | ResultWrapper result object as returned from DatabaseBase::query(), etc. |
DBUnexpectedError | Thrown if the database returns an error |
Implements DatabaseType.
Definition at line 198 of file DatabaseMssql.php.
References $res.
Referenced by estimateRowCount(), fieldInfo(), and textFieldSize().
DatabaseMssql::fieldExists | ( | $ | table, |
$ | field, | ||
$ | fname = 'DatabaseMssql::fieldExists' |
||
) |
Query whether a given column exists in the mediawiki schema.
Reimplemented from DatabaseBase.
Definition at line 651 of file DatabaseMssql.php.
References $res, getErrors(), print, and DatabaseBase\tableName().
DatabaseMssql::fieldInfo | ( | $ | table, |
$ | field | ||
) |
mysql_fetch_field() wrapper Returns false if the field doesn't exist
$table | string: table name |
$field | string: field name |
Implements DatabaseType.
Definition at line 666 of file DatabaseMssql.php.
References $res, fetchRow(), getErrors(), print, and DatabaseBase\tableName().
DatabaseMssql::fieldName | ( | $ | res, |
$ | n | ||
) |
Get a field name in a result object.
$res | Mixed: A SQL result |
$n | Integer |
Implements DatabaseType.
Definition at line 220 of file DatabaseMssql.php.
DatabaseMssql::freeResult | ( | $ | 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.
$res | Mixed: A SQL result |
Reimplemented from DatabaseBase.
Definition at line 168 of file DatabaseMssql.php.
References $res.
Returns true if this database can use functional indexes.
Reimplemented from DatabaseBase.
Definition at line 40 of file DatabaseMssql.php.
Definition at line 183 of file DatabaseMssql.php.
Referenced by fieldExists(), fieldInfo(), insert(), insertSelect(), lastError(), and tableExists().
Since MSSQL doesn't recognize the infinity keyword, set date manually.
Reimplemented from DatabaseBase.
Definition at line 913 of file DatabaseMssql.php.
Get search engine class.
All subclasses of this need to implement this if they wish to use searching.
Reimplemented from DatabaseBase.
Definition at line 905 of file DatabaseMssql.php.
Implements DatabaseType.
Definition at line 625 of file DatabaseMssql.php.
References $version.
static DatabaseMssql::getSoftwareLink | ( | ) | [static] |
Implements DatabaseType.
Definition at line 618 of file DatabaseMssql.php.
Get the type of the DBMS, as it appears in $wgDBtype.
Implements DatabaseType.
Definition at line 897 of file DatabaseMssql.php.
Returns true if this database does an implicit sort when doing GROUP BY.
Reimplemented from DatabaseBase.
Definition at line 34 of file DatabaseMssql.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.
Reimplemented from DatabaseBase.
Definition at line 37 of file DatabaseMssql.php.
DatabaseMssql::indexInfo | ( | $ | table, |
$ | index, | ||
$ | fname = 'DatabaseMssql::indexExists' |
||
) |
Returns information about an index If errors are explicitly ignored, returns NULL on failure.
Implements DatabaseType.
Definition at line 330 of file DatabaseMssql.php.
References $fname, $res, $result, and DatabaseBase\query().
DatabaseMssql::initial_setup | ( | $ | dbName, |
$ | newUser, | ||
$ | loginPassword | ||
) |
Initial setup.
Precondition: This object is connected as the superuser. Creates the database, schema, user and login.
Definition at line 730 of file DatabaseMssql.php.
References addQuotes(), doQuery(), and escapeIdentifier().
DatabaseMssql::insert | ( | $ | table, |
$ | arrToInsert, | ||
$ | fname = 'DatabaseMssql::insert' , |
||
$ | options = array() |
||
) |
INSERT wrapper, inserts an array into a table.
$arrToInsert may be a single associative array, or an array of these with numeric keys, for multi-row insert.
Usually aborts on failure If errors are explicitly ignored, returns success
Reimplemented from DatabaseBase.
Definition at line 369 of file DatabaseMssql.php.
References $fname, $keys, $options, $res, addQuotes(), doQuery(), getErrors(), lastErrno(), and DatabaseBase\tableName().
This must be called after nextSequenceVal.
Implements DatabaseType.
Definition at line 230 of file DatabaseMssql.php.
DatabaseMssql::insertSelect | ( | $ | destTable, |
$ | srcTable, | ||
$ | varMap, | ||
$ | conds, | ||
$ | fname = 'DatabaseMssql::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 than 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.
Reimplemented from DatabaseBase.
Definition at line 498 of file DatabaseMssql.php.
References $fname, getErrors(), and lastErrno().
DatabaseMssql::isQuotedIdentifier | ( | $ | name | ) |
Returns if the given identifier looks quoted or not according to the database convention for quoting identifiers .
$name | string |
Reimplemented from DatabaseBase.
Definition at line 850 of file DatabaseMssql.php.
Get the last error number.
Implements DatabaseType.
Definition at line 249 of file DatabaseMssql.php.
Referenced by insert(), and insertSelect().
Get a description of the last error.
Implements DatabaseType.
Definition at line 241 of file DatabaseMssql.php.
References getErrors().
Referenced by open().
DatabaseMssql::limitResult | ( | $ | sql, |
$ | limit, | ||
$ | offset = false |
||
) |
Construct a LIMIT query with optional offset This is used for query pages $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 563 of file DatabaseMssql.php.
References $limit.
Referenced by LimitToTopN().
DatabaseMssql::limitResultForUpdate | ( | $ | sql, |
$ | num | ||
) |
$sql | |
$num |
Reimplemented from DatabaseBase.
Definition at line 607 of file DatabaseMssql.php.
DatabaseMssql::LimitToTopN | ( | $ | sql | ) |
Definition at line 585 of file DatabaseMssql.php.
References $matches, and limitResult().
Referenced by doQuery().
DatabaseMssql::makeSelectOptions | ( | $ | options | ) |
$options | Array: an associative array of options to be turned into an SQL query, valid keys are listed in the function. |
Reimplemented from DatabaseBase.
Definition at line 865 of file DatabaseMssql.php.
References $options.
DatabaseMssql::nextSequenceValue | ( | $ | seqName | ) |
Return the next in a sequence, save the value for retrieval via insertId()
Reimplemented from DatabaseBase.
Definition at line 515 of file DatabaseMssql.php.
References tableExists().
Referenced by currentSequenceValue().
DatabaseMssql::numFields | ( | $ | res | ) |
Get the number of fields in a result object.
$res | Mixed: A SQL result |
Implements DatabaseType.
Definition at line 213 of file DatabaseMssql.php.
References $res.
DatabaseMssql::numRows | ( | $ | res | ) |
Get the number of rows in a result object.
$res | Mixed: A SQL result |
Implements DatabaseType.
Definition at line 206 of file DatabaseMssql.php.
References $res.
DatabaseMssql::open | ( | $ | server, |
$ | user, | ||
$ | password, | ||
$ | dbName | ||
) |
Usually aborts on failure.
Implements DatabaseType.
Definition at line 50 of file DatabaseMssql.php.
References $user, $wgDBport, close(), lastError(), wfDebug(), wfRestoreWarnings(), and wfSuppressWarnings().
Returns true if this database uses timestamps rather than integers.
Reimplemented from DatabaseBase.
Definition at line 31 of file DatabaseMssql.php.
DatabaseMssql::rollback | ( | $ | fname = 'DatabaseMssql::rollback' | ) |
Rollback a transaction.
No-op on non-transactional databases.
Reimplemented from DatabaseBase.
Definition at line 701 of file DatabaseMssql.php.
DatabaseMssql::select | ( | $ | table, |
$ | vars, | ||
$ | conds = '' , |
||
$ | fname = 'DatabaseMssql::select' , |
||
$ | options = array() , |
||
$ | join_conds = array() |
||
) |
SELECT wrapper.
$table | Mixed: array or string, table name(s) (prefix auto-added) |
$vars | Mixed: array or string, field name(s) to be retrieved |
$conds | Mixed: array or string, condition(s) for WHERE |
$fname | String: calling function name (use __METHOD__) for logs/profiling |
$options | Array: associative array of options (e.g. array('GROUP BY' => 'page_title')), see Database::makeSelectOptions code for list of supported stuff |
$join_conds | Array: Associative array of table join conditions (optional) (e.g. array( 'page' => array('LEFT JOIN','page_latest=rev_id') ) |
Reimplemented from DatabaseBase.
Definition at line 275 of file DatabaseMssql.php.
References $fname, $options, DatabaseBase\query(), and selectSQLText().
Referenced by estimateRowCount().
DatabaseMssql::selectDB | ( | $ | db | ) |
Change the current database.
$db |
Reimplemented from DatabaseBase.
Definition at line 854 of file DatabaseMssql.php.
References DatabaseBase\query().
DatabaseMssql::selectSQLText | ( | $ | table, |
$ | vars, | ||
$ | conds = '' , |
||
$ | fname = 'DatabaseMssql::select' , |
||
$ | options = array() , |
||
$ | join_conds = array() |
||
) |
SELECT wrapper.
$table | Mixed: Array or string, table name(s) (prefix auto-added) |
$vars | Mixed: Array or string, field name(s) to be retrieved |
$conds | Mixed: Array or string, condition(s) for WHERE |
$fname | String: Calling function name (use __METHOD__) for logs/profiling |
$options | Array: Associative array of options (e.g. array('GROUP BY' => 'page_title')), see Database::makeSelectOptions code for list of supported stuff |
$join_conds | Array: Associative array of table join conditions (optional) (e.g. array( 'page' => array('LEFT JOIN','page_latest=rev_id') ) |
Reimplemented from DatabaseBase.
Definition at line 300 of file DatabaseMssql.php.
References $fname, and $options.
Referenced by select().
DatabaseMssql::strencode | ( | $ | s | ) |
Wrapper for addslashes()
$s | string: to be slashed. |
Implements DatabaseType.
Definition at line 833 of file DatabaseMssql.php.
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 28 of file DatabaseMssql.php.
DatabaseMssql::tableExists | ( | $ | table, |
$ | fname = __METHOD__ , |
||
$ | schema = false |
||
) |
Definition at line 634 of file DatabaseMssql.php.
References $res, getErrors(), and print.
Referenced by nextSequenceValue().
DatabaseMssql::tableNamesWithUseIndexOrJOIN | ( | $ | tables, |
$ | use_index = array() , |
||
$ | join_conds = array() |
||
) |
Reimplemented from DatabaseBase.
Definition at line 799 of file DatabaseMssql.php.
References DatabaseBase\makeList(), DatabaseBase\tableName(), and DatabaseBase\useIndexClause().
DatabaseMssql::textFieldSize | ( | $ | table, |
$ | field | ||
) |
Returns the size of a text field, or -1 for "unlimited".
$table | string |
$field | string |
Reimplemented from DatabaseBase.
Definition at line 543 of file DatabaseMssql.php.
References $res, $size, fetchRow(), DatabaseBase\query(), and DatabaseBase\tableName().
DatabaseMssql::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.
$ts | string|int |
Reimplemented from DatabaseBase.
Definition at line 611 of file DatabaseMssql.php.
References wfTimestamp().
Returns true if current database backend supports ORDER BY or LIMIT for separate subqueries within the UNION construct.
Reimplemented from DatabaseBase.
Definition at line 43 of file DatabaseMssql.php.
DatabaseMssql::$mAffectedRows = NULL |
Definition at line 18 of file DatabaseMssql.php.
DatabaseMssql::$mInsertId = NULL |
Definition at line 16 of file DatabaseMssql.php.
DatabaseMssql::$mLastResult = NULL |
Definition at line 17 of file DatabaseMssql.php.
DatabaseMssql::$mPort |
Definition at line 20 of file DatabaseMssql.php.