Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I did this but it still doesn't work, as in nothing shows up in the Console.</p> <pre> #import "RootViewController.h" #import "FMDatabase.h" @implementation RootViewController - (void)viewDidLoad { [super viewDidLoad]; NSString *dbname = @"name.sqlite"; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *path = [documentsDirectory stringByAppendingPathComponent:dbname]; FMDatabase * database = [FMDatabase databaseWithPath:path]; FMResultSet *rs = [database executeQuery:@"select * from name;"]; while ([rs next]) { NSLog(@"%d %@", [rs intForColumn:@"nid"], [rs stringForColumn:@"name"]); } [database close]; } ... </pre> <p>And sorry but am unable to use the code block, so using a pre again.</p> <p>Edit: When I turn logging on in FMDB, like this:</p> <pre> FMDatabase * database = [FMDatabase databaseWithPath:path]; [database setLogsErrors:YES]; if (![database open]) { NSLog(@"Could not open db."); } else { NSLog(@"DB Open...."); } FMResultSet *rs = [database executeQuery:@"select * from 'name';"]; while ([rs next]) { // just print out what we've got in a number of formats. NSLog(@"%d %@", [rs intForColumn:@"nid"], [rs stringForColumn:@"name"]); } [database close]; </pre> <p>..., I get this in the Console:</p> <pre> [Session started at 2010-09-07 15:38:16 +0530.] 2010-09-07 15:38:19.178 MyDBTry[13670:207] DB Open.... 2010-09-07 15:38:19.181 MyDBTry[13670:207] DB Error: 1 "no such table: name" 2010-09-07 15:38:19.182 MyDBTry[13670:207] DB Query: select * from name; </pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload