Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
DALMssqlConverter Class Reference
Inheritance diagram for DALMssqlConverter:
DALConverter

Public Member Functions

 __construct ()
 
 convertCreateTable (array $table)
 
 handleFunctionSequenceExists ($sequenceName)
 
 convertDropSequence ($sequenceName)
 
 handleFunctionTableExists ($tableName, $schema=NULL)
 
- Public Member Functions inherited from DALConverter
 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

 convertAlterQueryAddConstraint (array $constraints, $incHeader=FALSE)
 
 convertCreateIndexes (array $table)
 
 convertSingleIndex (array $idx, $tableName)
 
 convertSingleSequence ($sequence)
 
 handleFunctionSeqNextVal ($seqName)
 
 handleFunctionSeqCurrVal ($seqName)
 
 handleFunctionConcat (array $args)
 
 handleFunctionToDate (array $args)
 
 convertUnionDisplayName ($type)
 
 convertInsertQueryValues (array $insert)
 
 convertCallQuery (array $callQuery)
 
 convertSingleFunction (array $function, $isProcedure=FALSE)
 
 convertSelectFieldList (array $fields, $level=1)
 
 convertLimit (array $limit)
 
 handleFunctionSubstring (array $args)
 
- Protected Member Functions inherited from DALConverter
 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

 $tableName = ''
 
 $name = 'MSSQL'
 
 $dataTypes
 
- Protected Attributes inherited from DALConverter
 $dataTypes
 
 $sqlConstructs
 
 $mathOps
 
 $query = array()
 
 $name = ''
 

Detailed Description

DALMssqlConverter.

Contains methods to perform any database specific conversions into SQL. The methods to convert XML structures into SQL are defined in the parent class "DALConverter", and if any conversions need to be altered for this database the corresponding methods of DALConverter should be redefined here.

Since
4.0.0

Definition at line 25 of file DALMssqlConverter.inc.

Constructor & Destructor Documentation

__construct ( )

Constructor.

Since
4.0.0

Definition at line 74 of file DALMssqlConverter.inc.

Member Function Documentation

convertAlterQueryAddConstraint ( array  $constraints,
  $incHeader = FALSE 
)
protected

Converts ALTER TABLE ADD CONSTRAINT statement to its SQL format.

Returns empty string if no constraints found.

Parameters
array$constraintsList of constraints.
boolean$incHeaderIf true ALTER query heading will be added.
Since
4.0.0
Returns
string

Definition at line 128 of file DALMssqlConverter.inc.

convertCallQuery ( array  $callQuery)
protected

Converts a single CALL query.

Parameters
array$callQueryThe array structure of the call query.
Since
4.0.0
Returns
string

Definition at line 396 of file DALMssqlConverter.inc.

convertCreateIndexes ( array  $table)
protected

Converts list of Index to SQL string.

Parameters
array$tableThe table array.
Since
4.0.0
Returns
string

Definition at line 161 of file DALMssqlConverter.inc.

convertCreateTable ( array  $table)

Converts create statement to SQL string.

Indexes are added after creating the table.

Parameters
array$tableCREATE array.
Since
4.0.0
Returns
string

Definition at line 90 of file DALMssqlConverter.inc.

convertDropSequence (   $sequenceName)

Converts DROP SEQUENCE statement.

MySQL does not support sequences, tables created instead of sequences.

Parameters
string$sequenceNameName of the sequence to drop from the db.
Since
4.0.0
Returns
string

Definition at line 280 of file DALMssqlConverter.inc.

convertInsertQueryValues ( array  $insert)
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.

SQLServer throws error if there are brackets () around SELECT statement.

Parameters
array$insertArray of the insert query.
Since
4.0.0
Returns
string
Exceptions
DALConverterExceptionIf the INSERT query cannot be converted.

Definition at line 360 of file DALMssqlConverter.inc.

convertLimit ( array  $limit)
protected

Converts LIMIT.

Parameters
array$limitSingle LIMIT clause.
Since
4.0.0
Returns
string

Definition at line 545 of file DALMssqlConverter.inc.

convertSelectFieldList ( array  $fields,
  $level = 1 
)
protected

Converts Select's field list to its SQL format.

Parameters
array$fieldsArray of fields.
integer$levelNumber of levels to indent.
Since
4.0.0
Returns
string

