Sqlite driver: added support for md5, mod and concat
This commit is contained in:
parent
76f4bfb90d
commit
9e35702c4d
@ -72,6 +72,15 @@ class Doctrine_Connection_Sqlite extends Doctrine_Connection_Common {
|
||||
|
||||
parent::__construct($manager, $pdo);
|
||||
}
|
||||
/**
|
||||
* initializes database functions missing in sqlite
|
||||
*/
|
||||
public function initFunctions() {
|
||||
$this->dbh->sqliteCreateFunction('md5', array('Doctrine_Expression_Sqlite', 'md5Impl'), 1);
|
||||
$this->dbh->sqliteCreateFunction('mod', array('Doctrine_Expression_Sqlite', 'modImpl'), 2);
|
||||
$this->dbh->sqliteCreateFunction('concat', array('Doctrine_Expression_Sqlite', 'concatImpl'));
|
||||
$this->dbh->sqliteCreateFunction('now', 'time', 0);
|
||||
}
|
||||
/**
|
||||
* Set the transacton isolation level.
|
||||
*
|
||||
|
@ -27,6 +27,32 @@ Doctrine::autoload('Doctrine_Expression');
|
||||
* @license LGPL
|
||||
*/
|
||||
class Doctrine_Expression_Sqlite extends Doctrine_Expression {
|
||||
/**
|
||||
* Returns the md5 sum of the data that SQLite's md5() function receives.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function md5Impl($data) {
|
||||
return md5($data);
|
||||
}
|
||||
/**
|
||||
* Returns the modules of the data that SQLite's mod() function receives.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function modImpl($dividend, $divisor) {
|
||||
return $dividend % $divisor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a concattenation of the data that SQLite's concat() function receives.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function concatImpl() {
|
||||
$args = func_get_args();
|
||||
return join( '', $args );
|
||||
}
|
||||
/**
|
||||
* returns the regular expression operator
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user