From: | Jochem van Dieten <jochemd(at)oli(dot)tudelft(dot)nl> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Escape characters, JDBC and ColdFusion MX |
Date: | 2002-07-25 12:52:07 |
Message-ID: | 3D3FF477.6080305@oli.tudelft.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Hi all,
I have a problem with inserting strings into a PostgreSQL database using
ColdFusion MX. Somehow the backslash is not identified as an escape
character. Single quotes are doubled up nicely and can be inserted very
easily, ie the following pseudo code works:
string = "test ' test"
INSERT INTO table (textstring) VALUES ('#string#')
However, the following pseudo code does not work:
string = "test \' test"
INSERT INTO table (textstring) VALUES ('#string#')
This is internally translated into the following statement
INSERT INTO test (textstring) VALUES ('\''')
Naturally this fails due to the unbalanced quotes. The obvious
workaround would be to write a function that doubles all the backslashes
and then the problem is gone. But I feel like it is a workaround, and
not a solution. But then again, there might be reasons for this that I
am yet unaware of. And I don't even know if the translation is done by
ColdFusion or the JDBC driver, let alone by which one it should be done.
But the problem is that other databases that I have tested do not have
this problem (possibly because they do not consider a backslash an
escape character), which sort of puts PostgreSQL at a disadvantage
(which is particularly bad because PostgreSQL is the only free database
that has Unicode completely supported, which is currently the main
reason why people are looking for a new dbms).
So I would like to know if there is a reason for this behaviour and if
there is something that I can do about it (i.e. let the JDBC driver
double the backslashes automatically). Unfortunately, ColdFusion MX is
largely a black box for me, so I do not know if it is necessary/possible
to change something there.
Alternatively, if anyone can provide some reference which indicates that
ColdFusion MX should do this, I would be equaly happy to bug Macromedia
for a solution :)
In case you want to see the problem for yourself, you can just enter the
teststrings in the input box at http://130.161.67.251:8500/index.cfm
setup:
ColdFusion MX using Unicode
JDBC binary from jdbc.postgresql.org, Java2 version for PostgreSQL 7.2
PostgreSQL 7.2.1 with multibyte and a default encoding of unicode
Jochem
--
Jochem van Dieten
Team Macromedia Volunteer for ColdFusion
http://www.macromedia.com/support/forums/team_macromedia/
From | Date | Subject | |
---|---|---|---|
Next Message | Parsons, Chris | 2002-07-25 15:34:23 | Re: PostgreSQL and Tomcat? |
Previous Message | Yuva Chandolu | 2002-07-24 18:05:49 | Re: server-side |