dimanche 25 janvier 2015

Android SQLiteException: near "0": syntax error

I am quite new to SQLite, and I have a syntax error that I can't point out.. I feel like I already tried everything..


there's my code :



String favorites = "CREATE TABLE " + AvailoContract.Favorites.TABLE_NAME
+ "(" + AvailoContract.Favorites._ID
+ " INTEGER PRIMARY KEY AUTOINCREMENT ,"
+ AvailoContract.Favorites.ID + " TEXT ,"
+ AvailoContract.Favorites.ROOTUID + " TEXT ,"
+ AvailoContract.Favorites.FILEKEY + " TEXT ,"
+ AvailoContract.Favorites.NAME + " TEXT ,"
+ AvailoContract.Favorites.SUBJECT + " TEXT ,"
+ AvailoContract.Favorites.DESCRIPTION + " TEXT ,"
+ AvailoContract.Favorites.BODY + " TEXT ,"
+ AvailoContract.Favorites.ACCOUNTID + " TEXT ,"
+ AvailoContract.Favorites.DBMODIFIEDTIME + " INTEGER " + ")";
db.execSQL(favorites);


if I remove the INTEGER line it works just fine. somewhere in the integer line something is wrong. that's the integer definition in the contract class :



public final static long DBMODIFIEDTIME = 0;


the error I get :



01-25 16:45:11.312 29510-29536/com.appus.app E/AndroidRuntime﹕ FATAL EXCEPTION: Thread-114217
Process: com.appus.app, PID: 29510
android.database.sqlite.SQLiteException: near "0": syntax error (code 1): , while compiling: CREATE TABLE favorites(_id INTEGER PRIMARY KEY AUTOINCREMENT ,id TEXT ,rootUid TEXT ,fileKey TEXT ,name TEXT ,subject TEXT ,description TEXT ,body TEXT ,accountId TEXT ,false TEXT ,0 INTEGER )


thanks all for your help in advance.


Aucun commentaire:

Enregistrer un commentaire