From af14c812ce475f6b241c4f2a5ea68805e4cf07ee Mon Sep 17 00:00:00 2001 From: jackbravo <jackbravo@625475ce-881a-0410-a577-b389adb331d8> Date: Wed, 5 Sep 2007 22:03:57 +0000 Subject: [PATCH] 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. --- lib/Doctrine/Connection/Sqlite.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/Doctrine/Connection/Sqlite.php b/lib/Doctrine/Connection/Sqlite.php index 2e81479bb..b3e8e8342 100644 --- a/lib/Doctrine/Connection/Sqlite.php +++ b/lib/Doctrine/Connection/Sqlite.php @@ -74,6 +74,13 @@ class Doctrine_Connection_Sqlite extends Doctrine_Connection_Common $this->options['server_version'] = ''; */ 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 @@ -83,6 +90,10 @@ class Doctrine_Connection_Sqlite extends Doctrine_Connection_Common */ public function connect() { + if ($this->isConnected) { + return false; + } + parent::connect(); $this->dbh->sqliteCreateFunction('mod', array('Doctrine_Expression_Sqlite', 'modImpl'), 2);