Using TUniLoader with Firebird embedded [Delphi XE2, UniDAC 5.0.1]
Posted: Sat 27 Jul 2013 21:41
Hello,
I am trying to find a solution on how to insert a lot of data into a Firebird database using Firebird embedded server v2.5 and TUniLoader component.
I have a string list of data (mixed types - integer, string, etc.) formatted like this:
And a table with 4 fields. Currently, I am using a workaround - I pass my data to a procedure where I parse them and create SQL statements like this:
Then I pass prepared SQL script to TUniScript, which executes it. The problem is that the execution is relatively slow - it does not exceed approx. 1000 records per second. Also, HDD light is blinking very actively during the operation. I think that there must be some bottleneck there of which I am not aware of... I think that 1000 rec/sec is a very low number.
Anyway, I wanted to give TUniLoader a try. Accordgin to the documentation, it should do basically the same I do, but I thought maybe I miss something and TUniLoader will be quicker.
The problem is that I am not able to load data that I have into some dataset which can be used with TUniLoader.LoadFromDataSet. As I said, I have a string list with data of various types. I tried to create TVirtualTable, added needed number of fields of ftBlob type - then I was able to populate TVirtualTable. But when I call LoadFromDataSet, it crashes. I would be very grateful if someone could help me and post some piece of code which shows how can I add data from delimitered string list into a database using TUniLoader.
Thank you!
I am trying to find a solution on how to insert a lot of data into a Firebird database using Firebird embedded server v2.5 and TUniLoader component.
I have a string list of data (mixed types - integer, string, etc.) formatted like this:
Code: Select all
123,abc,1,2
456,def,2,3
...Code: Select all
EXECUTE BLOCK AS BEGIN
INSERT OR UPDATE INTO table_name VALUES (.....);
...
ENDAnyway, I wanted to give TUniLoader a try. Accordgin to the documentation, it should do basically the same I do, but I thought maybe I miss something and TUniLoader will be quicker.
The problem is that I am not able to load data that I have into some dataset which can be used with TUniLoader.LoadFromDataSet. As I said, I have a string list with data of various types. I tried to create TVirtualTable, added needed number of fields of ftBlob type - then I was able to populate TVirtualTable. But when I call LoadFromDataSet, it crashes. I would be very grateful if someone could help me and post some piece of code which shows how can I add data from delimitered string list into a database using TUniLoader.
Thank you!