You are not logged in.
Pages: 1
Hello,
I am using Mormot for some weeks now and I am running into problems with my data.
I have some services added to rest server. Within a service I add a new record to database:
ServiceContext.Factory.RestServer.Add(rec);
where rec is my TSQLRecord based data record.
This will always save the info to database as expected.
After that I do a retrieve (in other service call):
ServiceContext.Factory.RestServer.Retrieve(rec_id, rec);
Here it goes wrong. Some fields (not all) are empty, where my database manager tells me the record contains data!
After changing some properties I update the database record with:
ServiceContext.Factory.RestServer.Update(rec_id, rec);
At this point the empty fields will be written to database and overwrite the existing data.
I am using MS SQL Server 2008 Express.
At Global level I defined:
function TdtmlConfig.GetDBConnection: TOleDBMSSQL2008ConnectionProperties;
begin
if not Assigned(FDBConfig) then
FDBConfig := TOleDBMSSQL2008ConnectionProperties.Create(FDatabaseServer,FDatabaseName, FDatabaseUser, FDatabasePassword);
Result := FDBConfig;
end;
When creating the model:
FModel := TSQLModel.Create([TSQLUploads, TSQLDocuments, TSQLDocumentPages, TSQLAssets, TSQLJoinTest, TSQLTimeline],ROOT_NAME);
VirtualTableExternalRegisterAll(FModel, dtmlConfig.GetDBConnection, True);
When I get data from database with the same GetDBConnection.Execute, it gives all fields with values. So the dataconnection seems good. It must have to be something in the restserver retrieve function.
Could it be some caching problems?
Thanks for help!
Offline
I think I got a solution: When I do a ServiceContext.Factory.RestServer.Cache.Flush; the data seems to be correct.
But it keeps strange, because I do not UPDATE this table via direct SQL functions.
So any extra input to understand the mechanism is welcome!
Offline
I use the 1.18 from 3 weeks ago.
TSQLUploads = class(TSQLRecord)
private
FUploadsID: Integer;
FOrderlineID: RawUTF8;
FLongID: RawUTF8;
FOrderXML: RawUTF8;
FQuantity: Integer;
FAssigned: Integer;
FCreated: TCreateTime;
FUpdated: TModTime;
FUpdateCount: Integer;
FJoinList: TSQLJoinTest;
FUploadsPath: String;
FChiliWorkspaceID: String;
FChiliViewPreferencesID: String;
FChiliConstraintsID: String;
FChiliFoldingSettingsID: String;
FUIUploadAllowed: Integer;
FUIShow3D: Integer;
FChiliClipartFolderName: String;
FUIShowPositionList: Integer;
FUIShowRotation: Integer;
FUIShowMirroring: Integer;
FUIAllowPositionNetto: Integer;
FUIAllowPositionBruto: Integer;
FUIAllowPositionImageSize: Integer;
FUIAllowPositionOneCmWhite: Integer;
FChiliIsGeneralTemplate: Integer;
function AS_UNIQUE(const Index: Integer): Boolean;
published
property OrderlineID: RawUTF8 read FOrderlineID write FOrderlineID;
property Quantity: Integer read FQuantity write FQuantity;
property LongID: RawUTF8 index 50 read FLongID write FLongID stored AS_UNIQUE;
property OrderXML: RawUTF8 read FOrderXML write FOrderXML;
property Assigned: Integer read FAssigned write FAssigned;
property Created: TCreateTime read FCreated;
property Updated: TModTime read FUpdated;
property UpdateCount: Integer read FUpdateCount write FUpdateCount;
property JoinList: TSQLJoinTest read FJoinList;
property UploadsPath: String read FUploadsPath;
property ChiliIsGeneralTemplate: Integer read FChiliIsGeneralTemplate write FChiliIsGeneralTemplate;
property ChiliWorkspaceID: String read FChiliWorkspaceID write FChiliWorkspaceID;
property ChiliViewPreferencesID: String read FChiliViewPreferencesID write FChiliViewPreferencesID;
property ChiliConstraintsID: String read FChiliConstraintsID write FChiliConstraintsID;
property ChiliFoldingSettingsID: String read FChiliFoldingSettingsID write FChiliFoldingSettingsID;
property ChiliClipartFolderName: String read FChiliClipartFolderName write FChiliClipartFolderName;
property UIUploadAllowed: Integer read FUIUploadAllowed write FUIUploadAllowed;
property UIShow3D: Integer read FUIShow3D write FUIShow3D;
property UIShowPositionList: Integer read FUIShowPositionList write FUIShowPositionList;
property UIShowMirroring: Integer read FUIShowMirroring write FUIShowMirroring;
property UIShowRotation: Integer read FUIShowRotation write FUIShowRotation;
property UIAllowPositionImageSize: Integer read FUIAllowPositionImageSize write FUIAllowPositionImageSize;
property UIAllowPositionBruto: Integer read FUIAllowPositionBruto write FUIAllowPositionBruto;
property UIAllowPositionNetto: Integer read FUIAllowPositionNetto write FUIAllowPositionNetto;
property UIAllowPositionOneCmWhite: Integer read FUIAllowPositionOneCmWhite write FUIAllowPositionOneCmWhite;
end;
Last edited by jrvoorhorst (2014-06-12 08:04:01)
Offline
Sorry, how do I get that?
ServiceContext.Factory.RestServer.Cache.?
Thanks!
Offline
When I inspect the retrieved TSQL... record without flushing cache before, some properties are empty (although there is data in database for that record), other are filled with correct values.
Offline
Pages: 1