You are not logged in.
I have mapped field:
VirtualTableExternalRegister(aModel,
TSQLCPU_USER,
fProps,
'CPU_USER');
aModel.Props[TSQLCPU_USER].ExternalDB.MapField('ID','IDUSER');
When I try to update a record, shows an error that the IDUSER field does not exist.
v_user := TSQLCPU_USER.Create(frmDMServer.aServerDB,'IDUSER=?',[1]);
v_user.NAME := 'USER 2';
v_user.MOD_DATE := now;
v_user.MOD_USER := 9999;
frmDMServer.aServerDB.Update(v_user);
I need help to solve this
Offline
I use it also with Firebird and it works fine.
I think when you map ID with IDUSER then you have to use ID and not IDUSER more.
Offline
Yes, on ORM side, i.e. from Delphi, you should use the TSQLCPU_USER fields, i.e. ID and not IDUSER.
Forget about the DB side! You are using an ORM!
You should have written:
v_user := TSQLCPU_USER.Create(frmDMServer.aServerDB,'ID=?',[1]);
The ORM will then compute and execute a SQL statement with the expected field, i.e. "SELECT * FROM CPU_USER WHERE IDUSER=?".
But you should not worry about the SQL, nor the table, any more.
Or even easier, and much more "mORMotish":
v_user := TSQLCPU_USER.Create(frmDMServer.aServerDB,1);
since you are reading one user per ID.
Offline
Thanks.
Offline
Another issue.
How do I that are not created index in my tables?
When I connect to my database, the system is creating some index's automatically, for example:
CREATE UNIQUE INDEX DESCENDING "NDXCPU_PROCESSIDPROCESS" ON "CPU_PROCESS Nord IDPROCESS" );
Offline
For a particular table, you can simply override the default class procedure TSQLRecord.InitializeTable() to do nothing (i.e. do not call inherited).
I've also just added a new "Option: TSQLInitializeTableOptions parameter" to TSQLRestServer.CreateMissingTables and TSQLRecord.InitializeTable methods, to tune underlying table creation (e.g. disable indexes creation).
See http://synopse.info/fossil/info/c7717b0ff9
/// the possible options for TSQLRestServer.CreateMissingTables and
// TSQLRecord.InitializeTable methods
// - itoNoIndex4ID won't create the index for the main ID field
// - itoNoIndex4UniqueField won't create indexes for "stored AS_UNIQUE" fields
// - itoNoIndex4NestedRecord won't create indexes for TSQLRecord fields
// - itoNoIndex4RecordReference won't create indexes for TRecordReference fields
TSQLInitializeTableOption = (
itoNoIndex4ID, itoNoIndex4UniqueField,
itoNoIndex4NestedRecord, itoNoIndex4RecordReference);
/// the options to be specified for TSQLRestServer.CreateMissingTables and
// TSQLRecord.InitializeTable methods
TSQLInitializeTableOptions = set of TSQLInitializeTableOption;
Offline
thanks
Offline
I am using TSQLRestClientURI with ExecuteList and Tclientdataset. Everything is working well, but I am facing a problem. When I delete a record by command TSQLRestClientURI.Delete , works perfectly when I give the command UpdateFromServer. The record does not appear in my grid. However when I exclude the registry directly from database, the record does not come out of my grid, even giving the command UpdateFromServer.
How do I that records are what really are in the database, regardless of whether form excluded by application or directly in the database?
Offline
thanks
Offline