Class SqlsrvConnector

Description

Implements interfaces:

IConnector implementation for Microsoft SQL Server 2005 Driver for PHP.

Located in /SqlsrvConnector.php (line 43)

BaseConnector
   |
   --SqlsrvConnector
Variable Summary
 static array $unicode
Method Summary
 SqlsrvConnector SqlsrvConnector (array $connection, [array $options = array()])
 string build (string $query, [array $options = array()])
 string castString (string $value,  $name, array &$stack, [array $options = array()])
 bool commit ([array $options = array()])
 int delete (string $query, [array $param = array()], [array $map = array()], [array $options = array()])
 array fetch (resource $stmt, [array $options = array()])
 array fetchDoublebyte (resource $stmt, [array $options = array()])
 array fetchSinglebyte (resource $stmt, [array $options = array()])
 int insert (string $query, [array $param = array()], [array $map = array()], [array $options = array()])
 bool open (array $connection)
 bool rollback ([array $options = array()])
 array select (string $query, [array $param = array()], [array $map = array()], [array $options = array()])
 bool transaction ([array $options = array()])
 int update (string $query, [array $param = array()], [array $map = array()], [array $options = array()])
Variables
static array $unicode = array("UCS-2LE", "UTF-16LE") (line 50)
  • var: Multibyte character encodings matching the MSSQL unicode format.
  • access: protected

Inherited Variables

Inherited from BaseConnector

BaseConnector::$cache
BaseConnector::$conn
BaseConnector::$options
Methods
Constructor SqlsrvConnector (line 61)

Open a connection to a MSSQL Server 2005 or higher and set global options.

  • access: public
SqlsrvConnector SqlsrvConnector (array $connection, [array $options = array()])
  • array $connection: An associated array of connection settings, like host and user name.
  • array $options: An associated array of global options for the resulting instance.
build (line 418)

Add a TOP x statement to a SQL SELECT query when the IConnector::RESULT_LENGTH is set.

  • return: A modified SQL query.
  • access: protected
string build (string $query, [array $options = array()])
  • string $query: A SQL query to execute on a database.
  • array $options: An associated array of options.
castString (line 390)

MSSQL unicode strings are converted to the special sqlsrv format.

  • return: A valid SQL string or placeholder.
  • access: protected
string castString (string $value,  $name, array &$stack, [array $options = array()])
  • string $value: The parameter to replace the query placeholder.
  • array &$stack: An array of values for use in parameterized queries.
  • array $options: An associated array of options.
  • $name

Redefinition of:
BaseConnector::castString()
Cast a string parameter to a valid SQL string or placeholder.
commit (line 330)

Commits the current transaction on the current connection.

The current transaction includes all statements on the connection that were executed after the call to transaction() and before any calls to rollback() or commit().

  • return: true if the transaction was successfully committed, false otherwise.
  • see: IConnector::commit().
  • access: public
bool commit ([array $options = array()])

Redefinition of:
BaseConnector::commit()
Commits the current transaction on the current connection.

Implementation of:
IConnector::commit()
Commits the current transaction on the current connection.
delete (line 260)

Send a SQL DELETE query to the database and get the number of rows deleted by the query.

  • return: The number of rows deleted by the query.
  • see: IConnector::delete().
  • throws: Exception when $param doesn't match the type definition $map.
  • access: public
int delete (string $query, [array $param = array()], [array $map = array()], [array $options = array()])
  • string $query: A SQL query to execute on a database.
  • array $param: An associated array of values to be used in the $query.
  • array $map: An array of type definitions for the $param values.
  • array $options: An associated array of options, see the Option elements.

Implementation of:
IConnector::delete()
Send a SQL DELETE query to the database and get the number of rows deleted by the query.
fetch (line 447)

Fetch multiple rows of a query result.

If the IConnector::RESULT_LENGTH or IConnector::RESULT_OFFSET options are set, some rows are omitted from the beginning and/or the end of the query result. If the IConnector::RESULT_KEY_FIELD option is set, the resulting table is an associated array of rows.

  • return: The query result as a table (array of associated arrays).
  • access: protected
array fetch (resource $stmt, [array $options = array()])
  • resource $stmt: A statement resource corresponding to an executed statement.
  • array $options: An associated array of options.
fetchDoublebyte (line 507)

Fetch multiple rows of a query result with double byte string encoding.

If the IConnector::RESULT_LENGTH or IConnector::RESULT_OFFSET options are set, some rows are omitted from the beginning and/or the end of the query result. If the IConnector::RESULT_KEY_FIELD option is set, the resulting table is an associated array of rows.

WARNING: To override the default PHP types, binary strings are fetched with the sqlsrv_fetch/sqlsrv_get_field functions. This combination is REALLY slow. sqlsrv_fetch_array is about 100 times faster.

  • return: The query result as a table (array of associated arrays).
  • access: protected
