Have you tried using the quote() function?

>From http://www.sqlite.org/lang_expr.html

quote(X)        This routine returns a string which is the value of its
argument suitable for inclusion into another SQL statement. Strings are
surrounded by single-quotes with escapes on interior quotes as needed.
BLOBs are encoded as hexadecimal literals. The current implementation of
VACUUM uses this function. The function is also useful when writing
triggers to implement undo/redo functionality.


Gussimulator wrote:
> Hi, When I have strings with "-", "!",  "\" or similar characters I get a 
> syntax error.. Now, I thought this would happen with a few of this chars so I 
> made 2 routines in my program, one that converts each of this chars into a 
> flag string, which then, by the other routine can be reverted to the original 
> characters to obtain the string in its original form, so I can later work 
> with it by my side.
> 
> Now, I've found myself with syntax errors even on strings that didnt had any 
> strange characters, So.. I'm wondering, what can I do to prevent this? Does 
> SQLite provide a "format" routine or is there anything I can do to prevent 
> the syntax errors... like this ones? (since my data wont get into the db if 
> theres an error, of course, thats why Im concerned).
> 
> I'm really worried about this, hence I subscribed on the list (first 
> message!).  I hope someone can help me out on this one, thanks.
> 
> And, Indeed.. I'm quite a newbie on SQL but, I never thought I'd find myself 
> with this type of problem.
> 
> 


-- 
-------------------------------
Christian Nassau
Software Developer
-------------------------------
Swissrisk
Holzhausenstrasse 44,
60322 Frankfurt, Germany

tele: +49 69 50952-266
fax:  +49 69 50952-299

www.swissrisk.com
-------------------------------

Reply via email to