Critical Unicode Problem in V 4.1.4 when working with Params

Discussion of open issues, suggestions and bugs regarding PgDAC (PostgreSQL Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
dschuch
Posts: 75
Joined: Thu 05 Feb 2009 15:29
Location: Dresden

Critical Unicode Problem in V 4.1.4 when working with Params

Post by dschuch » Fri 18 Oct 2013 11:02

Hy, we have some serious problems after Upgrading from 3.1.4 to 4.1.4

Can u please check out the following code, is this is working correct on your side? u need just an empty Delphi Application, Form, Button on it and paste the Following Code inside the OnClick. Perhaps u need to change Connection Parameters (esp. Port).

Code: Select all

var
    PgConnection1: TPgConnection;
    PgQuery1: TPgQuery;
begin
 PgConnection1:=TPgConnection.Create(Self);
 PgConnection1.Server:='localhost';
 PgConnection1.Port:=5433;
 PgConnection1.Username:='postgres';
 PgConnection1.Options.UseUnicode:=True;

 PgQuery1:=TPgQuery.Create(PgConnection1);
 PgQuery1.Connection:=PgConnection1;
 PgQuery1.Options.UnpreparedExecute:=True;

 PgQuery1.SQL.Text:='DROP TABLE IF EXISTS test; CREATE TABLE test (id SERIAL PRIMARY KEY, descr VARCHAR(100));';
 PgQuery1.Execute;

 PgQuery1.SQL.Text:='INSERT INTO test (descr) VALUES (''äöü'')';
 PgQuery1.Execute;

 PgQuery1.SQL.Text:='SELECT * FROM test';
 PgQuery1.Open;

 ShowMessage('this is ok: '+PgQuery1.FieldByName('descr').AsString); //result is "äöü"

 PgQuery1.Close;

 PgQuery1.SQL.Text:='DELETE FROM test';
 PgQuery1.Execute;

 PgQuery1.SQL.Text:='INSERT INTO test (descr) VALUES (:param)';
 PgQuery1.ParamByName('param').AsString:='äöü';
 PgQuery1.Execute;

 PgQuery1.SQL.Text:='SELECT * FROM test';
 PgQuery1.Open;

 ShowMessage('this is a real cirtical bug: '+PgQuery1.FieldByName('descr').AsString); //result is "äöü"
BTW: i think its a bug too, that the PGConnection implicitly uses the username as DataBaseName if no DataBase is specified (like in this test case => it connects implicit to DataBase "postgres" because of the username.

Code: Select all

-- Database: postgres

-- DROP DATABASE postgres;

CREATE DATABASE postgres
  WITH OWNER = postgres
       ENCODING = 'UTF8'
       TABLESPACE = pg_default
       LC_COLLATE = 'German_Germany.1252'
       LC_CTYPE = 'German_Germany.1252'
       CONNECTION LIMIT = -1;

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Critical Unicode Problem in V 4.1.4 when working with Params

Post by AlexP » Fri 18 Oct 2013 12:13

Hello,

Thank you for the information, we have reproduced the problem and will try to fix it in the nearest future. For the time being, for work with unicode parameters, you should disable the UnpreparedExecute property

dschuch
Posts: 75
Joined: Thu 05 Feb 2009 15:29
Location: Dresden

Re: Critical Unicode Problem in V 4.1.4 when working with Params

Post by dschuch » Tue 26 Nov 2013 11:39

Hey, is the problem is fixed?

Daniel

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Critical Unicode Problem in V 4.1.4 when working with Params

Post by AlexP » Wed 27 Nov 2013 13:13

Hello,

We haven't fixed this problem yet; it will be fixed in the next build.

Post Reply