author | Tero Marttila <terom@fixme.fi> |
Sat, 13 Dec 2008 19:55:50 +0200 | |
branch | new-evsql |
changeset 53 | 0d6e07f4c9a1 |
parent 52 | f5037572c326 |
child 54 | 7dc8ff496da1 |
permissions | -rw-r--r-- |
21
e5da1d428e3e
new evsql for queueing SQL queries
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
1 |
#ifndef EVSQL_H |
e5da1d428e3e
new evsql for queueing SQL queries
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
2 |
#define EVSQL_H |
e5da1d428e3e
new evsql for queueing SQL queries
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
3 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
4 |
/** |
52
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
5 |
* @file src/evsql.h |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
6 |
* |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
7 |
* A SQL library designed for use with libevent and PostgreSQL's libpq. Provides support for queueing non-transactional |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
8 |
* requests, transaction support, parametrized queries and result iteration. |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
9 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
10 |
* Currently, the API does not expose the underlying libpq data structures, but since it is currently the only |
52
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
11 |
* underlying implementation, there is no guarantee that the same API will actually work with other databases' interface |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
12 |
* libraries... |
52
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
13 |
* |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
14 |
* The order of function calls and callbacks goes something like this: |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
15 |
* |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
16 |
* - evsql_new_pq |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
17 |
* |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
18 |
* - evsql_trans |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
19 |
* - evsql_trans_abort |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
20 |
* - evsql_trans_error_cb |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
21 |
* - evsql_trans_ready_cb |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
22 |
* |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
23 |
* - evsql_query, evsql_params_* + evsql_query_params, evsql_query_exec |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
24 |
* - evsql_query_abort |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
25 |
* - evsql_query_cb |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
26 |
* - evsql_result_* |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
27 |
* - evsql_result_free |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
28 |
* |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
29 |
* - evsql_trans_commit |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
30 |
* - evsql_trans_done_cb |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
31 |
* |
21
e5da1d428e3e
new evsql for queueing SQL queries
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
32 |
*/ |
e5da1d428e3e
new evsql for queueing SQL queries
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
33 |
|
52
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
34 |
/** |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
35 |
* System includes |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
36 |
*/ |
28
e944453ca924
split off dbfs components into a separate dir, improve dirop docs, error handling, etc
Tero Marttila <terom@fixme.fi>
parents:
27
diff
changeset
|
37 |
#include <stdint.h> |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
38 |
#include <stdbool.h> |
21
e5da1d428e3e
new evsql for queueing SQL queries
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
39 |
#include <event2/event.h> |
e5da1d428e3e
new evsql for queueing SQL queries
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
40 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
41 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
42 |
* For err_t. |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
43 |
*/ |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
44 |
#include "lib/err.h" |
44
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
45 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
46 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
47 |
* The generic context handle used to manage a single "database connector" with multiple queries/transactions. |
21
e5da1d428e3e
new evsql for queueing SQL queries
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
48 |
*/ |
e5da1d428e3e
new evsql for queueing SQL queries
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
49 |
struct evsql; |
e5da1d428e3e
new evsql for queueing SQL queries
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
50 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
51 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
52 |
* Opaque transaction handle |
43 | 53 |
*/ |
54 |
struct evsql_trans; |
|
55 |
||
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
56 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
57 |
* Opaque query handle |
21
e5da1d428e3e
new evsql for queueing SQL queries
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
58 |
*/ |
e5da1d428e3e
new evsql for queueing SQL queries
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
59 |
struct evsql_query; |
e5da1d428e3e
new evsql for queueing SQL queries
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
60 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
61 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
62 |
* Opaque result handle |
25
99a41f48e29b
evsql transactions, it compiles...
Tero Marttila <terom@fixme.fi>
parents:
24
diff
changeset
|
63 |
*/ |
43 | 64 |
struct evsql_result; |
65 |
||
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
66 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
67 |
* Various transaction isolation levels for conveniance |
53 | 68 |
* |
69 |
* @see evsql_trans |
|
25
99a41f48e29b
evsql transactions, it compiles...
Tero Marttila <terom@fixme.fi>
parents:
24
diff
changeset
|
70 |
*/ |
99a41f48e29b
evsql transactions, it compiles...
Tero Marttila <terom@fixme.fi>
parents:
24
diff
changeset
|
71 |
enum evsql_trans_type { |
99a41f48e29b
evsql transactions, it compiles...
Tero Marttila <terom@fixme.fi>
parents:
24
diff
changeset
|
72 |
EVSQL_TRANS_DEFAULT, |
99a41f48e29b
evsql transactions, it compiles...
Tero Marttila <terom@fixme.fi>
parents:
24
diff
changeset
|
73 |
EVSQL_TRANS_SERIALIZABLE, |
99a41f48e29b
evsql transactions, it compiles...
Tero Marttila <terom@fixme.fi>
parents:
24
diff
changeset
|
74 |
EVSQL_TRANS_REPEATABLE_READ, |
99a41f48e29b
evsql transactions, it compiles...
Tero Marttila <terom@fixme.fi>
parents:
24
diff
changeset
|
75 |
EVSQL_TRANS_READ_COMMITTED, |
99a41f48e29b
evsql transactions, it compiles...
Tero Marttila <terom@fixme.fi>
parents:
24
diff
changeset
|
76 |
EVSQL_TRANS_READ_UNCOMMITTED, |
99a41f48e29b
evsql transactions, it compiles...
Tero Marttila <terom@fixme.fi>
parents:
24
diff
changeset
|
77 |
}; |
99a41f48e29b
evsql transactions, it compiles...
Tero Marttila <terom@fixme.fi>
parents:
24
diff
changeset
|
78 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
79 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
80 |
* An item can be in different formats, the classical text-based format (i.e. snprintf "1234") or a more low-level |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
81 |
* binary format (i.e uint16_t 0x04F9 in network-byte order). |
24 | 82 |
*/ |
43 | 83 |
enum evsql_item_format { |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
84 |
/** Format values as text strings */ |
24 | 85 |
EVSQL_FMT_TEXT, |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
86 |
|
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
87 |
/** Type-specific binary encoding */ |
24 | 88 |
EVSQL_FMT_BINARY, |
89 |
}; |
|
90 |
||
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
91 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
92 |
* An item has a specific type, these correspond somewhat to the native database types. |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
93 |
*/ |
43 | 94 |
enum evsql_item_type { |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
95 |
/** End marker, zero */ |
43 | 96 |
EVSQL_TYPE_INVALID, |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
97 |
|
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
98 |
/** A SQL NULL */ |
43 | 99 |
EVSQL_TYPE_NULL_, |
31 | 100 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
101 |
/** A `struct evsql_item_binary` */ |
43 | 102 |
EVSQL_TYPE_BINARY, |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
103 |
|
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
104 |
/** A NUL-terminated char* */ |
43 | 105 |
EVSQL_TYPE_STRING, |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
106 |
|
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
107 |
/** A uint16_t value */ |
43 | 108 |
EVSQL_TYPE_UINT16, |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
109 |
|
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
110 |
/** A uint32_t value */ |
43 | 111 |
EVSQL_TYPE_UINT32, |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
112 |
|
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
113 |
/** A uint64_t value */ |
43 | 114 |
EVSQL_TYPE_UINT64, |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
115 |
|
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
116 |
EVSQL_TYPE_MAX |
43 | 117 |
}; |
118 |
||
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
119 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
120 |
* Value for use with EVSQL_TYPE_BINARY, this just a non-NUL-terminated char* and an explicit length |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
121 |
*/ |
44
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
122 |
struct evsql_item_binary { |
52
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
123 |
/** The binary data */ |
44
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
124 |
const char *ptr; |
52
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
125 |
|
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
126 |
/** Number of bytes pointed to by ptr */ |
44
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
127 |
size_t len; |
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
128 |
}; |
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
129 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
130 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
131 |
* Metadata about the format and type of an item, this does not hold any actual value. |
44
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
132 |
*/ |
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
133 |
struct evsql_item_info { |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
134 |
/** The format */ |
43 | 135 |
enum evsql_item_format format; |
136 |
||
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
137 |
/** The type type */ |
43 | 138 |
enum evsql_item_type type; |
139 |
||
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
140 |
/** Various flags */ |
44
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
141 |
struct evsql_item_flags { |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
142 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
143 |
* The value may be NULL; behaviour varies for query and result |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
144 |
* XXX: document |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
145 |
*/ |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
146 |
bool null_ok : 1; |
44
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
147 |
} flags; |
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
148 |
}; |
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
149 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
150 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
151 |
* An union to provide storage for the values of small types |
53 | 152 |
* |
153 |
* @see evsql_item |
|
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
154 |
*/ |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
155 |
union evsql_item_value { |
52
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
156 |
/** 16-bit unsigned integer */ |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
157 |
uint16_t uint16; |
52
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
158 |
|
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
159 |
/** 32-bit unsigned integer */ |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
160 |
uint32_t uint32; |
52
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
161 |
|
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
162 |
/** 64-bit unsigned integer */ |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
163 |
uint64_t uint64; |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
164 |
}; |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
165 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
166 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
167 |
* A generic structure containing the type and value of a query parameter or a result field. |
53 | 168 |
* |
169 |
* @see evsql_query_info |
|
170 |
* @see evsql_query_params |
|
171 |
* @see evsql_result_info |
|
44
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
172 |
*/ |
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
173 |
struct evsql_item { |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
174 |
/** The "header" containing the type and format */ |
44
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
175 |
struct evsql_item_info info; |
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
176 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
177 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
178 |
* Pointer to the raw databytes. |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
179 |
* Set to NULL for SQL NULLs, otherwise &value or an external buf |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
180 |
*/ |
43 | 181 |
const char *bytes; |
182 |
||
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
183 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
184 |
* Size of the byte array pointed to by bytes, zero for EVSQL_FMT_TEXT data. |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
185 |
*/ |
43 | 186 |
size_t length; |
187 |
||
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
188 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
189 |
* Inline storage for small values |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
190 |
*/ |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
191 |
union evsql_item_value value; |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
192 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
193 |
/** Internal flags */ |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
194 |
struct { |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
195 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
196 |
* The item has a value stored in `value` |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
197 |
*/ |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
198 |
bool has_value : 1; |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
199 |
} flags; |
24 | 200 |
}; |
201 |
||
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
202 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
203 |
* Query meta-info, similar to a prepared statement. |
44
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
204 |
* |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
205 |
* Contains the literal SQL query and the types of the parameters, but no more. |
53 | 206 |
* |
207 |
* @see evsql_query_exec |
|
23
1dee73ae4ad0
evsql_query_params compiles...
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
208 |
*/ |
43 | 209 |
struct evsql_query_info { |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
210 |
/** The SQL query itself */ |
43 | 211 |
const char *sql; |
23
1dee73ae4ad0
evsql_query_params compiles...
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
212 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
213 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
214 |
* A variable-length array of the item_info parameters, terminated by an EVSQL_TYPE_INVALID entry. |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
215 |
*/ |
44
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
216 |
struct evsql_item_info params[]; |
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
217 |
}; |
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
218 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
219 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
220 |
* Contains the query parameter types and their actual values |
53 | 221 |
* |
222 |
* @see evsql_query_params |
|
44
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
223 |
*/ |
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
224 |
struct evsql_query_params { |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
225 |
/** Requested result format for this query. XXX: move elsewhere */ |
44
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
226 |
enum evsql_item_format result_format; |
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
227 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
228 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
229 |
* A variable-length array of the item parameter-values, terminated by an EVSQL_TYPE_INVALID entry. |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
230 |
*/ |
44
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
231 |
struct evsql_item list[]; |
23
1dee73ae4ad0
evsql_query_params compiles...
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
232 |
}; |
1dee73ae4ad0
evsql_query_params compiles...
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
233 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
234 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
235 |
* Result layout metadata. This contains the stucture needed to decode result rows. |
53 | 236 |
* |
237 |
* @see evsql_result_begin |
|
43 | 238 |
*/ |
239 |
struct evsql_result_info { |
|
52
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
240 |
/** XXX: make up something useful to stick here */ |
44
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
241 |
int _unused; |
43 | 242 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
243 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
244 |
* A variable-length array of the item_info column types. |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
245 |
*/ |
44
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
246 |
struct evsql_item_info columns[]; |
21
e5da1d428e3e
new evsql for queueing SQL queries
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
247 |
}; |
e5da1d428e3e
new evsql for queueing SQL queries
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
248 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
249 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
250 |
* Magic macros for defining param/result info -lists |
53 | 251 |
* |
252 |
* @code |
|
253 |
* static struct evsql_query_params params = EVSQL_PARAMS(EVSQL_FMT_BINARY) { |
|
254 |
* EVSQL_PARAM( UINT32 ), |
|
255 |
* ..., |
|
256 |
* |
|
257 |
* EVSQL_PARAMS_END |
|
258 |
* }; |
|
259 |
* @endcode |
|
52
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
260 |
* |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
261 |
* @name EVSQL_TYPE/PARAM_* |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
262 |
* @{ |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
263 |
*/ |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
264 |
|
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
265 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
266 |
* A `struct evsql_item_info` initializer, using FMT_BINARY and the given EVSQL_TYPE_ -suffix. |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
267 |
* |
53 | 268 |
* @param typenam the suffix of an evsql_item_type name |
269 |
* |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
270 |
* @see struct evsql_item_info |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
271 |
* @see enum evsql_item_type |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
272 |
*/ |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
273 |
#define EVSQL_TYPE(typenam) { EVSQL_FMT_BINARY, EVSQL_TYPE_ ## typenam } |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
274 |
|
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
275 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
276 |
* End marker for a `struct evsql_item_info` array. |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
277 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
278 |
* @see struct evsql_item_info |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
279 |
*/ |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
280 |
#define EVSQL_TYPE_END { EVSQL_FMT_BINARY, EVSQL_TYPE_INVALID } |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
281 |
|
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
282 |
/** |
53 | 283 |
* Initializer block for an evsql_query_params struct |
48
8b019d191353
update dbfs code to work with new evsql
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
284 |
*/ |
8b019d191353
update dbfs code to work with new evsql
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
285 |
#define EVSQL_PARAMS(result_fmt) { result_fmt, |
53 | 286 |
|
287 |
/** |
|
288 |
* An evsql_item initializer |
|
289 |
*/ |
|
50 | 290 |
#define EVSQL_PARAM(typenam) { EVSQL_TYPE(typenam) } |
53 | 291 |
|
292 |
/** |
|
293 |
* Include the ending item and terminate the pseudo-block started using #EVSQL_PARAMS |
|
294 |
*/ |
|
50 | 295 |
#define EVSQL_PARAMS_END { EVSQL_TYPE_END } \ |
48
8b019d191353
update dbfs code to work with new evsql
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
296 |
} // <<< |
8b019d191353
update dbfs code to work with new evsql
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
297 |
|
52
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
298 |
// @} |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
299 |
|
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
300 |
/** |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
301 |
* Callback definitions |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
302 |
* |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
303 |
* @name evsql_*_cb |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
304 |
* |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
305 |
* @{ |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
306 |
*/ |
50 | 307 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
308 |
/** |
25
99a41f48e29b
evsql transactions, it compiles...
Tero Marttila <terom@fixme.fi>
parents:
24
diff
changeset
|
309 |
* Callback for handling query results. |
21
e5da1d428e3e
new evsql for queueing SQL queries
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
310 |
* |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
311 |
* The query has completed, either succesfully or unsuccesfully. |
25
99a41f48e29b
evsql transactions, it compiles...
Tero Marttila <terom@fixme.fi>
parents:
24
diff
changeset
|
312 |
* |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
313 |
* Use the evsql_result_* functions to manipulate the results, and call evsql_result_free (or equivalent) once done. |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
314 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
315 |
* @param res The result handle that must be result_free'd after use |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
316 |
* @param arg The void* passed to evsql_query_* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
317 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
318 |
* @see evsql_query |
21
e5da1d428e3e
new evsql for queueing SQL queries
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
319 |
*/ |
44
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
320 |
typedef void (*evsql_query_cb)(struct evsql_result *res, void *arg); |
21
e5da1d428e3e
new evsql for queueing SQL queries
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
321 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
322 |
/** |
25
99a41f48e29b
evsql transactions, it compiles...
Tero Marttila <terom@fixme.fi>
parents:
24
diff
changeset
|
323 |
* Callback for handling global-level errors. |
21
e5da1d428e3e
new evsql for queueing SQL queries
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
324 |
* |
25
99a41f48e29b
evsql transactions, it compiles...
Tero Marttila <terom@fixme.fi>
parents:
24
diff
changeset
|
325 |
* The evsql is not useable anymore. |
99a41f48e29b
evsql transactions, it compiles...
Tero Marttila <terom@fixme.fi>
parents:
24
diff
changeset
|
326 |
* |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
327 |
* XXX: this is not actually called yet, as no retry logic is implemented, so an evsql itself never fails. |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
328 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
329 |
* @see evsql_new_pq |
21
e5da1d428e3e
new evsql for queueing SQL queries
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
330 |
*/ |
e5da1d428e3e
new evsql for queueing SQL queries
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
331 |
typedef void (*evsql_error_cb)(struct evsql *evsql, void *arg); |
e5da1d428e3e
new evsql for queueing SQL queries
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
332 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
333 |
/** |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
334 |
* Callback for handling transaction-level errors. This may be called at any time during a transaction's lifetime, |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
335 |
* including from within the evsql_query_* functions (but not always). |
25
99a41f48e29b
evsql transactions, it compiles...
Tero Marttila <terom@fixme.fi>
parents:
24
diff
changeset
|
336 |
* |
99a41f48e29b
evsql transactions, it compiles...
Tero Marttila <terom@fixme.fi>
parents:
24
diff
changeset
|
337 |
* The transaction is not useable anymore. |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
338 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
339 |
* @param trans the transaction in question |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
340 |
* @param arg the void* passed to evsql_trans |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
341 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
342 |
* @see evsql_trans |
25
99a41f48e29b
evsql transactions, it compiles...
Tero Marttila <terom@fixme.fi>
parents:
24
diff
changeset
|
343 |
*/ |
99a41f48e29b
evsql transactions, it compiles...
Tero Marttila <terom@fixme.fi>
parents:
24
diff
changeset
|
344 |
typedef void (*evsql_trans_error_cb)(struct evsql_trans *trans, void *arg); |
99a41f48e29b
evsql transactions, it compiles...
Tero Marttila <terom@fixme.fi>
parents:
24
diff
changeset
|
345 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
346 |
/** |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
347 |
* Callback for handling evsql_trans/evsql_query_abort completion. The transaction is ready for use with evsql_query_*. |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
348 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
349 |
* @param trans the transaction in question |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
350 |
* @param arg the void* passed to evsql_trans |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
351 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
352 |
* @see evsql_trans |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
353 |
* @see evsql_query_abort |
25
99a41f48e29b
evsql transactions, it compiles...
Tero Marttila <terom@fixme.fi>
parents:
24
diff
changeset
|
354 |
*/ |
99a41f48e29b
evsql transactions, it compiles...
Tero Marttila <terom@fixme.fi>
parents:
24
diff
changeset
|
355 |
typedef void (*evsql_trans_ready_cb)(struct evsql_trans *trans, void *arg); |
99a41f48e29b
evsql transactions, it compiles...
Tero Marttila <terom@fixme.fi>
parents:
24
diff
changeset
|
356 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
357 |
/** |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
358 |
* Callback for handling evsql_trans_commit completion. The transaction was commited, and should not be used anymore. |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
359 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
360 |
* @param trans the transaction in question |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
361 |
* @param arg the void* passed to evsql_trans |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
362 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
363 |
* @see evsql_trans |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
364 |
* @see evsql_trans_commit |
26
61668c57f4bb
preliminary *dir implementation
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
365 |
*/ |
61668c57f4bb
preliminary *dir implementation
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
366 |
typedef void (*evsql_trans_done_cb)(struct evsql_trans *trans, void *arg); |
61668c57f4bb
preliminary *dir implementation
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
367 |
|
52
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
368 |
// @} |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
369 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
370 |
/** |
53 | 371 |
* Session functions |
372 |
* |
|
373 |
* @name evsql_* |
|
374 |
* @{ |
|
375 |
*/ |
|
376 |
||
377 |
/** |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
378 |
* Create a new PostgreSQL/libpq (evpq) -based evsql using the given conninfo. |
25
99a41f48e29b
evsql transactions, it compiles...
Tero Marttila <terom@fixme.fi>
parents:
24
diff
changeset
|
379 |
* |
99a41f48e29b
evsql transactions, it compiles...
Tero Marttila <terom@fixme.fi>
parents:
24
diff
changeset
|
380 |
* The given conninfo must stay valid for the duration of the evsql's lifetime. |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
381 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
382 |
* See the libpq reference manual for the syntax of pq_conninfo |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
383 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
384 |
* @param ev_base the libevent base to use |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
385 |
* @param pq_conninfo the libpq connection information |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
386 |
* @param error_fn XXX: not used, may be NULL |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
387 |
* @param cb_arg: XXX: not used, argument for error_fn |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
388 |
* @return the evsql context handle for use with other functions |
21
e5da1d428e3e
new evsql for queueing SQL queries
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
389 |
*/ |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
390 |
struct evsql *evsql_new_pq (struct event_base *ev_base, const char *pq_conninfo, |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
391 |
evsql_error_cb error_fn, |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
392 |
void *cb_arg |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
393 |
); |
21
e5da1d428e3e
new evsql for queueing SQL queries
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
394 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
395 |
/** |
53 | 396 |
* Close a connection. Callbacks for waiting queries will not be run. |
397 |
* |
|
398 |
* XXX: not implemented yet. |
|
399 |
* |
|
400 |
* @ingroup evsql_* |
|
401 |
* @param evsql the context handle from evsql_new_* |
|
402 |
*/ |
|
403 |
void evsql_close (struct evsql *evsql); |
|
404 |
||
405 |
// @} |
|
406 |
||
407 |
/** |
|
52
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
408 |
* Query API |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
409 |
* |
52
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
410 |
* @name evsql_query_* |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
411 |
* @{ |
21
e5da1d428e3e
new evsql for queueing SQL queries
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
412 |
*/ |
e5da1d428e3e
new evsql for queueing SQL queries
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
413 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
414 |
/** |
25
99a41f48e29b
evsql transactions, it compiles...
Tero Marttila <terom@fixme.fi>
parents:
24
diff
changeset
|
415 |
* Queue the given query for execution. |
99a41f48e29b
evsql transactions, it compiles...
Tero Marttila <terom@fixme.fi>
parents:
24
diff
changeset
|
416 |
* |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
417 |
* If a trans is given (i.e. not NULL), then the transaction must be idle, and the query will be executed in that |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
418 |
* transaction's context. Otherwise, the query will be executed without a transaction using an idle connection, or |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
419 |
* enqueued for later execution. |
25
99a41f48e29b
evsql transactions, it compiles...
Tero Marttila <terom@fixme.fi>
parents:
24
diff
changeset
|
420 |
* |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
421 |
* Once the query is complete (got a result, got an error, the connection failed), then the query_cb will be called. |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
422 |
* The callback can use the evsql_result_* functions to manipulate it. |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
423 |
* |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
424 |
* The returned evsql_query handle can be passed to evsql_query_abort at any point before query_fn being called. |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
425 |
* |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
426 |
* @param evsql the context handle from evsql_new_* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
427 |
* @param trans the optional transaction handle from evsql_trans |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
428 |
* @param command the raw SQL command itself |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
429 |
* @param query_fn the query_cb to call once the query is complete |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
430 |
* @param cb_arg the void* passed to the above |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
431 |
* @return the evsql_query handle that can be used to abort the query |
23
1dee73ae4ad0
evsql_query_params compiles...
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
432 |
*/ |
25
99a41f48e29b
evsql transactions, it compiles...
Tero Marttila <terom@fixme.fi>
parents:
24
diff
changeset
|
433 |
struct evsql_query *evsql_query (struct evsql *evsql, struct evsql_trans *trans, const char *command, evsql_query_cb query_fn, void *cb_arg); |
99a41f48e29b
evsql transactions, it compiles...
Tero Marttila <terom@fixme.fi>
parents:
24
diff
changeset
|
434 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
435 |
/** |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
436 |
* Execute the given SQL query using the list of parameter types/values given via evsql_query_params. |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
437 |
* |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
438 |
* Use the EVSQL_PARAMS macros to declare the struct, and the evsql_param_* functions to populate the values. |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
439 |
* |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
440 |
* See evsql_query for more info about behaviour. |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
441 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
442 |
* XXX: explain SQL param syntax... |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
443 |
* |
52
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
444 |
* @param evsql the context handle from evsql_new_* |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
445 |
* @param trans the optional transaction handle from evsql_trans |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
446 |
* @param command the SQL command to bind the parameters to |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
447 |
* @param params the parameter types and values |
52
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
448 |
* @param query_fn the query_cb to call once the query is complete |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
449 |
* @param cb_arg the void* passed to the above |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
450 |
* @see evsql_query |
25
99a41f48e29b
evsql transactions, it compiles...
Tero Marttila <terom@fixme.fi>
parents:
24
diff
changeset
|
451 |
*/ |
44
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
452 |
struct evsql_query *evsql_query_params (struct evsql *evsql, struct evsql_trans *trans, |
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
453 |
const char *command, const struct evsql_query_params *params, |
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
454 |
evsql_query_cb query_fn, void *cb_arg |
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
455 |
); |
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
456 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
457 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
458 |
* Execute the given query_info's SQL query with the values given as variable arguments, using the evsql_query_info to |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
459 |
* resolve the types. |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
460 |
* |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
461 |
* See evsql_query for more info about behaviour. |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
462 |
* |
52
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
463 |
* @param evsql the context handle from evsql_new_* |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
464 |
* @param trans the optional transaction handle from evsql_trans |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
465 |
* @param query_info the SQL query information |
52
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
466 |
* @param query_fn the query_cb to call once the query is complete |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
467 |
* @param cb_arg the void* passed to the above |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
468 |
* @see evsql_query |
44
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
469 |
*/ |
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
470 |
struct evsql_query *evsql_query_exec (struct evsql *evsql, struct evsql_trans *trans, |
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
471 |
const struct evsql_query_info *query_info, |
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
472 |
evsql_query_cb query_fn, void *cb_arg, |
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
473 |
... |
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
474 |
); |
24 | 475 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
476 |
/** |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
477 |
* Abort a query returned by evsql_query_* that has not yet completed (query_fn has not been called yet). |
27 | 478 |
* |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
479 |
* The actual query itself may or may not be aborted (and hence may or may not be executed on the server), but query_fn |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
480 |
* will not be called anymore, and the query will dispose of itself and any results returned. |
27 | 481 |
* |
482 |
* If the query is part of a transaction, then trans must be given, and the query must be the query that is currently |
|
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
483 |
* executing on that trans. The transaction's ready_fn will be called once the query has been aborted and the |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
484 |
* transaction is now idle again. |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
485 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
486 |
* @param trans if the query is part of a transaction, then it MUST be given here |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
487 |
* @param query the in-progress query to abort |
27 | 488 |
*/ |
489 |
void evsql_query_abort (struct evsql_trans *trans, struct evsql_query *query); |
|
490 |
||
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
491 |
/** |
52
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
492 |
* Print out a textual dump of the given query and parameters using DEBUG |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
493 |
* |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
494 |
* @param sql the SQL query command |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
495 |
* @param params the list of parameter types and values |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
496 |
*/ |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
497 |
void evsql_query_debug (const char *sql, const struct evsql_query_params *params); |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
498 |
|
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
499 |
// @} |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
500 |
|
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
501 |
/** |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
502 |
* Transaction API |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
503 |
* |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
504 |
* @name evsql_trans_* |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
505 |
* @{ |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
506 |
*/ |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
507 |
|
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
508 |
/** |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
509 |
* Create a new transaction. |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
510 |
* |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
511 |
* A transaction will be allocated its own connection, and the "BEGIN TRANSACTION ..." query will be sent (use the |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
512 |
* trans_type argument to specify this). |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
513 |
* |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
514 |
* Once the transaction has been opened, the given trans_ready_cb will be triggered, and the transaction can then |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
515 |
* be used (see evsql_query_*). |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
516 |
* |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
517 |
* If, at any point, the transaction-connection fails, any pending query will be forgotten (i.e. the query callback |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
518 |
* will NOT be called), and the given trans_error_cb will be called. Note that this includes some, but not all, |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
519 |
* cases where evsql_query_* returns an error. |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
520 |
* |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
521 |
* Once you are done with the transaction, call either evsql_trans_commit or evsql_trans_abort. |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
522 |
* |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
523 |
* @ingroup evsql_trans_* |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
524 |
* @param evsql the context handle from evsql_new_* |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
525 |
* @param type the type of transaction to create |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
526 |
* @param error_fn the trans_error_cb to call if this transaction fails |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
527 |
* @param ready_fn the trans_ready_cb to call once this transaction is ready for use |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
528 |
* @param done_fn the trans_done_cb to call once this transaction has been commmited |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
529 |
* @param cb_arg the void* to pass to the above |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
530 |
* @return the evsql_trans handle for use with other functions |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
531 |
*/ |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
532 |
struct evsql_trans *evsql_trans (struct evsql *evsql, enum evsql_trans_type type, |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
533 |
evsql_trans_error_cb error_fn, |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
534 |
evsql_trans_ready_cb ready_fn, |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
535 |
evsql_trans_done_cb done_fn, |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
536 |
void *cb_arg |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
537 |
); |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
538 |
|
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
539 |
/** |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
540 |
* Commit a transaction using "COMMIT TRANSACTION". |
27 | 541 |
* |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
542 |
* The transaction must be idle, just like for evsql_query. Once the transaction has been commited, the transaction's |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
543 |
* done_fn will be called, after which the transaction must not be used anymore. |
28
e944453ca924
split off dbfs components into a separate dir, improve dirop docs, error handling, etc
Tero Marttila <terom@fixme.fi>
parents:
27
diff
changeset
|
544 |
* |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
545 |
* You cannot abort a COMMIT, calling trans_abort on trans after a succesful trans_commit is an error. |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
546 |
* |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
547 |
* Note that done_fn will never be called directly, always indirectly via the event loop. |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
548 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
549 |
* @param trans the transaction handle from evsql_trans to commit |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
550 |
* @see evsql_trans |
26
61668c57f4bb
preliminary *dir implementation
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
551 |
*/ |
61668c57f4bb
preliminary *dir implementation
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
552 |
int evsql_trans_commit (struct evsql_trans *trans); |
61668c57f4bb
preliminary *dir implementation
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
553 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
554 |
/** |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
555 |
* Abort a transaction, using "ROLLBACK TRANSACTION". |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
556 |
* |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
557 |
* No more transaction callbacks will be called. If there was a query running, it will be aborted, and the transaction |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
558 |
* then rollback'd. |
27 | 559 |
* |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
560 |
* You cannot abort a COMMIT, calling trans_abort on trans after a call to trans_commit is an error. |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
561 |
* |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
562 |
* Do not call evsql_trans_abort from within evsql_trans_error_cb! |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
563 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
564 |
* @param trans the transaction from evsql_trans to abort |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
565 |
* @see evsql_trans |
26
61668c57f4bb
preliminary *dir implementation
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
566 |
*/ |
27 | 567 |
void evsql_trans_abort (struct evsql_trans *trans); |
26
61668c57f4bb
preliminary *dir implementation
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
568 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
569 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
570 |
* Retrieve the transaction-specific error message from the underlying engine. |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
571 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
572 |
* Intended to be called from trans_error_cb |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
573 |
*/ |
26
61668c57f4bb
preliminary *dir implementation
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
574 |
const char *evsql_trans_error (struct evsql_trans *trans); |
61668c57f4bb
preliminary *dir implementation
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
575 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
576 |
// @} |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
577 |
|
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
578 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
579 |
* Parameter-building functions. |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
580 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
581 |
* These manipulate the value of the given parameter index. |
52
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
582 |
* |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
583 |
* @name evsql_param_* |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
584 |
* @{ |
24 | 585 |
*/ |
31 | 586 |
int evsql_param_binary (struct evsql_query_params *params, size_t param, const char *ptr, size_t len); |
24 | 587 |
int evsql_param_string (struct evsql_query_params *params, size_t param, const char *ptr); |
31 | 588 |
int evsql_param_uint16 (struct evsql_query_params *params, size_t param, uint16_t uval); |
24 | 589 |
int evsql_param_uint32 (struct evsql_query_params *params, size_t param, uint32_t uval); |
38
1fd4da071575
rework/hack parent to be a FOREIGN KEY (add a dir_ino col), implement dbfs_link
Tero Marttila <terom@fixme.fi>
parents:
34
diff
changeset
|
590 |
int evsql_param_null (struct evsql_query_params *params, size_t param); |
31 | 591 |
int evsql_params_clear (struct evsql_query_params *params); |
592 |
||
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
593 |
// @} |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
594 |
|
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
595 |
/** |
24 | 596 |
* Result-handling functions |
52
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
597 |
* |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
598 |
* @name evsql_result_* |
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
599 |
* @{ |
24 | 600 |
*/ |
601 |
||
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
602 |
/** |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
603 |
* Check the result for errors. Intended for use with non-data queries, i.e. CREATE, etc. |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
604 |
* |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
605 |
* Returns zero if the query was OK, err otherwise. EIO indicates an SQL error, the error message can be retrived |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
606 |
* using evsql_result_error. |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
607 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
608 |
* @param res the result handle passed to query_cb |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
609 |
* @return zero on success, EIO on SQL error, positive error code otherwise |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
610 |
*/ |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
611 |
err_t evsql_result_check (struct evsql_result *res); |
44
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
612 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
613 |
/** |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
614 |
* The iterator-based interface results interface. |
44
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
615 |
* |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
616 |
* Define an evsql_result_info struct that describes the columns returned by the query, and call evsql_result_begin on |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
617 |
* the evsql_result. This verifies the query result, and then prepares it for iteration using evsql_result_next. |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
618 |
* |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
619 |
* Call evsql_result_end once you've stopped iteration. |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
620 |
* |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
621 |
* Returns zero if the evsql_result is ready for iteration, err otherwise. EIO indicates an SQL error, the error |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
622 |
* message can be retreived using evsql_result_error. The result must be released in both cases. |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
623 |
* |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
624 |
* Note: currently the iterator state is simply stored in evsql_result, so only one iterator at a time per evsql_result. |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
625 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
626 |
* @param info the metadata to use to handle the result row columns |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
627 |
* @param res the result handle passed to query_cb |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
628 |
* @return zero on success, +err on error |
44
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
629 |
*/ |
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
630 |
err_t evsql_result_begin (struct evsql_result_info *info, struct evsql_result *res); |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
631 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
632 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
633 |
* Reads the next result row from the result prepared using evsql_result_begin. Stores the field values into to given |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
634 |
* pointer arguments based on the evsql_result_info given to evsql_result_begin. |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
635 |
* |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
636 |
* @param res the result handle previous prepared using evsql_result_begin |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
637 |
* @param ... a set of pointers corresponding to the evsql_result_info specified using evsql_result_begin |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
638 |
* @return >0 when a row was read, zero when there are no more rows left, and -err on error |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
639 |
*/ |
44
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
640 |
int evsql_result_next (struct evsql_result *res, ...); |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
641 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
642 |
/** |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
643 |
* Ends the result iteration, releasing any associated resources and the result itself. |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
644 |
* |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
645 |
* The result should not be iterated or accessed anymore. |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
646 |
* |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
647 |
* Note: this does the same thing as evsql_result_free, and works regardless of evsql_result_begin returning |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
648 |
* succesfully or not. |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
649 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
650 |
* @param res the result handle passed to query_cb |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
651 |
* @see evsql_result_free |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
652 |
*/ |
44
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
653 |
void evsql_result_end (struct evsql_result *res); |
24 | 654 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
655 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
656 |
* Get the error message associated with the result, intended for use after evsql_result_check/begin return an error |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
657 |
* code. |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
658 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
659 |
* @param res the result handle passed to query_cb |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
660 |
* @return a char* containing the NUL-terminated error string. Valid until evsql_result_free is called. |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
661 |
*/ |
45
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
662 |
const char *evsql_result_error (const struct evsql_result *res); |
424ce5ab82fd
compiles + some basic evsql_test
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
663 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
664 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
665 |
* Get the number of data rows returned by the query |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
666 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
667 |
* @param res the result handle passed to query_cb |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
668 |
* @return the number of rows, >= 0 |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
669 |
*/ |
44
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
670 |
size_t evsql_result_rows (const struct evsql_result *res); |
24 | 671 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
672 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
673 |
* Get the number of columns in the data results from the query |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
674 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
675 |
* @param res the result handle passed to query_cb |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
676 |
* @return the number of columns. XXX: zero if no data? |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
677 |
*/ |
44
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
678 |
size_t evsql_result_cols (const struct evsql_result *res); |
24 | 679 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
680 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
681 |
* Get the number of rows affected by an UPDATE/INSERT/etc query. |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
682 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
683 |
* @param res the result handle passed to query_cb |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
684 |
* @return the number of rows affected, >= 0 |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
685 |
*/ |
44
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
686 |
size_t evsql_result_affected (const struct evsql_result *res); |
34
460f995d3769
fix readdir to use ORDER BY, rename
Tero Marttila <terom@fixme.fi>
parents:
31
diff
changeset
|
687 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
688 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
689 |
* Fetch the raw binary value for the given field, returning it via ptr/size. |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
690 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
691 |
* The given row/col must be within bounds as returned by evsql_result_rows/cols. |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
692 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
693 |
* *ptr will point to *size bytes of read-only memory allocated internally. |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
694 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
695 |
* @param res the result handle passed to query_cb |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
696 |
* @param row the row index to access |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
697 |
* @param col the column index to access |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
698 |
* @param ptr where to store a pointer to the read-only field data, free'd upon evsql_result_free |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
699 |
* @param size updated to the size of the field value pointed to by ptr |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
700 |
* @param nullok when true and the field value is NULL, *ptr and *size are not modified, otherwise NULL means an error |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
701 |
* @return zero on success, <0 on error |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
702 |
*/ |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
703 |
int evsql_result_binary (const struct evsql_result *res, size_t row, size_t col, const char **ptr, size_t *size, bool nullok); |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
704 |
|
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
705 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
706 |
* Fetch the textual value of the given field, returning it via ptr. |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
707 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
708 |
* The given row/col must be within bounds as returned by evsql_result_rows/cols. |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
709 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
710 |
* *ptr will point to a NUL-terminated string allocated internally. |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
711 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
712 |
* @param res the result handle passed to query_cb |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
713 |
* @param row the row index to access |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
714 |
* @param col the column index to access |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
715 |
* @param ptr where to store a pointer to the read-only field data, free'd upon evsql_result_free |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
716 |
* @param nullok when true and the field value is NULL, *ptr and *size are not modified, otherwise NULL means an error |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
717 |
* @return zero on success, <0 on error |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
718 |
*/ |
44
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
719 |
int evsql_result_string (const struct evsql_result *res, size_t row, size_t col, const char **ptr, int nullok); |
24 | 720 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
721 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
722 |
* Use evsql_result_binary to read a binary field value, and then convert it using ntoh[slq], storing the value in |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
723 |
* *val. |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
724 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
725 |
* The given row/col must be within bounds as returned by evsql_result_rows/cols. |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
726 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
727 |
* @param res the result handle passed to query_cb |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
728 |
* @param row the row index to access |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
729 |
* @param col the column index to access |
52
f5037572c326
improved evsql docs and added a doxygen config file
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
730 |
* @param uval where to store the decoded value |
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
731 |
* @param nullok when true and the field value is NULL, *ptr and *size are not modified, otherwise NULL means an error |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
732 |
* @return zero on success, <0 on error |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
733 |
*/ |
44
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
734 |
int evsql_result_uint16 (const struct evsql_result *res, size_t row, size_t col, uint16_t *uval, int nullok); |
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
735 |
int evsql_result_uint32 (const struct evsql_result *res, size_t row, size_t col, uint32_t *uval, int nullok); |
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
736 |
int evsql_result_uint64 (const struct evsql_result *res, size_t row, size_t col, uint64_t *uval, int nullok); |
24 | 737 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
738 |
/** |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
739 |
* Every result handle passed to query_cb MUST be released by the user, using this function. |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
740 |
* |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
741 |
* @param res the result handle passed to query_cb |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
742 |
*/ |
44
9e76ee9729b6
more work on the new evsql interface
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
743 |
void evsql_result_free (struct evsql_result *res); |
24 | 744 |
|
51
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
745 |
// @} |
c65d0f4c3bff
evsql: documentation improvements, fix consts, use bools
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
746 |
|
21
e5da1d428e3e
new evsql for queueing SQL queries
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
747 |
#endif /* EVSQL_H */ |