At 20.04 24/06/2002, you wrote:
>I query postgres from pure java with statements such:
>
>this.pstmt = cn.prepareStatement("INSERT INTO "+table +" (msgid, author,
>subject)" + " VALUES (?,?,?)");
>pstmt.setString(MSGID, a.msgID);
>pstmt.setString(AUTHOR, a.from);
>pstmt.setString(SUBJECT, a.subject);
In this way I think you have done a parametric query, the same you do with
<cfqueryparam>. Try to execute all the query in prepareStatement
this.pstmt = cn.prepareStatement("INSERT INTO "+table +" (msgid, author,
subject)" + " VALUES ('var_a','var_b','var_c'));
>So I don't care about escapes, but the data-type is knwon from the statements
>and I guess the driver fix them accordingly.
The problem is not the data-type, but that in the standard SQL 92 \ is not
a special char. In PG and Mysql \ is a special char and you can escape
single quote with back slash.
The result is that if you try to insert a string like this (this is a test
\' hello world) an error occur because the driver escape the single quote.
Example:
String to insert via <input>: this is a test \' hello world
Result:
ODBC Error Code = 00000 ()
Error while executing the query (non-fatal); ERROR: parser: parse error at
or near "hello"
SQL = "UPDATE test SET a = 'this is a test \'' hello world' WHERE id_test = 1"
or with only \'
ODBC Error Code = 00000 ()
Error while executing the query (non-fatal); ERROR: Unterminated quoted string
SQL = "UPDATE test SET a = '\''' WHERE id_test = 1"
This is a well known problem and force you to use <cfqueryparam>. I hope
with cfmx this problem has been solved.
Unfortunately PG driver are not included with cfmx and I really don't
understand why. MM provide the driver for Mysql and not for the best Unix
OpenSource database ....bah.
Bye.
--------------------------------------------------
FABIO SERRA - faser(at)faser.net
PGP available
--------------------------------------------------
______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-linux%40houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_linux or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.