You are not logged in.
Hi,
I have a SQLite3 table "Artists" with the following definition:
CREATE TABLE "artists" (
"ArtistId" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
"Name" TEXT
);
That DB is statically linked (using SynSQLite3Static) to my server app.
How do I map the "ArtistId" field to the "ID" field required by mORMot so that I can use this model to query the DB ?
TSQLartists = class(TSQLRecord)
private
fName: RawUTF8;
published
property Name: RawUTF8 read fName write fName;
end;
I don't think this is supposed to work ? (gives me an access violation)
Model.Props[TSQLartists].ExternalDB.MapField('ID', 'ArtistId');
Last edited by jbroussia (2017-02-12 10:29:22)
Offline
OooooK, I think I have it working now... I was doing...
Model.Props[TSQLartists].ExternalDB.MapField('ID', 'ArtistId');
VirtualTableExternalRegisterAll(Model, DBConnProps);
instead of...
VirtualTableExternalRegisterAll(Model, DBConnProps);
Model.Props[TSQLartists].ExternalDB.MapField('ID', 'ArtistId');
Offline