xplo.re Medusa Core Framework 3.2
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Event
  • Todo
  • Download

Namespaces

  • Core
    • Authentication
      • Auto
        • Driver
      • Driver
    • Cache
      • Driver
    • Charset
      • Driver
    • Configuration
      • Driver
    • Controller
    • Converter
      • Driver
    • Decoder
      • Driver
    • Encoder
      • Driver
    • Env
      • Authentication
      • Locale
      • Proxy
      • Server
        • HTTP
        • Redirect
        • X
    • Exception
    • Exchange
      • Driver
    • Fault
      • Formatter
        • Driver
      • Incident
        • Exception
      • Reporter
        • Driver
    • Field
    • Filter
      • Driver
    • Formatter
      • Driver
        • coreuimarkup
          • Token
    • Hash
    • Loader
    • Locale
    • Log
      • Driver
    • Module
      • Dependency
        • Requirement
          • Core
          • PHP
      • Linkage
        • Driver
    • PDF
    • Plugin
    • Query
      • Driver
    • Server
      • Driver
    • Session
      • Driver
    • Set
    • Storage
      • Driver
      • Field
        • Element
    • Stream
      • Driver
    • String
    • Translation
      • Driver
      • Language
        • Driver
    • Type
    • URI
      • Driver
    • Version
    • View
      • Driver
        • coreui
          • Control
            • Button
            • Table
          • Element
        • htmlbuilder
          • Tags
        • yui
          • Modules
  • None
  • PHP

Classes

  • mysql
  • mysql_Result
  • mysql_Result_Statement
  • mysql_Statement
  • odbc
  • odbc_Result
  • odbc_Statement
  • sqlite2
  • sqlite2_Result
  • sqlite2_Statement
  • sqlite3
  • sqlite3_Result
  • sqlite3_Statement

Class odbc

ODBC storage driver.

Core\Object implements Core\Chainable
Extended by Core\Set implements Core\Accessor
Extended by Core\Storage
Extended by Core\Storage\Driver\odbc
Namespace: Core\Storage\Driver
Package: Core\Storage
Since: 3.1
Requires: PHP 5.3, ODBC
Version: 1.0
Located at Storage/Driver/odbc.inc.php

Methods summary

public
# __construct( Core\URI $uri )

Parses connection parameters. A database connection is established once it is required (lazy initialisation).

Parses connection parameters. A database connection is established once it is required (lazy initialisation).

Parameters

$uri

URI instance with ODBC connection parameters. Connection parameters are passed verbatim to the ODBC driver; username, password and ODBC driver are defined using the username, password and authority URI segments, respectively.

Since

3.1
public
# __destruct( )

Releases an existing ODBC connection.

Releases an existing ODBC connection.

Since

3.1
public
# __wakeup( )

Resets internal database connection to support de-serialisation.

Resets internal database connection to support de-serialisation.

Since

3.1
public static string
# sqlLong2State( integer $encodedCode )

ODBC uses alphanumeric state codes. This method converts a previously numerically encoded code back to the ODBC state code.

ODBC uses alphanumeric state codes. This method converts a previously numerically encoded code back to the ODBC state code.

Parameters

$encodedCode
Numerically encoded code to translate back into state code.

Returns

string
Translated ODBC state code.

Since

3.1
public static integer
# sqlState2Long( string $stateCode )

ODBC uses alphanumeric state codes. This method converts an ODBC state code into a numerical representation such that it can be used as an error code for PHP exceptions.

ODBC uses alphanumeric state codes. This method converts an ODBC state code into a numerical representation such that it can be used as an error code for PHP exceptions.

Parameters

$stateCode
ODBC state code string to encode.

Returns

integer
Numerical representation of ODBC state code.

Since

3.1
public string
# backendVersion( )

Returns the back-end version string. Some drivers use different layers for their backend storage (e.g. an interface library and a server) with different versions for each layer. The most basic layer, available and significant version is returned (e.g. the database server version).

Returns the back-end version string. Some drivers use different layers for their backend storage (e.g. an interface library and a server) with different versions for each layer. The most basic layer, available and significant version is returned (e.g. the database server version).

Returns

string
Back-end system version string.

Remark

An ODBC connection is established to retrieve version information.

Since

3.1
public Transaction
# begin( )

Begins a new (nested) transaction.

Begins a new (nested) transaction.

Returns

Transaction
counter index on success, otherwise an exception is thrown.

Remark

Starting a transaction is equal to setting auto-commit off for the current ODBC connection. Subsequently, ODBC does not support nested transactions: Nested calls to this method will increment an internal transaction counter; only the final commit will commit all changes.

Hence it is not possible to only cancel a nested transaction.


Since

3.1
public string
# clientVersion( )

Returns the client version string. Some drivers use different layers for their back-end storage (e.g. an interface library and a server) with different versions for each layer. The highest layer, available and significant version is returned (e.g. the database client version).

Returns the client version string. Some drivers use different layers for their back-end storage (e.g. an interface library and a server) with different versions for each layer. The highest layer, available and significant version is returned (e.g. the database client version).

Returns

string
Client system version string.

Since

3.1
public
# commit( $transactionID = null )

Commits the currently active transaction.

Commits the currently active transaction.

Since

3.1
public string
# escape( string $value, boolean $addDelimiters = false )

Escapes a binary string specific to the storage back-end for direct usage. When performing direct commands on the back-end engine, most storage systems require the user to escaped data sequences (e.g. SQL). Each data sequence used for direct commands should therefore be preprocessed by this method prior to sending the command.

