X-Original-To: pgsql-jdbc-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 98FFB9FB2A3 for ; Sat, 29 Jul 2006 02:10:03 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 28660-04 for ; Sat, 29 Jul 2006 02:09:24 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from web31808.mail.mud.yahoo.com (web31808.mail.mud.yahoo.com [68.142.207.71]) by postgresql.org (Postfix) with SMTP id 05E149FB289 for ; Sat, 29 Jul 2006 02:08:42 -0300 (ADT) Received: (qmail 80630 invoked by uid 60001); 29 Jul 2006 05:08:34 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=EzVM2+waIhAubVH0sc5qq2r2Ww8/dTSLtOkjhBm57cxO3a2sUZNg50XinrpDk57hNO3DLMHWwS95dgmbHzvJ6XgFTTl1tRt8RDXuNZsIKt+FC/x4BHRwYyYsk75FpA2o6KvesgU7wunQEEM9pzfxIjHhmOfUfdSeT6OBnW1z7IE= ; Message-ID: <20060729050834.80628.qmail@web31808.mail.mud.yahoo.com> Received: from [69.106.234.131] by web31808.mail.mud.yahoo.com via HTTP; Fri, 28 Jul 2006 22:08:34 PDT Date: Fri, 28 Jul 2006 22:08:34 -0700 (PDT) From: Mike Morris Subject: literal value in the select fieldlist returns not the string, but a java String object To: pgsql-jdbc@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-267400531-1154149714=:76338" Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200607/99 X-Sequence-Number: 15525 --0-267400531-1154149714=:76338 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hi, I'm using pgsql/jdbc in an evaluation of "bluedragon", a coldfusion app server clone. Following is an email to the bluedragon folks, but the behavior is probably really JDBC driver related... can anyone confirm that? Briefly, the issue is that having a static, literal value in the select fieldlist returns not the string, but a java String object; not sure if this is the driver, or if bluedragon for some reason fails to do a toString() on it for some reason... Here's the email to bluedragon support: ========================================= Single quoted literals are usually used to concatenate some constant with the contents of a field. This works fine. But I sometimes use a constant by itself, to create a column with just a string literal... for example, the word "Edit", to use for creating a clickable command hyperlink. This does *not* work (as I expected it would), because instead of returning a text string, it's returning a java String object. To see this: select 'test text' as staticText, firstname, lastname from employees Notice that the firstname and lastname columns are "normal", but the staticText column contains "object of java.lang.String". There's an easy workaround... appending an empty string gives the desired result: select 'test text' || '' as staticText, firstname, lastname from employees ========================================= bluedragon-support wrote: v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} st1\:*{behavior:url(#default#ieooui) } Hi Mike, You’ll have to forgive my ignorance, but I’ve never seen syntax like this before.  So, I created a table in Postgresql database named Employees and I dumped the same values into the table that you might already be familiar with.  I used cfsnippets which comes with CFMX and created a duplicate database in postgresql.  So, what is an appropriate Select statement that I should try? Select ‘Dave’ from Employees Please edit my cfquery in such a way that I can see the problem.  Thanks, -Lori Bluedragon Support --------------------------------- From: Mike Morris [mailto:mcmorris95125@yahoo.com] Sent: Friday, July 28, 2006 3:47 AM To: bluedragon-support Subject: RE: Thank You For Downloading BlueDragon Hi, Still evaluating BD... writing a simple SQL generator CFC as a test, using Postgres as back end. I can't get a single-quoted literal passed to Postgres properly. I've RTFM'd and Googled at NewAtlanta, Postgres and JDBC, to no avail. The issue is: select 'myString' as literal, * from testtable runs fine from pgAdmin, e.g., but from inside a CFQuery, I get various errors ... most of which contain doubled up instances of the single quote chars. I've tried PreserveSingleQuotes() on the SQL statement, escaping with "\" or doubling the quote, etc... Any tips? TIA, MikeM bluedragon-support wrote: Hi Mike! Thank you for the info. I’ll pass this along. Wow, I really appreciate your work. -Lori BlueDragon Support --------------------------------- Do you Yahoo!? Get on board. You're invited to try the new Yahoo! Mail Beta. --0-267400531-1154149714=:76338 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hi,

I'm using pgsql/jdbc in an evaluation of "bluedragon", a coldfusion app server clone. Following is an email to the bluedragon folks, but the behavior is probably really JDBC driver related... can anyone confirm that?

Briefly, the issue is that having a static, literal value in the select fieldlist returns not the string, but a java String object; not sure if this is the driver, or if bluedragon for some reason fails to do a toString() on it for some reason...

Here's the email to bluedragon support:

=========================================
Single quoted literals are usually used to concatenate some constant with the contents of a field. This works fine.

But I sometimes use a constant by itself, to create a column with just a string literal... for example, the word "Edit", to use for creating a clickable command hyperlink.

This does *not* work (as I expected it would), because instead of returning a text string, it's returning a java String object.

To see this:

<cfquery datasource="postgres" name="mike">
    select 'test text' as staticText, firstname, lastname
    from employees
</cfquery>
<cfdump var = "#mike#" >

Notice that the firstname and lastname columns are "normal", but the staticText column contains "object of java.lang.String".

There's an easy workaround... appending an empty string gives the desired result:

<cfquery datasource="postgres" name="mike">
    select 'test text' || '' as staticText, firstname, lastname
    from employees
</cfquery>
<cfdump var = "#mike#" >
=========================================



bluedragon-support <bluedragon-support@newatlanta.com> wrote:
Hi Mike,
You’ll have to forgive my ignorance, but I’ve never seen syntax like this before.  So, I created a table in Postgresql database named Employees and I dumped the same values into the table that you might already be familiar with.  I used cfsnippets which comes with CFMX and created a duplicate database in postgresql.  
 
So, what is an appropriate Select statement that I should try? 
 
<cfquery datasouce=”postgres” name=”Mike”>
Select ‘Dave’ from Employees
</cfquery>
 
<cfdump var=”#Mike#”>
 
Please edit my cfquery in such a way that I can see the problem.  Thanks,
-Lori
Bluedragon Support
 

From: Mike Morris [mailto:mcmorris95125@yahoo.com]
Sent: Friday, July 28, 2006 3:47 AM
To: bluedragon-support
Subject: RE: Thank You For Downloading BlueDragon
 
Hi,

Still evaluating BD... writing a simple SQL generator CFC as a test, using Postgres as back end.

I can't get a single-quoted literal passed to Postgres properly. I've RTFM'd and Googled at NewAtlanta, Postgres and JDBC, to no avail.

The issue is:
  •     select 'myString' as literal, * from testtable

runs fine from pgAdmin, e.g., but from inside a CFQuery, I get various errors ... most of which contain doubled up instances of the single quote chars. I've tried PreserveSingleQuotes() on the SQL statement, escaping with "\" or doubling the quote, etc...

Any tips?

TIA,

MikeM



bluedragon-support <bluedragon-support@newatlanta.com> wrote:
Hi Mike!  Thank you for the info.  I’ll pass this along.  Wow, I really appreciate your work. 
 
-Lori
BlueDragon Support



Do you Yahoo!?
Get on board. You're invited to try the new Yahoo! Mail Beta. --0-267400531-1154149714=:76338--