]> err.no Git - sope/commitdiff
implemented describeResults
authorhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Sun, 20 Feb 2005 20:53:25 +0000 (20:53 +0000)
committerhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Sun, 20 Feb 2005 20:53:25 +0000 (20:53 +0000)
git-svn-id: http://svn.opengroupware.org/SOPE/trunk@578 e4a50df8-12e2-0310-a44c-efbce7f8a7e3

sope-gdl1/SQLite3/ChangeLog
sope-gdl1/SQLite3/GNUmakefile.preamble
sope-gdl1/SQLite3/SQLiteChannel.m
sope-gdl1/SQLite3/Version
sope-gdl1/SQLite3/gdltest.m

index 157a64c933a2a8471083360b031b29be0c43da10..636294bf4b5514dd9305202a60f04ff390d96ad1 100644 (file)
@@ -1,9 +1,9 @@
 2005-02-20  Helge Hess  <helge.hess@opengroupware.org>
-       
+
+       * SQLiteChannel.m: implemented -describeResults (v4.5.10)
+
        * most SQL operations based on models are implemented now (v4.5.9)
        
-2005-02-20  Helge Hess  <helge.hess@opengroupware.org>
-
        * made gdltest work again
 
        * added work on the SQLite3 adaptor to SOPE 4.5 repository
index 5a4f4cc6e6127405d1eb7d7161392fde3464e768..ec1179d7197782b8afc21a8b2c06057818b1e250 100644 (file)
@@ -24,7 +24,9 @@
 
 SQLite3_BUNDLE_LIBS += -lsqlite3
 
-gdltest_TOOL_LIBS += -lGDLAccess
+gdltest_TOOL_LIBS += \
+       -lGDLAccess     \
+       -lNGExtensions
 
 # set compile flags and go
 
index 8db9b5b9622f03d8f67c1de6895f864f3e1ac4cc..3f056008c4c6ffdf5aa950e21038bcf66ac04a50 100644 (file)
@@ -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];
   }
 
index b191a15e76dac3e66bcd9f3cefe22e3b7ade21f4..c7825e078ab1a600cba9b22cbe0e1d7cdea587b8 100644 (file)
@@ -1,3 +1,3 @@
 # Version file
 
-SUBMINOR_VERSION:=9
+SUBMINOR_VERSION:=10
index a8ac58af45c8e0c0be8fbfcfada9f541f942395d..35534e1f98ae304761c0eb329e8561118b5d6f7b 100644 (file)
@@ -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 */