Hello!
Thanx for so quick answer!
I've tried the code you give me. But I made some changes:
1. My script contains 3 statements:
Code: Select all
insert into test_blob(id, blb) values(2, :blb1);
insert into test_blob(id, blb) values(3, :blb2);
insert into test_blob(id, blb) values(4, :blb3);
2. Changes in the code:
Code: Select all
for i := 1 to 3 do
begin
if OpenDialog1.Execute then
begin
ps := TMemoryStream.Create;
ps.LoadFromFile(OpenDialog1.FileName);
IBCScript1.Params.CreateParam(ftInteger, 'id'+inttostr(i), ptInput);
IBCScript1.Params.CreateParam(ftBlob, 'blb'+inttostr(i), ptInput);
IBCScript1.Params.ParamByName('id'+inttostr(i)).AsInteger := i;
IBCScript1.Params.ParamByName('blb'+inttostr(i)).LoadFromStream(ps, ftBlob);
ps.Free;
end;
end;
IBCScript1.Execute;
Again, everithing executed fine, but database contains:
Code: Select all
ID BLB
1 {This record inserted ok}
2
3
As you can see, first record have nonempty BLB value, and others have only ID filled, but not BLB.
Next, i've tried to change source code as follows:
Code: Select all
for i := 1 to 3 do
begin
if OpenDialog1.Execute then
begin
ps := TMemoryStream.Create;
ps.LoadFromFile(OpenDialog1.FileName);
IBCScript1.Params.CreateParam(ftInteger, 'id'+inttostr(i), ptInput);
IBCScript1.Params.CreateParam(ftBlob, 'blb'+inttostr(i), ptInput);
IBCScript1.Params.ParamByName('id'+inttostr(i)).AsInteger := i;
IBCScript1.Params.ParamByName('blb'+inttostr(i)).LoadFromStream(ps, ftBlob);
ps.Free;
end;
IBCScript1.ExecuteNext;
end;
And everything works and filled! I think that BLOB params becomes NULL somewhere "between" of executing statements.
Using of second procedure undesireable in my situation because of big script, contains ~100k records with BLOB fields and using of regular expressions to parse stream position of BLOB value.
Thanx again!