0

I am using Fmdb wrapper around Sqlite, everything is working fine. Now I want to load data from a variable table, the table name is stored in an NSString. I don't know how to write query for that. Please help!

Ali Sufyan
  • 2,038
  • 3
  • 17
  • 27

1 Answers1

0

I never used FMDB Wrapper. But reading the Documetation, it looks like -executeQuery is a method from FMDatabase Class that takes the QueryString as a parameter and returns an object of FMResultSet Class. So, argument is of NSString type and you can use %@ operator to add the dynamic string values in your QueryString.

Sample Code :

FMResultSet *results = nil;
results = [yourDB executeQuery:[NSString stringWithFormat:@"SELECT * FROM %@",variable_tableName]];
Bhavin
  • 27,155
  • 11
  • 55
  • 94
  • can you please help me regarding the same issue here? http://stackoverflow.com/questions/19095519/fmdb-select-query-with-variable-table-name – Ali Sufyan Sep 30 '13 at 13:40