[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/db/ -> DatabaseMssql.php (summary)

This is the MS SQL Server Native database abstraction layer. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Author: Joel Penner
Author: Chris Pucci
Author: Ryan Biesemeyer
Author: Ryan Schmidt
File Size: 1522 lines (42 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 4 classes

DatabaseMssql:: (63 methods):
  cascadingDeletes()
  cleanupTriggers()
  strictIPs()
  realTimestamps()
  implicitGroupby()
  implicitOrderby()
  functionalIndexes()
  unionSupportsOrderAndLimit()
  open()
  closeConnection()
  resultObject()
  doQuery()
  freeResult()
  fetchObject()
  fetchRow()
  numRows()
  numFields()
  fieldName()
  insertId()
  dataSeek()
  lastError()
  formatError()
  lastErrno()
  affectedRows()
  select()
  selectSQLText()
  deleteJoin()
  delete()
  estimateRowCount()
  indexInfo()
  insert()
  insertSelect()
  update()
  makeList()
  textFieldSize()
  limitResult()
  LimitToTopN()
  getSoftwareLink()
  getServerVersion()
  tableExists()
  fieldExists()
  fieldInfo()
  doBegin()
  doCommit()
  doRollback()
  escapeIdentifier()
  strencode()
  addQuotes()
  addIdentifierQuotes()
  isQuotedIdentifier()
  selectDB()
  makeSelectOptions()
  getType()
  buildConcat()
  buildGroupConcatField()
  getSearchEngine()
  getBinaryColumns()
  getBitColumns()
  populateColumnCaches()
  tableName()
  realTableName()
  prepareStatements()
  scrollableCursor()

MssqlField:: (7 methods):
  __construct()
  name()
  tableName()
  defaultValue()
  maxLength()
  isNullable()
  type()

MssqlBlob:: (2 methods):
  __construct()
  fetch()

MssqlResultWrapper:: (3 methods):
  fetchObject()
  fetchRow()
  seek()


Class: DatabaseMssql  - X-Ref


cascadingDeletes()   X-Ref
No description

cleanupTriggers()   X-Ref
No description

strictIPs()   X-Ref
No description

realTimestamps()   X-Ref
No description

implicitGroupby()   X-Ref
No description

implicitOrderby()   X-Ref
No description

functionalIndexes()   X-Ref
No description

unionSupportsOrderAndLimit()   X-Ref
No description

open( $server, $user, $password, $dbName )   X-Ref
Usually aborts on failure

param: string $server
param: string $user
param: string $password
param: string $dbName
return: bool|DatabaseBase|null

closeConnection()   X-Ref
Closes a database connection, if it is open
Returns success, true if already closed

return: bool

resultObject( $result )   X-Ref

param: bool|MssqlResultWrapper|resource $result
return: bool|MssqlResultWrapper

doQuery( $sql )   X-Ref

param: string $sql
return: bool|MssqlResult

freeResult( $res )   X-Ref
No description

fetchObject( $res )   X-Ref

param: MssqlResultWrapper $res
return: stdClass

fetchRow( $res )   X-Ref

param: MssqlResultWrapper $res
return: array

numRows( $res )   X-Ref

param: mixed $res
return: int

numFields( $res )   X-Ref

param: mixed $res
return: int

fieldName( $res, $n )   X-Ref

param: mixed $res
param: int $n
return: int

insertId()   X-Ref
This must be called after nextSequenceVal

return: int|null

dataSeek( $res, $row )   X-Ref

param: MssqlResultWrapper $res
param: int $row
return: bool

lastError()   X-Ref

return: string

formatError( $err )   X-Ref

param: array $err
return: string

lastErrno()   X-Ref

return: string

affectedRows()   X-Ref

return: int

select( $table, $vars, $conds = '', $fname = __METHOD__,$options = array()   X-Ref
SELECT wrapper

param: mixed $table Array or string, table name(s) (prefix auto-added)
param: mixed $vars Array or string, field name(s) to be retrieved
param: mixed $conds Array or string, condition(s) for WHERE
param: string $fname Calling function name (use __METHOD__) for logs/profiling
param: array $options Associative array of options (e.g.
param: array $join_conds Associative array of table join conditions
return: mixed Database result resource (feed to Database::fetchObject

selectSQLText( $table, $vars, $conds = '', $fname = __METHOD__,$options = array()   X-Ref
SELECT wrapper

param: mixed $table Array or string, table name(s) (prefix auto-added)
param: mixed $vars Array or string, field name(s) to be retrieved
param: mixed $conds Array or string, condition(s) for WHERE
param: string $fname Calling function name (use __METHOD__) for logs/profiling
param: array $options Associative array of options (e.g. array('GROUP BY' => 'page_title')),
param: array $join_conds Associative array of table join conditions (optional)
return: string The SQL text

deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds,$fname = __METHOD__)   X-Ref
No description

delete( $table, $conds, $fname = __METHOD__ )   X-Ref
No description

estimateRowCount( $table, $vars = '*', $conds = '',$fname = __METHOD__, $options = array()   X-Ref
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()

param: string $table
param: string $vars
param: string $conds
param: string $fname
param: array $options
return: int

indexInfo( $table, $index, $fname = __METHOD__ )   X-Ref
Returns information about an index
If errors are explicitly ignored, returns NULL on failure

param: string $table
param: string $index
param: string $fname
return: array|bool|null

insert( $table, $arrToInsert, $fname = __METHOD__, $options = array()   X-Ref
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
param: string $table
param: array $arrToInsert
param: string $fname
param: array $options
return: bool

insertSelect( $destTable, $srcTable, $varMap, $conds, $fname = __METHOD__,$insertOptions = array()   X-Ref
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().

param: string $destTable
param: array|string $srcTable May be an array of tables.
param: array $varMap
param: array $conds May be "*" to copy the whole table.
param: string $fname
param: array $insertOptions
param: array $selectOptions
return: null|ResultWrapper

update( $table, $values, $conds, $fname = __METHOD__, $options = array()   X-Ref
UPDATE wrapper. Takes a condition array and a SET array.

param: string $table Name of the table to UPDATE. This will be passed through
param: array $values An array of values to SET. For each array element,
param: array $conds An array of conditions (WHERE). See
param: string $fname The function name of the caller (from __METHOD__),
param: array $options An array of UPDATE options, can be:
return: bool

makeList( $a, $mode = LIST_COMMA, $binaryColumns = array()   X-Ref
Makes an encoded list of strings from an array

param: array $a Containing the data
param: int $mode Constant
param: array $binaryColumns Contains a list of column names that are binary types
return: string

textFieldSize( $table, $field )   X-Ref

param: string $table
param: string $field
return: int Returns the size of a text field, or -1 for "unlimited"

limitResult( $sql, $limit, $offset = false )   X-Ref
Construct a LIMIT query with optional offset
This is used for query pages

param: string $sql SQL query we will append the limit too
param: int $limit The SQL limit
param: bool|int $offset The SQL offset (default false)
return: array|string

LimitToTopN( $sql )   X-Ref
If there is a limit clause, parse it, strip it, and pass the remaining
SQL through limitResult() with the appropriate parameters. Not the
prettiest solution, but better than building a whole new parser. This
exists becase there are still too many extensions that don't use dynamic
sql generation.

param: string $sql
return: array|mixed|string

getSoftwareLink()   X-Ref

return: string Wikitext of a link to the server software's web site

getServerVersion()   X-Ref

return: string Version information from the database

tableExists( $table, $fname = __METHOD__ )   X-Ref

param: string $table
param: string $fname
return: bool

fieldExists( $table, $field, $fname = __METHOD__ )   X-Ref
Query whether a given column exists in the mediawiki schema

param: string $table
param: string $field
param: string $fname
return: bool

fieldInfo( $table, $field )   X-Ref
No description

doBegin( $fname = __METHOD__ )   X-Ref
Begin a transaction, committing any previously open transaction

param: string $fname

doCommit( $fname = __METHOD__ )   X-Ref
End a transaction

param: string $fname

doRollback( $fname = __METHOD__ )   X-Ref
Rollback a transaction.
No-op on non-transactional databases.

param: string $fname

escapeIdentifier( $identifier )   X-Ref
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

param: string $identifier
return: string

strencode( $s )   X-Ref

param: string $s
return: string

addQuotes( $s )   X-Ref

param: string $s
return: string

addIdentifierQuotes( $s )   X-Ref

param: string $s
return: string

isQuotedIdentifier( $name )   X-Ref

param: string $name
return: bool

selectDB( $db )   X-Ref

param: string $db
return: bool

makeSelectOptions( $options )   X-Ref

param: array $options An associative array of options to be turned into
return: array

getType()   X-Ref
Get the type of the DBMS, as it appears in $wgDBtype.

return: string

buildConcat( $stringList )   X-Ref

param: array $stringList
return: string

buildGroupConcatField( $delim, $table, $field, $conds = '',$join_conds = array()   X-Ref
Build a GROUP_CONCAT or equivalent statement for a query.
MS SQL doesn't have GROUP_CONCAT so we emulate it with other stuff (and boy is it nasty)

This is useful for combining a field for several rows into a single string.
NULL values will not appear in the output, duplicated values will appear,
and the resulting delimiter-separated values have no defined sort order.
Code using the results may need to use the PHP unique() or sort() methods.

param: string $delim Glue to bind the results together
param: string|array $table Table name
param: string $field Field name
param: string|array $conds Conditions
param: string|array $join_conds Join conditions
return: string SQL text

getSearchEngine()   X-Ref

return: string

getBinaryColumns( $table )   X-Ref
Returns an associative array for fields that are of type varbinary, binary, or image
$table can be either a raw table name or passed through tableName() first

param: string $table
return: array

getBitColumns( $table )   X-Ref

param: string $table
return: array

populateColumnCaches()   X-Ref
No description

tableName( $name, $format = 'quoted' )   X-Ref

param: string $name
param: string $format
return: string

realTableName( $name, $format = 'quoted' )   X-Ref
call this instead of tableName() in the updater when renaming tables

param: string $name
param: string $format One of quoted, raw, or split
return: string

prepareStatements( $value = null )   X-Ref
Called in the installer and updater.
Probably doesn't need to be called anywhere else in the codebase.

param: bool|null $value
return: bool|null

scrollableCursor( $value = null )   X-Ref
Called in the installer and updater.
Probably doesn't need to be called anywhere else in the codebase.

param: bool|null $value
return: bool|null

Class: MssqlField  - X-Ref

Utility class.

__construct( $info )   X-Ref
No description

name()   X-Ref
No description

tableName()   X-Ref
No description

defaultValue()   X-Ref
No description

maxLength()   X-Ref
No description

isNullable()   X-Ref
No description

type()   X-Ref
No description

Class: MssqlBlob  - X-Ref

__construct( $data )   X-Ref
No description

fetch()   X-Ref
Returns an unquoted hex representation of a binary string
for insertion into varbinary-type fields

return: string

Class: MssqlResultWrapper  - X-Ref

fetchObject()   X-Ref

return: stdClass|bool

fetchRow()   X-Ref

return: array|bool

seek( $row )   X-Ref

param: int $row
return: bool



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1