spoof
 All Data Structures Namespaces Files Functions Variables Pages
SQL Class Reference
Inheritance diagram for SQL:
Collaboration diagram for SQL:

Public Member Functions

 getCondition (\lib360\db\driver\IDriver $driver,\lib360\db\condition\ICondition $condition)
 getValue (\lib360\db\driver\IDriver $driver,\lib360\db\value\IValue $value)
 getConditionOperator (\lib360\db\driver\IDriver $driver,\lib360\db\condition\ICondition $condition)
 getConditionGroupOperator (\lib360\db\driver\IDriver $driver, $operator)
 getRandomTag ($n=4, $unique=TRUE, $addToUniqueList=TRUE)
 getFieldFormatted (\lib360\db\driver\IDriver $driver, $field)
 getSelect (\lib360\db\driver\IDriver $driver,\lib360\db\data\IStore $storage,\lib360\db\condition\ICondition $condition=NULL, array $fields=NULL)
 getSelectFields (\lib360\db\driver\IDriver $driver, array $fields=NULL)
 getSelectFieldFormatted (\lib360\db\driver\IDriver $driver, $field_key, $field_value)
 getSelectFrom (\lib360\db\driver\IDriver $driver,\lib360\db\data\IStore $storage)
 getSelectFromTable (\lib360\db\driver\IDriver $driver,\lib360\db\data\ITable $storage)
 getSelectFromTableName (\lib360\db\driver\IDriver $driver, $name)
 getSelectFromView (\lib360\db\driver\Driver $driver,\lib360\db\data\View $storage)
 getJoin (\lib360\db\driver\IDriver $driver,\lib360\db\join\IJoin $join)
 getUpdate (\lib360\db\driver\IDriver $driver,\lib360\db\data\IStore $storage, array $fields,\lib360\db\condition\ICondition $condition=NULL)
 getUpdateFields (\lib360\db\driver\IDriver $driver, array $fields)
 getDelete (\lib360\db\driver\IDriver $driver,\lib360\db\data\IStore $storage,\lib360\db\condition\ICondition $condition=NULL)
 getInsert (\lib360\db\driver\IDriver $driver,\lib360\db\data\IStore $storage, array $data)
 getInsertFields (\lib360\db\driver\IDriver $driver, array $data)
 getInsertValues (\lib360\db\driver\IDriver $driver, array $data)

Data Fields

const SELECT = 'select'
const SELECT_AS = 'as'
const SELECT_FIELD_SEPARATOR = ', '
const SELECT_FIELDS_ALL = '*'
const SELECT_JOIN_ON = 'on'
const SELECT_JOIN_SEPARATOR = ', '
const UPDATE = 'update'
const UPDATE_SET = 'set'
const UPDATE_FIELD_SEPARATOR = ', '
const DELETE = 'delete'
const INSERT = 'insert'
const INSERT_INTO = 'into'
const INSERT_VALUES = 'values'
const INSERT_FIELD_SEPARATOR = ', '
const INSERT_VALUES_WRAPPER_START = '('
const INSERT_VALUES_WRAPPER_END = ')'
const JOIN_TYPE_LEFT_OUTER = 'left outer join'
const JOIN_TYPE_INNER = 'inner join'
const JOIN_TYPE_JOIN = 'join'
const JOIN_TYPE_RIGHT_OUTER = 'right outer join'
const JOIN_TYPE_FULL = 'full join'
const FROM = 'from'
const WHERE = 'where'
const EQUALS = '='
const CONDITION_WRAPPER_START = '('
const CONDITION_WRAPPER_END = ')'
const CONDITION_VALUES_WRAPPER_START = '('
const CONDITION_VALUES_WRAPPER_END = ')'
const CONDITION_VALUES_SEPARATOR = ', '
const CONDITION_EQUALS = '='
const CONDITION_NOT_EQUALS = '<>'
const CONDITION_EQUALS_NULL = 'is'
const CONDITION_NOT_EQUALS_NULL = 'is not'
const CONDITION_GREATER_THAN = '>'
const CONDITION_GREATER_THAN_OR_EQUAL = '>='
const CONDITION_LESS_THAN = '<'
const CONDITION_LESS_THAN_OR_EQUAL = '<='
const CONDITION_IN = 'in'
const CONDITION_NOT_IN = 'not in'
const CONDITIONGROUP_AND = 'and'
const CONDITIONGROUP_OR = 'or'
const VALUE_NULL = 'null'
const BIND_CHAR = ':'

Static Protected Attributes

static $randomTags = array()

Detailed Description

Database language implementation for SQL


Member Function Documentation

getCondition ( \lib360\db\driver\IDriver  $driver,
\lib360\db\condition\ICondition  $condition 
)

Gets query of the condition using driver-specific syntax.

Parameters:
\lib360\db\driver\IDriver$driverdatabase driver
\lib360\db\condition\ICondition$conditiondatabase condition object
Returns:
database query object

Implements ILanguage.

Here is the call graph for this function:

Here is the caller graph for this function:

getConditionGroupOperator ( \lib360\db\driver\IDriver  $driver,
  $operator 
)

