Page 1 of 2

[patch_done] Bug insert record russian symbols Linux Lazarus

Posted: 08.03.2012, 22:52
by ism
with ascii symbols all ok , with Cyrillic this
Linux Lazarus 0.9.30.2 fpc 2.4.4 MySql 5.5

Image
Image
Image
Image

in base the field is null, after insert
where inserted symbols ?
CREATE TABLE `new_table1` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`str` varchar(200) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=47 DEFAULT CHARSET=utf8 PACK_KEYS=0;

Posted: 09.03.2012, 12:45
by ism
This only in Linux in Windows Xp all ok
possible it is related to the peculiarities of Unicode in Lazarus Linux

In unix Lazarus all strings and functions results Only in utf8

Posted: 09.03.2012, 19:38
by EgonHugeist
Changed GetString-default for FPC to:

GetString(ColumnIndex: Integer; const CharEncoding: TZCharEncoding = {$IFDEF FPC}ceUTF8{$ELSE}ceAnsi{$ENDIF}): Ansistring;

Eventually the FPC UTF8ToAnsi doesn't work for Linux..
That's something i wanted to do long times before.

Can you pleas verify? Changes?

Posted: 09.03.2012, 19:45
by ism
Rev 1064
No effect , the problem is not solved
maybe problem with update process and key fields ?

Posted: 09.03.2012, 19:57
by EgonHugeist
Can you debug out:

TZDbcGenericResolver.pas

procedure TZGenericCachedResolver.FillStatement(Statement: IZPreparedStatement;
Params: TObjectList; OldRowAccessor, NewRowAccessor: TZRowAccessor);

and check the Values at line 600 (set a breakpoint just befure you'll post the row):
Statement.SetString(I + 1, ZAnsiString(RowAccessor.GetString(ColumnIndex, WasNull)));

Check the RowAccessor.GetString/the Result of ZAnsiString and the Statement.SetString.

Are the values valid?

Posted: 09.03.2012, 21:35
by ism
RowAccessor.GetString(ColumnIndex, WasNull); returns empty value
stString:
{$IFDEF CHECK_CLIENT_CODE_PAGE}
begin
test_s:=RowAccessor.GetString(ColumnIndex, WasNull);
Statement.SetString(I + 1, ZAnsiString(RowAccessor.GetString(ColumnIndex, WasNull)));
end;
{$ELSE}
Statement.SetString(I + 1, AnsiString(RowAccessor.GetString(ColumnIndex, WasNull)));
{$ENDIF}
result

test_s:='' , but i write russian symbols value

wireshark sniffer show

Code: Select all

INSERT INTO test.new_table1 (id,str) VALUES (NULL,NULL)

Posted: 09.03.2012, 21:47
by EgonHugeist
Uppps whats that? That means we've a problem on setting the data between DB.TField and the AbstactRODataSet. There i did no work. Start to study me in what and why it happens...

ism,

can you please open the ZDateSetUtils.pas

go to line 516 of
procedure PostToResultSet(ResultSet: IZResultSet;
const FieldsLookupTable: TIntegerDynArray; Fields: TFields;
RowAccessor: TZRowAccessor);

and check the value assignment between ftString too? If we've the same results like before we've a problem higher up...

Posted: 09.03.2012, 22:31
by ism
ZDatasetUtils.pas
ftString:
// gto: do we need PChar here?
//ResultSet.UpdatePChar(ColumnIndex, RowAccessor.GetPChar(FieldIndex, WasNull));
begin
tests:=RowAccessor.GetString(FieldIndex, WasNull);
ResultSet.UpdateString(ColumnIndex, AnsiString(RowAccessor.GetString(FieldIndex, WasNull)));
end;
write "ыыы"

result

test:='';

Posted: 09.03.2012, 22:32
by ism
the bug not stable ,
Sometimes a record with a russian symbols is inserted properly

Posted: 10.03.2012, 13:50
by EgonHugeist
random bugs are difficult.
Do you see source-differences between MSWINDOWS vs. UNIX?
Do you've findings?
How did you inserted the other displayed values of your example on topic?

Posted: 10.03.2012, 15:03
by ism
Hm, this bug also in trunk rev 926 ,

maybe problem in Lazarus ?

I test it

Posted: 10.03.2012, 15:31
by EgonHugeist
ism,
you're a man of spoken words. You said you want help and you do. I like it.

If the trunk has the same problems than it seems really like a Lazarus problem...

It would be wonderfull to get the reason why it happens and/or a solution...
It makes me a little bit wondering why we've no report about this issues before. On the other hand maybe nobody tested it before. Or am i wrong here?

I See you check this issues with FPC2.4.4 is it complicated for you to upgrade Lazarus 0.9.30 and FPC 2.6? Can you use differnt IDE's eventually? Is the Problem the same?

Posted: 10.03.2012, 15:31
by ism
in last lazarus bug is present ,
maybe cause in mysql

Posted: 10.03.2012, 15:52
by EgonHugeist
I don't belive it's a MySQL problem... Actually i'm going deeper in the Dbc-Layers to see if it's possible there...

Posted: 10.03.2012, 16:38
by ism
Hint

If insert russian symbols without DBNavigator (arrow down in keyboard), all inserted normally

mysteriously

maybe problem in post method in DBNavigator Lazarus or Zeos