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

Namespaces

  • Core
    • Authentication
      • Auto
        • Driver
      • Driver
    • Cache
      • Driver
    • Charset
      • Driver
    • Configuration
    • Controller
    • Converter
      • Driver
    • Decoder
      • Driver
    • Encoder
      • Driver
    • Env
      • Authentication
      • Locale
      • Proxy
      • Server
        • HTTP
        • Redirect
        • X
    • Exception
    • Exchange
      • 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
    • URI
      • Driver
    • Version
    • View
      • Driver
        • coreui
          • Control
            • Button
            • Table
          • Element
        • htmlbuilder
          • Tags
        • yui
          • Modules
  • None
  • PHP

Classes

  • Accessor
  • Accessor_Alias
  • Accessor_BitwiseAND
  • Accessor_BitwiseOR
  • Accessor_BitwiseXOR
  • Accessor_Call
  • Accessor_Conditional
  • Accessor_Conditionals
  • Accessor_Conjunction
  • Accessor_Count
  • Accessor_Disjunction
  • Accessor_Eq
  • Accessor_Eraser
  • Accessor_Expressions
  • Accessor_Grouping
  • Accessor_GT
  • Accessor_GTE
  • Accessor_Insert
  • Accessor_Join
  • Accessor_JoinConditional
  • Accessor_Key
  • Accessor_Limit
  • Accessor_List
  • Accessor_LT
  • Accessor_LTE
  • Accessor_Match
  • Accessor_NEq
  • Accessor_Node
  • Accessor_Not
  • Accessor_Now
  • Accessor_Ordering
  • Accessor_Parameter
  • Accessor_Reference
  • Accessor_Regexp
  • Accessor_Reverse
  • Accessor_Selector
  • Accessor_Similarity
  • Accessor_Update
  • Accessor_Value
  • Accessor_Values
  • Accessor_Wildcard
  • Field
  • SQL_Result
  • SQL_Statement

Class SQL_Statement

SQL implementations for all statement transformations shared by common SQL-based storage engines.

Core\Object implements Core\Chainable
Extended by Core\Set implements Core\Accessor
Extended by Core\Storage_Statement
Extended by Core\Storage\SQL_Statement

Direct known subclasses

Core\Storage\Driver\mysql_Statement, Core\Storage\Driver\odbc_Statement, Core\Storage\Driver\sqlite2_Statement, Core\Storage\Driver\sqlite3_Statement

Namespace: Core\Storage
Package: Core\Storage
Since: 3.0
Requires: PHP 5.3
Version: 1.1
Located at Storage/SQL.inc.php

Methods summary

protected boolean|Core\Storage\Accessor_Node
# _tableReference( string $name, boolean|Core\Storage\Accessor_Node $value = null )

Sets or gets a table reference entry for the current stack index.

Sets or gets a table reference entry for the current stack index.

Parameters

$name
Table name to set or retrieve value for.
$value

If not null, the method sets the table reference data to the given value. If the value is false, it designates a JOINed reference, if true a standard reference, or an accessor node representing a sub-query.

Returns

boolean|Core\Storage\Accessor_Node

null if a new value was set, otherwise the retrieved value for the given reference name.

Since

3.1
protected integer
# _tableReferenceCount( )

Returns the number of table references for the current stack index.

Returns the number of table references for the current stack index.

Returns

integer
Number of table reference entries for the current stack index.

Since

3.1
protected array
# _tableReferencePop( )

Removes and returns the current top stack index table reference set.

Removes and returns the current top stack index table reference set.

Returns

array

Array of table references (names are stored as keys, additional data as their value) popped from stack. See Core\Storage\SQL_Statement::_tableReference() for a description on the data structure.

Since

3.1
protected
# _tableReferencePush( )

Adds a new reference set to the referenced tables stack.

Adds a new reference set to the referenced tables stack.

Since

3.1
protected string
# _transform_Conditional( array $nodes, string $operator )

Transforms a generic conditional. Depending on the number of nodes and operator used, a conjunction is returned.

Transforms a generic conditional. Depending on the number of nodes and operator used, a conjunction is returned.

Parameters

$nodes
Array of nodes to transform and use operator on.
$operator
Operator to use on nodes.

Returns

string

Throws

Core\Exception\Storage

