also show query on occuring error. helps for debugging to know which query has problems
[phpfspot.git] / phpfspot_db.php
index 1f7d59716a8a65d7df62e8dd92ccae260ad92609..7d8caa09f0a040ba770714c36e8adf81a7e108e7 100644 (file)
@@ -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 ."<br /><br />\n";
          print "<br /><br />". $string ."<br /><br />\n";
          try {
             throw new Exception;