-
Notifications
You must be signed in to change notification settings - Fork 0
/
odbcquery.h
50 lines (42 loc) · 1.11 KB
/
odbcquery.h
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
#ifndef ODBCQUERY_H
#define ODBCQUERY_H
#include"odbchandler.h"
#include <stdio.h>
/**
* Class to manage queries and parameter binding for unixodbc.
**/
class ODBCQuery
{
public:
ODBCQuery();
~ODBCQuery();
/**
* Prepares an stament from an active ODBCHandler connection.
* and set the sql string.
* return false if failed to prepare the statement.
*/
bool prepare(const char* sql);
/**
* Bing parameters to and statament.
* return false if failed to bind parameter.
*/
bool BindParameter(SQLUSMALLINT ipar,SQLSMALLINT fParamType,
SQLSMALLINT fCType,SQLSMALLINT fSqlType,SQLULEN cbColDef,
SQLSMALLINT ibScale,SQLPOINTER rgbValue,
SQLLEN cbValueMax,SQLLEN *pcbValue);
/**
* execute the prepared statement.
* return false if failed to execute query.
*/
bool exec();
/**
* Get the location of the statement of the query.
*/
SQLHSTMT* getStatement(){return &_stmnt;}
private:
bool allocated;
SQLHSTMT _stmnt;
ODBCHandler* dbhandler;
const char* _query_str;
};
#endif // ODBCQUERY_H