| 241 | } |
| 242 | |
| 243 | Tuple::ElementType Tuple::getType(size_t index) const { |
| 244 | if (index >= offsets.size()) { |
| 245 | throw invalid_tuple_index(); |
| 246 | } |
| 247 | |
| 248 | uint8_t code = data[offsets[index]]; |
| 249 | |
| 250 | if (code == '\x00') { |
| 251 | return ElementType::NULL_TYPE; |
| 252 | } else if (code == '\x01') { |
| 253 | return ElementType::BYTES; |
| 254 | } else if (code == '\x02') { |
| 255 | return ElementType::UTF8; |
| 256 | } else if (code >= '\x0c' && code <= '\x1c') { |
| 257 | return ElementType::INT; |
| 258 | } else if (code == 0x20) { |
| 259 | return ElementType::FLOAT; |
| 260 | } else if (code == 0x21) { |
| 261 | return ElementType::DOUBLE; |
| 262 | } else if (code == 0x26 || code == 0x27) { |
| 263 | return ElementType::BOOL; |
| 264 | } else if (code == VERSIONSTAMP_96_CODE) { |
| 265 | return ElementType::VERSIONSTAMP; |
| 266 | } else if (isUserType(code)) { |
| 267 | return ElementType::USER_TYPE; |
| 268 | } else { |
| 269 | throw invalid_tuple_data_type(); |
| 270 | } |
| 271 | } |
| 272 | |
| 273 | Standalone<StringRef> Tuple::getString(size_t index) const { |
| 274 | if (index >= offsets.size()) { |