[Android] DatabaseManager: re-enable and update mediaItemExists()

Edward Wang git at videolan.org
Fri Feb 8 05:23:47 CET 2013


vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Thu Feb  7 22:32:36 2013 -0500| [35127d3e271b4707e28992584ea535ebc8a19a57] | committer: Edward Wang

DatabaseManager: re-enable and update mediaItemExists()

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=35127d3e271b4707e28992584ea535ebc8a19a57
---

 .../src/org/videolan/vlc/DatabaseManager.java      |   30 ++++++++++----------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/DatabaseManager.java b/vlc-android/src/org/videolan/vlc/DatabaseManager.java
index 115b000..579d573 100644
--- a/vlc-android/src/org/videolan/vlc/DatabaseManager.java
+++ b/vlc-android/src/org/videolan/vlc/DatabaseManager.java
@@ -260,21 +260,21 @@ public class DatabaseManager {
 
     }
 
-    //    /**
-    //     * Check if the item already in the database
-    //     * @param path of the item (primary key)
-    //     * @return
-    //     */
-    //    public synchronized boolean mediaItemExists(String path) {
-    //        Cursor cursor = mDb.query(MEDIA_TABLE_NAME,
-    //                    new String[] { DIR_ROW_PATH },
-    //                    MEDIA_PATH + "=?",
-    //                    new String[] { path },
-    //                    null, null, null);
-    //        boolean exists = cursor.moveToFirst();
-    //        cursor.close();
-    //        return exists;
-    //    }
+    /**
+     * Check if the item is already in the database
+     * @param location of the item (primary key)
+     * @return True if the item exists, false if it does not
+     */
+    public synchronized boolean mediaItemExists(String location) {
+        Cursor cursor = mDb.query(MEDIA_TABLE_NAME,
+                    new String[] { MEDIA_LOCATION },
+                    MEDIA_LOCATION + "=?",
+                    new String[] { location },
+                    null, null, null);
+        boolean exists = cursor.moveToFirst();
+        cursor.close();
+        return exists;
+    }
 
     /**
      * Get all paths from the items in the database



More information about the Android mailing list