diff options
author | Andreas Unterkircher <unki@netshadow.at> | 2007-12-30 12:19:22 +0100 |
---|---|---|
committer | Andreas Unterkircher <unki@netshadow.at> | 2007-12-30 12:19:22 +0100 |
commit | 42421caef780487aeaa633f62ae08ec397865b68 (patch) | |
tree | 339f45ce1603219727c36872354bec941e28048a /phpfspot_db.php | |
parent | 8de7a22ceac0fab9eb984854758608d7aeb079d3 (diff) | |
parent | 18ff7e0419aebe37fcebdbfb180550acb118c0cb (diff) |
Merge branch 'master' of /var/cache/git/phpfspot
Diffstat (limited to 'phpfspot_db.php')
-rw-r--r-- | phpfspot_db.php | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/phpfspot_db.php b/phpfspot_db.php index 1f7d597..e9c99ce 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 @@ -42,7 +43,7 @@ class PHPFSPOT_DB { /* We are starting disconnected */ $this->setConnStatus(false); - /* Connect to MySQL Database */ + /* Connect to database */ $this->db_connect(); } // __construct() @@ -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) @@ -197,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]; @@ -230,19 +235,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 * * This function checks if the given table exists in the @@ -308,6 +300,7 @@ class PHPFSPOT_DB { private function ThrowError($string) { if(!defined('DB_NOERROR')) { + print "Error during query: ". $this->last_query ."<br /><br />\n"; print "<br /><br />". $string ."<br /><br />\n"; try { throw new Exception; |