Definition at line 490 of file DALMssqlConverter.inc.

convertSingleFunction ( array  $function,
  $isProcedure = FALSE 
)
protected

Converts a single function to its SQL string.

SQL Server does not like the brackets when calling a procedure using EXEC.

Parameters
array$functionFunction array.
boolean$isProcedureSet this to true if this is a procedure.
Since
4.0.0
Returns
string

Definition at line 416 of file DALMssqlConverter.inc.

convertSingleIndex ( array  $idx,
  $tableName 
)
protected

Converts single Index to its SQL string.

Postgres: INDEX index_name (assetid, linkid).

Parameters
array$idxSingle index array.
string$tableNameName of the table.
Since
4.0.0
Returns
string

Definition at line 189 of file DALMssqlConverter.inc.

convertSingleSequence (   $sequence)
protected

Converts a single CREATE SEQUENCE statament.

Parameters
string$sequenceName of the sequence.
Since
4.0.0
Returns
string

Definition at line 206 of file DALMssqlConverter.inc.

convertUnionDisplayName (   $type)
protected

SQL Server needs to use UNION ALL (no hyphen) so return that here.

Parameters
string$typeThe type of the union (UNION or UNION-ALL).
Since
4.0.0
Returns
string

Definition at line 335 of file DALMssqlConverter.inc.

handleFunctionConcat ( array  $args)
protected

Handles the CONCAT() function call.

Parameters
array$argsThe arguments to the concat function.
Since
4.0.0
Returns
string

Definition at line 296 of file DALMssqlConverter.inc.

handleFunctionSeqCurrVal (   $seqName)
protected

Handles SeqCurrVal(seqName) function.

SeqCurrVal will return the current sequence value. Note: SeqNextVal must be called before this function.

Parameters
string$seqNameName of the sequence.
Since
4.0.0
Returns
string

Definition at line 247 of file DALMssqlConverter.inc.

handleFunctionSeqNextVal (   $seqName)
protected

Handles SeqNextVal(seqName) function.

SewNextVal will increment sequence value and return the new sequence value.

Parameters
string$seqNameName of the sequence.
Since
4.0.0
Returns
string

Definition at line 228 of file DALMssqlConverter.inc.

handleFunctionSequenceExists (   $sequenceName)

Handles sequence exists.

Parameters
(array|string)$sequenceName Sequence name.
Since
4.0.0
Returns
string

Definition at line 263 of file DALMssqlConverter.inc.

handleFunctionSubstring ( array  $args)
protected

Handles the SUBSTRING() function.

MSSQL's SUBSTRING function syntax differs from that of the standard, SUBSTRING(input, start, length).

Parameters
array$argsMethod arguments.
Since
4.0.0
Returns
string

Definition at line 589 of file DALMssqlConverter.inc.

handleFunctionTableExists (   $tableName,
  $schema = NULL 
)

Handles table exists.

Parameters
(array|string)$tableName Table name argument.
string$schemaThe schema that the exists function should be called on.
Since
4.0.0
Returns
string

Definition at line 465 of file DALMssqlConverter.inc.

handleFunctionToDate ( array  $args)
protected

Handles a custom DAL ToDate() function call.

This function will convert an ISO8601 date into a format suitable for insertion into a query.

Parameters
array$argsThe arguments of the function.
Since
4.0.0
Returns
string

Definition at line 315 of file DALMssqlConverter.inc.

Field Documentation

$dataTypes
protected
Initial value:
= array(
'char' => 'NCHAR',
'varchar' => 'NVARCHAR',
'clob' => 'NVARCHAR(4000)',
'blob' => 'VARBINARY',
'integer' => 'INT',
'smallint' => 'SMALLINT',
'numeric' => 'NUMERIC',
'float' => 'FLOAT',
'real' => 'REAL',
'double_precision' => 'FLOAT',
'boolean' => 'CHAR(1)',
'date' => 'DATETIME',
'time' => 'DATETIME',
'timestamp' => 'DATETIME',
'time with time zone' => 'DATETIME',
)

Definition at line 50 of file DALMssqlConverter.inc.

string $name = 'MSSQL'
protected

Name of the table that is being converted.

Since
4.0.0

Definition at line 42 of file DALMssqlConverter.inc.


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