Squiz Matrix
4.12.2
|
Public Member Functions | |
getDataType ($type) | |
getName () | |
getConstructName ($name) | |
convertToSql (array $sqlArray) | |
convertCreateTable (array $table) | |
convertDropTable ($tableName, $cascade=FALSE) | |
convertTruncateTable ($tableName) | |
convertDropSequence ($sequenceName) | |
convertResetSequence ($sequenceName) | |
handleFunctionTableExists ($tableName, $schema=NULL) | |
Protected Member Functions | |
convertSelectQuery (array $sqlArray, $level=0, array $ignore=array()) | |
addSqlFilters (array $sqlArray) | |
convertSelectFieldList (array $fields, $level=1) | |
convertSingleField ($field) | |
getSelectFieldName (array $field) | |
setSelectFieldAlias (array $field, $alias) | |
getSelectFieldNames (array $fields) | |
convertField (array $field) | |
convertSingleValue ($field) | |
convertSingleFunction (array $function) | |
convertFromList (array $from, $level=1) | |
convertTableAlias ($alias) | |
convertMathOperation (array $mathOp) | |
separateFields (array $fields) | |
separateTables (array $tables) | |
convertWhereClause (array $where, $level=0, $addBrackets=TRUE) | |
convertInCondition (array $in, $level=0, $type='IN') | |
convertExistsCondition (array $exists, $level=0, $type='EXISTS') | |
convertIsNull (array $isNull) | |
convertNotNull (array $notNull) | |
convertUnionsInFromClause (array $union, $level=0) | |
getUnionType (array $union) | |
convertUnions (array $union, $level=1) | |
convertUnionDisplayName ($type) | |
convertGroupBy (array $groupBy) | |
convertOrderBy (array $orderBy) | |
convertLimit (array $limit) | |
convertJoins (array $joins) | |
convertSingleJoin (array $join) | |
convertInsertQuery (array $sqlArray) | |
addSpaces ($level=0, $spaces=4) | |
convertInsertQueryFields (array $fields) | |
convertInsertQueryValues (array $insert) | |
convertUpdateQuery (array $sqlArray) | |
convertUpdateQuerySetValues (array $values) | |
convertDeleteQuery (array $sqlArray) | |
convertAlterQueryHeader ($tableName) | |
convertAlterQuery (array $sqlArray) | |
convertAlterQueryAddColumn (array $addColumn) | |
convertAlterQueryDropColumn ($column) | |
convertAlterQueryRenameColumn (array $renameColumn) | |
convertAlterQueryModifyColumn (array $modifyColumns) | |
convertAlterQueryAddConstraint (array $constraints, $tableName=NULL) | |
convertAlterQueryDropConstraint ($dropConstraint) | |
convertAlterQueryRenameTable (array $renameTable) | |
convertCreateHeader (array $table) | |
convertCreateFooter (array $table) | |
convertCreateColumns (array $table) | |
convertSingleCreateColumn (array $col) | |
convertConstraints (array $constraintsList, $asArray=FALSE) | |
convertSinglePrimaryKey (array $pk) | |
convertSingleForeignKey (array $fk) | |
convertSingleUnique (array $un) | |
convertCreateIndexes (array $table) | |
convertSingleIndex (array $idx, $tableName) | |
convertCreateSequences (array $sequences) | |
convertSingleSequence ($sequence) | |
convertWithQuery (array $withQuery) | |
convertCallQuery (array $callQuery) | |
handleFunctionConcat (array $args) | |
handleFunctionArray (array $args) | |
convertLikeCondition (array $condition) | |
handleFunctionCast (array $args) | |
handleFunctionBindcast (array $args) | |
handleFunctionLength (array $args) | |
handleFunctionCoalesce (array $args) | |
handleFunctionMax (array $args) | |
handleFunctionMin (array $args) | |
handleFunctionCount (array $args) | |
handleFunctionSubstring (array $args) | |
getComparisonOperators ($type=NULL) | |
Protected Attributes | |
$dataTypes | |
$sqlConstructs | |
$mathOps | |
$query = array() | |
$name = '' | |
This class will have base functions that converts parsed XQDs to their SQL representation. XQDs are parsed by DALBaker and converted to PHP arrays. If new databases have different SQL constructs then they should extend this class and override its functions & members.
Definition at line 25 of file DALConverter.inc.
|
protected |
Returns string of spaces.
integer | $level | Number of levels to indent. |
integer | $spaces | Number of spaces for each indent level. |
Definition at line 1197 of file DALConverter.inc.
|
protected |
Returns string with the SQL filters included.
array | $sqlArray | The Query array. |
Definition at line 311 of file DALConverter.inc.
|
protected |
Converts ALTER TABLE statement to its SQL form.
array | $sqlArray | Single ALTER TABLE query. |
Definition at line 1369 of file DALConverter.inc.
|
protected |
Converts ALTER TABLE ADD COLUMN statement to its SQL form.
Throws DALConverterException if no columns found.
array | $addColumn | ADD COLUMN array. |
DALConverterException | If columns not specified. |
Definition at line 1397 of file DALConverter.inc.
|
protected |
Converts ALTER TABLE ADD CONSTRAINT statement to its SQL format.
Returns empty string if no constraints found.
array | $constraints | List of constraints. |
string | $tableName | Name of the table to alter. |
Definition at line 1518 of file DALConverter.inc.
|
protected |
Converts ALTER TABLE DROP COLUMN statement to its SQL format.
Throws DALConverterException if no column name given.
string | $column | Column name. |
DALConverterException | If column name is not specified. |
Definition at line 1431 of file DALConverter.inc.
|
protected |
Converts ALTER TABLE DROP CONSTRAINT to its SQL format.
Throws DALConverterException if no column name given.
string | $dropConstraint | Name of the constraint to drop. |
DALConverterException | If constraint name is empty. |
Definition at line 1546 of file DALConverter.inc.
|
protected |
Starts the ALTER query statement.
string | $tableName | Name of the table to alter. |
Definition at line 1353 of file DALConverter.inc.
|
protected |
Converts ALTER TABLE MODIFY COLUMN statement to its SQL format.
Throws DALConverterException if no columns provided.
array | $modifyColumns | Columns to be modified. |
DALConverterException | If columns not specified. |
Definition at line 1484 of file DALConverter.inc.
|
protected |
Converts ALTER TABLE RENAME COLUMN statement to its SQL format.
Throws DALConverterException if old column name or new column name is not provided.
array | $renameColumn | Old and New column names. |
DALConverterException | If old or new column name is not specified. |
Definition at line 1458 of file DALConverter.inc.
|
protected |
Converts ALTER TABLE RENAME TABLE statement to its SQL format.
Throws DALConverterException if old column name or new column name is not provided.
array | $renameTable | Old and New table name. |
DALConverterException | If old or new name is not specified. |
Definition at line 1573 of file DALConverter.inc.
|
protected |
Converts a 'CALL' query into SQL.
array | $callQuery | The array containing the function structure. |
Definition at line 2038 of file DALConverter.inc.
|
protected |
Converts constraints list to their SQL format.
Each constraint type (PK, FK, UQ) has its own method to convert a single constraint. This function is used by CREATE TABLE and ALTER TABLE CONSTRAINTS.
array | $constraintsList | The constraints array. |
boolean | $asArray | If true result will be array of strings. |
Definition at line 1743 of file DALConverter.inc.
|
protected |
Converts array of create clause columns to their SQL format.
array | $table | The table array. |
Definition at line 1671 of file DALConverter.inc.
|
protected |
Returns the start of the create table statement.
Create stetement close bracket and semi-colon. Postgres: );.
array | $table | CREATE array. |
Definition at line 1655 of file DALConverter.inc.
|
protected |
Returns the start of the create table statement.
Postgres: CREATE TABLE assets (.
array | $table | CREATE array. |
Definition at line 1636 of file DALConverter.inc.
|
protected |
Converts list of Index to SQL string.
array | $table | The table array. |
Definition at line 1855 of file DALConverter.inc.
|
protected |
Converts list of SEQUENCE stataments.
array | $sequences | Create sequence stataments. |
Definition at line 1900 of file DALConverter.inc.
convertCreateTable | ( | array | $table | ) |
Converts create statement to SQL string.
array | $table | CREATE array. |
Definition at line 1601 of file DALConverter.inc.
|
protected |
Converts delete query to its SQL string.
array | $sqlArray | Delete query array. |
Definition at line 1329 of file DALConverter.inc.
convertDropSequence | ( | $sequenceName | ) |
Converts DROP TABLE statement.
string | $sequenceName | Name of the sequence to drop from the db. |
Definition at line 1983 of file DALConverter.inc.
convertDropTable | ( | $tableName, | |
$cascade = FALSE |
|||
) |
Converts DROP TABLE statement.
string | $tableName | Name of the table to drop from the db. |
boolean | $cascade | If TRUE, deletions will be cascaded to dependent objects. |
Definition at line 1947 of file DALConverter.inc.
|
protected |
Converts EXISTS condition to its SQL format.
array | $exists | The exists condition array. |
integer | $level | Number of levels to indent. |
string | $type | The type of exists condition (exists/not-exists). |
Definition at line 875 of file DALConverter.inc.
|
protected |
Converts single field to its SQL format.
array | $field | Field's name. |
Definition at line 501 of file DALConverter.inc.
|
protected |
Converts From clause to its SQL format.
array | $from | The from clause array. |
integer | $level | Number of levels to indent. |
Definition at line 599 of file DALConverter.inc.
|
protected |
Converts GROUP BY clause.
array | $groupBy | Single GROUP BY clause. |
Definition at line 1048 of file DALConverter.inc.
|
protected |
Converts IN condition to its SQL format.
array | $in | The in condition array. |
integer | $level | Number of levels to indent. |
string | $type | Type of in condition (in/not-in). |
Definition at line 839 of file DALConverter.inc.
|
protected |
Converts Insert query to its SQL format.
array | $sqlArray | The insert query. |
Definition at line 1177 of file DALConverter.inc.
|
protected |
Converts Insert query's fields to their SQL format.
array | $fields | Array of fields. |
Definition at line 1212 of file DALConverter.inc.
|
protected |
Converts Insert query's values to their SQL format.
Converting values require the fields array. Because, fields list and values list must be in the same order.
array | $insert | Array of the insert query. |
DALConverterException | If field is missing. |
Definition at line 1236 of file DALConverter.inc.
|
protected |
Converts IS NULL statament.
array | $isNull | IS NULL array. |
DALConverterException | Is-null value is empty. |
Definition at line 896 of file DALConverter.inc.
|
protected |
Converts array of joins to their SQL form.
array | $joins | Array of joins. |
Definition at line 1126 of file DALConverter.inc.
|
protected |
Handles LIKE conditions.
array | $condition | The condition information. |
Definition at line 2112 of file DALConverter.inc.
|
protected |
Converts LIMIT.
array | $limit | Single LIMIT clause. |
Definition at line 1108 of file DALConverter.inc.
|
protected |
Converts a math operation block to its SQL format.
This function will call it self when there are multiple operations. For example: ((x + y) - z). Math ops can contain fields, values, function calls and hooks.
array | $mathOp | The math op block. |
Definition at line 677 of file DALConverter.inc.
|
protected |
Converts NOT NULL statament.
array | $notNull | IS NULL array. |
DALConverterException | Not null value is empty. |
Definition at line 926 of file DALConverter.inc.
|
protected |
Converts ORDER BY clause.
array | $orderBy | Single ORDER BY clause. |
Definition at line 1075 of file DALConverter.inc.
convertResetSequence | ( | $sequenceName | ) |
Converts DROP TABLE statement.
string | $sequenceName | Name of the sequence to drop from the db. |
Definition at line 1999 of file DALConverter.inc.
|
protected |
Converts Select's field list to its SQL format.
array | $fields | Array of fields. |
integer | $level | Number of levels to indent. |
Definition at line 350 of file DALConverter.inc.
|
protected |
Converts Select query to its SQL string.
array | $sqlArray | The select query array. |
integer | $level | Number of levels to indent. |
array | $ignore | Tag names that will be ignored while converting the select statement. Example: where,join.. |
Definition at line 251 of file DALConverter.inc.
|
protected |
Converts single create column to its SQL string.
Single create column consists of column's name, type (size and scale), null/not null, and its default value.
For Postgres SQL will look like: assetid VARCHAR2(15) NOT NULL DEFAUL 1.
array | $col | Single column in create clause. |
Definition at line 1698 of file DALConverter.inc.
|
protected |
Converts single field to its SQL format.
Field maybe a column, value, hook, function, math operation.
(string|array) | $field The field array or string. |
Definition at line 374 of file DALConverter.inc.
|
protected |
Converts single foreign key constraint to its SQL string.
Postgres: CONSTRAINT links_table_fk FOREIGN KEY (assetid) REFERENCES assets_table (assetid) ON DELETE CASCADE.
array | $fk | Single foreign key constraint. |
Definition at line 1806 of file DALConverter.inc.
|
protected |
Converts a single function to its SQL string.
array | $function | Function array. |
Definition at line 563 of file DALConverter.inc.
|
protected |
Converts single Index to its SQL string.
Postgres: INDEX index_name (assetid, linkid).
array | $idx | Single index array. |
string | $tableName | Name of the table. |
Definition at line 1883 of file DALConverter.inc.
|
protected |
Converts a single join.
array | $join | Single join array. |
Definition at line 1149 of file DALConverter.inc.
|
protected |
Converts single primary key constraint to its SQL string.
Postgres: CONSTRAINT assets_table_pk PRIMARY KEY (assetid).
array | $pk | Single primary key constraint. |
Definition at line 1786 of file DALConverter.inc.
|
protected |
Converts a single CREATE SEQUENCE statament.
string | $sequence | Name of the sequence. |
Definition at line 1927 of file DALConverter.inc.
|
protected |
Converts single unique constraint to its SQL string.
Postgres: CONSTRAINT unique_uk UNIQUE (someid).
array | $un | Single unique constraint. |
Definition at line 1838 of file DALConverter.inc.
|
protected |
Converts a single value to its SQL format.
array | string | $field | The field value. |
Definition at line 531 of file DALConverter.inc.
|
protected |
Converts given alias string to table alias.
string | $alias | Alias of the table. |
Definition at line 658 of file DALConverter.inc.
convertToSql | ( | array | $sqlArray | ) |
Converts given query to its SQL.
array | $sqlArray | Single query. |
Definition at line 198 of file DALConverter.inc.
convertTruncateTable | ( | $tableName | ) |
Converts TRUNCATE TABLE statement.
string | $tableName | Name of the table to truncate. |
Definition at line 1967 of file DALConverter.inc.
|
protected |
Convert the display name of union and union-all.
If the DB needs to display, in the SQL, something other than UNION or UNION-ALL (eg. DB2 needs UNION ALL), then return it here.
string | $type | The type of the union (UNION or UNION-ALL). |
Definition at line 1033 of file DALConverter.inc.
|
protected |
Convert list of union and union-all.
array | $union | Array of selects in union/union-all. |
integer | $level | Number of levels to indent. |
Definition at line 998 of file DALConverter.inc.
|
protected |
Convert list of union that are in side a FROM clause.
array | $union | Array of selects in union/union-all. |
integer | $level | Number of levels to indent. |
Definition at line 956 of file DALConverter.inc.
|
protected |
Converts update query to its SQL string.
array | $sqlArray | Delete query array. |
Definition at line 1277 of file DALConverter.inc.
|
protected |
Converts update query's set values to its SQL format.
array | $values | Array of values to set. |
Definition at line 1300 of file DALConverter.inc.
|
protected |
Converts Where clause to its SQL format.
array | $where | The where clasue array. |
integer | $level | Number of levels to indent. |
boolean | $addBrackets | Add brackets around first where condition. |
DALConverterException | Fails to convert where clause. |
Definition at line 764 of file DALConverter.inc.
|
protected |
Converts a WITH query.
array | $withQuery | Array containing the with query information. |
Definition at line 2016 of file DALConverter.inc.
|
protected |
Returns list of allowed where clause conditions.
string | $type | Type of the condition. It will return its sign. |
Definition at line 2305 of file DALConverter.inc.
getConstructName | ( | $name | ) |
Returns the construct string for the current database type.
Classes that extend this class should override the sqlConstructs member.
string | $name | Base name of the construct to get. |
Definition at line 178 of file DALConverter.inc.
getDataType | ( | $type | ) |
Returns the database specific data type.
Sub classes should override the $dataTypes member.
string | $type | Base data type. |
Definition at line 143 of file DALConverter.inc.
getName | ( | ) |
Returns the readable database name.
Definition at line 161 of file DALConverter.inc.
|
protected |
Given a field it returns its name.
array | $field | Single field from select field list. |
Definition at line 409 of file DALConverter.inc.
|
protected |
Given list of fields it returns their name.
array | $fields | Fields from Select field list. |
Definition at line 481 of file DALConverter.inc.
|
protected |
Returns the type of the union.
array | $union | Array of a union/union-all. |
Definition at line 975 of file DALConverter.inc.
|
protected |
Handles ARRAY cast function.
array | $args | String to cast to array. |
Definition at line 2096 of file DALConverter.inc.
|
protected |
Handles the BINDCAST() function call.
BINDCAST is used to wrap bind vars. Default will only print the bind var
array | $args | Method arguments. |
Definition at line 2149 of file DALConverter.inc.
|
protected |
Handles the CAST() function call.
array | $args | Method arguments. |
Definition at line 2131 of file DALConverter.inc.
|
protected |
Handles the COALESCE() function.
array | $args | Method arguments. |
Definition at line 2181 of file DALConverter.inc.
|
protected |
Handles the CONCAT() function call.
array | $args | Method arguments. |
Definition at line 2080 of file DALConverter.inc.
|
protected |
Handles the COUNT() function.
array | $args | Method arguments. |
Definition at line 2252 of file DALConverter.inc.
|
protected |
Handles the LENGTH() function.
array | $args | Method arguments. |
Definition at line 2165 of file DALConverter.inc.
|
protected |
Handles the MAX() function.
array | $args | Method arguments. |
Definition at line 2204 of file DALConverter.inc.
|
protected |
Handles the MIN() function.
array | $args | Method arguments. |
Definition at line 2228 of file DALConverter.inc.
|
protected |
Handles the SUBSTRING() function.
see DB2, MSSQL and Oracle converter for different syntax
array | $args | Method arguments. |
Definition at line 2279 of file DALConverter.inc.
handleFunctionTableExists | ( | $tableName, | |
$schema = NULL |
|||
) |
Handles table exists.
(array|string) | $tableName Table name argument. | |
string | $schema | The schema to check the table for. |
Definition at line 2056 of file DALConverter.inc.
|
protected |
Separates arary of fields/values and returns its SQL string.
array | $fields | Array of fields to separate. |
Definition at line 731 of file DALConverter.inc.
|
protected |
Separates arary of tables and returns its SQL string.
array | $tables | Array of fields to separate. |
Definition at line 746 of file DALConverter.inc.
|
protected |
Given a field it will update its alias.
array | $field | A field from Select field list. |
string | $alias | New alias for the field. |
Definition at line 452 of file DALConverter.inc.
|
protected |
Definition at line 36 of file DALConverter.inc.
|
protected |
Definition at line 87 of file DALConverter.inc.
|
protected |
Definition at line 62 of file DALConverter.inc.