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 mysql

MySQL storage driver.

The storage driver is internally based on the MySQL Improved (MySQLi) PHP extension and supports both numerical/associative index modes and cached or streaming query result fetching. Additionally, the character set and timezone can be set and are directly taken into account by the MySQL server.

Core\Object implements Core\Chainable
Extended by Core\Set implements Core\Accessor
Extended by Core\Storage
Extended by Core\Storage\Driver\mysql
Namespace: Core\Storage\Driver
Package: Core\Storage
Since: 3.0
Requires: PHP 5.3, MySQLi
Version: 1.0
Located at Storage/Driver/mysql.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 MySQL connection parameters.

Throws

Core\Exception\Parameter
The URI contains an invalid configuration parameter.

Since

3.0
public
# __destruct( )

Releases an existing database connection.

Releases an existing database connection.

Since

3.0
public
# __wakeUp( )

Resets internal database connection to support de-serialisation.

Resets internal database connection to support de-serialisation.

Since

3.0
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 MySQL 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 the MySQL server version.

Returns

string
Back-end system version string.

Remark

A server connection is established to retrieve the MySQL server version information.


Since

3.0
public string|false
# begin( )

Begins a new (nested) transaction.

Begins a new (nested) transaction.

Returns

string|false

A transaction ID on success or false, if the transaction could not be started due to a non-fatal error (e.g. the storage engine does not support transactions). Otherwise an exception is thrown.

A non-zero return value does not guarantee that the storage system actually fully supports transaction but merely understands the syntax.

Since

3.0
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 MySQL Improved client library 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 the MySQL Improved client library version.

Returns

string
Client system version string.

Since

3.0
public
# commit( $transactionID = null )

Commits the currently active transaction.

Commits the currently active transaction.

Since

3.0
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. The string is escaped with respect to the currently active connection character set.

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. The string is escaped with respect to the currently active connection character set.

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.

Since

3.0
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.0
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.0
public
# reset( )

Closes and re-opens the MySQL database connection. To be used after environmental changes, e.g. a character set change. If no connection is open, no action is performed.

Closes and re-opens the MySQL database connection. To be used after environmental changes, e.g. a character set change. If no connection is open, no action is performed.

Since

3.0
public
# rollback( $transactionID = null )

Cancels the currently active transaction.

Cancels the currently active transaction.

Since

3.0
public static integer
# unifyErrorCode( integer $code )

Translates a MySQL-specific error code into the unified error codes used by Core Storage.

Translates a MySQL-specific error code into the unified error codes used by Core Storage.

Parameters

$code
MySQL error code to translate.

Returns

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

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 StorageModeParameter

Storage mode parameter name.

Storage mode parameter name.

Since

3.0
# 'mode'
string FetchStorageMode

Fetching storage mode. Instructs MySQL to not cache query results but fetch a row on demand. This setting is useful to reduce the memory required to handle a result data set, but disables features such as the number of rows in unknown before completing the iteration on all rows.

Fetching storage mode. Instructs MySQL to not cache query results but fetch a row on demand. This setting is useful to reduce the memory required to handle a result data set, but disables features such as the number of rows in unknown before completing the iteration on all rows.

Since

3.0
# 'fetch'
string StoreStorageMode

Cached storage mode. Instructs MySQL to cache the complete query result set. This is the default.

Cached storage mode. Instructs MySQL to cache the complete query result set. This is the default.

Since

3.0
# 'store'
string IndexModeParameter

Index mode parameter name.

Index mode parameter name.

Since

3.0
# '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.0
# '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.0
# 'assoc'
string TimezoneParameter

Connection-local timezone parameter name.

Connection-local timezone parameter name.

Use of numeric offsets such as »+0130« and »-0900« is always supported; named timezones require the MySQL timezone tables to be filled with system-specific timezone information; refer to the manual for further instructions. In short, import TZ data from the system timezone database using the mysql_tzinfo_to_sql tool or use generic MyISAM tables available for download on the MySQL homepage for operating systems that do not provide an own timezone database, such as Windows:

# Generate or update TZ tables based on Unix host timezone information
# table; provide password or user-data as required.
mysql_tzinfo_to_sql /usr/share/zoneinfo/ | mysql -h localhost -p mysql

Since

3.0
# 'timezone'

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_parameters

Cached driver configuration array.

Cached driver configuration array.

Since

3.0
#
protected array $_v_transactionStack

Nested transactions stack.

Nested transactions stack.

Since

3.0
#
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.0
#
protected mysqli $_link

Database connection link.

Database connection link.

Since

3.0
#

Properties inherited from Core\Storage

$_v_affectedRows, $_v_insertID

Magic properties

public read-only array $parameters

Cached driver configuration array.

public read-only Core\URI $uri

Driver configuration URI.

public read-only array $transactionStack

Stack of open (nested) transactions.

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