Subject | About Executing Insert/Update Statements |
---|---|
Author | Vishal Tiwari |
Post date | 2010-05-19T06:41:30Z |
Hi SET,
SET i would like to use "TIB_DSQL" component to execute no. of "Update" statements as you shown for "Inserting" the no. of records.
For your kind reference i am adding the code you provided me last time. Here i have done a small test project and used the update statement and it worked fine. But will it give the same excecution speed for "Update" statements also.
Should i go with this component for executing the update statements?
Please let me know if i need to do some extra code change for Update statements. Right now, with the following code, update statement is working fine. but i have not checked with large no. of update statements.
If i would like to exeecute some insert as well as some update statements alternatively, using two DSQL components. Will it affect the speed?
Let me know your opinion.
Thanks and Regards.
Have A Nice Day.
Vishal
Code:
var
i1,
s1,
ts1,
ts2: TIB_Column;
begin
with TIB_DSQL.Create do
try
IB_Connection: =IB_Connection1;
IB_Transaction: =IB_Transaction1 ;
SQL.Add('Insert into MyTable(PK, MyString, MyTimestampFrom,
MyTimestampTo)
values (:PK, :MS, :MTSF, :MTST)');
Prepare;
i1:=ParamByName( 'PK');
s1:=ParamByName( 'MS');
ts1:=ParamByName( 'MTSF');
ts2:=ParamByName( 'MTST');
while not <whatever> do
begin
i1.AsInteger: =...;
s1.AsString: =...;
ts1.AsDateTime: =...;
ts2.AsDateTime: =...;
ExecSQL;
end;
finally
IB_Transaction1. Commit;
Free;
end;
end;
SET i would like to use "TIB_DSQL" component to execute no. of "Update" statements as you shown for "Inserting" the no. of records.
For your kind reference i am adding the code you provided me last time. Here i have done a small test project and used the update statement and it worked fine. But will it give the same excecution speed for "Update" statements also.
Should i go with this component for executing the update statements?
Please let me know if i need to do some extra code change for Update statements. Right now, with the following code, update statement is working fine. but i have not checked with large no. of update statements.
If i would like to exeecute some insert as well as some update statements alternatively, using two DSQL components. Will it affect the speed?
Let me know your opinion.
Thanks and Regards.
Have A Nice Day.
Vishal
Code:
var
i1,
s1,
ts1,
ts2: TIB_Column;
begin
with TIB_DSQL.Create do
try
IB_Connection: =IB_Connection1;
IB_Transaction: =IB_Transaction1 ;
SQL.Add('Insert into MyTable(PK, MyString, MyTimestampFrom,
MyTimestampTo)
values (:PK, :MS, :MTSF, :MTST)');
Prepare;
i1:=ParamByName( 'PK');
s1:=ParamByName( 'MS');
ts1:=ParamByName( 'MTSF');
ts2:=ParamByName( 'MTST');
while not <whatever> do
begin
i1.AsInteger: =...;
s1.AsString: =...;
ts1.AsDateTime: =...;
ts2.AsDateTime: =...;
ExecSQL;
end;
finally
IB_Transaction1. Commit;
Free;
end;
end;