Zeta Components Manual :: Docs For Class ezcQueryExpressionMssql
Database::ezcQueryExpressionMssql
Class ezcQueryExpressionMssql
The ezcQueryExpressionMssql class is used to create SQL expression for SQL Server.
This class reimplements the methods that have a different syntax in SQL Server.
Source for this file: /Database/src/sqlabstraction/implementations/expression_mssql.php
ezcQueryExpression | --ezcQueryExpressionMssql
Version: | //autogentag// |
Member Variables
protected array(string=>string) |
$intervalMap
= array(
Contains an interval map from generic intervals to MS SQL native intervals. |
Inherited Member Variables
From ezcQueryExpression | |
---|---|
protected |
ezcQueryExpression::$db
|
protected |
ezcQueryExpression::$quoteValues
|
Method Summary
public string |
ceil(
$number
)
Returns the SQL to calculate the next highest integer value from the number. |
public void |
concat(
$...
)
Returns a series of strings concatinated |
public string |
dateAdd(
$column
, $expr
, $type
)
Returns the SQL that adds an interval to a timestamp value. |
public string |
dateExtract(
$column
, $type
)
Returns the SQL that extracts parts from a timestamp value from a column. |
public string |
dateSub(
$column
, $expr
, $type
)
Returns the SQL that subtracts an interval from a timestamp value. |
public string |
length(
$column
)
Returns the length of a text field. |
public string |
md5(
$column
)
Returns the md5 sum of a field. |
public string |
mod(
$expression1
, $expression2
)
Returns the remainder of the division operation $expression1 / $expression2. |
public string |
now(
)
Returns the current system date and time in the database internal format. |
public string |
position(
$substr
, $value
)
Returns the SQL to locate the position of the first occurrence of a substring |
public string |
subString(
$value
, $from
, [ $len
= null] )
Returns part of a string. |
public string |
unixTimestamp(
$column
)
Returns the SQL that converts a timestamp value to number of seconds since 1970-01-01 00:00:00-00. |
Inherited Methods
From ezcQueryExpression | |
---|---|
public ezcQueryExpression |
ezcQueryExpression::__construct()
Constructs an empty ezcQueryExpression |
public string |
ezcQueryExpression::add()
Returns the SQL to add values or expressions together. |
public string |
ezcQueryExpression::avg()
Returns the average value of a column |
public string |
ezcQueryExpression::between()
Returns SQL that checks if an expression evaluates to a value between two values. |
public string |
ezcQueryExpression::bitAnd()
Returns the SQL that performs the bitwise AND on two values. |
public string |
ezcQueryExpression::bitOr()
Returns the SQL that performs the bitwise OR on two values. |
public string |
ezcQueryExpression::bitXor()
Returns the SQL that performs the bitwise XOR on two values. |
public string |
ezcQueryExpression::ceil()
Returns the SQL to calculate the next highest integer value from the number. |
public void |
ezcQueryExpression::concat()
Returns a series of strings concatinated |
public string |
ezcQueryExpression::count()
Returns the number of rows (without a NULL value) of a column |
public string |
ezcQueryExpression::dateAdd()
Returns the SQL that adds an interval to a timestamp value. |
public string |
ezcQueryExpression::dateExtract()
Returns the SQL that extracts parts from a timestamp value. |
public string |
ezcQueryExpression::dateSub()
Returns the SQL that subtracts an interval from a timestamp value. |
public string |
ezcQueryExpression::div()
Returns the SQL to divide values or expressions by eachother. |
public string |
ezcQueryExpression::eq()
Returns the SQL to check if two values are equal. |
public string |
ezcQueryExpression::floor()
Returns the SQL to calculate the next lowest integer value from the number. |
protected string |
ezcQueryExpression::getIdentifier()
Returns the correct identifier for the alias $alias. |
protected array(string) |
ezcQueryExpression::getIdentifiers()
Returns the correct identifiers for the aliases found in $aliases. |
public string |
ezcQueryExpression::gt()
Returns the SQL to check if one value is greater than another value. |
public string |
ezcQueryExpression::gte()
Returns the SQL to check if one value is greater than or equal to another value. |
public bool |
ezcQueryExpression::hasAliases()
Returns true if this object has aliases. |
public string |
ezcQueryExpression::in()
Returns the SQL to check if a value is one in a set of given values.. |
public string |
ezcQueryExpression::isNull()
Returns SQL that checks if a expression is null. |
public string |
ezcQueryExpression::lAnd()
Returns the SQL to bind logical expressions together using a logical and. |
public string |
ezcQueryExpression::length()
Returns the length of text field $column |
public void |
ezcQueryExpression::like()
Match a partial string in a column. |
public string |
ezcQueryExpression::lOr()
Returns the SQL to bind logical expressions together using a logical or. |
public string |
ezcQueryExpression::lower()
Returns the SQL to change all characters to lowercase |
public string |
ezcQueryExpression::lt()
Returns the SQL to check if one value is less than another value. |
public string |
ezcQueryExpression::lte()
Returns the SQL to check if one value is less than or equal to another value. |
public string |
ezcQueryExpression::max()
Returns the highest value of a column |
public string |
ezcQueryExpression::md5()
Returns the md5 sum of $column. |
public string |
ezcQueryExpression::min()
Returns the lowest value of a column |
public string |
ezcQueryExpression::mod()
Returns the remainder of the division operation $expression1 / $expression2. |
public string |
ezcQueryExpression::mul()
Returns the SQL to multiply values or expressions by eachother. |
public string |
ezcQueryExpression::neq()
Returns the SQL to check if two values are unequal. |
public string |
ezcQueryExpression::not()
Returns the SQL for a logical not, negating the $expression. |
public string |
ezcQueryExpression::now()
Returns the current system date and time in the database internal format. |
public string |
ezcQueryExpression::position()
Returns the SQL to locate the position of the first occurrence of a substring |
public string |
ezcQueryExpression::round()
Rounds a numeric field to the number of decimals specified. |
public string |
ezcQueryExpression::searchedCase()
Returns a searched CASE statement. |
public void |
ezcQueryExpression::setAliases()
Sets the aliases $aliases for this object. |
public void |
ezcQueryExpression::setValuesQuoting()
Sets the mode of quoting for parameters passed to SQL functions and operators. |
public string |
ezcQueryExpression::sub()
Returns the SQL to subtract values or expressions from eachother. |
public string |
ezcQueryExpression::subString()
Returns part of a string. |
public string |
ezcQueryExpression::sum()
Returns the total sum of a column |
public string |
ezcQueryExpression::unixTimestamp()
Returns the SQL that converts a timestamp value to a unix timestamp. |
public string |
ezcQueryExpression::upper()
Returns the SQL to change all characters to uppercase |
Methods
ceil
Returns the SQL to calculate the next highest integer value from the number.
Parameters:
Name | Type | Description |
---|---|---|
$number |
string |
Redefinition of:
Method | Description |
---|---|
ezcQueryExpression::ceil() |
Returns the SQL to calculate the next highest integer value from the number. |
concat
Returns a series of strings concatinated
concat() accepts an arbitrary number of parameters. Each parameter must contain an expression or an array with expressions.
Parameters:
Name | Type | Description |
---|---|---|
$... |
string|array(string) | strings that will be concatinated. |
Redefinition of:
Method | Description |
---|---|
ezcQueryExpression::concat() |
Returns a series of strings concatinated |
dateAdd
Returns the SQL that adds an interval to a timestamp value.
Parameters:
Name | Type | Description |
---|---|---|
$column |
string | |
$expr |
numeric | |
$type |
string | one of SECOND, MINUTE, HOUR, DAY, MONTH, or YEAR |
Redefinition of:
Method | Description |
---|---|
ezcQueryExpression::dateAdd() |
Returns the SQL that adds an interval to a timestamp value. |
dateExtract
Returns the SQL that extracts parts from a timestamp value from a column.
Parameters:
Name | Type | Description |
---|---|---|
$column |
string | |
$type |
string | one of SECOND, MINUTE, HOUR, DAY, MONTH, or YEAR |
Redefinition of:
Method | Description |
---|---|
ezcQueryExpression::dateExtract() |
Returns the SQL that extracts parts from a timestamp value. |
dateSub
Returns the SQL that subtracts an interval from a timestamp value.
Parameters:
Name | Type | Description |
---|---|---|
$column |
string | |
$expr |
numeric | |
$type |
string | one of SECOND, MINUTE, HOUR, DAY, MONTH, or YEAR |
Redefinition of:
Method | Description |
---|---|
ezcQueryExpression::dateSub() |
Returns the SQL that subtracts an interval from a timestamp value. |
length
Returns the length of a text field.
Parameters:
Name | Type | Description |
---|---|---|
$column |
string |
Redefinition of:
Method | Description |
---|---|
ezcQueryExpression::length() |
Returns the length of text field $column |
md5
Returns the md5 sum of a field.
There are two variants of implementation for this feature. Both not ideal though. First don't require additional setup of MS SQL Server and uses undocumented function master.dbo.fn_varbintohexstr() to convert result of Transact-SQL HashBytes() function to string.
Second one requires the stored procedure from http://www.thecodeproject.com/database/xp_md5.asp to be installed and wrapped by the user defined function fn_md5.
Parameters:
Name | Type | Description |
---|---|---|
$column |
string |
Redefinition of:
Method | Description |
---|---|
ezcQueryExpression::md5() |
Returns the md5 sum of $column. |
mod
Returns the remainder of the division operation $expression1 / $expression2.
Parameters:
Name | Type | Description |
---|---|---|
$expression1 |
string | |
$expression2 |
string |
Redefinition of:
Method | Description |
---|---|
ezcQueryExpression::mod() |
Returns the remainder of the division operation $expression1 / $expression2. |
now
Returns the current system date and time in the database internal format.
Redefinition of:
Method | Description |
---|---|
ezcQueryExpression::now() |
Returns the current system date and time in the database internal format. |
position
Returns the SQL to locate the position of the first occurrence of a substring
Parameters:
Name | Type | Description |
---|---|---|
$substr |
string | |
$value |
string |
Redefinition of:
Method | Description |
---|---|
ezcQueryExpression::position() |
Returns the SQL to locate the position of the first occurrence of a substring |
subString
Returns part of a string.
Note: Not SQL92, but common functionality.
Parameters:
Name | Type | Description |
---|---|---|
$value |
string | the target $value the string or the string column. |
$from |
int | extract from this characeter. |
$len |
int | extract this amount of characters. If $len is not provided it's assumed to be the number of characters to get the whole remainder of the string. |
Redefinition of:
Method | Description |
---|---|
ezcQueryExpression::subString() |
Returns part of a string. |
unixTimestamp
Returns the SQL that converts a timestamp value to number of seconds since 1970-01-01 00:00:00-00.
Parameters:
Name | Type | Description |
---|---|---|
$column |
string |
Redefinition of:
Method | Description |
---|---|
ezcQueryExpression::unixTimestamp() |
Returns the SQL that converts a timestamp value to a unix timestamp. |