Class JDatabaseDriverSqlsrv

Description

SQL Server database driver

Located in /libraries/joomla/database/driver/sqlsrv.php (line 20)

JDatabase
   |
   --JDatabaseDriver
      |
      --JDatabaseDriverSqlsrv
Direct descendents
Class Description
 class JDatabaseDriverSqlazure SQL Server database driver
 class JDatabaseSqlsrv SQL Server database driver
Variable Summary
 static string $dbMinimum
 string $name
 string $nameQuote
 string $nullDate
Method Summary
 static boolean isSupported ()
 JDatabaseDriverSqlsrv __construct (array $options)
 void __destruct ()
 boolean checkFieldExists (string $table, string $field)
 void connect ()
 boolean connected ()
 void disconnect ()
 JDatabaseDriverSqlsrv dropTable (string $tableName, [boolean $ifExists = true])
 string escape (string $text, [boolean $extra = false])
 mixed execute ()
 mixed fetchArray ([mixed $cursor = null])
 mixed fetchAssoc ([mixed $cursor = null])
 mixed fetchObject ([mixed $cursor = null], [string $class = 'stdClass'])
 void freeResult ([mixed $cursor = null])
 integer getAffectedRows ()
 mixed getCollation ()
 integer getNumRows ([resource $cursor = null])
 array getTableColumns (mixed $table, [boolean $typeOnly = true])
 array getTableConstraints (string $tableName)
 array getTableCreate (mixed $tables)
 array getTableKeys (string $table)
 array getTableList ()
 string getVersion ()
 integer insertid ()
 boolean insertObject (string $table, object &$object, [string $key = null])
 string limit (string $query, integer $limit, integer $offset)
 mixed loadResult ()
 JDatabaseDriverSqlsrv lockTable (string $tableName)
 void renameConstraints ([array $constraints = array()], [string $prefix = null], [string $backup = null])
 JDatabaseDriverSqlsrv renameTable (string $oldTable, string $newTable, [string $backup = null], [string $prefix = null])
 string replacePrefix (string $query, [string $prefix = '#__'])
 boolean select (string $database)
 boolean setUTF ()
 void transactionCommit ([boolean $toSavepoint = false])
 void transactionRollback ([boolean $toSavepoint = false])
 void transactionStart ([boolean $asSavepoint = false])
Variables
static string $dbMinimum = '10.50.1600.1' (line 54)
  • var: The minimum supported database version.
  • since: 12.1
  • access: protected

Redefinition of:
JDatabaseDriver::$dbMinimum
string $name = 'sqlsrv' (line 28)

The name of the database driver.

  • since: 12.1
  • access: public

Redefinition of:
JDatabaseDriver::$name
The name of the database driver.

Redefined in descendants as:
string $nameQuote = '[]' (line 39)

The character(s) used to quote SQL statement names such as table names or field names, etc. The child classes should define this as necessary. If a single character string the same character is used for both sides of the quoted name, else the first character will be used for the opening quote and the second for the closing quote.

  • since: 12.1
  • access: protected

Redefinition of:
JDatabaseDriver::$nameQuote
string $nullDate = '1900-01-01 00:00:00' (line 48)

The null or zero representation of a timestamp for the database driver. This should be defined in child classes to hold the appropriate value for the engine.

  • since: 12.1
  • access: protected

Redefinition of:
JDatabaseDriver::$nullDate

Inherited Variables

Inherited from JDatabaseDriver

JDatabaseDriver::$callStacks
JDatabaseDriver::$connection
JDatabaseDriver::$count
JDatabaseDriver::$cursor
JDatabaseDriver::$debug
JDatabaseDriver::$disconnectHandlers
JDatabaseDriver::$errorMsg
JDatabaseDriver::$errorNum
JDatabaseDriver::$instances
JDatabaseDriver::$limit
JDatabaseDriver::$log
JDatabaseDriver::$offset
JDatabaseDriver::$options
JDatabaseDriver::$sql
JDatabaseDriver::$tablePrefix
JDatabaseDriver::$timings
JDatabaseDriver::$transactionDepth
JDatabaseDriver::$utf
Methods
static isSupported (line 63)

