Hi,
I'm an iPhone developer. I'm writing my unit test cases, one of which checks if the app accepts UTF8 strings to be written to a sqlite3 database. I created a test case to generate random UTF8 strings and I can see the ones that fail do so because they contain an apostrophe (') which I need to be accepted.
I'm writing to the database like this:
NSString *query=@"INSERT INTO song (id,title, duration) VALUES (?,?,?);";
sqlite3_stmt *_statement;
insert=sqlite3_prepare_v2(_database, [query UTF8String], -1, &_statement, NULL);
sqlite3_bind_text(_statement, 1, [value1 UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_text(_statement, 2, [value2 UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_text(_statement, 3, [value3 UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_step(_statement);
Do I have to manually escape the apostrophes in value1-3 with a replace or something like that? If so, that's kind of lame...