[Android] No SQLite trigger for HoneyComb
Geoffrey Métais
git at videolan.org
Thu Jan 8 16:13:45 CET 2015
vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jan 8 15:15:29 2015 +0100| [a74f82062cb8120d862ede2a932bbca0871c3fa6] | committer: Geoffrey Métais
No SQLite trigger for HoneyComb
Because of crash
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=a74f82062cb8120d862ede2a932bbca0871c3fa6
---
vlc-android/src/org/videolan/vlc/MediaDatabase.java | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/MediaDatabase.java b/vlc-android/src/org/videolan/vlc/MediaDatabase.java
index 3a13e10..38615e1 100644
--- a/vlc-android/src/org/videolan/vlc/MediaDatabase.java
+++ b/vlc-android/src/org/videolan/vlc/MediaDatabase.java
@@ -42,6 +42,7 @@ 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 {
@@ -206,11 +207,14 @@ public class MediaDatabase {
MRL_URI + " TEXT PRIMARY KEY NOT NULL,"+
MRL_DATE + " DATETIME NOT NULL"
+");";
- 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";
+ 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";
+ }
db.execSQL(createMrlTableQuery);
}
More information about the Android
mailing list