aboutsummaryrefslogtreecommitdiff
path: root/src/sql/Sql.cpp
blob: 754a30dd6a1fc1345e871715a5ab80ed76c5edae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "../../include/odhtdb/sql/Sql.hpp"
#include <sqlite3.h>

namespace odhtdb
{
    int SqlArg::bind(sqlite3_stmt *stmt, int paramIndex) const
    {
        switch(type)
        {
            case Type::DATA_VIEW:
                return sqlite3_bind_blob(stmt, paramIndex, dataView.data, dataView.size, SQLITE_STATIC);
            case Type::INT:
                return sqlite3_bind_int(stmt, paramIndex, integer);
            case Type::INT64:
                return sqlite3_bind_int64(stmt, paramIndex, integer64);
            case Type::UINT64: // TODO: Find a way to use u64 in sqlite
                return sqlite3_bind_int64(stmt, paramIndex, uinteger64);
        }
        return SQLITE_OK;
    }
}