class Doctrine_Expression_Mock extends Doctrine_Expression_Driver (View source)

Doctrine_Expression_Mock Mock driver that is used for testing purposes

Properties

protected Doctrine_Connection $conn from Doctrine_Connection_Module
protected string $moduleName from Doctrine_Connection_Module

Methods

__construct(Doctrine_Connection $conn = null)

No description

getConnection()

getConnection returns the connection object this module uses

string
getModuleName()

getModuleName returns the name of this module

getIdentifier($column)

No description

getIdentifiers($columns)

No description

string
regexp()

regexp returns the regular expression operator

string
avg(string $column)

Returns the average value of a column

string
count(string|integer $column)

Returns the number of rows (without a NULL value) of a column

string
max(string $column)

Returns the highest value of a column

string
min(string $column)

Returns the lowest value of a column

string
sum(string $column)

Returns the total sum of a column

string
md5($column)

Returns the md5 sum of a field.

string
length($column)

Returns the length of a text field.

string
round($column, $decimals = 0)

Rounds a numeric field to the number of decimals specified.

string
mod(string $expression1, string $expression2)

Returns the remainder of the division operation $expression1 / $expression2.

string
trim(string $str)

trim returns the string $str with leading and proceeding space characters removed

string
rtrim(string $str)

rtrim returns the string $str with proceeding space characters removed

string
ltrim(string $str)

ltrim returns the string $str with leading space characters removed

string
upper(string $str)

upper Returns the string $str with all characters changed to uppercase according to the current character set mapping.

string
lower(string $str)

lower Returns the string $str with all characters changed to lowercase according to the current character set mapping.

integer
locate($str, $substr)

locate returns the position of the first occurrence of substring $substr in string $str

string
now()

Returns the current system date.

string
soundex(string $value)

soundex Returns a string to call a function to compute the soundex encoding of a string

string
substring($value, $from, $len = null)

return string to call a function to get a substring inside an SQL statement

concat()

Returns a series of strings concatinated

string
not($expression)

Returns the SQL for a logical not.

string
add(array $args)

Returns the SQL to add values or expressions together.

string
sub(array $args)

Returns the SQL to subtract values or expressions from eachother.

string
mul(array $args)

Returns the SQL to multiply values or expressions by eachother.

string
div(array $args)

Returns the SQL to divide values or expressions by eachother.

string
eq(string $value1, string $value2)

Returns the SQL to check if two values are equal.

string
neq(string $value1, string $value2)

Returns the SQL to check if two values are unequal.

string
gt(string $value1, string $value2)

Returns the SQL to check if one value is greater than another value.

string
gte(string $value1, string $value2)

Returns the SQL to check if one value is greater than or equal to another value.

string
lt(string $value1, string $value2)

Returns the SQL to check if one value is less than another value.

string
lte(string $value1, string $value2)

Returns the SQL to check if one value is less than or equal to another value.

string
in(string $column, string|array(string) $values)

Returns the SQL to check if a value is one in a set of given values.

string
isNull(string $expression)

Returns SQL that checks if a expression is null.

string
isNotNull(string $expression)

Returns SQL that checks if a expression is not null.

string
between(string $expression, string $value1, string $value2)

Returns SQL that checks if an expression evaluates to a value between two values.

string
guid()

Returns global unique identifier

string
acos($value)

returns arcus cosine SQL string

void
sin(string $value)

sin

void
pi()

pi

void
cos(string $value)

cos

string
coalesce()

coalesce

__call($m, $a)

__call

Details

__construct(Doctrine_Connection $conn = null)

Parameters

Doctrine_Connection $conn Doctrine_Connection object, every connection module holds an instance of Doctrine_Connection

Doctrine_Connection getConnection()

getConnection returns the connection object this module uses

Return Value

Doctrine_Connection

string getModuleName()

getModuleName returns the name of this module

Return Value

string the name of this module

getIdentifier($column)

Parameters

$column

getIdentifiers($columns)

Parameters

$columns

string regexp()

regexp returns the regular expression operator

Return Value

string

string avg(string $column)

Returns the average value of a column

Parameters

string $column the column to use

Return Value

string generated sql including an AVG aggregate function

string count(string|integer $column)

Returns the number of rows (without a NULL value) of a column

If a '*' is used instead of a column the number of selected rows is returned.

Parameters

string|integer $column the column to use

Return Value

string generated sql including a COUNT aggregate function

string max(string $column)

Returns the highest value of a column

Parameters

string $column the column to use

Return Value

string generated sql including a MAX aggregate function

string min(string $column)

Returns the lowest value of a column

Parameters

string $column the column to use

Return Value

string

string sum(string $column)

Returns the total sum of a column

Parameters

string $column the column to use

Return Value

string

string md5($column)

Returns the md5 sum of a field.

Note: Not SQL92, but common functionality

Parameters

$column

Return Value

string

string length($column)

Returns the length of a text field.

Parameters

$column

Return Value

string

string round($column, $decimals = 0)

Rounds a numeric field to the number of decimals specified.

Parameters

$column
$decimals

Return Value

string

string mod(string $expression1, string $expression2)

Returns the remainder of the division operation $expression1 / $expression2.

Parameters

string $expression1
string $expression2

Return Value

string

