Class FOFDatabaseDriverSqlsrv
SQL Server database driver
-
FOFDatabase
-
FOFDatabaseDriver
implements
FOFDatabaseInterface
-
FOFDatabaseDriverSqlsrv
Methods summary
public static
boolean
|
#
isSupported( )
Test to see if the SQLSRV connector is available.
Test to see if the SQLSRV connector is available.
Returns
boolean - True on success, false otherwise.
Since
12.1
|
public
|
#
__construct( array $options )
Constructor.
Parameters
- $options
array - $options List of options used to configure the connection
Since
12.1
Overrides
|
public
|
|
public
|
#
connect( )
Connects to the database if needed.
Connects to the database if needed.
Returns
- Returns void if the database connected successfully.
Throws
Since
12.1
|
public
|
#
disconnect( )
Disconnects the database.
Disconnects the database.
Since
12.1
|
protected
array
|
#
getTableConstraints( string $tableName )
Get table constraints
Parameters
- $tableName
string - $tableName The name of the database table.
Returns
array - Any constraints available for the table.
Since
12.1
|
protected
|
#
renameConstraints( array $constraints = array(), string $prefix = null, string $backup = null )
Rename constraints.
Parameters
- $constraints
array - $constraints Array(strings) of table constraints
- $prefix
string - $prefix A string
- $backup
string - $backup A string
Since
12.1
|
public
string
|
#
escape( string $text, boolean $extra = false )
Method to escape a string for usage in an SQL statement.
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.
Parameters
- $text
string - $text The string to be escaped.
- $extra
boolean - $extra Optional parameter to provide extra escaping.
Returns
string - The escaped string.
Since
12.1
|
public
boolean
|
#
connected( )
Determines if the connection to the server is active.
Determines if the connection to the server is active.
Returns
boolean - True if connected to the database engine.
Since
12.1
|
public
FOFDatabaseDriverSqlsrv
|
#
dropTable( string $tableName, boolean $ifExists = true )
Drops a table from the database.
Drops a table from the database.
Parameters
- $tableName
string - $tableName The name of the database table to drop.
- $ifExists
boolean - $ifExists Optionally specify that the table must exist before it is dropped.
Returns
Throws
Since
12.1
|
public
integer
|
#
getAffectedRows( )
Get the number of affected rows for the previous executed SQL statement.
Get the number of affected rows for the previous executed SQL statement.
Returns
integer - The number of affected rows.
Since
12.1
|
public
mixed
|
#
getCollation( )
Method to get the database collation in use by sampling a text field of a
table in the database.
Method to get the database collation in use by sampling a text field of a
table in the database.
Returns
mixed - The collation in use by the database or boolean false if not supported.
Since
12.1
|
public
string
|
#
getConnectionCollation( )
Method to get the database connection collation, as reported by the driver.
If the connector doesn't support reporting this value please return an empty
string.
Method to get the database connection collation, as reported by the driver.
If the connector doesn't support reporting this value please return an empty
string.
Returns
string
Overrides
|
public
integer
|
#
getNumRows( resource $cursor = null )
Get the number of returned rows for the previous executed SQL statement.
Get the number of returned rows for the previous executed SQL statement.
Parameters
- $cursor
resource - $cursor An optional database cursor resource to extract the row count from.
Returns
integer - The number of returned rows.
Since
12.1
|
public
array
|
#
getTableColumns( mixed $table, boolean $typeOnly = true )
Retrieves field information about the given tables.
Retrieves field information about the given tables.
Parameters
- $table
mixed - $table A table name
- $typeOnly
boolean - $typeOnly True to only return field types.
Returns
array - An array of fields.
Throws
Since
12.1
|
public
array
|
#
getTableCreate( mixed $tables )
Shows the table CREATE statement that creates the given tables.
Shows the table CREATE statement that creates the given tables.
This is unsupported by MSSQL.
Parameters
- $tables
mixed - $tables A table name or a list of table names.
Returns
array - A list of the create SQL for the tables.
Throws
Since
12.1
|
public
array
|
#
getTableKeys( string $table )
Get the details list of keys for a table.
Get the details list of keys for a table.
Parameters
- $table
string - $table The name of the table.
Returns
array - An array of the column specification for the table.
Throws
Since
12.1
|
public
array
|
#
getTableList( )
Method to get an array of all tables in the database.
Method to get an array of all tables in the database.
Returns
array - An array of all the tables in the database.
Throws
Since
12.1
|
public
string
|
#
getVersion( )
Get the version of the database connector.
Get the version of the database connector.
Returns
string - The database connector version.
Since
12.1
|
public
boolean
|
#
insertObject( string $table, object & $object, string $key = null )
Inserts a row into a table based on an object's properties.
Inserts a row into a table based on an object's properties.
Parameters
- $table
string - $table The name of the database table to insert into.
- $object
object - &$object A reference to an object whose public properties match the table
fields.
- $key
string - $key The name of the primary key. If provided the object property is updated.
Returns
boolean - True on success.
Throws
Since
12.1
Overrides
|
public
integer
|
#
insertid( )
Method to get the auto-incremented value from the last INSERT statement.
Method to get the auto-incremented value from the last INSERT statement.
Returns
integer - The value of the auto-increment field from the last inserted row.
Since
12.1
|
public
mixed
|
#
loadResult( )
Method to get the first field of the first row of the result set from the
database query.
Method to get the first field of the first row of the result set from the
database query.
Returns
mixed - The return value or null if the query failed.
Throws
Since
12.1
Overrides
|
public
mixed
|
#
execute( )
Execute the SQL statement.
Execute the SQL statement.
Returns
mixed - A database cursor resource on success, boolean false on failure.
Throws
Since
12.1
|
public
string
|
#
replacePrefix( string $query, string $prefix = '#__' )
This function replaces a string identifier $prefix with the string
held is the tablePrefix class variable.
This function replaces a string identifier $prefix with the string
held is the tablePrefix class variable.
Parameters
- $query
string - $query The SQL statement to prepare.
- $prefix
string - $prefix The common table prefix.
Returns
string - The processed SQL statement.
Since
12.1
Overrides
|
public
boolean
|
#
select( string $database )
Select a database for use.
Select a database for use.
Parameters
- $database
string - $database The name of the database to select for use.
Returns
boolean - True if the database was successfully selected.
Throws
Since
12.1
|
public
boolean
|
#
setUtf( )
Set the connection to use UTF-8 character encoding.
Set the connection to use UTF-8 character encoding.
Returns
boolean - True on success.
Since
12.1
|
public
|
#
transactionCommit( boolean $toSavepoint = false )
Method to commit a transaction.
Method to commit a transaction.
Parameters
- $toSavepoint
boolean - $toSavepoint If true, commit to the last savepoint.
Throws
Since
12.1
|
public
|
#
transactionRollback( boolean $toSavepoint = false )
Method to roll back a transaction.
Method to roll back a transaction.
Parameters
- $toSavepoint
boolean - $toSavepoint If true, rollback to the last savepoint.
Throws
Since
12.1
|
public
|
#
transactionStart( boolean $asSavepoint = false )
Method to initialize a transaction.
Method to initialize a transaction.
Parameters
- $asSavepoint
boolean - $asSavepoint If true and a transaction is already active, a savepoint will be
created.
Throws
Since
12.1
|
protected
mixed
|
#
fetchArray( mixed $cursor = null )
Method to fetch a row from the result set cursor as an array.
Method to fetch a row from the result set cursor as an array.
Parameters
- $cursor
mixed - $cursor The optional result set cursor from which to fetch the row.
Returns
mixed - Either the next row from the result set or false if there are no more rows.
Since
12.1
|
protected
mixed
|
#
fetchAssoc( mixed $cursor = null )
Method to fetch a row from the result set cursor as an associative array.
Method to fetch a row from the result set cursor as an associative array.
Parameters
- $cursor
mixed - $cursor The optional result set cursor from which to fetch the row.
Returns
mixed - Either the next row from the result set or false if there are no more rows.
Since
12.1
|
protected
mixed
|
#
fetchObject( mixed $cursor = null, string $class = 'stdClass' )
Method to fetch a row from the result set cursor as an object.
Method to fetch a row from the result set cursor as an object.
Parameters
- $cursor
mixed - $cursor The optional result set cursor from which to fetch the row.
- $class
string - $class The class name to use for the returned row object.
Returns
mixed - Either the next row from the result set or false if there are no more rows.
Since
12.1
|
protected
|
#
freeResult( mixed $cursor = null )
Method to free up the memory used for the result set.
Method to free up the memory used for the result set.
Parameters
- $cursor
mixed - $cursor The optional result set cursor from which to fetch the row.
Since
12.1
|
protected
boolean
|
#
checkFieldExists( string $table, string $field )
Method to check and see if a field exists in a table.
Method to check and see if a field exists in a table.
Parameters
- $table
string - $table The table in which to verify the field.
- $field
string - $field The field to verify.
Returns
boolean - True if the field exists in the table.
Since
12.1
|
protected
string
|
#
limit( string $query, integer $limit, integer $offset )
Method to wrap an SQL statement to provide a LIMIT and OFFSET behavior for
scrolling through a result set.
Method to wrap an SQL statement to provide a LIMIT and OFFSET behavior for
scrolling through a result set.
Parameters
- $query
string - $query The SQL statement to process.
- $limit
integer - $limit The maximum affected rows to set.
- $offset
integer - $offset The affected row offset to set.
Returns
string - The processed SQL statement.
Since
12.1
|
public
FOFDatabaseDriverSqlsrv
|
#
renameTable( string $oldTable, string $newTable, string $backup = null, string $prefix = null )
Renames a table in the database.
Renames a table in the database.
Parameters
- $oldTable
string - $oldTable The name of the table to be renamed
- $newTable
string - $newTable The new name for the table.
- $backup
string - $backup Table prefix
- $prefix
string - $prefix For the table - used to rename constraints in non-mysql databases
Returns
Throws
Since
12.1
|
public
FOFDatabaseDriverSqlsrv
|
#
lockTable( string $tableName )
Locks a table in the database.
Locks a table in the database.
Parameters
- $tableName
string - $tableName The name of the table to lock.
Returns
Throws
Since
12.1
|
public
FOFDatabaseDriverSqlsrv
|
#
unlockTables( )
Unlocks tables in the database.
Unlocks tables in the database.
Returns
Throws
Since
12.1
|
protected
integer
|
#
getErrorNumber( )
Return the actual SQL Error number
Return the actual SQL Error number
Returns
integer - The SQL Error number
Since
3.4.6
|
protected
string
|
#
getErrorMessage( string $query )
Return the actual SQL Error message
Return the actual SQL Error message
Parameters
- $query
string - $query The SQL Query that fails
Returns
string - The SQL Error message
Since
3.4.6
|
__call()
,
addDisconnectHandler()
,
alterDbCharacterSet()
,
alterTableCharacterSet()
,
convertUtf8mb4QueryToUtf8()
,
createDatabase()
,
getAlterDbCharacterSet()
,
getAlterTableCharacterSet()
,
getCallStacks()
,
getConnection()
,
getConnectors()
,
getCount()
,
getCreateDatabaseQuery()
,
getDatabase()
,
getDateFormat()
,
getExporter()
,
getImporter()
,
getInstance()
,
getIterator()
,
getLog()
,
getMinimum()
,
getName()
,
getNullDate()
,
getPrefix()
,
getQuery()
,
getServerType()
,
getTimings()
,
getUTFSupport()
,
hasUTF8mb4Support()
,
hasUTFSupport()
,
isMinimumVersion()
,
loadAssoc()
,
loadAssocList()
,
loadColumn()
,
loadNextObject()
,
loadNextRow()
,
loadObject()
,
loadObjectList()
,
loadRow()
,
loadRowList()
,
quote()
,
quoteName()
,
quoteNameStr()
,
setDebug()
,
setQuery()
,
splitSql()
,
truncateTable()
,
updateObject()
Methods inherited from FOFDatabase
getErrorMsg()
,
getErrorNum()
,
query()
,
stderr()
,
test()
Magic methods summary
q()
,
qn()
Properties summary
public
string
|
$name
|
#
The name of the database driver.
The name of the database driver.
Since
12.1
|
public
string
|
$serverType
|
#
The type of the database server family supported by this driver.
The type of the database server family supported by this driver.
Since
CMS 3.5.0
|
protected
string
|
$nameQuote
|
#
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.
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
|
protected
string
|
$nullDate
|
#
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.
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
|
protected static
string
|
$dbMinimum
|
#
The minimum supported database version.
The minimum supported database version.
Since
12.1
|
$callStacks
,
$connection
,
$count
,
$cursor
,
$debug
,
$disconnectHandlers
,
$errorMsg
,
$errorNum
,
$instances
,
$limit
,
$log
,
$offset
,
$options
,
$sql
,
$tablePrefix
,
$timings
,
$transactionDepth
,
$utf
,
$utf8mb4