X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 26307D1B431 for ; Fri, 28 Nov 2003 11:54:08 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 21699-05 for ; Fri, 28 Nov 2003 07:53:38 -0400 (AST) Received: from paiol.terra.com.br (paiol.terra.com.br [200.176.3.18]) by svr1.postgresql.org (Postfix) with ESMTP id 9F9D7D1B47E for ; Fri, 28 Nov 2003 07:53:34 -0400 (AST) Received: from botucatu.terra.com.br (botucatu.terra.com.br [200.176.3.78]) by paiol.terra.com.br (Postfix) with ESMTP id 614478482F6; Fri, 28 Nov 2003 09:53:36 -0200 (BRST) Received: from ttcristian (200-180-005-167.fnsce7006.dsl.brasiltelecom.net.br [200.180.5.167]) (authenticated user cristian_custodio) by botucatu.terra.com.br (Postfix) with ESMTP id 11E5929C989; Fri, 28 Nov 2003 09:53:31 -0200 (BRST) Message-ID: <001d01c3b5ae$38a28da0$b301a8c0@ttcristian> Reply-To: "Cristian Custodio" From: "Cristian Custodio" To: "Richard Combs" Cc: References: <005d01c3b50d$f1328c90$b301a8c0@ttcristian> <3FC6FD17.4020300@covad.net> Subject: Re: Character invalid saving memo with UpdateSQL Date: Fri, 28 Nov 2003 09:50:31 -0300 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_001A_01C3B595.0FBAA2B0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/126 X-Sequence-Number: 3528 This is a multi-part message in MIME format. ------=_NextPart_000_001A_01C3B595.0FBAA2B0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sorry, I forget to say that the problem occur just in Upate, not in Insert. And not in first time. You sometimes need update two or tree times until see the error. I have more detail about it. The problem occur because the componet UpdateSQL=20 apply the update using params. Param[x].AsMemo (That is the problem) I change the componente Update SQL to use AsString and it is Worked now. I did the following modification in Unit: DBTables.pas, and Method: SetPara= ms(UpdateKind: TUpdateKind); if Old then Param.AssignFieldValue(Field, Field.OldValue) else begin Value :=3D Field.NewValue;=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20 if VarIsEmpty(Value) then Value :=3D Field.OldValue;=20 if Field.DataType =3D ftMemo then begin Param.AsString :=3D Value; end else begin Param.AssignFieldValue(Field, Value); end; end; I can send you my project in file attachment?=20 Cristian ----- Original Message -----=20 From: Richard Combs=20 To: Cristian Custodio=20 Cc: pgsql-odbc@postgresql.org=20 Sent: Friday, November 28, 2003 4:45 AM Subject: Re: [ODBC] Character invalid saving memo with UpdateSQL I just did a quick test using the following setup postgreSQL 7.4 running on Linux (SuSE 8.2) ODBC client 7.03.02.00 on W2K - SP4 MDAC 2.8 Borland D7 BDE 5.01 LANGDRIVER set to (blank - default setting none chosen) SQLQRYMODE set to SERVER =20=20=20=20=20=20 This is the test database structure bigtest=3D# \encoding SQL_ASCII bigtest=3D# \d table1 Table "public.table1" Column | Type | Modifiers --------+-------------------------+----------- c1 | character(40) | v2 | character varying(4000) | Sample Delphi project type TForm1 =3D class(TForm) Table1: TTable; UpdateSQL1: TUpdateSQL; Query1: TQuery; Button1: TButton; DataSource1: TDataSource; DBGrid1: TDBGrid; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin // query1.ExecSQL; { the query is insert into table1 (c1,v2) values('characters',varchars) } updatesql1.ExecSQL(ukInsert); { updatesql1 is linked to Table1 the insert query is insert into table1 (c1,v2) values('characters-n','varchars-n') } end; end. All the above is linked through BDE to a user DSN Advanced options set to Use Declare/Fetch Parse Statements Unknown Sizes as Longest Updateable Cursors Server side prepare All else is default Results after several inserts bigtest=3D# select * from table1; c1 | v2 ------------------------------------------+------------ characters | varchars characters | varchars characters | varchars characters-n | varchars-n (4 rows) These results are seen in both psql on the server and in the DbGrid that is linked to the table. No "invalid" characters were found. I also tried changing the LANGDRIVER in the BDE to other encodings, while leaving postgreSQL at the above encoding, and got the same results. I can't replicate your problem. I upgraded to postgreSQL 7.4, and no longer have 7.3.4 running, so I don't know if that is the problem, or if it is a problem with BDE and D5. Also note, I'm using D7 Pro not D5, but I don't think the BDE components have changed all that much over the last few versions. One other thing check Borland's usage notes on the updatesql component, they indicate it should only be used for readonly datasets. You might also try Borland's newsgroups see if=20 there is anything about the "invalid" characters in them. HTH Richard=20 Cristian Custodio wrote: I'll do this, thanks. Cristian If you're converting an application from Oracle to PG, that implies t= hat in the Oracle DB you also had such large VARCHAR fields. And since that= didn't give trouble, it furthermore implies that the problem is in the PG = ODBC drivers. Perhaps you should file a bug against them? I'm using delphi 5 and PG: 7.3.4 and BDE I have 1 varchar(4000) column. When I try post any value in= this column using UpdateSQL it save very invalids caracters. Like this:= =ED=ED=ED=ED=ED=ED=ED=ED=ED. Any body could help me? Thanks, Cristian Luciano Custodio=20 ------=_NextPart_000_001A_01C3B595.0FBAA2B0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
 
