1
0
mirror of synced 2025-01-18 06:21:40 +03:00

Memory problem solved. Sqlite creating functions repeatedly.

Doctrine_Connection_Sqlite::connect was creating functions every time it was called even if it was allready connected.
This commit is contained in:
jackbravo 2007-09-05 22:03:57 +00:00
parent 87afb489b4
commit af14c812ce

View File

@ -74,6 +74,13 @@ class Doctrine_Connection_Sqlite extends Doctrine_Connection_Common
$this->options['server_version'] = ''; $this->options['server_version'] = '';
*/ */
parent::__construct($manager, $adapter); parent::__construct($manager, $adapter);
if ($this->isConnected) {
$this->dbh->sqliteCreateFunction('mod', array('Doctrine_Expression_Sqlite', 'modImpl'), 2);
$this->dbh->sqliteCreateFunction('concat', array('Doctrine_Expression_Sqlite', 'concatImpl'));
$this->dbh->sqliteCreateFunction('md5', 'md5', 1);
$this->dbh->sqliteCreateFunction('now', 'time', 0);
}
} }
/** /**
* initializes database functions missing in sqlite * initializes database functions missing in sqlite
@ -83,6 +90,10 @@ class Doctrine_Connection_Sqlite extends Doctrine_Connection_Common
*/ */
public function connect() public function connect()
{ {
if ($this->isConnected) {
return false;
}
parent::connect(); parent::connect();
$this->dbh->sqliteCreateFunction('mod', array('Doctrine_Expression_Sqlite', 'modImpl'), 2); $this->dbh->sqliteCreateFunction('mod', array('Doctrine_Expression_Sqlite', 'modImpl'), 2);