Browse Source

* Patch from Ladislav Karrach to use a field's type-affinity to determine the fieldtype. (Fixes aggregate test)

git-svn-id: trunk@16857 -
joost 14 years ago
parent
commit
d6adcdfe81
1 changed files with 10 additions and 3 deletions
  1. 10 3
      packages/fcl-db/src/sqldb/sqlite/sqlite3conn.pp

+ 10 - 3
packages/fcl-db/src/sqldb/sqlite/sqlite3conn.pp

@@ -364,9 +364,16 @@ begin
       ft1:=FieldMap[fi].t;
       break;
       end;
-    // Empty field types are allowed and used in calculated columns (aggregates)
-    // and by pragma-statements
-    if FD='' then ft1 := ftString;
+    // In case of an empty fieldtype (FD='', which is allowed and used in calculated
+    // columns (aggregates) and by pragma-statements) or an unknown fieldtype,
+    // use the field's affinity:
+    if ft1=ftUnknown then
+      case TStorageType(sqlite3_column_type(st,i)) of
+        stInteger: ft1:=ftLargeInt;
+        stFloat:   ft1:=ftFloat;
+        stBlob:    ft1:=ftBlob;
+        else       ft1:=ftString;
+      end;
     // handle some specials.
     size1:=0;
     case ft1 of