私のSQLiteテーブルには、単純な0/1値のコサインSQLite doesn't has distinct boolean typeを格納するはずのカラム 'hasSubCountries'があります。SQLiteのブール値は常に0を返します
私はthis questionを見つけましたが、私の問題は解決しませんでした。私はオブジェクトに値を読み取ろう
hasSubCountries integer DEFAULT 0
は1
そしてDBACCESSクラスにsubCountriesのカップルの値を変更している:私のデータベースで瞬間
私は列が持っている ViewControllerをコードでcountryObj.hasSubCountries=(sqlite3_column_int(statement, 6) == 1);
:
- (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);
}
NSLogは、とにかく私は0を得ていると言っています。そのため、もし 'if'が私を「Sub」にプッシュしているのです。 どこが間違っていたのですか?
問題のない国の名前とIDです。
テーブル全体の列定義を追加できますか? – bryanmac
もhasSubCountriesはBOOLですか? – bryanmac
@bryanmac hasSubCountries整数DEFAULT 0 – NCFUSN