cvs: pear /MDB2/MDB2/Driver sqlite.php

From: Date: Fri, 17 Mar 2006 08:36:12 +0000
Subject: cvs: pear /MDB2/MDB2/Driver sqlite.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-39142@lists.php.net to get a copy of this message
lsmith Fri Mar 17 08:36:12 2006 UTC Modified files: /pear/MDB2/MDB2/Driver sqlite.php Log: - fix bug sqlite:///:memory: trys to open file (bug #6599) http://cvs.php.net/viewcvs.cgi/pear/MDB2/MDB2/Driver/sqlite.php?r1=1.100&r2=1.101&diff_format=u Index: pear/MDB2/MDB2/Driver/sqlite.php diff -u pear/MDB2/MDB2/Driver/sqlite.php:1.100 pear/MDB2/MDB2/Driver/sqlite.php:1.101 --- pear/MDB2/MDB2/Driver/sqlite.php:1.100 Mon Mar 13 08:09:44 2006 +++ pear/MDB2/MDB2/Driver/sqlite.php Fri Mar 17 08:36:12 2006 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: sqlite.php,v 1.100 2006/03/13 08:09:44 lsmith Exp $ +// $Id: sqlite.php,v 1.101 2006/03/17 08:36:12 lsmith Exp $ // /** @@ -249,7 +249,7 @@ */ function _getDatabaseFile($database_name) { - if ($database_name == '') { + if ($database_name === '' || $database_name === ':memory:') { return $database_name; } return $this->options['database_path'].$database_name.$this->options['database_extension']; @@ -282,30 +282,32 @@ } if (!empty($this->database_name)) { - if (!file_exists($database_file)) { - if (!touch($database_file)) { - return $this->raiseError(MDB2_ERROR_NOT_FOUND); - } - if (!isset($this->dsn['mode']) - || !is_numeric($this->dsn['mode']) - ) { - $mode = 0644; - } else { - $mode = octdec($this->dsn['mode']); + if ($database_file !== ':memory:') { + if (!file_exists($database_file)) { + if (!touch($database_file)) { + return $this->raiseError(MDB2_ERROR_NOT_FOUND); + } + if (!isset($this->dsn['mode']) + || !is_numeric($this->dsn['mode']) + ) { + $mode = 0644; + } else { + $mode = octdec($this->dsn['mode']); + } + if (!chmod($database_file, $mode)) { + return $this->raiseError(MDB2_ERROR_NOT_FOUND); + } + if (!file_exists($database_file)) { + return $this->raiseError(MDB2_ERROR_NOT_FOUND); + } } - if (!chmod($database_file, $mode)) { - return $this->raiseError(MDB2_ERROR_NOT_FOUND); + if (!is_file($database_file)) { + return $this->raiseError(MDB2_ERROR_INVALID); } - if (!file_exists($database_file)) { - return $this->raiseError(MDB2_ERROR_NOT_FOUND); + if (!is_readable($database_file)) { + return $this->raiseError(MDB2_ERROR_ACCESS_VIOLATION); } } - if (!is_file($database_file)) { - return $this->raiseError(MDB2_ERROR_INVALID); - } - if (!is_readable($database_file)) { - return $this->raiseError(MDB2_ERROR_ACCESS_VIOLATION); - } $connect_function = ($this->options['persistent'] ? 'sqlite_popen' : 'sqlite_open'); $php_errormsg = '';

« previous php.pear.cvs (#39142) next »