From: Campbell, Greg <greg.campbell@us.michelin.com>
To: A.j. Langereis <a.j.langereis@inter.nl.net>
Cc: pgsql-odbc@postgresql.org
Subject: Re: Values in the select
Date: Fri, 23 Dec 2005 23:05:45 -0500
Message-ID: <43ACC919.6080609@us.michelin.com> (raw)
In-Reply-To: <001401c60749$bd1ab910$6500a8c0@aarjan2>
References: <001401c60749$bd1ab910$6500a8c0@aarjan2>
Nice sample.
Perhaps you can use a DSN connection and in the PostgreSQL ODBC Driver setup for the connection turn on
mylog.
Or you can use the ODBC Administrator, under the tracing tab, Start Tracing.
Or in the server postgresql.conf temporarily turn the logging on for all statements, to capture lower
level ODBC communication.
Do the ODBC connection encoding, and the database encoding match?
A.j. Langereis wrote:
> Dear all,
>
> I have written an application that uses Postgresql (8.1.0) trough an ODBC (ANSI) connection. I noticed that a query like "select 'bar' as foo" does not give the value "bar" in the column "foo". This works normally under PGadmin and even on other databases via ODBC. Am I overlooking something or might this be a bug?
>
> Values that I do get are like "#0#0#0#0#0"
>
> A piece of Delphi code to show the problem:
>
> procedure show_problem(conn : TADOConnection)
> var
> qry : TAdoQuery;
> datasource: TDataSource;
> begin
> qry := TADOQuery.create(nil);
> qry.Connection:=conn;
> qry.SQL.Text:= 'select ''bar'' as foo';
>
> qry.Open;
>
> if not qry.eof then
> begin
> datasource := TDataSource.Create(nil);
> datasource.dataset := qry;
>
> //datasource.DataSet.Fields[1].AsString now has the value of '#0#0#0#0#0'
> //datasource.DataSet.Fields[1].FieldName is now equal to 'foo'
>
> datasource.free;
> end;
>
> qry.close;
> qry.free;
> end;
>
> The version of ODBC that I've got installed is 08.00.0102 (via MSI installed).
>
> Yours,
>
> Aarjan
Attachments:greg.campbell.vcf (text/x-vcard, 239B) download
begin:vcard
fn:Greg Campbell
n:Campbell;Greg
org:Michelin North America - US5 Lexington;ENG-ASE
email;internet:greg.campbell@us.michelin.com
title:ASE Systems Engineer
tel;work:803-951-5561/x75561
x-mozilla-html:FALSE
version:2.1
end:vcard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: greg.campbell@us.michelin.com, a.j.langereis@inter.nl.net
Subject: Re: Values in the select
In-Reply-To: <43ACC919.6080609@us.michelin.com>
References: <001401c60749$bd1ab910$6500a8c0@aarjan2> <43ACC919.6080609@us.michelin.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox