[patch_done] Fix datetime to string Lazarus program MySql

Code patches written by our users to solve certain "problems" that were not solved, yet.

Moderators: gto, cipto_kh, EgonHugeist, mdaems

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

[patch_done] Fix datetime to string Lazarus program MySql

Postby ism » 21.05.2011, 20:13

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:
Last edited by ism on 21.05.2011, 20:20, edited 1 time in total.

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

Postby ism » 21.05.2011, 20:18

In Delphi XE (2011) all ok and does not require changes

Delphi correctly working with stUnicodeString

bobo
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 20.05.2011, 03:19

Postby bobo » 22.05.2011, 00:38

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.

bobo
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 20.05.2011, 03:19

Postby bobo » 08.06.2011, 18:52

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).

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

Postby mdaems » 02.09.2011, 20:44

Done. SVN rev 928. Testing branch.
Image


Return to “User Patches”

Who is online

Users browsing this forum: No registered users and 1 guest