change text of where the welcome template can be found
[phpfspot.git] / phpfspot_db.php
index 11ce7c8fc6c970222c06db572a64ec70ae9f9816..807cf0feb36ca072307497ba4d920208b4b27b3c 100644 (file)
@@ -28,6 +28,7 @@ class PHPFSPOT_DB {
    private $parent;
    private $is_connected;
    private $last_error;
    private $parent;
    private $is_connected;
    private $last_error;
+   private $last_query;
 
    /**
     * PHPFSPOT_DB class constructor
 
    /**
     * PHPFSPOT_DB class constructor
@@ -42,7 +43,7 @@ class PHPFSPOT_DB {
       /* We are starting disconnected */
       $this->setConnStatus(false);
 
       /* We are starting disconnected */
       $this->setConnStatus(false);
 
-      /* Connect to MySQL Database */
+      /* Connect to database */
       $this->db_connect();
 
    } // __construct()
       $this->db_connect();
 
    } // __construct()
@@ -61,7 +62,7 @@ class PHPFSPOT_DB {
    /**
     * PHPFSPOT_DB database connect
     *
    /**
     * PHPFSPOT_DB database connect
     *
-    * This function will connect to the database via MDB2
+    * This function will connect to the database
     */
    private function db_connect()
    {
     */
    private function db_connect()
    {
@@ -72,6 +73,7 @@ class PHPFSPOT_DB {
                $this->setConnStatus(false);
             }
             else {
                $this->setConnStatus(false);
             }
             else {
+               sqlite3_create_function($this->db, 'basename', 1, 'basename');
                $this->setConnStatus(true);
             }
             break;
                $this->setConnStatus(true);
             }
             break;
@@ -118,6 +120,8 @@ class PHPFSPOT_DB {
    public function db_query($query = "")
    {
       if($this->getConnStatus()) {
    public function db_query($query = "")
    {
       if($this->getConnStatus()) {
+   
+         $this->last_query = $query;
 
          switch($this->parent->cfg->db_access) {
             case 'native':
 
          switch($this->parent->cfg->db_access) {
             case 'native':
@@ -153,6 +157,8 @@ class PHPFSPOT_DB {
    {
       if($this->getConnStatus()) {
 
    {
       if($this->getConnStatus()) {
 
+         $this->last_query = $query;
+
          switch($this->parent->cfg->db_access) {
             case 'native':
                if(($result = sqlite3_exec($this->db, $query)) === false)
          switch($this->parent->cfg->db_access) {
             case 'native':
                if(($result = sqlite3_exec($this->db, $query)) === false)
@@ -197,10 +203,10 @@ class PHPFSPOT_DB {
          $result = $this->db_query($query);
          switch($this->parent->cfg->db_access) {
             case 'native':
          $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':
                break;
             case 'pdo':
-               $row = $result[0];
+               $row = $result->fetch();
                break;
          }
          return $row;
                break;
          }
          return $row;
@@ -229,19 +235,6 @@ class PHPFSPOT_DB {
 
    } // db_getNumRows()
 
 
    } // 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
     *
    /**
     * PHPFSPOT_DB check table exists
     *
@@ -308,6 +301,7 @@ class PHPFSPOT_DB {
    private function ThrowError($string)
    {
       if(!defined('DB_NOERROR'))  {
    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;
          print "<br /><br />". $string ."<br /><br />\n";
          try {
             throw new Exception;