Database: ezcQueryExpressionMssql
[ ]
[ Oracle setup ]
[ ]
[ ]
[ ]
[ ]
Class: ezcQueryExpressionMssql
|
The ezcQueryExpressionMssql class is used to create SQL expression for SQL Server. [
source]
This class reimplements the methods that have a different syntax in SQL Server.
Parents
ezcQueryExpression
|
--ezcQueryExpressionMssql
Member Variables
|
protected array(string=>string) |
$intervalMap
= array( 'SECOND' => 'second', 'MINUTE' => 'minute', 'HOUR' => 'Hour', 'DAY' => 'Day', 'MONTH' => 'Month', 'YEAR' => 'Year', )
Contains an interval map from generic intervals to MS SQL native intervals. |
Inherited Member Variables
From
ezcQueryExpression:
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 :
Methods
ceil
string ceil(
string
$number )
Returns the SQL to calculate the next highest integer value from the number.
Parameters
| Name |
Type |
Description |
$number |
string |
|
Redefinition of
concat
void concat(
string|array(string)
$... )
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
dateAdd
string dateAdd(
string
$column, numeric
$expr, string
$type )
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
dateExtract
string dateExtract(
string
$column, string
$type )
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
dateSub
string dateSub(
string
$column, numeric
$expr, string
$type )
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
length
string length(
string
$column )
Returns the length of a text field.
Parameters
| Name |
Type |
Description |
$column |
string |
|
Redefinition of
md5
string md5(
string
$column )
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
mod
string mod(
string
$expression1, string
$expression2 )
Returns the remainder of the division operation $expression1 / $expression2.
Parameters
| Name |
Type |
Description |
$expression1 |
string |
|
$expression2 |
string |
|
Redefinition of
now
string now(
)
Returns the current system date and time in the database internal format.
Redefinition of
position
string position(
string
$substr, string
$value )
Returns the SQL to locate the position of the first occurrence of a substring
Parameters
| Name |
Type |
Description |
$substr |
string |
|
$value |
string |
|
Redefinition of
subString
string subString(
string
$value, int
$from, [int
$len = null] )
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
unixTimestamp
string unixTimestamp(
string
$column )
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
Last updated: Mon, 21 Dec 2009