Test to see if the SQLSRV connector is available.

  • return: True on success, false otherwise.
  • since: 12.1
  • access: public
static boolean isSupported ()
Constructor __construct (line 75)

Constructor.

  • since: 12.1
  • access: public
JDatabaseDriverSqlsrv __construct (array $options)
  • array $options: List of options used to configure the connection

Redefinition of:
JDatabaseDriver::__construct()
Constructor.
Destructor __destruct (line 93)

Destructor.

  • since: 12.1
  • access: public
void __destruct ()
checkFieldExists (line 973)

Method to check and see if a field exists in a table.

  • return: True if the field exists in the table.
  • since: 12.1
  • access: protected
boolean checkFieldExists (string $table, string $field)
  • string $table: The table in which to verify the field.
  • string $field: The field to verify.
connect (line 106)

Connects to the database if needed.

  • return: Returns void if the database connected successfully.
  • since: 12.1
  • throws: RuntimeException
  • access: public
void connect ()

Redefinition of:
JDatabaseDriver::connect()
Connects to the database if needed.
connected (line 246)

Determines if the connection to the server is active.

  • return: True if connected to the database engine.
  • since: 12.1
  • access: public
boolean connected ()

Redefinition of:
JDatabaseDriver::connected()
Determines if the connection to the server is active.
disconnect (line 150)

Disconnects the database.

  • since: 12.1
  • access: public
void disconnect ()

Redefinition of:
JDatabaseDriver::disconnect()
Disconnects the database.
dropTable (line 262)

Drops a table from the database.

  • return: Returns this object to support chaining.
  • since: 12.1
  • access: public
JDatabaseDriverSqlsrv dropTable (string $tableName, [boolean $ifExists = true])
  • string $tableName: The name of the database table to drop.
  • boolean $ifExists: Optionally specify that the table must exist before it is dropped.

Redefinition of:
JDatabaseDriver::dropTable()
Drops a table from the database.
escape (line 223)

Method to escape a string for usage in an SQL statement.

The escaping for MSSQL isn't handled in the driver though that would be nice. Because of this we need to handle the escaping ourselves.

  • return: The escaped string.
  • since: 12.1
  • access: public
string escape (string $text, [boolean $extra = false])
  • string $text: The string to be escaped.
  • boolean $extra: Optional parameter to provide extra escaping.

Redefinition of:
JDatabaseDriver::escape()
Escapes a string for usage in an SQL statement.
execute (line 565)

Execute the SQL statement.

  • return: A database cursor resource on success, boolean false on failure.
  • throws: RuntimeException
  • throws: Exception
  • since: 12.1
  • access: public
mixed execute ()

Redefinition of:
JDatabaseDriver::execute()
Execute the SQL statement.
fetchArray (line 915)

Method to fetch a row from the result set cursor as an array.

  • return: Either the next row from the result set or false if there are no more rows.
  • since: 12.1
  • access: protected
mixed fetchArray ([mixed $cursor = null])
  • mixed $cursor: The optional result set cursor from which to fetch the row.

Redefinition of:
JDatabaseDriver::fetchArray()
Method to fetch a row from the result set cursor as an array.
fetchAssoc (line 929)

Method to fetch a row from the result set cursor as an associative array.

  • return: Either the next row from the result set or false if there are no more rows.
  • since: 12.1
  • access: protected
mixed fetchAssoc ([mixed $cursor = null])
  • mixed $cursor: The optional result set cursor from which to fetch the row.

Redefinition of:
JDatabaseDriver::fetchAssoc()
Method to fetch a row from the result set cursor as an associative array.
fetchObject (line 944)

Method to fetch a row from the result set cursor as an object.

  • return: Either the next row from the result set or false if there are no more rows.
  • since: 12.1
  • access: protected
mixed fetchObject ([mixed $cursor = null], [string $class = 'stdClass'])
  • mixed $cursor: The optional result set cursor from which to fetch the row.
  • string $class: The class name to use for the returned row object.

