On Tue, 2010-04-06 at 16:27 -0500, nando wrote:
> Strings that contain these three characters: quote, double quote and backslash
> need to be escaped.
> You escape them by having a backslash immediately before it.
> Example:
>  Patty O'Lantern  would be...
>  Patty O\'Lantern
> 
> One way is to make a small function that will insert a backslash
> when it finds a quote or double quote or backslash. 
> 
> When you create your SQL string (Insert, Update, Select, etc)
> you escape the strings for the char, varchar, text, or similar.
> 
> sql = "SELECT * FROM inventory WHERE part = ' & escape(mypart) & "';"
> 
> SELECT from the database will not return the 'escape' backslash.
> It will appear normal.
> 
> Please note: / (on the question mark key) is not the backslash.
> \ is the backslash.
> 
> -Fernando
> 
Can I not do this with Replace$?  I can with the single quote with
Replace$($string,"'","\'"), but I cannot do the same with double quotes.

I'm not sure I understand this whole escape thing.



------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to