Page 41 of 44

Posted: 09.11.2012, 11:13
by miab3
EgonHugeist,

After the R1995 in my Linux 64 FreeTDS works with WIN1250 ClientCodePage.
However, it is still a problem with the number of national characters in Lazarus and Frirebird NONE.

Michal

Posted: 09.11.2012, 20:01
by EgonHugeist
miab3,

today i made a testcase: New FB-DB, default Charset non.

Code: Select all

create table people (
p_id                 SMALLINT                       not null,
p_dep_id             SMALLINT,
p_name               VARCHAR(40) character set UTF8 collate UTF8,
p_begin_work         TIME,
p_end_work           TIME,
p_picture            BLOB,
p_resume             BLOB SUB_TYPE TEXT,
p_redundant          SMALLINT,
primary key (p_id)
);
to test it. First impression with FPC2.7.1 you are right but only @designtime. @runtime everything was ok.

Also did i notice that sometime properties like ClientCodePage, Protocol & Database are missing. LCL Rev:39124 V1.1.

Then i opened the same app with FPC2.6 and Layarus 1.02RC2.
NO ISSUES to see>

Posted: 09.11.2012, 20:08
by EgonHugeist
Furthermore the columns and editable values are oversized!

A little pic of Lazarus:

I personally can't reproduce this issue on Zeos yet. The reason why i could not fix something, Michal. But what i can do is to modify the column displaysize in dependencies to the column charset....

Is that a unix or an common issue?

Posted: 09.11.2012, 20:43
by miab3
EgonHugeist,

But I'm talkin 'about the field (for example):
p_name1 VARCHAR (10) CHARACTER SET WIN1250 COLLATE PXW_PLK;

Michal

Posted: 09.11.2012, 21:02
by EgonHugeist
miab3,

me too. That's my problem. The pic above shows 40 chars for a field defined as
VARCHAR(40) character set UTF8 collate UTF8. Not 20 chars. I HAD the issue you are talking about @designtime but not @runtime. Crazy is after recompiling Lazarus the issue was gone. Also was the case solved after assigning the fiels to the formular. Now tell me how i can fix an issue which i can no longer see?

Posted: 09.11.2012, 21:35
by miab3
EgonHugeist,

I do not understand.
I say that Lazarus 2.7.1 Win and Lin can not write and read correctly 10 national characters in the field:
VARCHAR (10) CHARACTER SET WIN1250 COLLATE PXW_PLK (Firebird 2.5 NONE).
It can write and read(max):
0123456789 or
ą12345678
ąż234567
ążź3456
ążźć45
ążźćń
Delphi does not have any problem with that.

Michal

Posted: 10.11.2012, 08:47
by EgonHugeist
miab3,

that's because delphi writes only ansi for charset none. Lazarus (not FPC) assumes all strings are utf8 encoded. That's why they'll not fir into the column.

Solution:
TZConnection.ClientCodePage = WIN1250
TZConnection.AutoEncode := True;

IF ALL columns are defined as WIN1251.

On the other hand writes the data "as is" und it's possible national chars won't fit...

Another way is what firebird proposes for people with charset none: Write the cast for the charset around your statement values and it should work too.

Example for my 40-Chars testring:
Charset none, column collate utf8. Data written and displayed as: üüüüüüüüüüääääääääää

Each of this chars will be exceptet by your collation but if the encopding is wrong then each à or ¼ eats two bytes again.

I was starting from the premise Zeos does something wrong... Further more its a question how you use it. I checket the IBX components and -> the same behavior.

Posted: 10.11.2012, 09:51
by miab3
EgonHugeist,

Is not that very similar to FreeTDS in Lazarus?

Michal

Posted: 10.11.2012, 10:59
by EgonHugeist
miab3,

If that charset is used than no conversations where done from FireBird. But with my proposal you'll run into the same issue if other collations are defined for other columns.

I had a look to the column subtypes where firebird wrote in the article:

Code: Select all

Abstraction layers that have to manage this can read the low byte of the sqlsubtype field in the XSQLVAR structure, which contains the character set identifier. 
But that's not right at all! They determine only these:
CS_NONE = 0;
CS_BINARY = 1;
CS_ASCII = 2;
CS_UNICODE_FSS = 3;
CS_METADATA = CS_UNICODE_FSS;

which means Zeos would never be able to do right char conversations for all columns. That leads to pain since charset 'NONE' does exists.

I propose you recreate you database with either UTF8 or WIN1250 as default charset. Than firbird can do all conversations for the column collations.
Is not that very similar to FreeTDS in Lazarus?
Yes and no Michal.

i guess you're right for charset none, Michal. But Mssql is a weak database according functionality. Each free RDMS does support a lot of more functionality than Mssql. And Mssql doesn't support a neutral charset like utf8. That's one of the reasons for my implementations...

Posted: 10.11.2012, 11:08
by miab3
EgonHugeist,

Solution:
TZConnection.ClientCodePage = WIN1250
TZConnection.AutoEncode := True;
Does not work.
It not allows to store full lenght national character strings in Lazarus.

Still it seems to me that you can use FreeTDS solution for the non Unicode fields Firebird(NONE).

Michal

Posted: 10.11.2012, 12:54
by EgonHugeist
miab3,

well i've debuggedd me down now.
But that's not right at all! They determine only these:
CS_NONE = 0;
CS_BINARY = 1;
CS_ASCII = 2;
CS_UNICODE_FSS = 3;
CS_METADATA = CS_UNICODE_FSS;
that was terribly wrong! It seems firebird does it right. On our implementation is a lot missing. Starting right now, Michal...... ):

But the ibx components do not support such an implementation!

which controlsCodepage is set for Lazarus? cCP_UTF or cCP_UTF16?

Posted: 10.11.2012, 13:06
by miab3
EgonHugeist,

Author IBX always said that this is not a library for Firebird but for Interbase and quite carefully avoided innovations introduced into the Firebird.
Among other things, the code pages.
Closer to the Firebird may be UIB and FIBPlus

Michal

Posted: 10.11.2012, 17:21
by EgonHugeist
miab3,

made a patch spezially for CharSet 'NONE'. I do now determine each column collation. To get it working right: TZConnection.ClientcodePage := 'NONE'.

Rev 2002 \testing

Code: Select all

CREATE TABLE PEOPLE
(
  P_ID Smallint NOT NULL,
  P_DEP_ID Smallint,
  P_NAME Varchar(40) CHARACTER SET UTF8,
  P_BEGIN_WORK Time,
  P_END_WORK Time,
  P_PICTURE Blob sub_type 0,
  P_RESUME Blob sub_type 1,
  P_REDUNDANT Smallint,
  BLABLA Varchar(10) CHARACTER SET WIN1252,
  PRIMARY KEY (P_ID)
);
GRANT DELETE, INSERT, REFERENCES, SELECT, UPDATE
 ON PEOPLE TO  SYSDBA WITH GRANT OPTION;
You see i use two different collations.

Both can be written and reconverted correctly:

Posted: 10.11.2012, 20:56
by EgonHugeist
To show you everything is rightly encoded, that's the way it looks with flame robin:

Posted: 13.11.2012, 11:36
by miab3
EgonHugeist,

R2005
Lazarus 2.7.1 Linux 64
When compiling the application gives me an error:
source/core/ZEncoding.pas(66,3) Fatal: Can not find unit Windows used by ZEncoding

Michal