[Rets-dev] SQL string escaping

Jeff Brush jeffbrush at hotmail.com
Thu Mar 30 22:49:34 CST 2006


I think the E'' syntax is Postgres's way of implementing the '\' syntax  as 
an extension.

Within the SQL:2003 spec, there doesn't appear to be a way to do special 
characters inline. It can be done in Oracle and MS SQL Server using

   'line one' + CHR(10) + 'line two'
or
   'line one' + CHAR(10) + 'line two'

I think we should stick with the '\' escape char, especially if we do not 
implement string concatenation.

Also, should all non-quoted words be case-insensitive? i.e. field in (v1,v2)

Jeff

>From: Dave Dribin <dribin at crt.realtors.org>
>To: E-mail Rets-Dev <rets-dev at rets.org>
>Subject: [Rets-dev] SQL string escaping
>Date: Thu, 30 Mar 2006 13:46:40 -0600
>
>Here's an FAQ on how JDBC abstracts away string escaping:
>
>   <http://www.jguru.com/faq/view.jsp?EID=8881>
>
>I don't like that syntax at all. :)
>
>Here's the Postgres documentation on string escaping:
>
>   <http://www.postgresql.org/docs/8.1/static/sql-syntax.html#SQL- 
>SYNTAX-CONSTANTS>
>
>This particular bit is interesting:
>
>"Note: While ordinary strings now support C-style backslash escapes,  
>future versions will generate warnings for such usage and eventually  treat 
>backslashes as literal characters to be standard-conforming.  The proper 
>way to specify escape processing is to use the escape  string syntax to 
>indicate that escape processing is desired. Escape  string syntax is 
>specified by writing the letter E (upper or lower  case) just before the 
>string, e.g. E'\041'. This method will work in  all future versions of 
>PostgreSQL."
>
>Why are they deprecating this?  What does "proper" mean... does  SQL2003 
>now define an escaped string as E''?
>
>-Dave
>
>_______________________________________________
>Rets-dev mailing list
>Rets-dev at rets.org
>http://lists.rets.org/mailman/listinfo/rets-dev




More information about the Rets-dev mailing list