-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsqlitetable.cpp
More file actions
50 lines (41 loc) · 1007 Bytes
/
Copy pathsqlitetable.cpp
File metadata and controls
50 lines (41 loc) · 1007 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include "sqlite.h"
#include "sqlitetable.h"
namespace sqliteWrapper {
/*
This implementation uses the convenience function sqlite_get_table.
It stores the whole result in a table of strings on the heap (fast).
*/
/*SqliteTable::SqliteTable()
{
result_ = 0;
numberRows_ = 0;
numberCols_ = 0;
currentRow_ = 0;
}*/
SqliteTable::SqliteTable(char **result, int numberRows, int numberCols)
{
result_ = result;
numberRows_ = numberRows;
numberCols_ = numberCols;
currentRow_ = 0;
}
SqliteTable::~SqliteTable()
{
// We always have to free up the table (on heap)
sqlite3_free_table(result_);
}
const char* SqliteTable::getField(int row, int column)
{
return result_[((row+1)*numberCols_)+column];
}
const char* SqliteTable::getColumnName(int column)
{
return result_[column];
}
const int SqliteTable::numberRows() {
return numberRows_;
}
const int SqliteTable::numberCols() {
return numberCols_;
}
}