Consider a string with an apostrophe that needs to be inserted into a SQLite table.
INSERT INTO myTable ( table_Title TEXT ) VALUES ( 'world's' )
How can you markup or escape the apostrophe in the value in the INSERT statement?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
http://www.sqlite.org/c3ref/bind_blob.html
You should not be passing input directly into a query as a string like this. Not only is it a nuisance, it’s also vulnerable to SQL injection attacks, which may not be a big problem for a Mac app, but is still a bad idea when you have Prepared Statements at your disposal. Prepared Statements ensure the underlying database reads the actual, unmodified, input values safely.
For your specific example (error checking removed for brevity/clarity):
(Untested, but you get the idea).