Overview

Packages

  • Actions
  • Codegen
  • Controls
    • Base
  • DatabaseAdapters
  • Events
  • None
  • Sessions
  • Tests

Classes

  • QDatabaseBase
  • QDatabaseFieldType
  • QDatabaseForeignKey
  • QDatabaseIndex
  • QDatabaseRowBase
  • QInformixPdoDatabase
  • QMySqlDatabase
  • QMySqlDatabaseField
  • QMySqli5ClusterDatabase
  • QMySqli5Database
  • QMySqli5DatabaseField
  • QMySqli5DatabaseResult
  • QMySqliDatabase
  • QMySqliDatabaseField
  • QMySqliDatabaseResult
  • QMySqliDatabaseRow
  • QOracleDatabase
  • QOracleDatabaseRow
  • QPdoDatabase
  • QPostgreSqlDatabase
  • QPostgreSqlDatabaseField
  • QPostgreSqlDatabaseResult
  • QPostgreSqlDatabaseRow
  • QPostgreSqlPdoDatabase
  • QSqLite3PdoDatabase
  • QSqlServer2005Database
  • QSqlServer2005DatabaseField
  • QSqlServer2005DatabaseResult
  • QSqlServer2005DatabaseRow
  • QSqlServerDatabase
  • QSqlServerDatabaseField
  • QSqlServerDatabaseResult
  • QSqlServerDatabaseRow

Exceptions

  • QDatabaseExceptionBase
  • QMySqliDatabaseException
  • QOracleDatabaseException
  • QPostgreSqlDatabaseException
  • QSqlServer2005DatabaseException
  • QSqlServerDatabaseException
  • Overview
  • Package
  • Class

Class QSqlServerDatabase

Database Adapter for Microsoft SQL Server Utilizes the Microsoft SQL Server extension php_mssql.dll (win) or the freetds extension (*nix)

NOTES:

LimitInfo and Query utilizes an interal SQL tag QCUBED_OFFSET<#>, where # represents the number of rows to offset for "Limit"-based queries. The QCUBED_OFFSET is added internally by SqlLimitVariablePrefix(), and it is handled (and removed from the query) by Query(). In error messages and DB profiling, the QCUBED_OFFSET<#> tag WILL appear (if applicable). The framework will handle this gracefully, but obviously, if you try and cut and paste SQL code that contains QCUBED_OFFSET<#> into QueryAnalyzer, the query will fail, so just be aware of that. If you want to do something like test queries with QueryAnalyzer, just remember to manually remove any QCUBED_OFFSET<#> information.

MSSQL will return DATE values according to regional settings. QCubed expects dates to be of the format YYYY-MM-DD. Therefore, make sure that your PHP.INI file says: mssql.datetimeconvert = Off

Also, if you are using MSSQL Server 2K from Linux/Unix (using FreeTDS), you may encounter an issue with the following error: WARNING! ! Some character(s) could not be converted into client's character set... If so, then update your connection settings in the freetds.conf to say the following: client charset = UTF-8 For consistancy, you will also want to update QApplication::$EncodingType to be UTF-8 as well.

QBaseClass
Extended by QDatabaseBase
Extended by QSqlServerDatabase
Package: DatabaseAdapters
Located at includes/database/QSqlServerDatabase.class.php
Methods summary
public string
# SqlVariable( mixed $mixData, boolean $blnIncludeEquality = false, boolean $blnReverseEquality = false )

Properly escapes $mixData to be used as a SQL query parameter. If IncludeEquality is set (usually not), then include an equality operator. So for most data, it would just be "=". But, for example, if $mixData is NULL, then most RDBMS's require the use of "IS".

Properly escapes $mixData to be used as a SQL query parameter. If IncludeEquality is set (usually not), then include an equality operator. So for most data, it would just be "=". But, for example, if $mixData is NULL, then most RDBMS's require the use of "IS".

Parameters

$mixData
$blnIncludeEquality
whether or not to include an equality operator
$blnReverseEquality
whether the included equality operator should be a "NOT EQUAL", e.g. "!="

Returns

string
the properly formatted SQL variable

Overrides

QDatabaseBase::SqlVariable()
public
# SqlLimitVariablePrefix( $strLimitInfo )
public
# SqlLimitVariableSuffix( $strLimitInfo )
public
# SqlSortByVariable( $strSortByInfo )
public
# Connect( )

Connects to the database

Connects to the database

public mixed
# __get( string $strName )

PHP magic method

PHP magic method

Parameters

$strName
Property name

Returns

mixed

Throws

Exception|QCallerException

Overrides

QDatabaseBase::__get()
protected mixed
# ExecuteQuery( string $strQuery )

Sends a SQL query for execution to the database In this regard, a query is a 'SELECT' statement

Sends a SQL query for execution to the database In this regard, a query is a 'SELECT' statement