Since

3.0
protected string
# _transform_Core_Nothing( Core\Nothing $node )

Transforms a NULL value.

Transforms a NULL value.

Parameters

$node

Returns

string

Since

3.0
protected integer|string
# _transform_Core_Storage_Accessor_Value( Core\Storage\Accessor_Value $node )

Transforms wrapped value nodes. All values that need proper encoding use parameter binding, integers and floats are directly embedded into the query.

Transforms wrapped value nodes. All values that need proper encoding use parameter binding, integers and floats are directly embedded into the query.

Parameters

$node

Returns

integer|string

Since

3.0
protected string
# _transform_Core_Storage_Accessor_Alias( Core\Storage\Accessor_Alias $node )

Transforms an alias statement.

Transforms an alias statement.

Parameters

$node

Returns

string

Throws

Core\Exception\Storage

Since

3.0
protected string
# _transform_Core_Storage_Accessor_BitwiseAND( Core\Storage\Accessor_BitwiseAND $node )

Transforms a bit-wise AND expression.

Transforms a bit-wise AND expression.

Parameters

$node

Returns

string

Throws

Core\Exception\Storage

Since

3.0
protected string
# _transform_Core_Storage_Accessor_BitwiseOR( Core\Storage\Accessor_BitwiseOR $node )

Transforms a bit-wise OR expression.

Transforms a bit-wise OR expression.

Parameters

$node

Returns

string

Throws

Core\Exception\Storage

Since

3.0
protected string
# _transform_Core_Storage_Accessor_BitwiseXOR( Core\Storage\Accessor_BitwiseXOR $node )

Transforms a bit-wise XOR expression.

Transforms a bit-wise XOR expression.

Parameters

$node

Returns

string

Throws

Core\Exception\Storage

Since

3.0
protected string
# _transform_Core_Storage_Accessor_Call( Core\Storage\Accessor_Call $node )

Transforms a function call. The name of the called function is always written in uppercase letters.

Transforms a function call. The name of the called function is always written in uppercase letters.

Parameters

$node

Returns

string

Throws

Core\Exception\Storage

Since

3.0
protected string|null
# _transform_Core_Storage_Accessor_Conditional( Core\Storage\Accessor_Conditional $node )

Transforms a conditional WHERE clause.

Transforms a conditional WHERE clause.

Parameters

$node

Returns

string|null
Transformed component or null, if the conditional is empty.

Throws

Core\Exception\Storage

Since

3.0
protected string
# _transform_Core_Storage_Accessor_Count( Core\Storage\Accessor_Count $node )

Transforms the special COUNT() aggregator. If no column names are associated, a wildcard count COUNT(*) is returned.

Transforms the special COUNT() aggregator. If no column names are associated, a wildcard count COUNT(*) is returned.

Parameters

$node

Returns

string

Throws

Core\Exception\Storage

Since

3.0
protected string
# _transform_Core_Storage_Accessor_Conjunction( Core\Storage\Accessor_Conjunction $node )

Transforms a conjunction "AND".

Transforms a conjunction "AND".

Parameters

$node

Returns

string

Throws

Core\Exception\Storage

Since

3.0
protected string
# _transform_Core_Storage_Accessor_Disjunction( Core\Storage\Accessor_Disjunction $node )

Transforms a disjunction "OR".

Transforms a disjunction "OR".

Parameters

$node

Returns

string

Throws

Core\Exception\Storage

Since

3.0
protected string
# _transform_Core_Storage_Accessor_Eq( Core\Storage\Accessor_Eq $node )

Transforms an equality expression.

Transforms an equality expression.

Parameters

$node

Returns

string

Throws

Core\Exception\Storage

Since

3.0
protected string
# _transform_Core_Storage_Accessor_Eraser( Core\Storage\Accessor_Eraser $node )

Transforms a DELETE statement.

Transforms a DELETE statement.

Parameters

$node

Returns

string

Throws

Core\Exception\Inconsistency
No table references found to perform deletion on.
Core\Exception\Storage

Since

3.0
protected string
# _transform_Core_Storage_Accessor_GT( Core\Storage\Accessor_GT $node )

Transforms a greater-than expression.

Transforms a greater-than expression.

Parameters

$node

Returns

string

Throws

