In my SQLite table I have a column ‘hasSubCountries’ which supposed to store simple 0/1 value cos SQLite doesn’t has distinct boolean type.
While digging in stackoverflow I’ve found this question, but it didn’t solve my problem.
At moment in my database I have column:
hasSubCountries integer DEFAULT 0
Have changed the value of the couple of subCountries to 1.
And DBAccess class I try to read the value into object:
countryObj.hasSubCountries=(sqlite3_column_int(statement, 6) == 1);
In viewController code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
Country* country = [[self.countries objectAtIndex:[indexPath section]] objectAtIndex:[indexPath row]];
if(country.hasSubCountries==1)
{
SelectedCountry *selCountry=[[SelectedCountry alloc]initWithNibName:@"SelectedCountry" bundle:nil];
[selCountry setTitle:@"Country"];
[selCountry setCountryID:country.countryID];
[self.navigationController pushViewController:selCountry animated:YES];
[selCountry release];
}
else
{
SubCountries *subCountries=[[SubCountries alloc]initWithNibName:@"SubCountries" bundle:nil];
[subCountries setTitle:@"Sub"];
[self.navigationController pushViewController:subCountries animated:YES];
[subCountries release];
}
NSLog(@"%d ... %d",country.hasSubCountries,country.countryID);
}
Well, NSLog says me that anyway I’m getting 0, and that’s why ‘if’ pushes me to @”Sub”. Where I went wrong?
The name and ID of country I am getting without problem. See screenshot

Full table definition:

Wouldn’t it be column index 7?
0 countryID
1 countryName
2 relativeToContinent
3 countryFlag
4 hasRegionalIssues
5 hasDifferentBankIssues
6 hasIssue
7 hasSubCountries
Try:
Not: