Hi,
I have two pieces of code that talk to each other over IP. One of them puts a request in, then the other gets the request, processes a SQL command and the result is contained in an MSQuery. Is there method in MSQuery that saves its state to a memory block so I can transfer than back to the source program so it can restore the memory block to a MSQuery and then mine the results?
I don't want the source program issuing the SQL commands directly...
Thanks,
Alan
Is there a way to save a MSQuery to a memory structure?
You can save recordset in memory using the TMSQuery.SaveToXML method.
To restore saved data in dataset you should use the TVirtualTable component and load data with the help of TVirtualTable.LoadFromStream or LoadFromFile functions.
You can find more detailed information about these methods in the SDAC help.
To restore saved data in dataset you should use the TVirtualTable component and load data with the help of TVirtualTable.LoadFromStream or LoadFromFile functions.
You can find more detailed information about these methods in the SDAC help.
Hi,
Ok, I got that working. A 9000 record table takes a bit of time however to savetoxml and reload into a virtualtable. It takes about 6 seconds to save to a XML stream and 5.7 seconds to load from an XML stream.
IF I copy the data into a VirtualTable and use the SaveToStream which looks like some sort of binary stream, it only takes 0.3 seconds to savetostream and 0.891 seconds to loadfromstream. Considerably faster, but the problem is that the virtualtable.assign(msquery) command takes 17 seconds. Is there a way to make msquery save to the binary format? I don't see a savetostream method. Or, is there a way to execute a query and have the results dumped directly into the virtualtable?
Thanks,
Alan
Ok, I got that working. A 9000 record table takes a bit of time however to savetoxml and reload into a virtualtable. It takes about 6 seconds to save to a XML stream and 5.7 seconds to load from an XML stream.
IF I copy the data into a VirtualTable and use the SaveToStream which looks like some sort of binary stream, it only takes 0.3 seconds to savetostream and 0.891 seconds to loadfromstream. Considerably faster, but the problem is that the virtualtable.assign(msquery) command takes 17 seconds. Is there a way to make msquery save to the binary format? I don't see a savetostream method. Or, is there a way to execute a query and have the results dumped directly into the virtualtable?
Thanks,
Alan
-
- Devart Team
- Posts: 925
- Joined: Thu 17 Nov 2005 10:53