string trim(string $str)

trim returns the string $str with leading and proceeding space characters removed

Parameters

string $str literal string or column name

Return Value

string

string rtrim(string $str)

rtrim returns the string $str with proceeding space characters removed

Parameters

string $str literal string or column name

Return Value

string

string ltrim(string $str)

ltrim returns the string $str with leading space characters removed

Parameters

string $str literal string or column name

Return Value

string

string upper(string $str)

upper Returns the string $str with all characters changed to uppercase according to the current character set mapping.

Parameters

string $str literal string or column name

Return Value

string

string lower(string $str)

lower Returns the string $str with all characters changed to lowercase according to the current character set mapping.

Parameters

string $str literal string or column name

Return Value

string

integer locate($str, $substr)

locate returns the position of the first occurrence of substring $substr in string $str

Parameters

$str
$substr

Return Value

integer

string now()

Returns the current system date.

Return Value

string

string soundex(string $value)

soundex Returns a string to call a function to compute the soundex encoding of a string

The string "?000" is returned if the argument is NULL.

Parameters

string $value

Return Value

string SQL soundex function with given parameter

string substring($value, $from, $len = null)

return string to call a function to get a substring inside an SQL statement

Note: Not SQL92, but common functionality.

SQLite only supports the 2 parameter variant of this function

Parameters

$value
$from
$len

Return Value

string SQL substring function with given parameters

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.

string not($expression)

Returns the SQL for a logical not.

Parameters

$expression

Return Value

string a logical expression

string add(array $args)

Returns the SQL to add values or expressions together.

add() accepts an arbitrary number of parameters. Each parameter must contain a value or an expression or an array with values or expressions.

Parameters

array $args

Return Value

string an expression

string sub(array $args)

Returns the SQL to subtract values or expressions from eachother.

subtract() accepts an arbitrary number of parameters. Each parameter must contain a value or an expression or an array with values or expressions.

Parameters

array $args

Return Value

string an expression

string mul(array $args)

Returns the SQL to multiply values or expressions by eachother.

multiply() accepts an arbitrary number of parameters. Each parameter must contain a value or an expression or an array with values or expressions.

Parameters

array $args

Return Value

string an expression

string div(array $args)

Returns the SQL to divide values or expressions by eachother.

divide() accepts an arbitrary number of parameters. Each parameter must contain a value or an expression or an array with values or expressions.

Parameters

array $args

Return Value

string an expression

string eq(string $value1, string $value2)

Returns the SQL to check if two values are equal.

Parameters

string $value1 logical expression to compare
string $value2 logical expression to compare with

Return Value

string logical expression

string neq(string $value1, string $value2)

Returns the SQL to check if two values are unequal.

Parameters

string $value1 logical expression to compare
string $value2 logical expression to compare with

Return Value

string logical expression

string gt(string $value1, string $value2)

Returns the SQL to check if one value is greater than another value.

Parameters

string $value1 logical expression to compare
string $value2 logical expression to compare with

Return Value

string logical expression

string gte(string $value1, string $value2)

Returns the SQL to check if one value is greater than or equal to another value.

Parameters

string $value1 logical expression to compare
string $value2 logical expression to compare with

Return Value

string logical expression

string lt(string $value1, string $value2)

Returns the SQL to check if one value is less than another value.

Parameters

string $value1 logical expression to compare
string $value2 logical expression to compare with

Return Value

string logical expression

string lte(string $value1, string $value2)

Returns the SQL to check if one value is less than or equal to another value.

Parameters

string $value1 logical expression to compare
string $value2 logical expression to compare with

Return Value

string logical expression

string in(string $column, string|array(string) $values)

Returns the SQL to check if a value is one in a set of given values.

.

in() accepts an arbitrary number of parameters. The first parameter must always specify the value that should be matched against. Successive must contain a logical expression or an array with logical expressions. These expressions will be matched against the first parameter.

Parameters

string $column the value that should be matched against
string|array(string) $values values that will be matched against $column

Return Value

string logical expression

string isNull(string $expression)

Returns SQL that checks if a expression is null.

Parameters

string $expression the expression that should be compared to null

Return Value

string logical expression

string isNotNull(string $expression)

Returns SQL that checks if a expression is not null.

Parameters

string $expression the expression that should be compared to null

Return Value

string logical expression

string between(string $expression, string $value1, string $value2)

Returns SQL that checks if an expression evaluates to a value between two values.

The parameter $expression is checked if it is between $value1 and $value2.

Note: There is a slight difference in the way BETWEEN works on some databases. http://www.w3schools.com/sql/sql_between.asp. If you want complete database independence you should avoid using between().

Parameters

string $expression the value to compare to
string $value1 the lower value to compare with
string $value2 the higher value to compare with

Return Value

string logical expression

string guid()

Returns global unique identifier

Return Value

string to get global unique identifier

string acos($value)

returns arcus cosine SQL string

Parameters

$value

Return Value

string

void sin(string $value)

sin

Parameters

string $value

Return Value

void

void pi()

pi

Return Value

void

void cos(string $value)

cos

Parameters

string $value

Return Value

void

string coalesce()

coalesce

Return Value

string

__call($m, $a)

__call

for all native RDBMS functions the function name itself is returned

Parameters

$m
$a