1
0
mirror of synced 2024-12-13 14:56:01 +03:00

Sqlite driver: added support for md5, mod and concat

This commit is contained in:
zYne 2006-11-02 13:34:33 +00:00
parent 76f4bfb90d
commit 9e35702c4d
2 changed files with 35 additions and 0 deletions

View File

@ -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.
*

View File

@ -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
*