array fetchDoublebyte (resource $stmt, [array $options = array()])
  • resource $stmt: A statement resource corresponding to an executed statement.
  • array $options: An associated array of options.
fetchSinglebyte (line 469)

Fetch multiple rows of a query result with single byte string encoding.

If the IConnector::RESULT_LENGTH or IConnector::RESULT_OFFSET options are set, some rows are omitted from the beginning and/or the end of the query result. If the IConnector::RESULT_KEY_FIELD option is set, the resulting table is an associated array of rows.

  • return: The query result as a table (array of associated arrays).
  • access: protected
array fetchSinglebyte (resource $stmt, [array $options = array()])
  • resource $stmt: A statement resource corresponding to an executed statement.
  • array $options: An associated array of options.
insert (line 173)

Send a SQL INSERT query to the database and get the IDENTITY ID generated from the last INSERT operation (if any).

  • return: The IDENTITY ID of the last inserted row.
  • see: IConnector::insert().
  • throws: Exception when $param doesn't match the type definition $map.
  • access: public
int insert (string $query, [array $param = array()], [array $map = array()], [array $options = array()])
  • string $query: A SQL query to execute on a database.
  • array $param: An associated array of values to be used in the $query.
  • array $map: An array of type definitions for the $param values.
  • array $options: An associated array of options, see the Option elements.

Implementation of:
IConnector::insert()
Send a SQL INSERT query to the database and get the IDENTITY ID generated from the last INSERT operation (if any).
open (line 88)

Open a database connection.

  • return: true, if a database connection was successfully opened, false otherwise.
  • access: protected
bool open (array $connection)
  • array $connection: An associated array of connection settings, like host and user name.
rollback (line 361)

Rolls back the current transaction on the current connection.

The current transaction includes all statements on the connection that were executed after the call to transaction() and before any calls to rollback() or commit().

  • return: true if the transaction was successfully rolled back, false otherwise.
  • see: IConnector::rollback().
  • access: public
bool rollback ([array $options = array()])

Redefinition of:
BaseConnector::rollback()
Rolls back the current transaction on the current connection.

Implementation of:
IConnector::rollback()
Rolls back the current transaction on the current connection.
select (line 122)

Send a SQL SELECT query to the database and get the query result.

  • return: The query result as a table (array of associated arrays).
  • see: IConnector::select().
  • throws: Exception when $param doesn't match the type definition $map.
  • access: public
array select (string $query, [array $param = array()], [array $map = array()], [array $options = array()])
  • string $query: A SQL query to execute on a database.
  • array $param: An associated array of values to be used in the $query.
  • array $map: An array of type definitions for the $param values.
  • array $options: An associated array of options, see the Option elements.

Implementation of:
IConnector::select()
Send a SQL SELECT query to the database and get the query result.
transaction (line 299)

Begins a transaction on the current connection.

The current transaction includes all statements on the connection that were executed after the call to transaction() and before any calls to rollback() or commit().

  • return: true if the transaction was successfully begun, false otherwise.
  • see: IConnector::transaction().
  • access: public
bool transaction ([array $options = array()])

Redefinition of:
BaseConnector::transaction()
Begins a transaction on the current connection.

Implementation of:
IConnector::transaction()
Begins a transaction on the current connection.
update (line 219)

Send a SQL UPDATE query to the database and get the number of rows updates by the query.

  • return: The number of rows updates by the query.
  • see: IConnector::update().
  • throws: Exception when $param doesn't match the type definition $map.
  • access: public
int update (string $query, [array $param = array()], [array $map = array()], [array $options = array()])
  • string $query: A SQL query to execute on a database.
  • array $param: An associated array of values to be used in the $query.
  • array $map: An array of type definitions for the $param values.
  • array $options: An associated array of options, see the Option elements.

Implementation of:
IConnector::update()
Send a SQL UPDATE query to the database and get the number of rows updates by the query.

Inherited Methods

Inherited From BaseConnector

 BaseConnector::BaseConnector()
 BaseConnector::bind()
 BaseConnector::cast()
 BaseConnector::castArray()
 BaseConnector::castBool()
 BaseConnector::castDate()
 BaseConnector::castFloat()
 BaseConnector::castInt()
 BaseConnector::castNull()
 BaseConnector::castNumeric()
 BaseConnector::castObject()
 BaseConnector::castString()
 BaseConnector::commit()
 BaseConnector::getCache()
 BaseConnector::getHash()
 BaseConnector::getLink()
 BaseConnector::getOptions()
 BaseConnector::lookup()
 BaseConnector::push()
 BaseConnector::rollback()
 BaseConnector::setCache()
 BaseConnector::setOptions()
 BaseConnector::strDecode()
 BaseConnector::strEncode()
 BaseConnector::strEscape()
 BaseConnector::strQuote()
 BaseConnector::strStrip()
 BaseConnector::transaction()

Documentation generated on Wed, 03 Jun 2009 12:41:56 +0200 by phpDocumentor 1.4.1