IODA Bundle
Types.cc
Go to the documentation of this file.
1 /*
2  * (C) Copyright 1996-2012 ECMWF.
3  *
4  * This software is licensed under the terms of the Apache Licence Version 2.0
5  * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6  * In applying this licence, ECMWF does not waive the privileges and immunities
7  * granted to it by virtue of its status as an intergovernmental organisation nor
8  * does it submit to any jurisdiction.
9  */
10 
11 #include "eckit/exception/Exceptions.h"
12 #include "eckit/sql/type/SQLType.h"
13 #include "eckit/utils/Translator.h"
14 
15 #include "odc/sql/Types.h"
16 
17 using namespace eckit;
18 using namespace eckit::sql::type;
19 using namespace odc::api;
20 
21 namespace odc {
22 namespace sql {
23 
24 //----------------------------------------------------------------------------------------------------------------------
25 
26 ColumnType sqlToOdbType(const SQLType& t) {
27 
28  switch(t.getKind()) {
29  case SQLType::realType:
30  return REAL;
31  case SQLType::integerType:
32  return INTEGER;
33  case SQLType::stringType:
34  return STRING;
35  case SQLType::bitmapType:
36  return BITFIELD;
37  case SQLType::doubleType:
38  return DOUBLE;
39  case SQLType::blobType:
40  throw SeriousBug("SQL blob type not supported in odc", Here());
41  default:
42  throw SeriousBug("Unrecognised type found: " + Translator<int, std::string>()(t.getKind()), Here());
43  };
44 
45  ASSERT(false);
46  return IGNORE;
47 }
48 
49 
50 //----------------------------------------------------------------------------------------------------------------------
51 
52 } // namespace sql
53 } // namespace odc
@ BITFIELD
Definition: ColumnType.h:27
ColumnType sqlToOdbType(const SQLType &t)
Definition: Types.cc:26
Definition: ColumnInfo.h:23