[Android] MediaDatabase: refactor playlist table creation

Edward Wang git at videolan.org
Mon Dec 8 09:41:55 CET 2014


vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Thu Jul 10 17:03:49 2014 -0400| [df26143192bfbcad650c34780c367db2c0374681] | committer: Edward Wang

MediaDatabase: refactor playlist table creation

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

 .../src/org/videolan/vlc/MediaDatabase.java        |   33 +++++++++++---------
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/MediaDatabase.java b/vlc-android/src/org/videolan/vlc/MediaDatabase.java
index 7484922..1766fd2 100644
--- a/vlc-android/src/org/videolan/vlc/MediaDatabase.java
+++ b/vlc-android/src/org/videolan/vlc/MediaDatabase.java
@@ -173,20 +173,7 @@ public class MediaDatabase {
             db.execSQL(query);
         }
 
-        @Override
-        public void onCreate(SQLiteDatabase db) {
-
-            String createDirTabelQuery = "CREATE TABLE IF NOT EXISTS "
-                    + DIR_TABLE_NAME + " ("
-                    + DIR_ROW_PATH + " TEXT PRIMARY KEY NOT NULL"
-                    + ");";
-
-            // Create the directories table
-            db.execSQL(createDirTabelQuery);
-
-            // Create the media table
-            createMediaTableQuery(db);
-
+        private void createPlaylistTablesQuery(SQLiteDatabase db) {
             String createPlaylistTableQuery = "CREATE TABLE IF NOT EXISTS " +
                     PLAYLIST_TABLE_NAME + " (" +
                     PLAYLIST_NAME + " VARCHAR(200) PRIMARY KEY NOT NULL);";
@@ -201,6 +188,24 @@ public class MediaDatabase {
                     PLAYLIST_MEDIA_ORDER + " INTEGER NOT NULL);";
 
             db.execSQL(createPlaylistMediaTableQuery);
+        }
+
+        @Override
+        public void onCreate(SQLiteDatabase db) {
+
+            String createDirTabelQuery = "CREATE TABLE IF NOT EXISTS "
+                    + DIR_TABLE_NAME + " ("
+                    + DIR_ROW_PATH + " TEXT PRIMARY KEY NOT NULL"
+                    + ");";
+
+            // Create the directories table
+            db.execSQL(createDirTabelQuery);
+
+            // Create the media table
+            createMediaTableQuery(db);
+
+            // Create playlist tables
+            createPlaylistTablesQuery(db);
 
             String createSearchhistoryTabelQuery = "CREATE TABLE IF NOT EXISTS "
                     + SEARCHHISTORY_TABLE_NAME + " ("



More information about the Android mailing list