Page 1 of 1

Parameterized INSERT loop with incorrect data after COMMIT

Posted: Wed 16 Jun 2010 11:38
by upscene
OK, here's an interesting case --

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)
);
Here's some code:

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

Posted: Thu 17 Jun 2010 08:21
by Dimon
I can not reproduce the problem. Please, check that you have the latest IBDAC build (3.10.0.14).

Posted: Thu 17 Jun 2010 08:27
by upscene
Dimon wrote:I can not reproduce the problem. Please, check that you have the latest IBDAC build (3.10.0.14).
I'm using .13 - but has anything changed that could influence this behaviour?

btw, using .Value instead of .AsString works.

Posted: Thu 17 Jun 2010 09:39
by Dimon
I could not reproduce the problem.
Please send me a complete small sample to dmitryg*devart*com to demonstrate it.
Also supply me the following information:
- the exact version of your IDE;
- the exact version of InterBase server and client.

Posted: Thu 17 Jun 2010 10:14
by upscene
Dimon wrote:I could not reproduce the problem.
Please send me a complete small sample to dmitryg*devart*com to demonstrate it.
Also supply me the following information:
- the exact version of your IDE;
- the exact version of InterBase server and client.
Done, mind you, I'm using Firebird.

Posted: Fri 18 Jun 2010 09:32
by Dimon
We have answered you by e-mail.