Parameterized INSERT loop with incorrect data after COMMIT

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
upscene
Posts: 306
Joined: Thu 19 Oct 2006 08:13

Parameterized INSERT loop with incorrect data after COMMIT

Post by upscene » 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:

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

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Thu 17 Jun 2010 08:21

I can not reproduce the problem. Please, check that you have the latest IBDAC build (3.10.0.14).

upscene
Posts: 306
Joined: Thu 19 Oct 2006 08:13

Post by upscene » Thu 17 Jun 2010 08:27

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.

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Thu 17 Jun 2010 09:39

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.

upscene
Posts: 306
Joined: Thu 19 Oct 2006 08:13

Post by upscene » Thu 17 Jun 2010 10:14

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.

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Fri 18 Jun 2010 09:32

We have answered you by e-mail.

Post Reply