Core\Exception\Storage

Since

3.0
protected string
# _transform_Core_Storage_Accessor_GTE( Core\Storage\Accessor_GTE $node )

Transforms a greater-than-or-equal expression.

Transforms a greater-than-or-equal expression.

Parameters

$node

Returns

string

Throws

Core\Exception\Storage

Since

3.0
protected string
# _transform_Core_Storage_Accessor_Grouping( Core\Storage\Accessor_Grouping $node )

Transforms a GROUP BY clause.

Transforms a GROUP BY clause.

Parameters

$node

Returns

string

Throws

Core\Exception\Storage

Since

3.0
protected string
# _transform_Core_Storage_Accessor_Insert( Core\Storage\Accessor_Insert $node )

Transforms an INSERT statement.

Transforms an INSERT statement.

Parameters

$node

Returns

string

Throws

Core\Exception\Inconsistency

Multiple table references found for insert query or number of values and columns does not match.


Core\Exception\Storage

Since

3.0
protected string
# _transform_Insert( string $destinationTableName, array $columns, array $values, Core\Storage\Accessor_Update $duplicateKeyUpdate = null )

Actual transformation of an INSERT statement.

Actual transformation of an INSERT statement.

Parameters

$destinationTableName
Destination table name.
$columns
Array of column references.
$values
Array of values to insert, for each given column reference respectively.
$duplicateKeyUpdate

Optional associated update node to perform an update instead if a duplicate key was encountered.

Returns

string

Throws

Core\Exception\Storage

Since

3.0
protected string
# _transform_Core_Storage_Accessor_Key( Core\Storage\Accessor_Key $node )

Transforms a key (either column identifier or numeric/Boolean value).

Transforms a key (either column identifier or numeric/Boolean value).

Parameters

$node

Returns

string

Throws

Core\Exception\Storage

Since

3.0
protected string
# _transform_Core_Storage_Accessor_Limit( Core\Storage\Accessor_Limit $node )

Transforms a LIMIT clause.

Transforms a LIMIT clause.

Parameters

$node

Returns

string

Throws

Core\Exception\Storage

Since

3.0
protected string
# _transform_Core_Storage_Accessor_LT( Core\Storage\Accessor_LT $node )

Transforms a less-than expression.

Transforms a less-than expression.

Parameters

$node

Returns

string

Throws

Core\Exception\Storage

Since

3.0
protected string
# _transform_Core_Storage_Accessor_LTE( Core\Storage\Accessor_LTE $node )

Transforms a less-than-or-equal expression.

Transforms a less-than-or-equal expression.

Parameters

$node

Returns

string

Throws

Core\Exception\Storage

Since

3.0
protected string
# _transform_Core_Storage_Accessor_Match( Core\Storage\Accessor_Match $node )

Transforms a MATCH clause.

Transforms a MATCH clause.

Currently only supports MySQL FULLTEXT for MyISAM tables.

Parameters

$node

Returns

string

Throws

Core\Exception\Storage

Since

3.0
protected string
# _transform_Core_Storage_Accessor_NEq( Core\Storage\Accessor_NEq $node )

Transforms an inequality expression.

Transforms an inequality expression.

Parameters

$node

Returns

string

Throws

Core\Exception\Storage

Since

3.0
protected string
# _transform_Core_Storage_Accessor_Not( Core\Storage\Accessor_Not $node )

Transforms a binary inversion expression.

Transforms a binary inversion expression.

Parameters

$node

Returns

string

Throws

Core\Exception\Storage

Since

3.0
protected string
# _transform_Core_Storage_Accessor_Now( Core\Storage\Accessor_Now $node )

Transforms node to an expression that represents the current timestamp at the back-end (with respect to timezone settings of the engine or connection).

Transforms node to an expression that represents the current timestamp at the back-end (with respect to timezone settings of the engine or connection).

Parameters

$node

Returns

string

Remark

For most SQL engines this equals the expression CURRENT_TIMESTAMP.

Since

3.0
protected string
# _transform_Core_Storage_Accessor_Ordering( Core\Storage\Accessor_Ordering $node )

Transforms an ORDER BY clause.

Transforms an ORDER BY clause.

Parameters

$node

Returns

string

Throws

Core\Exception\Storage

Since