Redefinition of:
JDatabaseDriver::fetchObject()
Method to fetch a row from the result set cursor as an object.
freeResult (line 958)

Method to free up the memory used for the result set.

  • since: 12.1
  • access: protected
void freeResult ([mixed $cursor = null])
  • mixed $cursor: The optional result set cursor from which to fetch the row.

Redefinition of:
JDatabaseDriver::freeResult()
Method to free up the memory used for the result set.
getAffectedRows (line 291)

Get the number of affected rows for the previous executed SQL statement.

  • return: The number of affected rows.
  • since: 12.1
  • access: public
integer getAffectedRows ()

Redefinition of:
JDatabaseDriver::getAffectedRows()
Get the number of affected rows for the previous executed SQL statement.
getCollation (line 305)

Method to get the database collation in use by sampling a text field of a table in the database.

  • return: The collation in use by the database or boolean false if not supported.
  • since: 12.1
  • access: public
mixed getCollation ()

Redefinition of:
JDatabaseDriver::getCollation()
Method to get the database collation in use by sampling a text field of a table in the database.
getNumRows (line 320)

Get the number of returned rows for the previous executed SQL statement.

  • return: The number of returned rows.
  • since: 12.1
  • access: public
integer getNumRows ([resource $cursor = null])
  • resource $cursor: An optional database cursor resource to extract the row count from.

Redefinition of:
JDatabaseDriver::getNumRows()
Get the number of returned rows for the previous executed SQL statement.
getTableColumns (line 338)

Retrieves field information about the given tables.

  • return: An array of fields.
  • since: 12.1
  • throws: RuntimeException
  • access: public
array getTableColumns (mixed $table, [boolean $typeOnly = true])
  • mixed $table: A table name
  • boolean $typeOnly: True to only return field types.

Redefinition of:
JDatabaseDriver::getTableColumns()
Retrieves field information about the given tables.
getTableConstraints (line 175)

Get table constraints

  • return: Any constraints available for the table.
  • since: 12.1
  • access: protected
array getTableConstraints (string $tableName)
  • string $tableName: The name of the database table.
getTableCreate (line 383)

Shows the table CREATE statement that creates the given tables.

This is unsupported by MSSQL.

  • return: A list of the create SQL for the tables.
  • since: 12.1
  • throws: RuntimeException
  • access: public
array getTableCreate (mixed $tables)
  • mixed $tables: A table name or a list of table names.

Redefinition of:
JDatabaseDriver::getTableCreate()
Shows the table CREATE statement that creates the given tables.
getTableKeys (line 400)

Get the details list of keys for a table.

  • return: An array of the column specification for the table.
  • since: 12.1
  • throws: RuntimeException
  • access: public
array getTableKeys (string $table)
  • string $table: The name of the table.

Redefinition of:
JDatabaseDriver::getTableKeys()
Retrieves field information about the given tables.
getTableList (line 416)

Method to get an array of all tables in the database.

  • return: An array of all the tables in the database.
  • since: 12.1
  • throws: RuntimeException
  • access: public
array getTableList ()

Redefinition of:
JDatabaseDriver::getTableList()
Method to get an array of all tables in the database.
getVersion (line 434)

Get the version of the database connector.

  • return: The database connector version.
  • since: 12.1
  • access: public
string getVersion ()

Redefinition of:
JDatabaseDriver::getVersion()
Get the version of the database connector
insertid (line 513)

Method to get the auto-incremented value from the last INSERT statement.

  • return: The value of the auto-increment field from the last inserted row.
  • since: 12.1
  • access: public
integer insertid ()

Redefinition of:
JDatabaseDriver::insertid()
Method to get the auto-incremented value from the last INSERT statement.
insertObject (line 455)

Inserts a row into a table based on an object's properties.

  • return: True on success.
  • since: 12.1
  • throws: RuntimeException
  • access: public
boolean insertObject (string $table, object &$object, [string $key = null])
  • string $table: The name of the database table to insert into.
  • object &$object: A reference to an object whose public properties match the table fields.
  • string $key: The name of the primary key. If provided the object property is updated.