Sorry, I forget to say that the problem oc= cur just=20 in Upate, not in Insert.
And not in first time. You sometimes need = update=20 two or tree times
until see the error.
 
I have more detail about it.
 
The problem occur because the componet Upd= ateSQL=20
apply the update using params. Param[x].As= Memo=20 (That is the problem)
 
I change the componente Update SQL to use = AsString=20 and it is Worked now.
 
I did the following modification in Unit:= =20 DBTables.pas, and Method: SetParams(UpdateKind: TUpdateKind);
 
      if Old then= =20 Param.AssignFieldValue(Field, Field.OldValue)=20 else
     =20 begin
        Value :=3D=20 Field.NewValue;          =             &nb= sp;    
       = =20 if VarIsEmpty(Value) then Value :=3D=20 Field.OldValue; 
       = if=20 Field.DataType =3D ftMemo then=20 begin
          =20 Param.AsString :=3D=20 Value;

        end e= lse=20 begin
         &nb= sp;=20 Param.AssignFieldValue(Field,=20 Value);
       =20 end;
      end;
I can send you my project in&nbs= p;file=20 attachment?
 
Cristian
 
----- Original Message -----
Fro= m:=20 Richard Co= mbs=20
To: Cristian Custodio
Cc: pgsql-odbc@postgresql.org <= /DIV>
Sent: Friday, November 28, 2003 4:= 45=20 AM
Subject: Re: [ODBC] Character inva= lid=20 saving memo with UpdateSQL

I just did a quick test using the following=20 setup

postgreSQL 7.4 running on Linux (SuSE 8.2)
ODBC client=20 7.03.02.00 on W2K - SP4
MDAC 2.8
Borland D7
BDE=20 5.01
    LANGDRIVER set to (blank - default setting non= e=20 chosen)
    SQLQRYMODE set to SERVER
  &nb= sp;=20

This is the test database structure

bigtest=3D#=20 \encoding
SQL_ASCII

bigtest=3D# \d=20 table1
          &nb= sp;=20 Table "public.table1"
 Column=20 |         =20 Type           |=20 Modifiers
--------+-------------------------+-----------
 c1&n= bsp;   =20 | character(40)         &nbs= p;=20 |
 v2     | character varying(4000)=20 |


Sample Delphi project

type
  TForm1 =3D= =20 class(TForm)
     Table1: TTable;
  &= nbsp;=20  UpdateSQL1: TUpdateSQL;
     Query1:=20 TQuery;
     Button1: TButton;
  &nbs= p;=20  DataSource1: TDataSource;
     DBGrid1:=20 TDBGrid;
     procedure Button1Click(Sender:=20 TObject);
  private
     { Private declara= tions=20 }
  public
     { Public declarations=20 }
  end;

var
  Form1:=20 TForm1;

implementation

{$R *.dfm}

procedure=20 TForm1.Button1Click(Sender: TObject);
begin
//   =20 query1.ExecSQL;
{ the query is
    insert into table= 1=20 (c1,v2)
   =20 values('characters',varchars)
}
   =20 updatesql1.ExecSQL(ukInsert);
{ updatesql1 is linked to Table1
&nbs= p;=20 the insert query is
    insert into table1=20 (c1,v2)
   =20 values('characters-n','varchars-n')
}
end;

end.

All t= he=20 above is linked through BDE to a user DSN
Advanced options set=20 to
    Use Declare/Fetch
    Parse=20 Statements
    Unknown Sizes as=20 Longest
    Updateable Cursors
    Se= rver=20 side prepare
All else is default

Results after several=20 inserts

bigtest=3D# select * from=20 table1;
          &n= bsp;        =20 c1            = ;       =20 |    =20 v2
------------------------------------------+------------
 ch= aracters           &= nbsp;           &nbs= p;      =20 |=20 varchars
 characters       &nb= sp;            =           =20 |=20 varchars
 characters       &nb= sp;            =           =20 |=20 varchars
 characters-n       &= nbsp;           &nbs= p;        =20 | varchars-n
(4 rows)

These results are seen in both psql = on=20 the server and in the
DbGrid that is linked to the table.

No=20 "invalid" characters were found.

I also tried changing the LANGDRI= VER=20 in the BDE to other encodings,
while leaving postgreSQL at the above= =20 encoding, and got the
same results.

I can't replicate your=20 problem.  I upgraded to postgreSQL 7.4, and
no longer have 7.3.4= =20 running, so I don't know if that is the problem,
or if it is a problem= with=20 BDE and D5.  Also note, I'm using
D7 Pro not D5, but I don't thin= k the=20 BDE components have
changed all that much over the last few=20 versions.

One other thing check Borland's usage notes on the=20 updatesql
component, they indicate it should only be used for=20 readonly
datasets.  You might also try Borland's newsgroups see i= f=20
there is anything about the "invalid" characters in=20 them.

HTH

Richard


Cristian Custodio wrote:
I'll do this, thanks.
 
Cristian
 
If you're converting an application from Oracle to PG, that = implies=20 that in the Oracle DB you also had such large VARCHAR fields. And sin= ce=20 that didn't give trouble, it furthermore implies that the problem is = in=20 the PG ODBC drivers.
 
Perhaps you should file a bug against them?
I'm using delphi 5 and PG:= 7.3.4=20 and BDE
 
I have 1 varchar(4000) col= umn. When=20 I try post any value in this column
using UpdateSQL it save ve= ry=20 invalids caracters. Like this: =ED=ED=ED=ED=ED=ED=ED=ED=ED.=
 
Any body could help=20 me?
 
Thanks,
 
Cristian Luciano Custodio=20
= ------=_NextPart_000_001A_01C3B595.0FBAA2B0--