MySQL, conversion from Strings from Zeos 6.6.6 to Zeos 7

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

Locked
mmvisual
Senior Boarder
Senior Boarder
Posts: 51
Joined: 13.10.2010, 14:55

MySQL, conversion from Strings from Zeos 6.6.6 to Zeos 7

Post by mmvisual »

Now, I use the ZeosV7 SVN1159 FPC2.6
https://zeoslib.svn.sourceforge.net/svn ... gonhugeist

And I have make a upgrade from Zeos 6.6.6 to 7. In Zeos 6.6.6+MySQL was a bug and all Strings are doubled UTF8Encoded and wrong posted into the Database. (See MyPHPAdmin or MySQLWorkbech)
This mistake needs an update function to correct that bug. This function must everybody self programing for his database.

I have make it, here my code example:

Code: Select all

      q2 := TZQuery.Create(Self);
      q2.Connection := q.Connection;
      q.SQL.Text := 'BEGIN';
      q.ExecSQL;
      q.SQL.Text := 'SHOW TABLES';
      q.Open;
      While Not q.EOF Do // Seek for all tabels
      Begin
        q2.Close;
        q2.SQL.Text := 'SELECT * FROM ' + LowerCase(q.Fields[0].AsString);
        q2.Open;
        While Not q2.EOF Do // Seek for all Datalines
        Begin
          bOK := False;
          For i := 0 To q2.FieldCount - 1 Do // Seek for all colums
          Begin
            fi := q2.Fields[i];
            If fi.DataType In [ftString, ftMemo] Then
            Begin
              If Not bOK Then
                q2.Edit;
              bOK := True;
              fi.AsString := UTF8Decode(WideString(fi.AsString));
            end;
          end;
          If bOK Then
            q2.Post;
          q2.Next;
        end;
        q.Next;
      End;
      q.Close;
      q2.Close;
      q2.Free;
      q.SQL.Text := 'COMMIT';
      q.ExecSQL;
You only make this conversion one time with a update. After them you can see all Characters like üäöß right.

Have a lot of fun, regards Markus.
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

Thanks mmvisual,

for that hint. I must admit i never realised this bug and didn't wanted to beleave it. :x
Until i saw that 6.6.6 bug flawless with my own eyes. :shock:

Zeos7 becomes better and better 8) !

Markus, your workaround will be very useful for everybody i hope! :bash:

Michael
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
Locked