Returns SQL operator for given condition group object operator

Parameters:
\lib360\db\driver\IDriver$driverdatabase driver object
integer$operatorone of operator constants' values
Returns:
string SQL operator
Exceptions:
\lib360\db\language\SQLExceptionwhen illegal or unsupported operator given
See also:

Here is the caller graph for this function:

getConditionOperator ( \lib360\db\driver\IDriver  $driver,
\lib360\db\condition\ICondition  $condition 
)

Returns condition operator for the given object

Parameters:
\lib360\db\driver\IDriver$driverdatabase driver object
\lib360\db\condition\ICondition$conditiondatabase condition object
Returns:
string SQL operator
Exceptions:
\lib360\db\language\SQLExceptionwhen condition operator is invalid or unsupported

Here is the caller graph for this function:

getDelete ( \lib360\db\driver\IDriver  $driver,
\lib360\db\data\IStore  $storage,
\lib360\db\condition\ICondition  $condition = NULL 
)

Returns query object for full delete statement

Parameters:
\lib360\db\driver\IDriver$driverdatabase driver
\lib360\db\data\IStore$storagedatabase storage object
\lib360\db\condition\ICondition$conditionoptional database condition object, default NULL
Returns:
database query object

Implements ILanguage.

Here is the call graph for this function:

getFieldFormatted ( \lib360\db\driver\IDriver  $driver,
  $field 
)

Returns formatted SQL field string

Parameters:
\lib360\db\driver\IDriver$driverdatabase driver
string$fieldunformatted raw field
Returns:
string formatted field

Here is the caller graph for this function:

getInsert ( \lib360\db\driver\IDriver  $driver,
\lib360\db\data\IStore  $storage,
array  $data 
)

Returns query object for full insert statement

Parameters:
\lib360\db\driver\IDriver$driverdatabase driver
\lib360\db\data\IStore$storagedatabase storage object
array$dataassociative array of field => to insert
Returns:
database query object

Implements ILanguage.

Here is the call graph for this function:

getInsertFields ( \lib360\db\driver\IDriver  $driver,
array  $data 
)

Returns formatted string of fields for insert query

Parameters:
\lib360\db\driver\IDriver$driverdatabase driver
array$dataassociative array of field => to insert
Returns:
string formatted field list

Here is the call graph for this function:

Here is the caller graph for this function:

getInsertValues ( \lib360\db\driver\IDriver  $driver,
array  $data 
)

Gererates a query object for "values" section of the insert query

Parameters:
\lib360\db\driver\IDriver$driverdatabase driver
array$dataassociative array of field => to insert
Returns:
object

Here is the call graph for this function:

Here is the caller graph for this function:

getJoin ( \lib360\db\driver\IDriver  $driver,
\lib360\db\join\IJoin  $join 
)

Generates a query object for a database join

Parameters:
\lib360\db\driver\IDriver$driverdatabase driver
\lib360\db\join\IJoin$joindatabase join
Returns:
object

Here is the call graph for this function:

Here is the caller graph for this function:

getRandomTag (   $n = 4,
  $unique = TRUE,
  $addToUniqueList = TRUE 
)
Returns a random and optionally unique (per process) alphanumeric string of a specified length
@param $n integer length; optional, default 4
@param $unique boolean whether tag should be unique; optional, default TRUE
@param $addToUniqueList boolean whether to add to unique list; optional, default TRUE
@return random string
Todo:
need to move this to a separate utility, does not belong here

Here is the caller graph for this function:

getSelect ( \lib360\db\driver\IDriver  $driver,
\lib360\db\data\IStore  $storage,
\lib360\db\condition\ICondition  $condition = NULL,
array  $fields = NULL 
)

Returns query object for full select statement

Parameters:
\lib360\db\driver\IDriver$driverdatabase driver
\lib360\db\data\IStore$storagedatabase storage object
\lib360\db\condition\ICondition$conditionoptional database condition object, default NULL
array$fieldsoptional (optionally associative) array of fields to query and return, default NULL
Returns:
database query object

Implements ILanguage.

Here is the call graph for this function:

getSelectFieldFormatted ( \lib360\db\driver\IDriver  $driver,
  $field_key,
  $field_value 
)

Returns formatted field for select statement If associative array given the result will be "key AS value" If non-associative array given element value will be used as the field name

Parameters:
\lib360\db\driver\IDriver$driverdatabase driver
mixed$field_keycan be associative string key or integer
string$field_valuefield name
Returns:
string formatted field

Here is the call graph for this function:

Here is the caller graph for this function:

getSelectFields ( \lib360\db\driver\IDriver  $driver,
array  $fields = NULL 
)

Returns formatted list of fields for select statement

Parameters:
\lib360\db\driver\IDriver$driverdatabase driver
array$fieldsoptional (optionally associative) array of fields to format
Returns:
string formatted field list

Here is the call graph for this function:

Here is the caller graph for this function:

getSelectFrom ( \lib360\db\driver\IDriver  $driver,
\lib360\db\data\IStore  $storage 
)

Returns the "from" section of the SQL select query for the given storage object

