}
}
- public function openConnection($adapter, $name = null, $setCurrent = true)
+ public function openConnection($adapter, $name = null, $setCurrent = true, $persistent = false)
{
if (is_object($adapter)) {
if ( ! ($adapter instanceof PDO) && ! in_array('IPF_ORM_Adapter_Interface', class_implements($adapter))) {
$className = $drivers[$driverName];
$conn = new $className($this, $adapter);
+ if ($persistent)
+ $conn->setOption(IPF_ORM::ATTR_PERSISTENT, true);
$conn->setName($name);
$conn->setCharset('utf8');
$dsn = IPF::get('dsn');
if ($dsn=='')
throw new IPF_Exception_Panic('Specify dsn in config file');
- $conn = IPF_ORM_Manager::connection($dsn);
+
+ IPF_ORM_Manager::getInstance()->openConnection($dsn, null, true, IPF::get('db_persistent', false));
if (IPF::get('debug')){
$this->sqlProfiler = new IPF_ORM_Connection_Profiler();