Redefinition of:
JDatabaseDriver::insertObject()
Inserts a row into a table based on an object's properties.
limit (line 1003)

Method to wrap an SQL statement to provide a LIMIT and OFFSET behavior for scrolling through a result set.

  • return: The processed SQL statement.
  • since: 12.1
  • access: protected
string limit (string $query, integer $limit, integer $offset)
  • string $query: The SQL statement to process.
  • integer $limit: The maximum affected rows to set.
  • integer $offset: The affected row offset to set.
loadResult (line 531)

Method to get the first field of the first row of the result set from the database query.

  • return: The return value or null if the query failed.
  • since: 12.1
  • throws: RuntimeException
  • access: public
mixed loadResult ()

Redefinition of:
JDatabaseDriver::loadResult()
Method to get the first field of the first row of the result set from the database query.
lockTable (line 1071)

Locks a table in the database.

  • return: Returns this object to support chaining.
  • since: 12.1
  • throws: RuntimeException
  • access: public
JDatabaseDriverSqlsrv lockTable (string $tableName)
  • string $tableName: The name of the table to lock.

Redefinition of:
JDatabaseDriver::lockTable()
Locks a table in the database.
renameConstraints (line 199)

Rename constraints.

  • since: 12.1
  • access: protected
void renameConstraints ([array $constraints = array()], [string $prefix = null], [string $backup = null])
  • array $constraints: Array(strings) of table constraints
  • string $prefix: A string
  • string $backup: A string
renameTable (line 1043)

Renames a table in the database.

  • return: Returns this object to support chaining.
  • since: 12.1
  • throws: RuntimeException
  • access: public
JDatabaseDriverSqlsrv renameTable (string $oldTable, string $newTable, [string $backup = null], [string $prefix = null])
  • string $oldTable: The name of the table to be renamed
  • string $newTable: The new name for the table.
  • string $backup: Table prefix
  • string $prefix: For the table - used to rename constraints in non-mysql databases

Redefinition of:
JDatabaseDriver::renameTable()
Renames a table in the database.
replacePrefix (line 683)

This function replaces a string identifier $prefix with the string held is the tablePrefix class variable.

  • return: The processed SQL statement.
  • since: 12.1
  • access: public
string replacePrefix (string $query, [string $prefix = '#__'])
  • string $query: The SQL statement to prepare.
  • string $prefix: The common table prefix.

Redefinition of:
JDatabaseDriver::replacePrefix()
This function replaces a string identifier $prefix with the string held is the tablePrefix class variable.
select (line 784)

Select a database for use.

  • return: True if the database was successfully selected.
  • since: 12.1
  • throws: RuntimeException
  • access: public
boolean select (string $database)
  • string $database: The name of the database to select for use.

Redefinition of:
JDatabaseDriver::select()
Select a database for use.
setUTF (line 808)

Set the connection to use UTF-8 character encoding.

  • return: True on success.
  • since: 12.1
  • access: public
boolean setUTF ()

Redefinition of:
JDatabaseDriver::setUTF()
Set the connection to use UTF-8 character encoding.
transactionCommit (line 823)

Method to commit a transaction.

  • since: 12.1
  • throws: RuntimeException
  • access: public
void transactionCommit ([boolean $toSavepoint = false])
  • boolean $toSavepoint: If true, commit to the last savepoint.

Redefinition of:
JDatabaseDriver::transactionCommit()
Method to commit a transaction.
transactionRollback (line 850)

Method to roll back a transaction.

  • since: 12.1
  • throws: RuntimeException
  • access: public
void transactionRollback ([boolean $toSavepoint = false])
  • boolean $toSavepoint: If true, rollback to the last savepoint.

Redefinition of:
JDatabaseDriver::transactionRollback()
Method to roll back a transaction.
transactionStart (line 883)

Method to initialize a transaction.

  • since: 12.1
  • throws: RuntimeException
  • access: public
void transactionStart ([boolean $asSavepoint = false])
  • boolean $asSavepoint: If true and a transaction is already active, a savepoint will be created.

Redefinition of:
JDatabaseDriver::transactionStart()
Method to initialize a transaction.
unlockTables (line 1084)

