Doctrine 1.2.4
Doctrine_Expression_Sqlite Class Reference

Inherits Doctrine_Expression_Driver.

Public Member Functions

 __call ($m, $a)
 
 acos ($value)
 
 add (array $args)
 
 avg ($column)
 
 between ($expression, $value1, $value2)
 
 coalesce ()
 
 concat ()
 
 cos ($value)
 
 count ($column)
 
 div (array $args)
 
 eq ($value1, $value2)
 
 getConnection ()
 
 getModuleName ()
 
 gt ($value1, $value2)
 
 gte ($value1, $value2)
 
 guid ()
 
 in ($column, $values)
 
 isNotNull ($expression)
 
 isNull ($expression)
 
 length ($column)
 
 locate ($str, $substr)
 
 lower ($str)
 
 lt ($value1, $value2)
 
 lte ($value1, $value2)
 
 ltrim ($str)
 
 max ($column)
 
 md5 ($column)
 
 min ($column)
 
 mod ($expression1, $expression2)
 
 mul (array $args)
 
 neq ($value1, $value2)
 
 not ($expression)
 
 now ($type= 'timestamp')
 
 now ()
 
 pi ()
 
 random ()
 
 regexp ()
 
 round ($column, $decimals=0)
 
 rtrim ($str)
 
 sin ($value)
 
 soundex ($value)
 
 sub (array $args)
 
 substring ($value, $position, $length=null)
 
 sum ($column)
 
 trim ($str)
 
 upper ($str)
 

Static Public Member Functions

static concatImpl ()
 
static locateImpl ($substr, $str)
 
static md5Impl ($data)
 
static modImpl ($dividend, $divisor)
 

Detailed Description

Definition at line 33 of file Sqlite.php.

Member Function Documentation

Doctrine_Expression_Driver::__call (   $m,
  $a 
)
inherited

__call

for all native RDBMS functions the function name itself is returned

Definition at line 639 of file Driver.php.

{
if ($this->conn->getAttribute(Doctrine_Core::ATTR_PORTABILITY) & Doctrine_Core::PORTABILITY_EXPR) {
throw new Doctrine_Expression_Exception('Unknown expression: ' . $m);
}
return $m . '(' . implode(', ', $a) . ')';
}
Doctrine_Expression_Driver::acos (   $value)
inherited

returns arcus cosine SQL string

Returns
string

Definition at line 585 of file Driver.php.

{
return 'ACOS(' . $value . ')';
}
Doctrine_Expression_Driver::add ( array  $args)
inherited

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
string|array(string)
Returns
string an expression

Definition at line 360 of file Driver.php.

{
return $this->basicMath('+', $args);
}
Doctrine_Expression_Driver::avg (   $column)
inherited

Returns the average value of a column

Parameters
string$columnthe column to use
Returns
string generated sql including an AVG aggregate function

Definition at line 62 of file Driver.php.

{
$column = $this->getIdentifier($column);
return 'AVG(' . $column . ')';
}
Doctrine_Expression_Driver::between (   $expression,
  $value1,
  $value2 
)
inherited

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$expressionthe value to compare to
string$value1the lower value to compare with
string$value2the higher value to compare with
Returns
string logical expression

Definition at line 562 of file Driver.php.

{
$expression = $this->getIdentifier($expression);
$value1 = $this->getIdentifier($value1);
$value2 = $this->getIdentifier($value2);
return $expression . ' BETWEEN ' .$value1 . ' AND ' . $value2;
}
Doctrine_Expression_Driver::coalesce ( )
inherited

coalesce

Returns
string

Definition at line 627 of file Driver.php.

{
$args = func_get_args();
return 'COALESCE(' . join(', ', (array) $args) . ')';
}
Doctrine_Expression_Driver::concat ( )
inherited

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
string|array(string)strings that will be concatinated.

Definition at line 307 of file Driver.php.

{
$args = func_get_args();
return 'CONCAT(' . join(', ', (array) $args) . ')';
}
static Doctrine_Expression_Sqlite::concatImpl ( )
static

Returns a concatenation of the data that SQLite's concat() function receives.

Returns
string

Definition at line 63 of file Sqlite.php.

