You are not logged in.
I encountered a strange SQLite error when calling 'CreateMissingTables' for a model with several tables, but the error was specific to one table. I checked for mistakes in that table's record fields declaration, but found nothing wrong. Then I realized that mORMot had created a table named 'ORDER', which I didn't have as a table with that name. The corresponding record was named 'TOrmOrder'. When I changed the name to something different, like 'TOrmOrdera' or 'TOrmAnOrder', the error disappeared. Could this be a mORMot bug?
Last edited by Prometeus (Today 02:40:25)
Offline
You can try the code from this gist: https://gist.github.com/PrometeusRec/68 … b04e17a1ab
The error message is: ESqlite3Exception: Error SQLITE_ERROR (1) [CREATE TABLE Order(ID INTEGER PRIMARY KEY AUTOINCREMENT, field_d TEXT COLLATE SYSTEMNOCASE, field_e FLOAT, field_f TEXT COLLATE ISO8601);] using 3.46.1 - near "Order": syntax error
This is because mORMot doesn't like the name 'TOrmOrder'. If you change this name to something else, it works
Offline
"order" is a reserved SQL keyword so should not be used for a table name.
Just rename the class "TOrmOrders".
I just tested that it will happen with any other SQL reserved word, but only if the class name starts with 'TOrm'. I used to name all my ORM classes with 'TOrm' + the_name_of_data, but now I'll take care with reserved SQL words. If you use 'TAbcOrder', for example, it does not raise an error.
Offline