The ?
should only be used for binding actual values into the query such in the VALUES
section of an INSERT
or values in a WHERE
clause.
For dynamically building the column and table names you should simply use a string format to build the query string before sending it to FMDB.
- (BOOL)existsColumn:(NSString *)column inTable:(NSString *)table ofDatabase:(FMDatabase *)database {
NSString *query = [NSString stringWithFormat:@"SELECT %@ FROM %@ LIMIT 0", column, table];
return (BOOL)[database executeQuery:query];
}
Please note that you should not use the string format in place of using ?
and proper value binding for actual values (which you don't have in this case).