vendredi 3 juillet 2015

SQLite "WITHOUT ROWID" supported on Android SQLite?

I have a SQLite application that works fine on Linux, Windows an also Android when using a custom compiled SQLite (using the NDK). Creating tables without ROWID works properly.

On the opposite, when I try to create the same schema using the standard SQLite in Android a syntax error is thrown near "WITHOUT" in the next SQL sentence:

CREATE TABLE REL_TABLE1_TABLE2
  ( FK_TABLE1_ID integer, FK_TABLE2_ID integer, 
    FOREIGN KEY (FK_TABLE1_ID)   REFERENCES  TABLE1(ROWID),
    FOREIGN KEY (FK_TABLE2_ID) REFERENCES TABLE2(ROWID),
    PRIMARY KEY (FK_TABLE1_ID, FK_TABLE2_ID) 
  ) 
  WITHOUT ROWID;

If I remove the "WITHOUT ROWID" it works properly. Does it mean WITHOUT ROWID is not supported on Android?.

I found no related documentation but someone else looks to have related problems:

Cannot open sqlite database with linqpad, when WITHOUT ROWID is used

Aucun commentaire:

Enregistrer un commentaire