Parameterized INSERT loop with incorrect data after COMMIT
Posted: Wed 16 Jun 2010 11:38
OK, here's an interesting case --
I have a database with CHARSET = NONE.
Next, I have a table with a few VARCHAR fields:
Here's some code:
All varchars in rows after the first Commit/StartTransaction cycle only include the first character.
Can you reproduce and fix this?
When using CommitRetaining, the error doesn't happen, however, for my particular situation, this cannot be used.
With regards,
Martijn Tonies
Upscene Productions
I have a database with CHARSET = NONE.
Next, I have a table with a few VARCHAR fields:
Code: Select all
CREATE TABLE COMMODITY
(
IRN INTEGER NOT NULL,
COMCODE VARCHAR( 20) COLLATE NONE,
DESCRIPTION VARCHAR( 60) COLLATE NONE,
GL_ACCOUNT VARCHAR( 10) COLLATE NONE,
DEPTCODE VARCHAR( 10) COLLATE NONE,
CONSTRAINT PK_COMMODITY PRIMARY KEY (IRN)
);
Code: Select all
var n: Integer;
begin
IBCConnection1.ExecSQL('delete from commodity', []);
IBCTransaction1.StartTransaction;
IBCQuery1.Prepare;
for n := 1 to 101
do begin
IBCQuery1.Params[0].AsInteger := n;
IBCQuery1.Params[1].AsString := '123456789';
IBCQuery1.Params[2].AsString := '123456789';
IBCQuery1.Params[3].AsString := '123456789';
IBCQuery1.Params[4].AsString := '123456789';
IBCQuery1.ExecSQL;
if n mod 10 = 0
then begin
//IBCTransaction1.CommitRetaining;
IBCTransaction1.Commit;
IBCTransaction1.StartTransaction
end;
end;
IBCTransaction1.Commit;
All varchars in rows after the first Commit/StartTransaction cycle only include the first character.
Can you reproduce and fix this?
When using CommitRetaining, the error doesn't happen, however, for my particular situation, this cannot be used.
With regards,
Martijn Tonies
Upscene Productions