BTW..
"MyQuery" is not your full Insert or Select Statement.
I guess I should have called it MyString...
It is just your "String" you need escaped so you can put it into a query.
A better example would be:
char * value = "'quotes'";
char * SafeString= sqlite3_mprintf("%q",value);
...
-----Original Message-----
From: John Buck [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 25, 2005 12:09 PM
To: '[email protected]'
Subject: RE: [sqlite] How to insert a string using C interface that contains
both single and double quotes
Try this
char * EscapedQuery = sqlite3_mprintf("%q",MyQuery);
///.. Do some Stuff .. execute query..etc..
sqlite3_free(EscapedQuery);
--
JB
-----Original Message-----
From: Sergey Startsev [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 25, 2005 11:45 AM
To: Sankara Narayanan
Subject: Re: [sqlite] How to insert a string using C interface that contains
both single and double quotes
Hello,
Wednesday, May 25, 2005, 11:30:00 PM, you wrote:
SN> single and double quotes. I am using the C APIs of sqlite3_prepare and
SN> sqlite3_exec to insert data into the database. How do I prepare the
query
SN> string in such case where the string data have both single and double
SN> quotes.
This insert works currently:
INSERT INTO test (str)
VALUES ('single ''quotes'' and double "quotes"')
--
Best regards
Sergey Startsev
SQLite Analyzer - GUI tool to manage SQLite databases.
http://www.kraslabs.com/sqlite_analyzer.html