{
$args = func_get_args();
return join('', $args);
}
Doctrine_Expression_Driver::cos (   $value)
inherited

cos

Parameters
string$value
Returns
void

Definition at line 617 of file Driver.php.

{
return 'COS(' . $value . ')';
}
Doctrine_Expression_Driver::count (   $column)
inherited

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$columnthe column to use
Returns
string generated sql including a COUNT aggregate function

Definition at line 77 of file Driver.php.

{
$column = $this->getIdentifier($column);
return 'COUNT(' . $column . ')';
}
Doctrine_Expression_Driver::div ( array  $args)
inherited

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
string|array(string)
Returns
string an expression

Definition at line 405 of file Driver.php.

{
return $this->basicMath('/', $args);
}
Doctrine_Expression_Driver::eq (   $value1,
  $value2 
)
inherited

Returns the SQL to check if two values are equal.

Parameters
string$value1logical expression to compare
string$value2logical expression to compare with
Returns
string logical expression

Definition at line 417 of file Driver.php.

{
$value1 = $this->getIdentifier($value1);
$value2 = $this->getIdentifier($value2);
return $value1 . ' = ' . $value2;
}
Doctrine_Connection_Module::getConnection ( )
inherited

getConnection returns the connection object this module uses

Returns
Doctrine_Connection

Definition at line 68 of file Module.php.

{
return $this->conn;
}
Doctrine_Connection_Module::getModuleName ( )
inherited

getModuleName returns the name of this module

Returns
string the name of this module

Definition at line 79 of file Module.php.

{
return $this->moduleName;
}
Doctrine_Expression_Driver::gt (   $value1,
  $value2 
)
inherited

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

Parameters
string$value1logical expression to compare
string$value2logical expression to compare with
Returns
string logical expression

Definition at line 445 of file Driver.php.

{
$value1 = $this->getIdentifier($value1);
$value2 = $this->getIdentifier($value2);
return $value1 . ' > ' . $value2;
}
Doctrine_Expression_Driver::gte (   $value1,
  $value2 
)
inherited

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

Parameters
string$value1logical expression to compare
string$value2logical expression to compare with
Returns
string logical expression

Definition at line 460 of file Driver.php.

{
$value1 = $this->getIdentifier($value1);
$value2 = $this->getIdentifier($value2);
return $value1 . ' >= ' . $value2;
}
Doctrine_Expression_Driver::guid ( )
inherited

Returns global unique identifier

Returns
string to get global unique identifier

Definition at line 575 of file Driver.php.

{
throw new Doctrine_Expression_Exception('method not implemented');
}
Doctrine_Expression_Driver::in (   $column,
  $values 
)
inherited

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$columnthe value that should be matched against
string|array(string)values that will be matched against $column
Returns
string logical expression

Definition at line 509 of file Driver.php.

{
if ( ! is_array($values)) {
$values = array($values);
}
$values = $this->getIdentifiers($values);
$column = $this->getIdentifier($column);
if (count($values) == 0) {
throw new Doctrine_Expression_Exception('Values array for IN operator should not be empty.');
}
return $column . ' IN (' . implode(', ', $values) . ')';
}
Doctrine_Expression_Driver::isNotNull (   $expression)
inherited

Returns SQL that checks if a expression is not null.

Parameters
string$expressionthe expression that should be compared to null
Returns
string logical expression

Definition at line 541 of file Driver.php.

{
$expression = $this->getIdentifier($expression);
return $expression . ' IS NOT NULL';
}
Doctrine_Expression_Driver::isNull (   $expression)
inherited

Returns SQL that checks if a expression is null.

Parameters
string$expressionthe expression that should be compared to null
Returns
string logical expression

Definition at line 529 of file Driver.php.

{
$expression = $this->getIdentifier($expression);
return $expression . ' IS NULL';
}
Doctrine_Expression_Driver::length (   $column)
inherited

Returns the length of a text field.

Parameters
string$expression1
string$expression2
Returns
string

Definition at line 141 of file Driver.php.

{
$column = $this->getIdentifier($column);
return 'LENGTH(' . $column . ')';
}
Doctrine_Expression_Driver::locate (   $str,
  $substr 
)
inherited

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

