From e4cfdbe7da6340d8c06f797eba686797391717c6 Mon Sep 17 00:00:00 2001 From: Andreas Unterkircher Date: Sun, 30 Dec 2007 11:04:28 +0100 Subject: also show query on occuring error. helps for debugging to know which query has problems --- phpfspot_db.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'phpfspot_db.php') diff --git a/phpfspot_db.php b/phpfspot_db.php index 1f7d597..7d8caa0 100644 --- a/phpfspot_db.php +++ b/phpfspot_db.php @@ -28,6 +28,7 @@ class PHPFSPOT_DB { private $parent; private $is_connected; private $last_error; + private $last_query; /** * PHPFSPOT_DB class constructor @@ -118,6 +119,8 @@ class PHPFSPOT_DB { public function db_query($query = "") { if($this->getConnStatus()) { + + $this->last_query = $query; switch($this->parent->cfg->db_access) { case 'native': @@ -153,6 +156,8 @@ class PHPFSPOT_DB { { if($this->getConnStatus()) { + $this->last_query = $query; + switch($this->parent->cfg->db_access) { case 'native': if(($result = sqlite3_exec($this->db, $query)) === false) @@ -308,6 +313,7 @@ class PHPFSPOT_DB { private function ThrowError($string) { if(!defined('DB_NOERROR')) { + print "Error during query: ". $this->last_query ."

\n"; print "

". $string ."

\n"; try { throw new Exception; -- cgit v1.2.3-18-g5258 From af140085fe603c00c7ce98435b89d2ee56a10cd9 Mon Sep 17 00:00:00 2001 From: Andreas Unterkircher Date: Sun, 30 Dec 2007 11:05:17 +0100 Subject: removed any trace of MySQL from PHPFSPOT_DB --- phpfspot_db.php | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'phpfspot_db.php') diff --git a/phpfspot_db.php b/phpfspot_db.php index 7d8caa0..4e87cf9 100644 --- a/phpfspot_db.php +++ b/phpfspot_db.php @@ -43,7 +43,7 @@ class PHPFSPOT_DB { /* We are starting disconnected */ $this->setConnStatus(false); - /* Connect to MySQL Database */ + /* Connect to database */ $this->db_connect(); } // __construct() @@ -234,19 +234,6 @@ class PHPFSPOT_DB { } // db_getNumRows() - /** - * PHPFSPOT_DB get primary key - * - * This function returns the primary key of the last - * operated insert SQL query. - */ - public function db_getid() - { - /* Get the last primary key ID from execute query */ - return mysql_insert_id($this->db->connection); - - } // db_getid() - /** * PHPFSPOT_DB check table exists * -- cgit v1.2.3-18-g5258 From e8bc8f7d5f8dea6906f6e61ba464353c92e87ccf Mon Sep 17 00:00:00 2001 From: Andreas Unterkircher Date: Sun, 30 Dec 2007 11:17:16 +0100 Subject: issue82, read out F-Spot DB version to differ between different databases schemas --- phpfspot_db.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpfspot_db.php') diff --git a/phpfspot_db.php b/phpfspot_db.php index 4e87cf9..e9c99ce 100644 --- a/phpfspot_db.php +++ b/phpfspot_db.php @@ -202,7 +202,7 @@ class PHPFSPOT_DB { $result = $this->db_query($query); switch($this->parent->cfg->db_access) { case 'native': - $row = $result->fetchRow(); + $row = $this->db_fetch_object($result); break; case 'pdo': $row = $result[0]; -- cgit v1.2.3-18-g5258