[Android] Fix sql trigger creation

Geoffrey Métais git at videolan.org
Thu Jan 8 17:43:15 CET 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jan  8 17:40:03 2015 +0100| [771e09c959ca586f6e357a954e25816f243ca404] | committer: Geoffrey Métais

Fix sql trigger creation

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

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

diff --git a/vlc-android/src/org/videolan/vlc/MediaDatabase.java b/vlc-android/src/org/videolan/vlc/MediaDatabase.java
index 38615e1..5926c97 100644
--- a/vlc-android/src/org/videolan/vlc/MediaDatabase.java
+++ b/vlc-android/src/org/videolan/vlc/MediaDatabase.java
@@ -42,7 +42,6 @@ import android.database.sqlite.SQLiteFullException;
 import android.database.sqlite.SQLiteOpenHelper;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
-import android.os.Build;
 import android.util.Log;
 
 public class MediaDatabase {
@@ -207,14 +206,11 @@ public class MediaDatabase {
                     MRL_URI + " TEXT PRIMARY KEY NOT NULL,"+
                     MRL_DATE + " DATETIME NOT NULL"
                     +");";
-            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB &&
-                    Build.VERSION.SDK_INT <= Build.VERSION_CODES.HONEYCOMB_MR2) {
-                createMrlTableQuery += "CREATE TRIGGER mrl_history_trigger AFTER INSERT ON " +
-                        MRL_TABLE_NAME + "BEGIN " +
-                        "DELETE FROM " + MRL_TABLE_NAME + " where " + MRL_URI + " NOT IN (SELECT " + MRL_URI +
-                        " from " + MRL_TABLE_NAME + " ORDER BY insertion_date DESC LIMIT " + MRL_TABLE_SIZE + ")" +
-                        "END";
-            }
+            createMrlTableQuery += " CREATE TRIGGER mrl_history_trigger AFTER INSERT ON "+
+                    MRL_TABLE_NAME+ " BEGIN "+
+                    " DELETE FROM "+MRL_TABLE_NAME+" where "+MRL_URI+" NOT IN (SELECT "+MRL_URI+
+                    " from "+MRL_TABLE_NAME+" ORDER BY insertion_date DESC LIMIT "+MRL_TABLE_SIZE+");"+
+                    " END";
             db.execSQL(createMrlTableQuery);
         }
 



More information about the Android mailing list