Note that there are some explanatory texts on larger screens.

plurals
  1. POIphone Sqlite problem
    primarykey
    data
    text
    <p>I have to make a project using sqlite, i would rather use simple plists, xml or even core data as i don't have any experience with sql. However it has to be able to read from sqlite database. I downloaded the FMDB wrapper and set it up quickly however when i try and read from my database it does not display in the tableview, Here is my code:</p> <pre><code>TermsArray = [[NSMutableArray alloc] init]; NSString *path = [[NSBundle mainBundle] pathForResource:@"Database" ofType:@"sql"]; FMDatabase *db = [[FMDatabase alloc] initWithPath:path]; [db open]; FMResultSet *fResult= [db executeQuery:@"SELECT * FROM country WHERE id=1"]; while([fResult next]) { CountryString = [fResult stringForColumn:@"name"]; [CountryArray addObject:CountryString]; NSLog(@"The data is %@=",CountryString); } [db close]; } </code></pre> <p>and i display it in my tableview using this:</p> <pre><code>NSString *Text = [CountryArray objectAtIndex:indexPath.row]; cell.textLabel.text = Text; </code></pre> <p>Now i don't get any errors, however the array is always empty, in the console i don't get any warnings etc either but i noticed that the NSLOG never shows up, so i don't think that part is working. Heres my sql file in a text editor:</p> <pre><code> CREATE TABLE country ( id INTEGER PRIMARY KEY, name VARCHAR(250),location TEXT,number INTERGER); INSERT INTO country (name,location,number) VALUES('UK','country location here',1); </code></pre> <p>Also how are sqlite files supposed to be like? I created one using a sqlite editor and it produced a sql file, when i open it in a text editor i just see sql statements?</p> <p>It would be really great it someone could help me with this,</p> <p>Thanks!</p>
    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.
 

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