Page 1 of 1

[patch_done] Fix datetime to string Lazarus program MySql

Posted: 21.05.2011, 20:13
by ism
Need to replace all stUnicodeString to stString for Lazarus in other modules for fix Lazarus crashes

It seems a problem in Lazarus and not in zeos.

Discussion
http://zeos.firmos.at/viewtopic.php?t=3179

Code: Select all

Index: src/dbc/ZDbcMySqlUtils.pas
===================================================================
--- src/dbc/ZDbcMySqlUtils.pas	(revision 903)
+++ src/dbc/ZDbcMySqlUtils.pas	(working copy)
@@ -243,14 +243,22 @@
           (PMYSQL_FIELD(FieldHandle)^.charsetnr = 83) or
         	((PMYSQL_FIELD(FieldHandle)^.charsetnr>=192) and
           (PMYSQL_FIELD(FieldHandle)^.charsetnr<=210)) )(*  the end is not fix ??? *) then
-        Result := stUnicodeString
+    {$IFDEF FPC}
+      Result := stString
+    {$ELSE}
+      Result := stUnicodeString
+    {$ENDIF}
       else
       if ( // UCS2
         	(PMYSQL_FIELD(FieldHandle)^.charsetnr = 35) or
           (PMYSQL_FIELD(FieldHandle)^.charsetnr = 90) or
         	((PMYSQL_FIELD(FieldHandle)^.charsetnr>=128) and
           (PMYSQL_FIELD(FieldHandle)^.charsetnr<=146)) )(*  the end is not fix ??? *) then
-        Result := stUnicodeString
+    {$IFDEF FPC}
+      Result := stString
+    {$ELSE}
+      Result := stUnicodeString
+    {$ENDIF}
       else
         Result := stString;
     FIELD_TYPE_ENUM:

Posted: 21.05.2011, 20:18
by ism
In Delphi XE (2011) all ok and does not require changes

Delphi correctly working with stUnicodeString

Posted: 22.05.2011, 00:38
by bobo
Yes, this seems to fix it. Thank you.

I am not sure we can call this a "problem" with Lazarus. It is just that FPC and Lazarus uses UTF-8 strings by default on all operating systems.

Posted: 08.06.2011, 18:52
by bobo
There might be other places when something like this needs to be done for FPC/Lazarus.
The other day I again saw a lot of ?? field value returns for some simple string fields (not calculated fields, just normal db fields) on Windows (did not check on Linux).

Posted: 02.09.2011, 20:44
by mdaems
Done. SVN rev 928. Testing branch.