Skip to content

Instantly share code, notes, and snippets.

@ccarse ccarse/patch.m
Created Sep 5, 2012

What would you like to do?
kvcMagic: for more than just strings....
- (void)enhancedKvcMagic:(id)object {
int columnCount = sqlite3_column_count([_statement statement]);
int columnIdx = 0;
for (columnIdx = 0; columnIdx < columnCount; columnIdx++) {
id c = [self objectForColumnIndex:columnIdx];
// check for a null row
if (c) {
[object setValue:c forKey:[NSString stringWithUTF8String:sqlite3_column_name([_statement statement], columnIdx)]];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.