Save/Load one record to and from UniQuery
Posted: Thu 23 Apr 2015 04:36
I am trying to setup a Synchronization system for a specific table in my Firebird database. What I want to do is store the master records in a central database. Then all the clients login and the master data is downloaded to each client. The are a few issues with dates and so forth, but that is the main concept.
I can upload the master records to the central database ok using XML and streams. ie
This works fine and the complete current record from the Source UniQuery is stored as XML in one field of the Dest table.
the question is - how do I get the XML back, convert it to the appropriate fields and add it to the Source table?
There does not seem to be a Method in UniQuery to do this. ie query.LoadFromXML(stream)
Please note - I do not want to load the whole table - just the one record.
I can upload the master records to the central database ok using XML and streams. ie
Code: Select all
procedure AddMySQL;
var
BStream: TStream;
begin
qryDest.insert;
qryDest.FieldByName('DATE_UPDATED').AsDateTime := Now;
BStream := qryDest.CreateBlobStream(qryDest.FieldByName('DATA'), bmWrite);
try
qrySource.SaveToXML(BStream);
finally
BStream.Free;
end;
qryDest.post;
end;
the question is - how do I get the XML back, convert it to the appropriate fields and add it to the Source table?
There does not seem to be a Method in UniQuery to do this. ie query.LoadFromXML(stream)
Please note - I do not want to load the whole table - just the one record.