-
Notifications
You must be signed in to change notification settings - Fork 2
/
query.hh
61 lines (52 loc) · 1.41 KB
/
query.hh
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
51
52
53
54
55
56
57
58
59
60
61
/*
* $Id: query.hh,v 2.9 2005/10/20 11:24:12 martin Exp $
* Copyright (c) 2004, 2005, Voidsoft AB
*/
#ifndef VOIDSOFT_TDSPP_QUERY_HH
#define VOIDSOFT_TDSPP_QUERY_HH
#include <string>
#include "tdspp.hh"
#include "field.hh"
using namespace std;
class TDSPP;
/** Query class */
class Query {
public:
/** SQL command */
string command;
/** Rows */
Rows *rows;
/** Number of fields per row. */
CS_INT fieldcount;
/** Number of rows in a result set. */
CS_INT rowcount;
/** Constructor */
Query(TDSPP* tds);
/** Destructor */
~Query();
/** Execute an SQL query where a result is expected. */
void execute();
/** Iterate to next row in a result set. */
void next();
/** Go to the first row in a result set. */
void first();
/** Return the columnvalue i for the current row. */
Field *fields(int i);
/** Return the columnvalue s for the current row. */
Field *fields(string s);
/** Check if we've reached the end of the result set. */
bool eof();
/** Overloaded [] operator. Used to specify index in a row. */
string operator[](const char *);
/** Overloaded [] operator. Used to specify index in a row. */
string operator[](string);
private:
TDSPP* TDS;
bool endoffile;
void init();
void addrow();
bool addfield();
void getrc();
void getresults();
};
#endif /* VOIDSOFT_TDSPP_QUERY_HH */