Lazarus 0.9.31+MySql server 5.5+windows 7 "Access Viola

The alpha/beta tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.

This is a forum that will be removed once the 7.X version goes into stable!!

Moderators: gto, EgonHugeist, olehs

ism
Zeos Test Team
Zeos Test Team
Posts: 202
Joined: 02.10.2010, 20:48

Lazarus 0.9.31+MySql server 5.5+windows 7 "Access Viola

Post by ism »

Hello, i try to test version from svn://zeos.firmos.at/zeos/branches/testing rev 887
But the program crash when i try to write some sumbols in ztable through DBGrid
And more , the string of any length in DBGrid visible as "??" (russian chars)

this problem repeat in Windows XP and Lazarus 0.9.30 and MySql 5.1

Exception in lines ZAbstractRODataset
ftWideString:
begin
{$IFDEF BDS4_UP}
WStrCopy(Buffer, PWideChar(RowAccessor.GetUnicodeString(ColumnIndex, Result)));
{$ELSE}
line 1381 --------->PWideString(Buffer)^ := RowAccessor.GetUnicodeString(ColumnIndex, Result);
{$ENDIF}
Result := not Result;
end;

Error "Invalid Pointer operation"

test project
http://narod.ru/disk/10018079001/test_proj.7z.html


Version from http://zeosdownloads.firmos.at/downloads/snapshots/
ZEOSLIB_TRUNK_REV834.zip working good

Sorry for bad english
Dali
Junior Boarder
Junior Boarder
Posts: 30
Joined: 08.02.2010, 14:36

Post by Dali »

The same happened to me when testing ADO (yes, I'm aware of the lack of support of the ADO driver under Lazarus):

http://zeos.firmos.at/viewtopic.php?p=12959#12959

So, maybe it's the same problem.
Dali
Junior Boarder
Junior Boarder
Posts: 30
Joined: 08.02.2010, 14:36

Post by Dali »

Anyway, I tried trunk rev 834 and it crashed as well.
Dali
Junior Boarder
Junior Boarder
Posts: 30
Joined: 08.02.2010, 14:36

Post by Dali »

Any clues on this anyone? Please?
ism
Zeos Test Team
Zeos Test Team
Posts: 202
Joined: 02.10.2010, 20:48

Post by ism »

It happens, because not allocated memory for the pointer, when function is called

function TZAbstractRODataset.GetFieldData(Field: TField;
Buffer: Pointer): Boolean;

I'm trying to find the problematic place
Lazarus 1.0.8 fpc 2.6.0
ism
Zeos Test Team
Zeos Test Team
Posts: 202
Joined: 02.10.2010, 20:48

Post by ism »

Who knows where this function is called?

This only happens with DBgrid and Datasource
ism
Zeos Test Team
Zeos Test Team
Posts: 202
Joined: 02.10.2010, 20:48

Post by ism »

Details
Сreated a new project (just in case)
Any string row from the database shows as "???"

Image
Zoran
Senior Boarder
Senior Boarder
Posts: 55
Joined: 07.05.2010, 22:32

Post by Zoran »

Do not forget to put the line "codepage=UTF8" in Properties property of the ZConnection.
ism
Zeos Test Team
Zeos Test Team
Posts: 202
Joined: 02.10.2010, 20:48

Post by ism »

Is not the case, I tried it.

ZConnection1.Connect;
ZSQLProcessor1.Script.Text:='SET NAMES UTF8';
ZSQLProcessor1.Execute;
ZQuery1.Open;

result - access violation

and

codepage=UTF8

result - '??.'

The strung in table is

'привет привет ... '

It must be displayed as '??????? ????????'
ism
Zeos Test Team
Zeos Test Team
Posts: 202
Joined: 02.10.2010, 20:48

Post by ism »

I found
Problem in module ZDbcMySqlUtils.pas
function ConvertMySQLTypeToSQLType(TypeName, TypeNameFull, Collation: string): TZSQLType;

Bug appeared in the revision 850, in 848 all ok.


Old procedure return STSTRING
New procedure return STUNICODESTRING

Probably a problem with the processing of type
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

ism,

Did you check the discussion in http://zeos.firmos.at/viewtopic.php?t=2652
That's the thread that caused revision 850.
I'm not working with mysql databases using non latin1 encodings so I'm really unsure how this works/should work exactly.

Mark
Image
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Found your patch and applied it in SVN rev 903
Image
ism
Zeos Test Team
Zeos Test Team
Posts: 202
Joined: 02.10.2010, 20:48

Post by ism »

In Lazarus 0.9.30 by default all strings in UTF8

Enough

Code: Select all

ZConnection1.Connect;
ZSQLProcessor1.Script.Text:='SET NAMES utf8;';
ZSQLProcessor1.Execute;
ZQuery1.Open;



or

Code: Select all

ZConnection1.Properties='CodePage=UTF8'
Lazarus 1.0.8 fpc 2.6.0
ism
Zeos Test Team
Zeos Test Team
Posts: 202
Joined: 02.10.2010, 20:48

Post by ism »

If something should test, contact me
Lazarus 1.0.8 fpc 2.6.0
Dali
Junior Boarder
Junior Boarder
Posts: 30
Joined: 08.02.2010, 14:36

Post by Dali »

I think that it's the same problem in a different database protocol, so I'll say here that Zeos snv 903 is not working for me using PostgreSQL in Lazarus (from today's svn, compiled using fpc 2.4.2).

Database encoding is UTF8. I tried adding "codepage=utf8", even optionally followed by "client_encoding=utf8". In any case, it just crashes down with "invalid pointer operation".

If I do something similar to what you did, editing src/dbc/ZDbcPostgreSQLUtils.pas:

Code: Select all

  if Connection.GetCharactersetCode = csUTF8 then
    case Result of
{$IFNDEF FPC}
      stString: Result := stUnicodeString;
{$ENDIF}
      stAsciiStream: Result := stUnicodeStream;
    end;
... Then it does not crash, but all the special chars reflect as "?".
Locked