3.0
protected string
# _transform_Core_Storage_Accessor_Reference( Core\Storage\Accessor_Reference $node )

Transforms a table name with optional LEFT JOIN clause (for single target reference) or CROSS JOIN (for multiple target references) clauses.

Transforms a table name with optional LEFT JOIN clause (for single target reference) or CROSS JOIN (for multiple target references) clauses.

Parameters

$node

Returns

string

Throws

Core\Exception\Storage

Since

3.0
protected string
# _transform_Core_Storage_Accessor_Regexp( Core\Storage\Accessor_Regexp $node )

Transforms a REGEXP expression.

Transforms a REGEXP expression.

Parameters

$node

Returns

string

Throws

Core\Exception\Storage

Remark

If the back-end does not support regular expressions, the driver should throw an exception during transformation.


Since

3.0
protected string
# _transform_Core_Storage_Accessor_Reverse( Core\Storage\Accessor_Reverse $node )

Transforms a reversed ordering clause (DESC mode).

Transforms a reversed ordering clause (DESC mode).

Parameters

$node

Returns

string

Throws

Core\Exception\Storage

Since

3.0
protected string
# _transform_Core_Storage_Accessor_Selector( Core\Storage\Accessor_Selector $node )

Transforms a SELECT statement.

Transforms a SELECT statement.

Parameters

$node

Returns

string

Throws

Core\Exception\Inconsistency
No references to operate on detected.
Core\Exception\Storage

Since

3.0
protected string
# _transform_SelectorNode( Core\Storage\Accessor_Node $node )

Transforms an expression of a SELECT statement.

Transforms an expression of a SELECT statement.

Parameters

$node

Returns

string

Throws

Core\Exception\Storage

Since

3.0
protected string
# _transform_Core_Storage_Accessor_Similarity( Core\Storage\Accessor_Similarity $node )

Transforms a LIKE expression.

Transforms a LIKE expression.

Parameters

$node

Returns

string

Throws

Core\Exception\Storage

Since

3.0
protected string
# _transform_Core_Storage_Accessor_Update( Core\Storage\Accessor_Update $node, string & $valuesUpdateExpression = null )

Transforms an UPDATE statement.

Transforms an UPDATE statement.

Parameters

$node
$valuesUpdateExpression
The transformed comma-separated string of update assignments key=value.

Returns

string

Throws

Core\Exception\Inconsistency
Invalid number of table references for update node.
Core\Exception\Storage

Since

3.0
protected string
# _transform_Core_Storage_Accessor_Wildcard( Core\Storage\Accessor_Wildcard $node )

Transforms a wildcard.

Transforms a wildcard.

Parameters

$node

Returns

string

Since

3.0
protected string
# _transform_TableReferences( )

Transforms a FROM clause, JOIN expressions and sub-queries.

Transforms a FROM clause, JOIN expressions and sub-queries.

Returns

string

Throws

Core\Exception\Storage

Since

3.1

Methods inherited from Core\Storage_Statement

__construct(), __toString(), _bind(), _transform(), _transform_Boolean(), _transform_Core_Storage_Accessor_Parameter(), _transform_Float(), _transform_Identifier(), _transform_Integer(), _transform_Storable(), _transform_String(), execute(), mergeParameters()

Methods inherited from Core\Set

__get(), __isset()

Methods inherited from Core\Object

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

Constants summary

Constants inherited from Core\Object

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

Properties summary

protected array $_tableReferences

Two-dimensional reference set that stores references on tables used as keys per query. References are collected during node transformations and qualify for automatic reference listings for e.g. FROM statements.

Sub-queries require an own table references array, hence table references are organised as a stack and access to these should be based on the corresponding class-internal methods.

Two-dimensional reference set that stores references on tables used as keys per query. References are collected during node transformations and qualify for automatic reference listings for e.g. FROM statements.

Sub-queries require an own table references array, hence table references are organised as a stack and access to these should be based on the corresponding class-internal methods.

Since

3.0
# array ()

Properties inherited from Core\Storage_Statement

$_v_bindingParameters, $_v_bindings, $_v_driver, $_v_insertID, $_v_query

Magic properties inherited from Core\Storage_Statement

$driver, $insertID, $query

Magic properties inherited from Core\Object

$hash, $uuid

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