[objective-c]EGODatabase #8 カラム名一覧取得
カラム名一覧取得
-(NSArray*)getColumnNamesByTableName:(NSString*)tableName{ EGODatabase*db=[self getDB]; NSString*sql=[NSString stringWithFormat:@"pragma table_info(%@)",tableName]; EGODatabaseResult*result=[db executeQuery:sql]; NSMutableArray*list=[NSMutableArray arrayWithCapacity:[result count]]; for (EGODatabaseRow*row in result) { [list addObject:[row stringForColumn:@"name"]]; } return [NSArray arrayWithArray:list]; }