Parameters
string$substrliteral string to find
string$strliteral string
Returns
integer

Definition at line 246 of file Driver.php.

{
return 'LOCATE(' . $str . ', ' . $substr . ')';
}
static Doctrine_Expression_Sqlite::locateImpl (   $substr,
  $str 
)
static

locate returns the position of the first occurrence of substring $substr in string $str that SQLite's locate() function receives

Parameters
string$substrliteral string to find
string$strliteral string
Returns
string

Definition at line 78 of file Sqlite.php.

{
return strpos($str, $substr);
}
Doctrine_Expression_Driver::lower (   $str)
inherited

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

Parameters
string$strliteral string or column name
Returns
string

Definition at line 233 of file Driver.php.

{
return 'LOWER(' . $str . ')';
}
Doctrine_Expression_Driver::lt (   $value1,
  $value2 
)
inherited

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

Parameters
string$value1logical expression to compare
string$value2logical expression to compare with
Returns
string logical expression

Definition at line 474 of file Driver.php.

{
$value1 = $this->getIdentifier($value1);
$value2 = $this->getIdentifier($value2);
return $value1 . ' < ' . $value2;
}
Doctrine_Expression_Driver::lte (   $value1,
  $value2 
)
inherited

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

Parameters
string$value1logical expression to compare
string$value2logical expression to compare with
Returns
string logical expression

Definition at line 489 of file Driver.php.

{
$value1 = $this->getIdentifier($value1);
$value2 = $this->getIdentifier($value2);
return $value1 . ' <= ' . $value2;
}
Doctrine_Expression_Driver::ltrim (   $str)
inherited

ltrim returns the string $str with leading space characters removed

Parameters
string$strliteral string or column name
Returns
string

Definition at line 207 of file Driver.php.

{
return 'LTRIM(' . $str . ')';
}
Doctrine_Expression_Driver::max (   $column)
inherited

Returns the highest value of a column

Parameters
string$columnthe column to use
Returns
string generated sql including a MAX aggregate function

Definition at line 89 of file Driver.php.

{
$column = $this->getIdentifier($column);
return 'MAX(' . $column . ')';
}
Doctrine_Expression_Driver::md5 (   $column)
inherited

Returns the md5 sum of a field.

Note: Not SQL92, but common functionality

Returns
string

Definition at line 128 of file Driver.php.

{
$column = $this->getIdentifier($column);
return 'MD5(' . $column . ')';
}
static Doctrine_Expression_Sqlite::md5Impl (   $data)
static

Returns the md5 sum of the data that SQLite's md5() function receives.

Parameters
mixed$data
Returns
string

Definition at line 41 of file Sqlite.php.

{
return md5($data);
}
Doctrine_Expression_Driver::min (   $column)
inherited

Returns the lowest value of a column

Parameters
string$columnthe column to use
Returns
string

Definition at line 101 of file Driver.php.

{
$column = $this->getIdentifier($column);
return 'MIN(' . $column . ')';
}
Doctrine_Expression_Driver::mod (   $expression1,
  $expression2 
)
inherited

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

Parameters
string$expression1
string$expression2
Returns
string

Definition at line 169 of file Driver.php.

{
$expression1 = $this->getIdentifier($expression1);
$expression2 = $this->getIdentifier($expression2);
return 'MOD(' . $expression1 . ', ' . $expression2 . ')';
}
static Doctrine_Expression_Sqlite::modImpl (   $dividend,
  $divisor 
)
static

Returns the modules of the data that SQLite's mod() function receives.

Parameters
integer$dividend
integer$divisor
Returns
string

Definition at line 53 of file Sqlite.php.

{
return $dividend % $divisor;
}
Doctrine_Expression_Driver::mul ( array  $args)
inherited

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
string|array(string)
Returns
string an expression

Definition at line 390 of file Driver.php.

{
return $this->basicMath('*', $args);
}
Doctrine_Expression_Driver::neq (   $value1,
  $value2 
)
inherited

Returns the SQL to check if two values are unequal.

Parameters
string$value1logical expression to compare
string$value2logical expression to compare with
Returns
string logical expression

Definition at line 431 of file Driver.php.

