-(id)select:(NSString *)original_query
{
sqlite3_stmt *statement;
const char * converted = [original_query UTF8String];
NSLog(@"[INFO] converted char = %@", converted);
if (sqlite3_prepare_v2(db, converted, -1, &statement, NULL) != SQLITE_OK) {
@throw [NSException exceptionWithName: @"DB Encriptor" reason: [NSString stringWithFormat: @"Query \"%s\" has failed, we could not execute the SQL statement. '%s'", converted, sqlite3_errmsg(db) ] userInfo: nil];
}
else {
@try {
...
}
@catch (NSException * e) {
NSLog(@"Exception: %@", e);
return NULL;
}
}
}
When the execution reaches the line :
const char * converted = [original_query UTF8String];
I get the following error:
2013-06-27 02:17:33.505 proof[25200:3c03] -[__NSArrayM UTF8String]: unrecognized selector sent to instance 0xc954a30
This is probably a very simple and silly error, I would appreciate if anyone could give me some guidance, I've spent hours trying different schemas to convert the string to UTF8 but no success so far.
Thanks!
EDIT: Some more information: I am creating a native iOS module to work along Titanium. I call this method from JavaScript (in Titanium) passing a string, something like:
encriptmydb.select("SELECT count(*) FROM sqlite_master;")
But the error persists ...