Changeset 19965 for trunk/FACT++
- Timestamp:
- 05/26/20 20:18:26 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/FileEntry.h
r19959 r19965 12 12 kNone = 0, 13 13 kConst, 14 kChar, 14 15 kVarchar, 15 16 kBool, … … 24 25 kInt64, 25 26 kUInt64, 27 kDecimal, 28 kNumeric, 29 kTime, 30 kDate, 31 kDateTime, 26 32 }; 27 33 … … 29 35 { 30 36 BasicType_t type; 31 std::string root; 32 char fits; 33 std::string sql; 37 std::string root; // root basic type 38 char branch; // root branch 39 char fits; // fits type 40 std::string sql; // sql type 34 41 }; 35 42 … … 78 85 static const Types LUT = 79 86 { 80 // type root fits sql 81 { kVarchar, "Char_t", 'A', "VARCHAR" }, 82 { kVarchar, "Char_t", 'a', "VARCHAR" }, 83 { kBool, "Bool_t", 'L', "BOOLEAN" }, 84 { kBool, "Bool_t", 'l', "BOOLEAN" }, 85 { kInt8, "Char_t", 'B', "TINYINT" }, 86 { kUInt8, "UInt8_t", 'b', "TINYINT UNSIGNED" }, 87 { kInt16, "Short_t", 'I', "SMALLINT" }, 88 { kUInt16, "UShort_t", 'i', "SMALLINT UNSIGNED" }, 89 { kInt32, "Int_t", 'J', "INT" }, 90 { kUInt32, "UInt_t", 'j', "INT UNSIGNED" }, 91 { kInt64, "Long64_t", 'K', "BIGINT" }, 92 { kUInt64, "ULong64_t", 'k', "BIGINT UNSIGNED" }, 93 { kFloat, "Float_t", 'E', "FLOAT" }, 94 { kFloat, "Float_t", 'e', "FLOAT" }, 95 { kDouble, "Double_t", 'D', "DOUBLE" }, 96 { kDouble, "Double_t", 'd', "DOUBLE" }, 87 // type root branch fits sql 88 { kChar, "Char_t", ' ', 'A', "CHAR" }, 89 { kChar, "Char_t", ' ', 'a', "CHAR" }, 90 { kVarchar, "Char_t", ' ', 'A', "VARCHAR" }, 91 { kVarchar, "Char_t", ' ', 'a', "VARCHAR" }, 92 { kBool, "Bool_t", 'O', 'L', "BOOLEAN" }, 93 { kBool, "Bool_t", 'O', 'l', "BOOLEAN" }, 94 { kInt8, "Char_t", 'B', 'B', "TINYINT" }, 95 { kUInt8, "UInt8_t", 'b', 'b', "TINYINT UNSIGNED" }, 96 { kInt16, "Short_t", 'S', 'I', "SMALLINT" }, 97 { kUInt16, "UShort_t", 's', 'i', "SMALLINT UNSIGNED" }, 98 { kInt32, "Int_t", 'I', 'J', "INT" }, 99 { kUInt32, "UInt_t", 'i', 'j', "INT UNSIGNED" }, 100 { kInt32, "Int_t", 'I', 'J', "MEDIUMINT" }, 101 { kUInt32, "UInt_t", 'i', 'j', "MEDIUMINT UNSIGNED" }, 102 { kInt64, "Long64_t", 'L', 'K', "BIGINT" }, 103 { kUInt64, "ULong64_t", 'l', 'k', "BIGINT UNSIGNED" }, 104 { kFloat, "Float_t", 'F', 'E', "FLOAT" }, 105 { kFloat, "Float_t", 'F', 'e', "FLOAT" }, 106 { kDouble, "Double_t", 'D', 'D', "DOUBLE" }, 107 { kDouble, "Double_t", 'D', 'd', "DOUBLE" }, 108 { kTime, "UInt32_t", 'i', 'j', "TIME" }, 109 { kDate, "UInt64_t", 'l', 'k', "DATE" }, 110 { kDateTime, "UInt64_t", 'l', 'k', "DATETIME" }, 111 { kDecimal, "Double_t", 'D', 'D', "DECIMAL" }, 112 { kDecimal, "Double_t", 'D', 'd', "DECIMAL" }, 113 { kNumeric, "Double_t", 'D', 'D', "NUMERIC" }, 114 { kNumeric, "Double_t", 'D', 'd', "NUMERIC" }, 97 115 }; 98 116 … … 109 127 void *ptr; 110 128 129 Container() : type(kNone), num(0), ptr(0) 130 { 131 } 132 111 133 // Root File (do not mix with FitsFile!) 112 134 Container(const std::string &b, const std::string &c, 113 const BasicType_t &t, const size_t &n )135 const BasicType_t &t, const size_t &n=1) 114 136 : branch(b), column(c), type(t), num(n), ptr(0) 115 137 { … … 120 142 case kBool: ptr = new uint8_t[n]; break; 121 143 case kFloat: ptr = new float[n]; break; 144 case kDecimal: 145 case kNumeric: 122 146 case kDouble: ptr = new double[n]; break; 123 147 case kInt16: ptr = new int16_t[n]; break; 124 148 case kUInt16: ptr = new uint16_t[n]; break; 125 149 case kInt32: ptr = new int32_t[n]; break; 150 case kTime: 126 151 case kUInt32: ptr = new uint32_t[n]; break; 127 152 case kInt64: ptr = new int64_t[n]; break; 153 case kDate: 154 case kDateTime: 128 155 case kUInt64: ptr = new uint64_t[n]; break; 156 case kChar: 129 157 case kVarchar: 130 158 case kConst: … … 136 164 } 137 165 166 // This is for rootifysql! 167 Container(const std::string &b, const BasicType_t &t) 168 : branch(b), type(t), num(1) 169 { 170 ptr = new double[1]; 171 // Indicate that this was allocated and how often 172 counter[ptr]++; 173 } 174 138 175 Container(const std::string &c, const std::string &value) 139 176 : branch(value), column(c), type(kConst), num(1), ptr(0) … … 174 211 case kVarchar: str << std::string(reinterpret_cast<char*>(ptr), num).c_str(); break; 175 212 case kFloat: str << std::setprecision(8) << reinterpret_cast<float*>(ptr)[index]; break; 213 case kDecimal: 214 case kNumeric: 176 215 case kDouble: str << std::setprecision(16) << reinterpret_cast<double*>(ptr)[index]; break; 177 216 case kBool: … … 181 220 case kUInt16: str << reinterpret_cast<uint16_t*>(ptr)[index]; break; 182 221 case kInt32: str << reinterpret_cast<int32_t*>(ptr)[index]; break; 222 case kTime: 183 223 case kUInt32: str << reinterpret_cast<uint32_t*>(ptr)[index]; break; 184 224 case kInt64: str << reinterpret_cast<int64_t*>(ptr)[index]; break; 225 case kDate: 226 case kDateTime: 185 227 case kUInt64: str << reinterpret_cast<uint64_t*>(ptr)[index]; break; 186 228 case kConst: str << branch; break; 229 case kChar: 187 230 case kNone: 188 231 break;
Note:
See TracChangeset
for help on using the changeset viewer.