From: helge Date: Sun, 20 Feb 2005 20:53:25 +0000 (+0000) Subject: implemented describeResults X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a81ac73a93b38ee4903f96b64b80479aa0ced992;p=sope implemented describeResults git-svn-id: http://svn.opengroupware.org/SOPE/trunk@578 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- diff --git a/sope-gdl1/SQLite3/ChangeLog b/sope-gdl1/SQLite3/ChangeLog index 157a64c9..636294bf 100644 --- a/sope-gdl1/SQLite3/ChangeLog +++ b/sope-gdl1/SQLite3/ChangeLog @@ -1,9 +1,9 @@ 2005-02-20 Helge Hess - + + * SQLiteChannel.m: implemented -describeResults (v4.5.10) + * most SQL operations based on models are implemented now (v4.5.9) -2005-02-20 Helge Hess - * made gdltest work again * added work on the SQLite3 adaptor to SOPE 4.5 repository diff --git a/sope-gdl1/SQLite3/GNUmakefile.preamble b/sope-gdl1/SQLite3/GNUmakefile.preamble index 5a4f4cc6..ec1179d7 100644 --- a/sope-gdl1/SQLite3/GNUmakefile.preamble +++ b/sope-gdl1/SQLite3/GNUmakefile.preamble @@ -24,7 +24,9 @@ SQLite3_BUNDLE_LIBS += -lsqlite3 -gdltest_TOOL_LIBS += -lGDLAccess +gdltest_TOOL_LIBS += \ + -lGDLAccess \ + -lNGExtensions # set compile flags and go diff --git a/sope-gdl1/SQLite3/SQLiteChannel.m b/sope-gdl1/SQLite3/SQLiteChannel.m index 8db9b5b9..3f056008 100644 --- a/sope-gdl1/SQLite3/SQLiteChannel.m +++ b/sope-gdl1/SQLite3/SQLiteChannel.m @@ -263,10 +263,6 @@ static int openConnectionCount = 0; 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]; @@ -307,20 +303,39 @@ static int openConnectionCount = 0; [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]; } diff --git a/sope-gdl1/SQLite3/Version b/sope-gdl1/SQLite3/Version index b191a15e..c7825e07 100644 --- a/sope-gdl1/SQLite3/Version +++ b/sope-gdl1/SQLite3/Version @@ -1,3 +1,3 @@ # Version file -SUBMINOR_VERSION:=9 +SUBMINOR_VERSION:=10 diff --git a/sope-gdl1/SQLite3/gdltest.m b/sope-gdl1/SQLite3/gdltest.m index a8ac58af..35534e1f 100644 --- a/sope-gdl1/SQLite3/gdltest.m +++ b/sope-gdl1/SQLite3/gdltest.m @@ -1,5 +1,5 @@ /* - SQLiteValues.h + gdltest.m Copyright (C) 1999-2005 MDlink online service center GmbH and Helge Hess @@ -31,8 +31,6 @@ static void fetchExprInChannel(NSString *expr, EOAdaptorChannel *ch) { NSArray *attrs; NSDictionary *record; - if (![expr isNotNull]) return; - if (![ch evaluateExpression:expr]) { NSLog(@"ERROR: failed to evaluate: %@", expr); return; @@ -114,7 +112,7 @@ static void runtestInOpenChannel(EOAdaptorChannel *ch) { /* do something */ pool = [[NSAutoreleasePool alloc] init]; #if 1 - fetchExprInChannel(expr, ch); + if (expr) fetchExprInChannel(expr, ch); #endif /* fetch some MyEntity records */