Parameters:
\lib360\db\driver\IDriver$driverdatabase driver
\lib360\db\data\IStore$storageor object for which the result will be generated
Returns:
object
Exceptions:
\InvalidArgumentExceptionwhen invalid or unsupported storage object type is given

Here is the call graph for this function:

Here is the caller graph for this function:

getSelectFromTable ( \lib360\db\driver\IDriver  $driver,
\lib360\db\data\ITable  $storage 
)

Returns formatted table name for the storage object

Parameters:
\lib360\db\driver\IDriver$driverdatabase driver
\lib360\db\data\ITable$storagestorage object for which the result will be generated
Returns:
string formatted table name

Here is the call graph for this function:

Here is the caller graph for this function:

getSelectFromTableName ( \lib360\db\driver\IDriver  $driver,
  $name 
)

Formats table name from the raw table name string

Parameters:
\lib360\db\driver\IDriver$driverdatabase driver
string$nametable name
Returns:
string formatted table name

Here is the caller graph for this function:

getSelectFromView ( \lib360\db\driver\Driver  $driver,
\lib360\db\data\View  $storage 
)

Returns query object for the "from" portion of the select query for a view

Parameters:
\lib360\db\driver\IDriver$driverdatabase driver
\lib360\db\data\IView$storagedatabase view object
Returns:
object
Exceptions:
\InvalidArgumentExceptionwhen any of the view joins are not , , or string table name
See also:

Here is the call graph for this function:

Here is the caller graph for this function:

getUpdate ( \lib360\db\driver\IDriver  $driver,
\lib360\db\data\IStore  $storage,
array  $fields,
\lib360\db\condition\ICondition  $condition = NULL 
)

Returns query object for full update statement

Parameters:
\lib360\db\driver\IDriver$driverdatabase driver
\lib360\db\data\IStore$storagedatabase storage object
array$fieldsassociative array of field => IDBValue to update
\lib360\db\condition\ICondition$conditionoptional database condition object, default NULL
Returns:
database query object

Implements ILanguage.

Here is the call graph for this function:

getUpdateFields ( \lib360\db\driver\IDriver  $driver,
array  $fields 
)

Returns query object for "set" section of the update query

Parameters:
\lib360\db\driver\IDriver$driverdatabase driver
array$fieldsassociative array of field => IDBValue
Returns:
object

Here is the call graph for this function:

Here is the caller graph for this function:

getValue ( \lib360\db\driver\IDriver  $driver,
\lib360\db\value\IValue  $value 
)

Returns object for given IDBValue

Parameters:
\lib360\db\driver\IDriver$driverdatabase driver object
\lib360\db\value\IValue$valuedatabase value object
Returns:
object
Todo:
implement function type

Here is the call graph for this function:

Here is the caller graph for this function:


Field Documentation

$randomTags = array()
staticprotected
Internal property to store tags already generated; used to verify uniqueness of a new tag
Todo:
this should move when DBLanguageSQL::getRandomTag moves to a separate utility
const BIND_CHAR = ':'
const CONDITION_EQUALS = '='
const CONDITION_EQUALS_NULL = 'is'
const CONDITION_GREATER_THAN = '>'
const CONDITION_GREATER_THAN_OR_EQUAL = '>='
const CONDITION_IN = 'in'
const CONDITION_LESS_THAN = '<'
const CONDITION_LESS_THAN_OR_EQUAL = '<='
const CONDITION_NOT_EQUALS = '<>'
const CONDITION_NOT_EQUALS_NULL = 'is not'
const CONDITION_NOT_IN = 'not in'
const CONDITION_VALUES_SEPARATOR = ', '
const CONDITION_VALUES_WRAPPER_END = ')'
const CONDITION_VALUES_WRAPPER_START = '('
const CONDITION_WRAPPER_END = ')'
const CONDITION_WRAPPER_START = '('
const CONDITIONGROUP_AND = 'and'
const CONDITIONGROUP_OR = 'or'
const DELETE = 'delete'
const EQUALS = '='
const FROM = 'from'
const INSERT = 'insert'
const INSERT_FIELD_SEPARATOR = ', '
const INSERT_INTO = 'into'
const INSERT_VALUES = 'values'
const INSERT_VALUES_WRAPPER_END = ')'
const INSERT_VALUES_WRAPPER_START = '('
const JOIN_TYPE_FULL = 'full join'
const JOIN_TYPE_INNER = 'inner join'
const JOIN_TYPE_JOIN = 'join'
const JOIN_TYPE_LEFT_OUTER = 'left outer join'
const JOIN_TYPE_RIGHT_OUTER = 'right outer join'
const SELECT = 'select'
const SELECT_AS = 'as'
const SELECT_FIELD_SEPARATOR = ', '
const SELECT_FIELDS_ALL = '*'
const SELECT_JOIN_ON = 'on'
const SELECT_JOIN_SEPARATOR = ', '
const UPDATE = 'update'
const UPDATE_FIELD_SEPARATOR = ', '
const UPDATE_SET = 'set'
const VALUE_NULL = 'null'
const WHERE = 'where'

The documentation for this class was generated from the following file: