fieldCount = sqlite3_column_count(self->statement);
-#warning TODO: describe row
- // allowsNull, columnName, externType, name, valueClassName, valueType
- NSLog(@"%s: TODO describe current row ...", __PRETTY_FUNCTION__);
-
/* old code below */
result = [[NSMutableArray alloc] initWithCapacity:fieldCount];
[attribute setName:attrName];
[attribute setColumnName:columnName];
- //NSLog(@"column: %@", columnName);
+ switch (sqlite3_column_type(self->statement, cnt)) {
+ case SQLITE_INTEGER:
+ [attribute setExternalType:@"INTEGER"];
+ [attribute setValueClassName:@"NSNumber"];
+ [attribute setValueType:@"d"];
+ break;
+ case SQLITE_FLOAT:
+ [attribute setExternalType:@"REAL"];
+ [attribute setValueClassName:@"NSNumber"];
+ [attribute setValueType:@"f"];
+ break;
+ case SQLITE_TEXT:
+ [attribute setExternalType:@"TEXT"];
+ [attribute setValueClassName:@"NSString"];
+ break;
+ case SQLITE_BLOB:
+ [attribute setExternalType:@"BLOB"];
+ [attribute setValueClassName:@"NSData"];
+ break;
+ case SQLITE_NULL:
+ NSLog(@"WARNING(%s): got SQLite NULL type at column %i, can't derive ",
+ @"type information.",
+ __PRETTY_FUNCTION__, cnt);
+ [attribute setExternalType:@"NULL"];
+ [attribute setValueClassName:@"NSNull"];
+ break;
+ default:
+ NSLog(@"ERROR(%s): unexpected SQLite type at column %i",
+ __PRETTY_FUNCTION__, cnt);
+ break;
+ }
-#if 1
-# warning TODO: loadValueClassAndTypeUsingSQLiteType:
-#else
- [attribute loadValueClassAndTypeUsingSQLiteType:
- self->fieldInfo[cnt].type
- size:self->fieldInfo[cnt].size
- modification:self->fieldInfo[cnt].modification
- binary:self->containsBinaryData];
-#endif
-
[result addObject:attribute];
-
[attribute release];
}
/*
- SQLiteValues.h
+ gdltest.m
Copyright (C) 1999-2005 MDlink online service center GmbH and Helge Hess
NSArray *attrs;
NSDictionary *record;
- if (![expr isNotNull]) return;
-
if (![ch evaluateExpression:expr]) {
NSLog(@"ERROR: failed to evaluate: %@", expr);
return;
/* do something */
pool = [[NSAutoreleasePool alloc] init];
#if 1
- fetchExprInChannel(expr, ch);
+ if (expr) fetchExprInChannel(expr, ch);
#endif
/* fetch some MyEntity records */