Escapes a binary string specific to the storage back-end for direct usage. When performing direct commands on the back-end engine, most storage systems require the user to escaped data sequences (e.g. SQL). Each data sequence used for direct commands should therefore be preprocessed by this method prior to sending the command.

Parameters

$value
Binary string to escape.
$addDelimiters

Optional. Controls whether the escaped data sequence should be packed into data sequence delimiters (e.g. string markers).

Returns

string
Escaped input string.

Remark

The ODBC extension for PHP does not provide any proper escape method based on an established ODBC connection. This method manually encodes the given value. It is highly recommended to use parameter binding instead that is supported by the ODBC extension and will efficiently encode parameters as needed.


Since

3.1
public Storage_Result
# execute( mixed $statement, array $parameters = null )

Executes an accessor node, prepared storage statement or direct back-end query.

Executes an accessor node, prepared storage statement or direct back-end query.

Parameters

$statement

Prepared storage statement, raw storage accessor node or binary back-end specific query string for execution.

$parameters
Associative array of parameter values (including bindings).

Returns

Storage_Result
Driver-specific result object on success, otherwise an exception is thrown.

Since

3.1
public Core\Storage_Statement
# prepare( Core\Storage\Accessor_Node $query )

Prepares a query for optimised repeated execution.

Prepares a query for optimised repeated execution.

Parameters

$query
Storage accessor node to prepare for execution.

Returns

Core\Storage_Statement

Prepared driver-specific storage statement on success, otherwise an exception is thrown.

Since

3.1
public
# reset( )

Closes and reopens the ODBC database connection. If no connection is open, no action is performed.

Closes and reopens the ODBC database connection. If no connection is open, no action is performed.

Since

3.1
public
# rollback( $transactionID = null )

Cancels the currently active transaction. The ODBC extension for PHP does not natively support nested transactions, hence reverting back to any other index than 1 (or the default null) will throw an exception (can only cancel all concurrent transactions).

Cancels the currently active transaction. The ODBC extension for PHP does not natively support nested transactions, hence reverting back to any other index than 1 (or the default null) will throw an exception (can only cancel all concurrent transactions).

Since

3.1
public static integer
# unifyErrorCode( integer $code )

Translates an ODBC-specific error code into the unified error codes used by Core Storage.

Translates an ODBC-specific error code into the unified error codes used by Core Storage.

Parameters

$code
ODBC error code to translate (do not use the ODBC state code string).

Returns

integer
Translate Core Storage error code or false, if translation failed.

Link

https://msdn.microsoft.com/en-gb/library/ms714687.aspx

Since

3.1

Methods inherited from Core\Storage

autocreate()

Methods inherited from Core\Set

__get(), __isset()

Methods inherited from Core\Object

__autocreateFactory(), __call(), __processParameters(), __toString(), attachMethod(), chain(), getValueForKey(), getValueForKeyPath(), getValueForUndefinedKey(), hash(), issetValueForKey(), setValueForKey(), setValueForKeyPath(), setValueForUndefinedKey(), uuid()

Constants summary

string EmulateBindingsParameter

Whether to emulate bindings. Useful for ODBC back-ends that do not support parameter binding, such as MS Access.

Whether to emulate bindings. Useful for ODBC back-ends that do not support parameter binding, such as MS Access.

Since

3.1
# 'emulate-bindings'
string IndexModeParameter

Index mode parameter name.

Index mode parameter name.

Since

3.1
# 'index'
string NumericIndexMode

Index modes that uses numeric indices for result columns. Column names are ignored. Slightly reduces memory overhead.

Index modes that uses numeric indices for result columns. Column names are ignored. Slightly reduces memory overhead.

Since

3.1
# 'numeric'
string AssociativeIndexMode

Index mode that uses associative indices for result columns. Indices are based on the table column name or selection expression. This is the default.

Index mode that uses associative indices for result columns. Indices are based on the table column name or selection expression. This is the default.

Since

3.1
# 'assoc'

Constants inherited from Core\Storage

ContextArgument, DuplicateKeyError, Parameters, RowClass

Constants inherited from Core\Object

AnyParameterType, AutochainParameterType, AutocreateParameterType, BooleanParameterType, CharParameterType, EnumParameterType, IntegerParameterType, RealParameterType, StringParameterType, UserParameterType

Properties summary

protected array $_v_odbcParameters

Raw ODBC connection configuration parameters passed to back-end driver.

Raw ODBC connection configuration parameters passed to back-end driver.

Since

3.1
#
protected array $_v_parameters

Cached driver configuration array.

Cached driver configuration array.

Since

3.1
#
protected integer $_v_transactionCounter

Nested transactions counter.

Nested transactions counter.

Since

3.1
#
protected Core\URI $_v_uri

Driver configuration URI. Required for re-connecting to the database.

Driver configuration URI. Required for re-connecting to the database.

Since

3.1
#
protected resource $_connection

ODBC connection.

ODBC connection.

Since

3.1
#

Properties inherited from Core\Storage

$_v_affectedRows, $_v_insertID

Magic properties

public read-only array $odbcParameters

Raw ODBC connection parameters passed to back-end driver.

public read-only array $parameters

Cached driver configuration array.

public read-only integer $transactionCounter

Counter for nested transactions.

public read-only Core\URI $uri

Driver configuration URI.

Magic properties inherited from Core\Storage

$affectedRows, $insertID

Magic properties inherited from Core\Object

$hash, $uuid

xplo.re Medusa Core Framework 3.2 API documentation generated by ApiGen