OmniSciDB  2e3a973ef4
DBEngine.h
Go to the documentation of this file.
1 /*
2  * Copyright 2020 OmniSci, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <iostream>
20 #include <memory>
21 #include <string>
22 #include <type_traits>
23 #include <vector>
25 
26 namespace EmbeddedDatabase {
27 
28 class Row {
29  public:
30  Row();
31  Row(std::vector<TargetValue>& row);
32  int64_t getInt(size_t col_num);
33  double getDouble(size_t col_num);
34  std::string getStr(size_t col_num);
35 
36  private:
37  std::vector<TargetValue> row_;
38 };
39 
40 class Cursor {
41  public:
42  size_t getColCount();
43  size_t getRowCount();
44  Row getNextRow();
45  int getColType(uint32_t col_num);
46 };
47 
48 class DBEngine {
49  public:
50  void reset();
51  void executeDDL(std::string query);
52  Cursor* executeDML(std::string query);
53  static DBEngine* create(std::string path);
54 
55  protected:
56  DBEngine() {}
57 };
58 } // namespace EmbeddedDatabase
std::string getStr(size_t col_num)
Definition: DBEngine.cpp:220
double getDouble(size_t col_num)
Definition: DBEngine.cpp:211
int64_t getInt(size_t col_num)
Definition: DBEngine.cpp:202
std::vector< TargetValue > row_
Definition: DBEngine.h:37