Subject | Re: [IBO] Uploading a table |
---|---|
Author | Svein Erling Tysvær |
Post date | 2001-02-12T09:48:33Z |
>Could someone explain this difference ? ThanksNo, I'll leave that for Helen ;=)
But why do you use a TIBOQuery for inserts? Use a TIB_DSQL and code
something like this:
with <YourInsertDSQL> do try
BeginBusy (false); //or True if you use Application.ProcessMessages within
//this try/finally block
if not Prepared then Prepare;
repeat
readln(<YourTextFile>);
ParamByName('Item1').AsInteger:=<whateveryouwant>; //or Params[0] if you
//prefer
...
Execute;
until eof(<YourTextFile>);
finally
<YourTransaction>.Commit; //You better use an explicit Transaction for this
//insert and have AutoCommit set to false!
//(isolation tiCommitted recommended)
EndBusy;
end;
You should be able to do this kind of insert in much less than a minute -
it would surprise me if you didn't get below 10 seconds.
Set
At 09:45 12.02.2001 +0100, you wrote:
>When inserting 8700 recs into a table from a text file using an
>TIBOQuery whose SQL property is insert into table A(Item1, ..) values
>(:Val1, ...), it takes more than 6 minutes. The loop is in a
>start/commit transaction and the query is prepared before the loop. When
>replacing the SQL property with a select Item1, ... from tableA where
>0=1 (I don't want to get records) and then in the loop using insert/post
>methods of the query, it takes 1 minute. In both cases my database is
>very small (< 2Mb) and is run on my dev machine.
>Could someone explain this difference ? Thanks