Unlocks tables in the database.

  • return: Returns this object to support chaining.
  • since: 12.1
  • throws: RuntimeException
  • access: public
JDatabaseDriverSqlsrv unlockTables ()

Redefinition of:
JDatabaseDriver::unlockTables()
Unlocks tables in the database.

Inherited Methods

Inherited From JDatabaseDriver

 JDatabaseDriver::__construct()
 JDatabaseDriver::addDisconnectHandler()
 JDatabaseDriver::alterDbCharacterSet()
 JDatabaseDriver::connect()
 JDatabaseDriver::connected()
 JDatabaseDriver::createDatabase()
 JDatabaseDriver::disconnect()
 JDatabaseDriver::dropTable()
 JDatabaseDriver::escape()
 JDatabaseDriver::execute()
 JDatabaseDriver::fetchArray()
 JDatabaseDriver::fetchAssoc()
 JDatabaseDriver::fetchObject()
 JDatabaseDriver::freeResult()
 JDatabaseDriver::getAffectedRows()
 JDatabaseDriver::getAlterDbCharacterSet()
 JDatabaseDriver::getCallStacks()
 JDatabaseDriver::getCollation()
 JDatabaseDriver::getConnection()
 JDatabaseDriver::getConnectors()
 JDatabaseDriver::getCount()
 JDatabaseDriver::getCreateDatabaseQuery()
 JDatabaseDriver::getDatabase()
 JDatabaseDriver::getDateFormat()
 JDatabaseDriver::getExporter()
 JDatabaseDriver::getImporter()
 JDatabaseDriver::getInstance()
 JDatabaseDriver::getIterator()
 JDatabaseDriver::getLog()
 JDatabaseDriver::getMinimum()
 JDatabaseDriver::getNullDate()
 JDatabaseDriver::getNumRows()
 JDatabaseDriver::getPrefix()
 JDatabaseDriver::getQuery()
 JDatabaseDriver::getTableColumns()
 JDatabaseDriver::getTableCreate()
 JDatabaseDriver::getTableKeys()
 JDatabaseDriver::getTableList()
 JDatabaseDriver::getTimings()
 JDatabaseDriver::getUTFSupport()
 JDatabaseDriver::getVersion()
 JDatabaseDriver::hasUTFSupport()
 JDatabaseDriver::insertid()
 JDatabaseDriver::insertObject()
 JDatabaseDriver::isMinimumVersion()
 JDatabaseDriver::loadAssoc()
 JDatabaseDriver::loadAssocList()
 JDatabaseDriver::loadColumn()
 JDatabaseDriver::loadNextObject()
 JDatabaseDriver::loadNextRow()
 JDatabaseDriver::loadObject()
 JDatabaseDriver::loadObjectList()
 JDatabaseDriver::loadResult()
 JDatabaseDriver::loadRow()
 JDatabaseDriver::loadRowList()
 JDatabaseDriver::lockTable()
 JDatabaseDriver::quote()
 JDatabaseDriver::quoteName()
 JDatabaseDriver::quoteNameStr()
 JDatabaseDriver::renameTable()
 JDatabaseDriver::replacePrefix()
 JDatabaseDriver::select()
 JDatabaseDriver::setDebug()
 JDatabaseDriver::setQuery()
 JDatabaseDriver::setUTF()
 JDatabaseDriver::splitSql()
 JDatabaseDriver::transactionCommit()
 JDatabaseDriver::transactionRollback()
 JDatabaseDriver::transactionStart()
 JDatabaseDriver::truncateTable()
 JDatabaseDriver::unlockTables()
 JDatabaseDriver::updateObject()
 JDatabaseDriver::__call()

Inherited From JDatabase

 JDatabase::getConnectors()
 JDatabase::getErrorMsg()
 JDatabase::getErrorNum()
 JDatabase::getInstance()
 JDatabase::query()
 JDatabase::splitSql()
 JDatabase::stderr()
 JDatabase::test()

Documentation generated on Tue, 19 Nov 2013 15:14:14 +0100 by phpDocumentor 1.4.3