[patch_done] PostgreSQL UTF8 Charset Patch R5 for 6.6.3

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

Moderators: gto, cipto_kh, EgonHugeist, mdaems

Post Reply
whitekid
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 05.11.2007, 07:05
Contact:

[patch_done] PostgreSQL UTF8 Charset Patch R5 for 6.6.3

Post by whitekid »

Here is PostgreSQL utf8 Patch for Zeoslib 6.6.3 Stable.

It only tested on Delphi 2007

You need to set TZConnection.Options as

Code: Select all

codepage=utf8
client_encoding=utf8
ps. This patch only tested on D2007. on D7 or below this patch make comile error that unknown identifier ftWideMemo type missed in TFieldType(DB.pas).

If you use D7 please help me to solve this problem.. :D
You do not have the required permissions to view the files attached to this post.
whitekid
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 05.11.2007, 07:05
Contact:

Post by whitekid »

If you apply this patch on D7. You need to map TEXT type to TWideString field.

follow this step

STEP1: replace all ftWideMemo usages to using conditional directive
ex) {$IFNDEF VER150BELOW}ftWideMemo{$ENDIF}

STEP2: change the type mapping:
in src/component/ZDatasetUtils.pas patch
- stUnicodeString, stUnicodeStream:
+ stUnicodeString:
Result := ftWideString;
+ stUnicodeStream:
+ Result := {$IFDEF VER150BELOW}ftWideString{$ELSE}ftWideMemo{$ENDIF};

It may be OK(but not tested. I have no D7). If this steps are work OK please send me the modified patch.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Thanks a lot Whitekid.

I'll try to apply this patch to Testing branch when I find some time. It's not very probable we will add this patch to a 6.6.X version.
Normally this privilege is reserved for real bug fixes. The change you did is likely to have impact on programs using the 6.6.3 version who did already handle the stUnicodeStream as a stWidestring. We can't ask users of a stable version to change this again, I think.

Mark
Image
whitekid
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 05.11.2007, 07:05
Contact:

Post by whitekid »

We can't ask users of a stable version to change this again
I totally agree with you. and I hope this patch will be incldued next release(may be 6.7.X)
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

I think you made a small typo. But tell me if I'm wrong.

Code: Select all

+++ src/component/ZSqlProcessor.pas	Fri Aug 08 17:21:48 2008
@@ -506,6 +506,15 @@
                 Stream.Free;
               end;
             end;
+          ftWideMemo:
+            begin
+              Stream := WideStringStream(Param.AsWideString);
+              try
+                Statement.SetAsciiStream(I + 1, Stream);   <<---- SetUnicodeStream??
+              finally
+                Stream.Free;
+              end;
+            end;
           ftBlob, ftGraphic:
             begin
               Stream := TStringStream.Create(Param.AsBlob);
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 »

Done SVN rev 414.
Please test. Test suite didn't fail with mysql. I hope there will be no trouble with other databases.

Mark
Image
Post Reply