cvs: pear /DB/DB sqlite.php
| From: | Mika Tuupola | Date: | Sun, 07 Sep 2003 20:09:45 +0000 |
| Subject: | cvs: pear /DB/DB sqlite.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-12531@lists.php.net to get a copy of this message | ||
tuupola Sun Sep 7 16:09:45 2003 EDT
Modified files:
/pear/DB/DB sqlite.php
Log:
* CS and comments
Index: pear/DB/DB/sqlite.php
diff -u pear/DB/DB/sqlite.php:1.11 pear/DB/DB/sqlite.php:1.12
--- pear/DB/DB/sqlite.php:1.11 Sun Sep 7 16:01:44 2003
+++ pear/DB/DB/sqlite.php Sun Sep 7 16:09:44 2003
@@ -17,7 +17,7 @@
// | Mika Tuupola <tuupola@appelsiini.net> |
// +----------------------------------------------------------------------+
//
-// $Id: sqlite.php,v 1.11 2003/09/07 20:01:44 tuupola Exp $
+// $Id: sqlite.php,v 1.12 2003/09/07 20:09:44 tuupola Exp $
//
// Database independent query interface definition for the PECL's SQLite
// extension.
@@ -50,6 +50,7 @@
require_once 'DB/sqlite.php';
// Define a DSN
+ // TODO: mode should be passed id options array, fix example.
$dsn = array (
'phptype' => "sqlite",
'database' => getcwd() . "/test1.db",
@@ -120,9 +121,6 @@
*/
function DB_sqlite() {
- /* for retrieving meaningfull error messages */
- /* TODO: set it back to original somewhere */
-
$this->DB_common();
$this->phptype = 'sqlite';
$this->dbsyntax = 'sqlite';
@@ -177,25 +175,26 @@
$ret = DB_OK;
$file = $dsninfo['database'];
- if (!DB::assertExtension('sqlite'))
+ if (!DB::assertExtension('sqlite')) {
return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
+ }
if (isset($file)) {
if (!file_exists($file)) {
touch($file );
- chmod($file, (is_numeric($dsninfo['mode']) ? $dsninfo['mode'] :
0644 ));
+ chmod($file, (is_numeric($dsninfo['mode']) ? $dsninfo['mode'] :
0644));
if (!file_exists($file)) {
- return $this->sqliteRaiseError(DB_ERROR_NOT_FOUND );
+ return $this->sqliteRaiseError(DB_ERROR_NOT_FOUND);
}
}
if (!is_file($file)) {
- return $this->sqliteRaiseError(DB_ERROR_INVALID );
+ return $this->sqliteRaiseError(DB_ERROR_INVALID);
}
if (!is_readable($file)) {
- return $this->sqliteRaiseError(DB_ERROR_ACCESS_VIOLATION );
+ return $this->sqliteRaiseError(DB_ERROR_ACCESS_VIOLATION);
}
} else {
- return $this->sqliteRaiseError(DB_ERROR_ACCESS_VIOLATION );
+ return $this->sqliteRaiseError(DB_ERROR_ACCESS_VIOLATION);
}
$connect_function = $persistent ? 'sqlite_open' : 'sqlite_popen';
@@ -294,7 +293,7 @@
}
$res = $this->fetchInto($this->result, $arr, $fetchmode, $rownum );
if (!$res) {
- $errno = sqlite_last_error($this->connection );
+ $errno = sqlite_last_error($this->connection);
if (!$errno) {
return null;
}
@@ -329,12 +328,12 @@
}
}
if ($fetchmode & DB_FETCHMODE_ASSOC ) {
- $arr = sqlite_fetch_array($this->result, SQLITE_ASSOC );
+ $arr = sqlite_fetch_array($this->result, SQLITE_ASSOC);
} else {
- $arr = sqlite_fetch_array($this->result, SQLITE_NUM );
+ $arr = sqlite_fetch_array($this->result, SQLITE_NUM);
}
if (!$arr) {
- $errno = sqlite_last_error($this->connection );
+ $errno = sqlite_last_error($this->connection);
if (!$errno) {
return null;
}