Index: trunk/FACT++/src/FileEntry.h
===================================================================
--- trunk/FACT++/src/FileEntry.h	(revision 19964)
+++ trunk/FACT++/src/FileEntry.h	(revision 19965)
@@ -12,4 +12,5 @@
         kNone = 0,
         kConst,
+        kChar,
         kVarchar,
         kBool,
@@ -24,4 +25,9 @@
         kInt64,
         kUInt64,
+        kDecimal,
+        kNumeric,
+        kTime,
+        kDate,
+        kDateTime,
     };
 
@@ -29,7 +35,8 @@
     {
         BasicType_t type;
-        std::string root;
-        char fits;
-        std::string sql;
+        std::string root;  // root basic type
+        char branch;       // root branch
+        char fits;         // fits type
+        std::string sql;   // sql type
     };
 
@@ -78,21 +85,32 @@
     static const Types LUT =
     {
-        // type      root         fits sql
-        { kVarchar,  "Char_t",    'A', "VARCHAR"           },
-        { kVarchar,  "Char_t",    'a', "VARCHAR"           },
-        { kBool,     "Bool_t",    'L', "BOOLEAN"           },
-        { kBool,     "Bool_t",    'l', "BOOLEAN"           },
-        { kInt8,     "Char_t",    'B', "TINYINT"           },
-        { kUInt8,    "UInt8_t",   'b', "TINYINT UNSIGNED"  },
-        { kInt16,    "Short_t",   'I', "SMALLINT"          },
-        { kUInt16,   "UShort_t",  'i', "SMALLINT UNSIGNED" },
-        { kInt32,    "Int_t",     'J', "INT"               },
-        { kUInt32,   "UInt_t",    'j', "INT UNSIGNED"      },
-        { kInt64,    "Long64_t",  'K', "BIGINT"            },
-        { kUInt64,   "ULong64_t", 'k', "BIGINT UNSIGNED"   },
-        { kFloat,    "Float_t",   'E', "FLOAT"             },
-        { kFloat,    "Float_t",   'e', "FLOAT"             },
-        { kDouble,   "Double_t",  'D', "DOUBLE"            },
-        { kDouble,   "Double_t",  'd', "DOUBLE"            },
+        // type      root      branch  fits  sql
+        { kChar,     "Char_t",    ' ', 'A', "CHAR"               },
+        { kChar,     "Char_t",    ' ', 'a', "CHAR"               },
+        { kVarchar,  "Char_t",    ' ', 'A', "VARCHAR"            },
+        { kVarchar,  "Char_t",    ' ', 'a', "VARCHAR"            },
+        { kBool,     "Bool_t",    'O', 'L', "BOOLEAN"            },
+        { kBool,     "Bool_t",    'O', 'l', "BOOLEAN"            },
+        { kInt8,     "Char_t",    'B', 'B', "TINYINT"            },
+        { kUInt8,    "UInt8_t",   'b', 'b', "TINYINT UNSIGNED"   },
+        { kInt16,    "Short_t",   'S', 'I', "SMALLINT"           },
+        { kUInt16,   "UShort_t",  's', 'i', "SMALLINT UNSIGNED"  },
+        { kInt32,    "Int_t",     'I', 'J', "INT"                },
+        { kUInt32,   "UInt_t",    'i', 'j', "INT UNSIGNED"       },
+        { kInt32,    "Int_t",     'I', 'J', "MEDIUMINT"          },
+        { kUInt32,   "UInt_t",    'i', 'j', "MEDIUMINT UNSIGNED" },
+        { kInt64,    "Long64_t",  'L', 'K', "BIGINT"             },
+        { kUInt64,   "ULong64_t", 'l', 'k', "BIGINT UNSIGNED"    },
+        { kFloat,    "Float_t",   'F', 'E', "FLOAT"              },
+        { kFloat,    "Float_t",   'F', 'e', "FLOAT"              },
+        { kDouble,   "Double_t",  'D', 'D', "DOUBLE"             },
+        { kDouble,   "Double_t",  'D', 'd', "DOUBLE"             },
+        { kTime,     "UInt32_t",  'i', 'j', "TIME"               },
+        { kDate,     "UInt64_t",  'l', 'k', "DATE"               },
+        { kDateTime, "UInt64_t",  'l', 'k', "DATETIME"           },
+        { kDecimal,  "Double_t",  'D', 'D', "DECIMAL"            },
+        { kDecimal,  "Double_t",  'D', 'd', "DECIMAL"            },
+        { kNumeric,  "Double_t",  'D', 'D', "NUMERIC"            },
+        { kNumeric,  "Double_t",  'D', 'd', "NUMERIC"            },
     };
 
@@ -109,7 +127,11 @@
         void *ptr;
 
+        Container() :  type(kNone), num(0), ptr(0)
+        {
+        }
+
         // Root File (do not mix with FitsFile!)
         Container(const std::string &b, const std::string &c,
-                  const BasicType_t &t, const size_t &n)
+                  const BasicType_t &t, const size_t &n=1)
             : branch(b), column(c), type(t), num(n), ptr(0)
         {
@@ -120,11 +142,17 @@
             case kBool:   ptr = new uint8_t[n];  break;
             case kFloat:  ptr = new float[n];    break;
+            case kDecimal:
+            case kNumeric:
             case kDouble: ptr = new double[n];   break;
             case kInt16:  ptr = new int16_t[n];  break;
             case kUInt16: ptr = new uint16_t[n]; break;
             case kInt32:  ptr = new int32_t[n];  break;
+            case kTime:
             case kUInt32: ptr = new uint32_t[n]; break;
             case kInt64:  ptr = new int64_t[n];  break;
+            case kDate:
+            case kDateTime:
             case kUInt64: ptr = new uint64_t[n]; break;
+            case kChar:
             case kVarchar:
             case kConst:
@@ -136,4 +164,13 @@
         }
 
+        // This is for rootifysql!
+        Container(const std::string &b, const BasicType_t &t)
+            : branch(b), type(t), num(1)
+        {
+            ptr = new double[1];
+            // Indicate that this was allocated and how often
+            counter[ptr]++;
+        }
+
         Container(const std::string &c, const std::string &value)
             : branch(value), column(c), type(kConst), num(1), ptr(0)
@@ -174,4 +211,6 @@
             case kVarchar: str << std::string(reinterpret_cast<char*>(ptr), num).c_str(); break;
             case kFloat:   str << std::setprecision(8) << reinterpret_cast<float*>(ptr)[index];  break;
+            case kDecimal:
+            case kNumeric:
             case kDouble:  str << std::setprecision(16) << reinterpret_cast<double*>(ptr)[index]; break;
             case kBool:
@@ -181,8 +220,12 @@
             case kUInt16:  str << reinterpret_cast<uint16_t*>(ptr)[index]; break;
             case kInt32:   str << reinterpret_cast<int32_t*>(ptr)[index]; break;
+            case kTime:
             case kUInt32:  str << reinterpret_cast<uint32_t*>(ptr)[index]; break;
             case kInt64:   str << reinterpret_cast<int64_t*>(ptr)[index]; break;
+            case kDate:
+            case kDateTime:
             case kUInt64:  str << reinterpret_cast<uint64_t*>(ptr)[index]; break;
             case kConst:   str << branch; break;
+            case kChar:
             case kNone:
                 break;