{
$value1 = $this->getIdentifier($value1);
$value2 = $this->getIdentifier($value2);
return $value1 . ' <> ' . $value2;
}
Doctrine_Expression_Driver::not (   $expression)
inherited

Returns the SQL for a logical not.

Returns
string a logical expression

Definition at line 319 of file Driver.php.

{
$expression = $this->getIdentifier($expression);
return 'NOT(' . $expression . ')';
}
Doctrine_Expression_Sqlite::now (   $type = 'timestamp')

Return string to call a variable with the current timestamp inside an SQL statement There are three special variables for current date and time.

Returns
string sqlite function as string

Definition at line 138 of file Sqlite.php.

{
switch ($type) {
case 'time':
return 'time(\'now\')';
case 'date':
return 'date(\'now\')';
case 'timestamp':
default:
return 'datetime(\'now\')';
}
}
Doctrine_Expression_Driver::now ( )
inherited

Returns the current system date.

Returns
string

Definition at line 256 of file Driver.php.

{
return 'NOW()';
}
Doctrine_Expression_Driver::pi ( )
inherited

pi

Returns
void

Definition at line 606 of file Driver.php.

{
return 'PI()';
}
Doctrine_Expression_Sqlite::random ( )

return string to call a function to get random value inside an SQL statement

Returns
string to generate float between 0 and 1

Definition at line 156 of file Sqlite.php.

{
return '((RANDOM() + 2147483648) / 4294967296)';
}
Doctrine_Expression_Sqlite::regexp ( )

returns the regular expression operator

Returns
string

Definition at line 112 of file Sqlite.php.

{
return 'RLIKE';
}
Doctrine_Expression_Driver::round (   $column,
  $decimals = 0 
)
inherited

Rounds a numeric field to the number of decimals specified.

Parameters
string$expression1
string$expression2
Returns
string

Definition at line 154 of file Driver.php.

{
$column = $this->getIdentifier($column);
return 'ROUND(' . $column . ', ' . $decimals . ')';
}
Doctrine_Expression_Driver::rtrim (   $str)
inherited

rtrim returns the string $str with proceeding space characters removed

Parameters
string$strliteral string or column name
Returns
string

Definition at line 195 of file Driver.php.

{
return 'RTRIM(' . $str . ')';
}
Doctrine_Expression_Driver::sin (   $value)
inherited

sin

Parameters
string$value
Returns
void

Definition at line 596 of file Driver.php.

{
return 'SIN(' . $value . ')';
}
Doctrine_Expression_Sqlite::soundex (   $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
Returns
string SQL soundex function with given parameter

Definition at line 127 of file Sqlite.php.

{
return 'SOUNDEX(' . $value . ')';
}
Doctrine_Expression_Driver::sub ( array  $args)
inherited

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
string|array(string)
Returns
string an expression

Definition at line 375 of file Driver.php.

{
return $this->basicMath('-', $args );
}
Doctrine_Expression_Sqlite::substring (   $value,
  $position,
  $length = 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
string$valuean sql string literal or column name/alias
integer$positionwhere to start the substring portion
integer$lengththe substring portion length
Returns
string SQL substring function with given parameters

Definition at line 173 of file Sqlite.php.

{
if ($length !== null) {
return 'SUBSTR(' . $value . ', ' . $position . ', ' . $length . ')';
}
return 'SUBSTR(' . $value . ', ' . $position . ', LENGTH(' . $value . '))';
}
Doctrine_Expression_Driver::sum (   $column)
inherited

Returns the total sum of a column

Parameters
string$columnthe column to use
Returns
string

Definition at line 113 of file Driver.php.

{
$column = $this->getIdentifier($column);
return 'SUM(' . $column . ')';
}
Doctrine_Expression_Driver::trim (   $str)
inherited

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

Parameters
string$strliteral string or column name
Returns
string

Definition at line 183 of file Driver.php.

{
return 'TRIM(' . $str . ')';
}
Doctrine_Expression_Driver::upper (   $str)
inherited

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

Parameters
string$strliteral string or column name
Returns
string

Definition at line 220 of file Driver.php.

{
return 'UPPER(' . $str . ')';
}

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