translate_path() only needs one parameters. remove unused second one
[phpfspot.git] / phpfspot_db.php
index 7d8caa09f0a040ba770714c36e8adf81a7e108e7..90fdb8cc17392088a0d83763b7508b940dc764ce 100644 (file)
@@ -2,8 +2,9 @@
 
 /***************************************************************************
  *
- * Copyright (c) by Andreas Unterkircher, unki@netshadow.at
- * All rights reserved
+ * phpfspot, presents your F-Spot photo collection in Web browsers.
+ *
+ * Copyright (c) by Andreas Unterkircher
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *
  ***************************************************************************/
 
+/**
+ * PHPFSPOT_DB class
+ * @package phpfspot
+ */
 class PHPFSPOT_DB {
 
    private $db;
@@ -37,13 +42,15 @@ class PHPFSPOT_DB {
     */
    public function __construct($parent, $db_path)
    {
-      $this->parent = $parent;
+      global $phpfspot;
+
+      $this->parent = $phpfspot;
       $this->db_path = $db_path;
 
       /* We are starting disconnected */
       $this->setConnStatus(false);
 
-      /* Connect to MySQL Database */
+      /* Connect to database */
       $this->db_connect();
 
    } // __construct()
@@ -73,6 +80,7 @@ class PHPFSPOT_DB {
                $this->setConnStatus(false);
             }
             else {
+               sqlite3_create_function($this->db, 'basename', 1, 'basename');
                $this->setConnStatus(true);
             }
             break;
@@ -202,10 +210,10 @@ 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];
+               $row = $result->fetch();
                break;
          }
          return $row;
@@ -234,19 +242,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
     *