Board index » delphi » varchar>255 and collate DE_DE

varchar>255 and collate DE_DE

Hello,

I use Delphi 5 c/s and Delphi 6 enterprise and Interbase 6.0.1 on
Windows 2000. The following error oocurs in delphi 5 and delphi 6.

I have a db with two tables (created in SQL dialect 1 and Character
set set to ISO8859_1:

create table test (
ID integer not null,
feld1 varchar(255),
feld2( varchar(2000),
primary key (ID))

create table test1 (
ID integer not null,
feld1 varchar(255) collate DE_DE,
feld2( varchar(2000) collate DE_DE,
primary key (ID))

In both tables there is a record with ID=1 and feld1 and feld2 are
filled with the maximum length of characters (could be done with
Butto1.Click). Button2.Click do the select.

If I d the select on table test all works fine. If I do the select on
table t1 (the one with collate DE_DE) Interbase reports a strange
error:
"Unable to complete network request to host "localhost". Error reading
data from the connection. An existing conection was cancelld from the
host-computer by software"

After that error I have to stop the interbase-service and start it
again to bring interbase back to live.

This seems to be a serious bug. Could anyone reproduce it and have a
solution for it?

Thanks

Stefan Westner

My delphi-code looks like (D1 is my TDatabase and S1 my TQuery):

procedure TForm1.Button1Click(Sender: TObject);
begin
  D1.Open;
  S1.SQL.Clear;
  S1.SQL.Add('insert into test1 (ID, feld1, feld2) values (:ID,
:feld1, :feld2)');
  S1.ParamByName('ID').AsInteger:=1;
  S1.ParamByName('feld1').AsString:=

'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'+

'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'+
  '123456789012345678901234567890123456789012345';
  S1.ParamByName('feld2').AsString:=

'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'+

'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'+

'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'+

'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'+

'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'+

'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'+

'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'+

'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'+

'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'+

'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'+

'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'+

'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'+

'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'+

'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'+

'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'+

'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'+

'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'+

'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'+

'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'+

'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890';
  D1.StartTransaction;
  S1.ExecSQL;
  D1.Commit;
  D1.Close;
end;

procedure TForm1.Button2Click(Sender: TObject);
var i: Integer;
    f1, f2: String;
begin
  Memo1.Clear;
  D1.Open;
  S1.SQL.Clear;
  S1.SQL.Add('select distinct ID, feld1, feld2 from test1');
  D1.StartTransaction;
  S1.Open;
  i:=S1.FieldByName('ID').AsInteger;
  f1:=S1.FieldByName('feld1').AsString;
  f2:=S1.FieldByName('feld2').AsString;
  Memo1.Lines.Add('i='+IntToStr(i));
  Memo1.Lines.Add('feld1='+f1);
  Memo1.Lines.Add('feld2='+f2);
  D1.Commit;
  D1.Close;
end;

 

Re:varchar>255 and collate DE_DE


Quote
Stefan Westner wrote:

> create table test1 (
> ID integer not null,
> feld1 varchar(255) collate DE_DE,
> feld2( varchar(2000) collate DE_DE,
> primary key (ID))

        I ran the following DDL in a dialect 1 DB in IBConsole:

CREATE TABLE TEST1
(
  ID    INTEGER NOT NULL,
  FELD1 VARCHAR(255) CHARACTER SET ISO8859_1 COLLATE DE_DE,
  FELD2 VARCHAR(2000) CHARACTER SET ISO8859_1 COLLATE DE_DE,
 PRIMARY KEY (ID)
);

        I then filled all columns to the max length on a record with the ID of
1 and did a SELECT from the table.  It worked as expected.

        So, you may have a corrupt database, or there may be some part of the
problem which you did not include in your message.  I'd suggest you
start by doing a database validation.

        -Craig

--
 Craig Stuntz (TeamB) Vertex Systems Corp. Columbus, OH
We're hiring: http://www.vertexsoftware.com/careerops.htm#sd
     Delphi/InterBase WebLog: http://delphi.weblogs.com

Re:varchar>255 and collate DE_DE


Hello Craig,

I checked it with CHARACTER SET ISO8859_1 in the DDL and the result is
the same. I'll mail you my DB and code (38 KB). I would be very
graceful if you could give it a look.

Thanks

Stefan Westner

On Thu, 01 Nov 2001 13:43:02 -0500, "Craig Stuntz (TeamB)"

Quote
<cstuntz@no_spam.vertexsoftware.com> wrote:

>Stefan Westner wrote:

>> create table test1 (
>> ID integer not null,
>> feld1 varchar(255) collate DE_DE,
>> feld2( varchar(2000) collate DE_DE,
>> primary key (ID))

>    I ran the following DDL in a dialect 1 DB in IBConsole:

>CREATE TABLE TEST1
>(
>  ID        INTEGER NOT NULL,
>  FELD1     VARCHAR(255) CHARACTER SET ISO8859_1 COLLATE DE_DE,
>  FELD2     VARCHAR(2000) CHARACTER SET ISO8859_1 COLLATE DE_DE,
> PRIMARY KEY (ID)
>);

>    I then filled all columns to the max length on a record with the ID of
>1 and did a SELECT from the table.  It worked as expected.

>    So, you may have a corrupt database, or there may be some part of the
>problem which you did not include in your message.  I'd suggest you
>start by doing a database validation.

>    -Craig

Re:varchar>255 and collate DE_DE


I already validate the database - no errors.
I tested it on serveral PCs with absolutely newly created dbs.
It seems to me that you didn't the same as I:
Create the db with ibconsole with ISO8859_1 and leave this out in the
DDL, only use COLLATE DE_DE. This is what I did.

Could I mail you my DB (550 KB) and my test-prog (all zipped abaout
100 KB)?

Thanks

Stefan Westner

On Thu, 01 Nov 2001 13:43:02 -0500, "Craig Stuntz (TeamB)"

Quote
<cstuntz@no_spam.vertexsoftware.com> wrote:

>Stefan Westner wrote:

>> create table test1 (
>> ID integer not null,
>> feld1 varchar(255) collate DE_DE,
>> feld2( varchar(2000) collate DE_DE,
>> primary key (ID))

>    I ran the following DDL in a dialect 1 DB in IBConsole:

>CREATE TABLE TEST1
>(
>  ID        INTEGER NOT NULL,
>  FELD1     VARCHAR(255) CHARACTER SET ISO8859_1 COLLATE DE_DE,
>  FELD2     VARCHAR(2000) CHARACTER SET ISO8859_1 COLLATE DE_DE,
> PRIMARY KEY (ID)
>);

>    I then filled all columns to the max length on a record with the ID of
>1 and did a SELECT from the table.  It worked as expected.

>    So, you may have a corrupt database, or there may be some part of the
>problem which you did not include in your message.  I'd suggest you
>start by doing a database validation.

>    -Craig

Re:varchar>255 and collate DE_DE


Quote
Stefan Westner wrote:

> I checked it with CHARACTER SET ISO8859_1 in the DDL and the result is
> the same. I'll mail you my DB and code (38 KB). I would be very
> graceful if you could give it a look.

        I received your email.  I can run a SELECT * FROM TEST1 in IBConsole
without problems.  I cannot test your program because it appears to use
third-party DB components that I don't have.  But the DB itself seems
fine.

        -Craig

--
 Craig Stuntz (TeamB) Vertex Systems Corp. Columbus, OH
We're hiring: http://www.vertexsoftware.com/careerops.htm#sd
     Delphi/InterBase WebLog: http://delphi.weblogs.com

Re:varchar>255 and collate DE_DE


Quote
Stefan Westner wrote:

> I checked it with CHARACTER SET ISO8859_1 in the DDL and the result is
> the same. I'll mail you my DB and code (38 KB). I would be very
> graceful if you could give it a look.

        I received the second email and I can now duplicate the problem.  There
is an important piece of information missing from your first post:  You
weren't doing SELECT, you're doing SELECT DISTINCT.  SELECT works.
SELECT DISTINCT does not.

        I'll report the bug.

        -Craig

--
 Craig Stuntz (TeamB) Vertex Systems Corp. Columbus, OH
We're hiring: http://www.vertexsoftware.com/careerops.htm#sd
     Delphi/InterBase WebLog: http://delphi.weblogs.com

Re:varchar>255 and collate DE_DE


Fine that we could trace down the bug.

On Fri, 02 Nov 2001 15:12:51 -0500, "Craig Stuntz (TeamB)"

Quote
<cstuntz@no_spam.vertexsoftware.com> wrote:

>Stefan Westner wrote:

>> I checked it with CHARACTER SET ISO8859_1 in the DDL and the result is
>> the same. I'll mail you my DB and code (38 KB). I would be very
>> graceful if you could give it a look.

>    I received the second email and I can now duplicate the problem.  There
>is an important piece of information missing from your first post:  You
>weren't doing SELECT, you're doing SELECT DISTINCT.  SELECT works.
>SELECT DISTINCT does not.

>    I'll report the bug.

>    -Craig

Other Threads