Page 3 of 3
Re: build Import LIB from LibPQ.DLL
Posted: Thu Jul 20, 2023 4:29 am
by Jimmy
hi,
have try Sample c:\fwh\samples\pgre01.prg again
using my old PostgreSQL v9.5 Server and WIN1252 for Database
now i can "input", even German Umlaute, and "save" it
on same Server i try UTF8 Table but than it fail again ...
so i need to use ANSI Table for Fivewin Sample
Re: build Import LIB from LibPQ.DLL
Posted: Thu Jul 20, 2023 7:05 am
by nageswaragunupudi
Thanks for the information.
How do you propose to proceed further now?
Re: build Import LIB from LibPQ.DLL
Posted: Thu Jul 20, 2023 8:20 am
by Jimmy
hi,
i have read in PostgreSQL Manual and found
"SHOW SERVER_ENCODING"
"SHOW CLIENT_ENCODING"
it does show me UTF8 or WIN1252, depend on Server, on both Side
but i can change it to
Code: Select all | Expand
cQuery := 'SET CLIENT_ENCODING TO "WIN1252"'
cENCODING := oPGU:QuickQuery( cQuery )
CONNECT2SRV( 207 ) cPGVersion = "PostgreSQL 14.1, compiled by Visual C++ build 1914, 64-bit"
CONNECT2SRV( 209 ) FWPG_ListSchemas( oPGU ) = {"pg_toast","pg_catalog","public","information_schema"}
CONNECT2SRV( 213 ) cENCODING = "UTF8"
CONNECT2SRV( 217 ) cENCODING = ""
CONNECT2SRV( 221 ) cENCODING = "WIN1252"
Code: Select all | Expand
cQuery := "SELECT version()"
cPGVersion := oPGU:QuickQuery( cQuery )
IF !EMPTY( cPGVersion )
oPGU:cVersion := cPGVersion
ENDIF
fwlog cPGVersion
fwlog FWPG_ListSchemas( oPGU )
cQuery := "SHOW SERVER_ENCODING"
cENCODING := oPGU:QuickQuery( cQuery )
fwlog cENCODING
cQuery := 'SET CLIENT_ENCODING TO "WIN1252"'
cENCODING := oPGU:QuickQuery( cQuery )
fwlog cENCODING
cQuery := "SHOW CLIENT_ENCODING"
cENCODING := oPGU:QuickQuery( cQuery )
fwlog cENCODING
now it work perfect UTF8 <-> WIN1252 and no hb_translate() is need any more
! Note : SERVER_ENCODING Setting are default for Database ( Catalog ) ... but Table itself can be different
p.s. have use TGrid() but it should work with XBROWSE too
Re: build Import LIB from LibPQ.DLL
Posted: Thu Jul 20, 2023 5:58 pm
by nageswaragunupudi
Thanks for sharing the information.
What is "WIN1252" ?
Is the German "Umlaute" issue is resolved now? ( by keeping FW_SetUnicode() to .F.)
Please also share the code for creating a table with WIN1252
Re: build Import LIB from LibPQ.DLL
Posted: Thu Jul 20, 2023 10:15 pm
by Jimmy
hi,
nageswaragunupudi wrote:What is "WIN1252" ?
Manual PostgreSQL
22.3.3. Automatic Character Set Conversion Between Server and Client
i got WIN1252 Codepage from here
https://wiki.freepascal.org/Language_Codes
https://www.vbsedit.com/html/882ca1eb-8 ... 40bf70.asp
https://www.science.co.il/language/Locale-codes.php
nageswaragunupudi wrote:Is the German "Umlaute" issue is resolved now? ( by keeping FW_SetUnicode() to .F.)
no Problem with German "Umlaute" any more
do not need to use FW_SetUnicode(.T. / .F.)
nageswaragunupudi wrote:Please also share the code for creating a table with WIN1252
please Note : "Database" = "Catalog" does "hold" TABLE
you can use "Database" e.g Customer1 to "hold" all TABLE of Customer1
you can use "Database" e.g Customer2 to "hold" all TABLE of Customer2
"Database" default Setting work for TABLE
Code: Select all | Expand
CREATE DATABASE name
[ [ WITH ] [ OWNER [=] user_name ]
[ TEMPLATE [=] template ]
[ ENCODING [=] encoding ]
[ LC_COLLATE [=] lc_collate ]
[ LC_CTYPE [=] lc_ctype ]
[ TABLESPACE [=] tablespace ]
[ CONNECTION LIMIT [=] connlimit ] ]
Code: Select all | Expand
CREATE DATABASE mdidemo
WITH
OWNER = postgres
ENCODING = 'WIN1252'
LC_COLLATE = 'German_Germany.1252'
LC_CTYPE = 'German_Germany.1252'
TABLESPACE = pg_default
CONNECTION LIMIT = -1;
Code: Select all | Expand
EATE DATABASE mdidemo
WITH
OWNER = postgres
ENCODING = 'UTF8'
LC_COLLATE = 'German_Germany.1252'
LC_CTYPE = 'German_Germany.1252'
TABLESPACE = pg_default
CONNECTION LIMIT = -1;
Re: build Import LIB from LibPQ.DLL
Posted: Fri Jul 21, 2023 3:40 am
by nageswaragunupudi
Thanks for sharing the information.
Next.
You were getting errors while saving data with the pgre01.prg.
Now is that problem resolved?
If so what could be the reason for those errors?
Can you provide feedback on this issue please?
Re: build Import LIB from LibPQ.DLL
Posted: Sat Jul 22, 2023 11:15 pm
by Jimmy
hi,
nageswaragunupudi wrote:You were getting errors while saving data with the pgre01.prg.
Now is that problem resolved?
when set "ENCODING" and FW_SetUnicode( .F. ) it work on both PostgreSQL Server and XBROWSEr
nageswaragunupudi wrote:If so what could be the reason for those errors?
Can you provide feedback on this issue please?
i can´t say why "edit" use wrong "Position" when NOT set "ENCODING" and FW_SetUnicode( .F. )
---
my "native" LibPQ.DLL Version, using TGrid() work also with FW_SetUnicode( .T. )
but TGrid() fail to "send" Notify Event and "Input" is wrong when use FW_SetUnicode( .T. )
---
is FW_SetUnicode() for hole App of for each Thread
Re: build Import LIB from LibPQ.DLL
Posted: Sun Jul 23, 2023 11:58 pm
by nageswaragunupudi
is FW_SetUnicode() for hole App of for each Thread
Yes, this setting is for the entire application.
This setting decides whether all Windows messages are 16-bit (UTF16) or 8-bit(ANSI)