Parameters

$strQuery
The Query to be executed

Returns

mixed
Result that the database returns after running the query.
protected mixed
# ExecuteNonQuery( string $strNonQuery )

Sends a non-SELECT query (such as INSERT, UPDATE, DELETE, TRUNCATE) to DB server. In most cases, the results of this function are not used and you should not send 'SELECT' queries using this method because a result is not guaranteed to be returned

Sends a non-SELECT query (such as INSERT, UPDATE, DELETE, TRUNCATE) to DB server. In most cases, the results of this function are not used and you should not send 'SELECT' queries using this method because a result is not guaranteed to be returned

If there was an error, it would most probably be caught as an exception.

Parameters

$strNonQuery
The Query to be executed

Returns

mixed
Result that the database returns after running the query
public mixed|string[]
# GetTables( )

Returns the list of tables in the database (as string)

Returns the list of tables in the database (as string)

Returns

mixed|string[]
List of tables
public
# GetTableForId( $intTableId )
public mixed
# GetFieldsForTable( string $strTableName )

Get the list of columns/fields for a given table

Get the list of columns/fields for a given table

Parameters

$strTableName
Name of table whose fields we have to get

Returns

mixed
public mixed
# InsertId( null|string $strTableName = null, null|string $strColumnName = null )

Returns the ID to be inserted in a table column (normally it an autoincrement column)

Returns the ID to be inserted in a table column (normally it an autoincrement column)

Parameters

$strTableName
Table name where the ID has to be inserted
$strColumnName
Column name where the ID has to be inserted

Returns

mixed
public mixed
# Close( )

Closes the database connection

Closes the database connection

Returns

mixed
protected
# ExecuteTransactionBegin( )

This function actually begins the database transaction. Must be implemented in all subclasses. The "TransactionBegin" wrapper are meant to be called by end-user code

This function actually begins the database transaction. Must be implemented in all subclasses. The "TransactionBegin" wrapper are meant to be called by end-user code

Returns


Nothing
protected
# ExecuteTransactionCommit( )

This function actually commits the database transaction. Must be implemented in all subclasses. The "TransactionCommit" wrapper are meant to be called by end-user code

This function actually commits the database transaction. Must be implemented in all subclasses. The "TransactionCommit" wrapper are meant to be called by end-user code

Returns


Nothing
protected
# ExecuteTransactionRollBack( )

This function actually rolls back the database transaction. Must be implemented in all subclasses. The "TransactionRollBack" wrapper are meant to be called by end-user code

This function actually rolls back the database transaction. Must be implemented in all subclasses. The "TransactionRollBack" wrapper are meant to be called by end-user code

Returns


Nothing
public mixed
# GetIndexesForTable( string $strTableName )

Get list of indexes for a table

Get list of indexes for a table

Parameters

$strTableName
Name of table whose column indexes we have to get

Returns

mixed
public mixed
# GetForeignKeysForTable( string $strTableName )

Get list of foreign keys for a table

Get list of foreign keys for a table

Parameters

$strTableName
Name of table whose foreign keys we are trying to get

Returns

mixed
Methods inherited from QDatabaseBase
EnableProfiling(), EscapeIdentifier(), EscapeIdentifiers(), EscapeIdentifiersAndValues(), EscapeValues(), ExecuteProcedure(), ExplainStatement(), ExtractCommentOptions(), InsertOrUpdate(), NonQuery(), OutputProfiling(), PrepareStatement(), Query(), TransactionBegin(), TransactionCommit(), TransactionRollBack(), __construct(), __set(), transactionCacheFlush(), transactionCacheRestore()
Methods inherited from QBaseClass
OverrideAttributes(), __call()
Constants inherited from QDatabaseBase
Adapter
Properties summary
protected $objMsSql
#
protected string $strEscapeIdentifierBegin

The beginning part of characters which can escape identifiers in a SQL query for the database

The beginning part of characters which can escape identifiers in a SQL query for the database

# '['
protected string $strEscapeIdentifierEnd

The ending part of characters which can escape identifiers in a SQL query for the database

The ending part of characters which can escape identifiers in a SQL query for the database

# ']'
protected boolean $blnOnlyFullGroupBy
# true
Properties inherited from QDatabaseBase
$blnConnectedFlag, $blnEnableProfiling, $intDatabaseIndex, $intTransactionDepth, $objCacheProviderStack, $objConfigArray, $strProfileArray
Magic properties inherited from QDatabaseBase
$Adapter, $AffectedRows, $Caching, $Database, $DatabaseIndex, $DateFormat, $EnableProfiling, $EscapeIdentifierBegin, $EscapeIdentifierEnd, $Host, $OnlyFullGroupBy, $Password, $Port, $Profile, $Protocol, $Server, $Service, $Username
API documentation generated by ApiGen