lundi 7 décembre 2015

sqlite sql syntax error near '('

The code is

  1. @Override public void onCreate(SQLiteDatabase arg0) { StringBuilder sb = new StringBuilder(); sb.append("create table IF NOT EXISTS " + tableName + "(" ); sb.append(" eng TEXT primary key,"); sb.append(" gra TEXT not null,"); sb.append(" memo TEXT null,"); sb.append(" fsen TEXT null,"); sb.append(" ox INTEGER not null DEFAULT 0,"); sb.append(" oxSeq TEXT null,"); sb.append(" timeCreate TEXT not null DEFAULT datetime('now', 'localtime'),"); sb.append(" timeLast TEXT not null DEFAULT datetime('now', 'localtime') )"); arg0.execSQL(sb.toString()); Log.w(" -- Result -- ", tableName + " is created."); }

    ////Error message is like following...
    
    android.database.sqlite.SQLiteException: near "(": 
    syntax error (code 1): , while compiling: 
    create table IF NOT EXISTS userDic( 
      eng TEXT primary key, 
      kor TEXT not null, 
      memo TEXT null, 
      fsen TEXT null, 
      ox INTEGER not null DEFAULT 0, 
      oxSeq TEXT null, 
      timeCreate TEXT not null DEFAULT datetime('now', 'localtime'), 
      timeLast TEXT not null DEFAULT datetime('now', 'localtime') )
    
    

I don't know why the error is occurred...

Aucun commentaire:

Enregistrer un commentaire