Merge lp:~linuxjedi/libdrizzle/5.1-docs into lp:libdrizzle
- 5.1-docs
- Merge into libdrizzle-redux
Proposed by
Andrew Hutchings
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Andrew Hutchings | ||||
Approved revision: | 79 | ||||
Merged at revision: | 79 | ||||
Proposed branch: | lp:~linuxjedi/libdrizzle/5.1-docs | ||||
Merge into: | lp:libdrizzle | ||||
Diff against target: |
327 lines (+175/-57) 5 files modified
configure.ac (+2/-2) docs/api/connection.rst (+7/-0) docs/api/statement.rst (+157/-43) docs/examples/statement.rst (+8/-10) rpm/spec.in (+1/-2) |
||||
To merge this branch: | bzr merge lp:~linuxjedi/libdrizzle/5.1-docs | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Drizzle Trunk | Pending | ||
Review via email: mp+141978@code.launchpad.net |
Commit message
Description of the change
Update the docs for the latest prep statement changes
Also bump version ready for release soon
To post a comment you must log in.
- 80. By Andrew Hutchings
-
Fix spec.in for lib version
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'configure.ac' |
2 | --- configure.ac 2012-12-29 17:31:57 +0000 |
3 | +++ configure.ac 2013-01-04 21:00:30 +0000 |
4 | @@ -6,7 +6,7 @@ |
5 | # Use and distribution licensed under the BSD license. See |
6 | # the COPYING file in this directory for full text. |
7 | |
8 | -AC_INIT([libdrizzle],[5.1.0],[http://bugs.launchpad.net/drizzle],[libdrizzle],[http://drizzle.org/]) |
9 | +AC_INIT([libdrizzle],[5.1.1],[http://bugs.launchpad.net/drizzle],[libdrizzle],[http://drizzle.org/]) |
10 | |
11 | AC_CONFIG_AUX_DIR([build-aux]) |
12 | |
13 | @@ -27,7 +27,7 @@ |
14 | AC_CONFIG_SRCDIR([libdrizzle/drizzle.cc]) |
15 | |
16 | #shared library versioning |
17 | -LIBDRIZZLE_LIBRARY_VERSION=5:1:0 |
18 | +LIBDRIZZLE_LIBRARY_VERSION=6:0:0 |
19 | # | | | |
20 | # +------+ | +---+ |
21 | # | | | |
22 | |
23 | === modified file 'docs/api/connection.rst' |
24 | --- docs/api/connection.rst 2012-12-22 08:54:15 +0000 |
25 | +++ docs/api/connection.rst 2013-01-04 21:00:30 +0000 |
26 | @@ -215,6 +215,13 @@ |
27 | :param con: A connection object |
28 | :returns: A :c:type:`drizzle_return_t` status. :py:const:`DRIZZLE_RETURN_OK` upon success |
29 | |
30 | +.. c:function:: drizzle_return_t drizzle_close(drizzle_st *con) |
31 | + |
32 | + Gracefully disconnect from a server (leaves the connection object available for a reconnect |
33 | + |
34 | + :param con: A connection object |
35 | + :returns: A :c:type:`drizzle_return_t` response for the quit command sent to the server |
36 | + |
37 | .. c:function:: drizzle_return_t drizzle_quit(drizzle_st *con) |
38 | |
39 | Gracefully disconnect from a server and free the connection object |
40 | |
41 | === modified file 'docs/api/statement.rst' |
42 | --- docs/api/statement.rst 2012-12-23 14:44:44 +0000 |
43 | +++ docs/api/statement.rst 2013-01-04 21:00:30 +0000 |
44 | @@ -19,17 +19,108 @@ |
45 | :param ret_ptr: A pointer to a :c:type:`drizzle_return_t` to store the return status into |
46 | :returns: A newly allocated and prepared statement object (or NULL on error) |
47 | |
48 | -.. c:function:: drizzle_return_t drizzle_stmt_bind_param(drizzle_stmt_st *stmt, uint16_t param_num, drizzle_column_type_t type, void *data, uint32_t length, drizzle_bind_options_t options) |
49 | - |
50 | - Bind a parameter to send in statement. This needs to be called before every |
51 | - :c:func:`drizzle_stmt_execute` if the data changes. |
52 | - |
53 | - :param stmt: The prepared statement object |
54 | - :param param_num: The parameter number this bind is for |
55 | - :param type: The column type this parameter uses |
56 | - :param data: The data for this parameter |
57 | - :param length: The length of the data |
58 | - :param options: Options for the parameter |
59 | +.. c:function:: drizzle_return_t drizzle_stmt_set_tiny(drizzle_stmt_st *stmt, uint16_t param_num, uint8_t value, bool is_unsigned) |
60 | + |
61 | + Sets a parameter of a prepared statement to a tinyint value |
62 | + |
63 | + :param stmt: A prepared statement object |
64 | + :param param_num: The parameter number to set (starting at 0) |
65 | + :param value: The value to set the parameter |
66 | + :param is_unsigned: Set to true if the parameter is unsigned |
67 | + :returns: A return status code, :py:const:`DRIZZLE_RETURN_OK` upon success |
68 | + |
69 | +.. c:function:: drizzle_return_t drizzle_stmt_set_short(drizzle_stmt_st *stmt, uint16_t param_num, uint16_t value, bool is_unsigned) |
70 | + |
71 | + Sets a parameter of a prepared statement to a short int value |
72 | + |
73 | + :param stmt: A prepared statement object |
74 | + :param param_num: The parameter number to set (starting at 0) |
75 | + :param value: The value to set the parameter |
76 | + :param is_unsigned: Set to true if the parameter is unsigned |
77 | + :returns: A return status code, :py:const:`DRIZZLE_RETURN_OK` upon success |
78 | + |
79 | +.. c:function:: drizzle_return_t drizzle_stmt_set_int(drizzle_stmt_st *stmt, uint16_t param_num, uint32_t value, bool is_unsigned) |
80 | + |
81 | + Sets a parameter of a prepared statement to an int value |
82 | + |
83 | + :param stmt: A prepared statement object |
84 | + :param param_num: The parameter number to set (starting at 0) |
85 | + :param value: The value to set the parameter |
86 | + :param is_unsigned: Set to true if the parameter is unsigned |
87 | + :returns: A return status code, :py:const:`DRIZZLE_RETURN_OK` upon success |
88 | + |
89 | +.. c:function:: drizzle_return_t drizzle_stmt_set_bigint(drizzle_stmt_st *stmt, uint16_t param_num, uint64_t value, bool is_unsigned) |
90 | + |
91 | + Sets a parameter of a prepared statement to a bigint value |
92 | + |
93 | + :param stmt: A prepared statement object |
94 | + :param param_num: The parameter number to set (starting at 0) |
95 | + :param value: The value to set the parameter |
96 | + :param is_unsigned: Set to true if the parameter is unsigned |
97 | + :returns: A return status code, :py:const:`DRIZZLE_RETURN_OK` upon success |
98 | + |
99 | +.. c:function:: drizzle_return_t drizzle_stmt_set_double(drizzle_stmt_st *stmt, uint16_t param_num, double value) |
100 | + |
101 | + Sets a parameter of a prepared statement to a double value |
102 | + |
103 | + :param stmt: A prepared statement object |
104 | + :param param_num: The parameter number to set (starting at 0) |
105 | + :param value: The value to set the parameter |
106 | + :returns: A return status code, :py:const:`DRIZZLE_RETURN_OK` upon success |
107 | + |
108 | +.. c:function:: drizzle_return_t drizzle_stmt_set_float(drizzle_stmt_st *stmt, uint16_t param_num, float value) |
109 | + |
110 | + Sets a parameter of a prepared statement to a float value |
111 | + |
112 | + :param stmt: A prepared statement object |
113 | + :param param_num: The parameter number to set (starting at 0) |
114 | + :param value: The value to set the parameter |
115 | + :returns: A return status code, :py:const:`DRIZZLE_RETURN_OK` upon success |
116 | + |
117 | +.. c:function:: drizzle_return_t drizzle_stmt_set_string(drizzle_stmt_st *stmt, uint16_t param_num, char *value, size_t length) |
118 | + |
119 | + Sets a parameter of a prepared statement to a string value |
120 | + |
121 | + :param stmt: A prepared statement object |
122 | + :param param_num: The parameter number to set (starting at 0) |
123 | + :param value: The value to set the parameter |
124 | + :param length: The length of the value data |
125 | + :returns: A return status code, :py:const:`DRIZZLE_RETURN_OK` upon success |
126 | + |
127 | +.. c:function:: drizzle_return_t drizzle_stmt_set_null(drizzle_stmt_st *stmt, uint16_t param_num) |
128 | + |
129 | + Sets a parameter of a prepared statement to a NULL value |
130 | + |
131 | + :param stmt: A prepared statement object |
132 | + :param param_num: The parameter number to set (starting at 0) |
133 | + :returns: A return status code, :py:const:`DRIZZLE_RETURN_OK` upon success |
134 | + |
135 | +.. c:function:: drizzle_return_t drizzle_stmt_set_time(drizzle_stmt_st *stmt, uint16_t param_num, uint32_t days, uint8_t hours, uint8_t minutes, uint8_t seconds, uint32_t microseconds, bool is_negative) |
136 | + |
137 | + Sets a parameter of a prepared statement to a time value |
138 | + |
139 | + :param stmt: A prepared statement object |
140 | + :param param_num: The parameter number to set (starting at 0) |
141 | + :param days: The number of days for the time |
142 | + :param hours: The number of hours for the time |
143 | + :param minutes: The number of minutes for the time |
144 | + :param seconds: The number of seconds for the time |
145 | + :param microseconds: The number of microseconds for the time |
146 | + :returns: A return status code, :py:const:`DRIZZLE_RETURN_OK` upon success |
147 | + |
148 | +.. c:function:: drizzle_return_t drizzle_stmt_set_timestamp(drizzle_stmt_st *stmt, uint16_t param_num, uint16_t year, uint8_t month, uint8_t day, uint8_t hours, uint8_t minutes, uint8_t seconds, uint32_t microseconds) |
149 | + |
150 | + Sets a parameter of a prepared statement to a datetime/timestamp value |
151 | + |
152 | + :param stmt: A prepared statement object |
153 | + :param param_num: The parameter number to set (starting at 0) |
154 | + :param year: The year number for the timestamp |
155 | + :param month: The month number for the timestamp |
156 | + :param day: The day number for the timestamp |
157 | + :param hours: The hour number for the timestamp |
158 | + :param minutes: The minute number for the timestamp |
159 | + :param seconds: The minute number for the timestamp |
160 | + :param microseconds: The minute number for the timestamp |
161 | :returns: A return status code, :py:const:`DRIZZLE_RETURN_OK` upon success |
162 | |
163 | .. c:function:: drizzle_return_t drizzle_stmt_execute(drizzle_stmt_st *stmt) |
164 | @@ -71,6 +162,61 @@ |
165 | :param stmt: The prepared statement object |
166 | :returns: A return status code, :py:const:`DRIZZLE_RETURN_OK` upon success |
167 | |
168 | +.. c:function:: bool drizzle_stmt_get_is_null(drizzle_stmt_st *stmt, uint16_t column_number, drizzle_return_t *ret_ptr) |
169 | + |
170 | + Check if a column for a fetched row is set to NULL |
171 | + |
172 | + :param stmt: The prepared statement object |
173 | + :param column_number: The column number to get (starting at 0) |
174 | + :param ret_ptr: A pointer to a :c:type:`drizzle_return_t` to store the return status into |
175 | + :returns: True if NULL |
176 | + |
177 | +.. c:function:: bool drizzle_stmt_get_is_unsigned(drizzle_stmt_st *stmt, uint16_t column_number, drizzle_return_t *ret_ptr) |
178 | + |
179 | + Check if a column for a fetched row is unsigned |
180 | + |
181 | + :param stmt: The prepared statement object |
182 | + :param column_number: The column number to get (starting at 0) |
183 | + :param ret_ptr: A pointer to a :c:type:`drizzle_return_t` to store the return status into |
184 | + :returns: True if unsigned |
185 | + |
186 | +.. c:function:: const char *drizzle_stmt_get_string(drizzle_stmt_st *stmt, uint16_t column_number, size_t *len, drizzle_return_t *ret_ptr) |
187 | + |
188 | + Get the string value for a column of a fetched row (int types are automatically converted) |
189 | + |
190 | + :param stmt: The prepared statement object |
191 | + :param column_number: The column number to get (starting at 0) |
192 | + :param len: A pointer to a :c:type:`size_t` to store the result length into |
193 | + :param ret_ptr: A pointer to a :c:type:`drizzle_return_t` to store the return status into |
194 | + :returns: A pointer to the string value |
195 | + |
196 | +.. c:function:: uint32_t drizzle_stmt_get_int(drizzle_stmt_st *stmt, uint16_t column_number, drizzle_return_t *ret_ptr) |
197 | + |
198 | + Get the int value for a column of a fetched row |
199 | + |
200 | + :param stmt: The prepared statement object |
201 | + :param column_number: The column number to get (starting at 0) |
202 | + :param ret_ptr: A pointer to a :c:type:`drizzle_return_t` to store the return status into :py:const:`DRIZZLE_RETURN_TRUNCATED` if a truncation has occurred |
203 | + :returns: The int value |
204 | + |
205 | +.. c:function:: uint64_t drizzle_stmt_get_bigint(drizzle_stmt_st *stmt, uint16_t column_number, drizzle_return_t *ret_ptr) |
206 | + |
207 | + Get the bigint value for a column of a fetched row |
208 | + |
209 | + :param stmt: The prepared statement object |
210 | + :param column_number: The column number to get (starting at 0) |
211 | + :param ret_ptr: A pointer to a :c:type:`drizzle_return_t` to store the return status into :py:const:`DRIZZLE_RETURN_TRUNCATED` if a truncation has occurred |
212 | + :returns: The bigint value |
213 | + |
214 | +.. c:function:: double drizzle_stmt_get_double(drizzle_stmt_st *stmt, uint16_t column_number, drizzle_return_t *ret_ptr) |
215 | + |
216 | + Get the double value for a column of a fetched row |
217 | + |
218 | + :param stmt: The prepared statement object |
219 | + :param column_number: The column number to get (starting at 0) |
220 | + :param ret_ptr: A pointer to a :c:type:`drizzle_return_t` to store the return status into :py:const:`DRIZZLE_RETURN_TRUNCATED` if a truncation has occurred |
221 | + :returns: The double value |
222 | + |
223 | .. c:function:: drizzle_return_t drizzle_stmt_close(drizzle_stmt_st *stmt) |
224 | |
225 | Close and free a prepared statement |
226 | @@ -78,38 +224,6 @@ |
227 | :param stmt: The prepared statement object |
228 | :returns: A return status code, :py:const:`DRIZZLE_RETURN_OK` upon success |
229 | |
230 | -.. c:function:: drizzle_column_type_t drizzle_stmt_item_type(drizzle_stmt_st *stmt, uint16_t column_number) |
231 | - |
232 | - Gets the column type of an element from a row retrieved with :c:func:`drizzle_stmt_fetch` |
233 | - |
234 | - :param stmt: The prepared statement object |
235 | - :param column_number: The column number for the element |
236 | - :returns: The column type |
237 | - |
238 | -.. c:function:: void* drizzle_stmt_item_data(drizzle_stmt_st *stmt, uint16_t column_number) |
239 | - |
240 | - Gets the data of an element from a row retrieved with :c:func:`drizzle_stmt_fetch` |
241 | - |
242 | - :param stmt: The prepared statement object |
243 | - :param column_number: The column number for the element |
244 | - :returns: The data for the element |
245 | - |
246 | -.. c:function:: uint32_t drizzle_stmt_item_length(drizzle_stmt_st *stmt, uint16_t column_number) |
247 | - |
248 | - Gets the length of the data for an element from a row retrieved with :c:func:`drizzle_stmt_fetch` |
249 | - |
250 | - :param stmt: The prepared statement object |
251 | - :param column_number: The column number for the element |
252 | - :returns: The length of data for the element |
253 | - |
254 | -.. c:function:: drizzle_bind_options_t drizzle_stmt_item_options(drizzle_stmt_st *stmt, uint16_t column_number) |
255 | - |
256 | - Gets the options set for an element from a row retrieved with :c:func:`drizzle_stmt_fetch` |
257 | - |
258 | - :param stmt: The prepared statement object |
259 | - :param column_number: The column number for the element |
260 | - :returns: The options for the element |
261 | - |
262 | .. c:function:: uint16_t drizzle_stmt_column_count(drizzle_stmt_st *stmt) |
263 | |
264 | Gets the column count for a result set which has been executed using :c:func:`drizzle_stmt_execute` |
265 | |
266 | === modified file 'docs/examples/statement.rst' |
267 | --- docs/examples/statement.rst 2012-12-23 14:44:44 +0000 |
268 | +++ docs/examples/statement.rst 2013-01-04 21:00:30 +0000 |
269 | @@ -12,8 +12,8 @@ |
270 | :c:func:`drizzle_stmt_prepare` and we can get the number of parameters the |
271 | server is expecting with :c:func:`drizzle_stmt_param_count`. In this example |
272 | we know that there is only one parameter required so we send one INT type |
273 | -parameter using :c:func:`drizzle_stmt_bind_param` stating that this is |
274 | -parameter 0 and it is 4 bytes long (standard for an INT type). |
275 | +parameter using :c:func:`drizzle_stmt_set_int` stating that this is |
276 | +parameter 0 and a signed value. |
277 | |
278 | Once the parameters have been provided the statement is executed using |
279 | :c:func:`drizzle_stmt_execute` and the results buffered using |
280 | @@ -22,11 +22,9 @@ |
281 | |
282 | Finally we get the result data. A call to :c:func:`drizzle_stmt_fetch` gets |
283 | the next row from either the network or the buffer (the buffer in this case). |
284 | -The data can be retreived using :c:func:`drizzle_stmt_item_data`, a call for |
285 | -each column in the row (in example the table only has one column). |
286 | - |
287 | -It is also possible to get the data type and length of data using the other |
288 | -``drizzle_stmt_item_`` functions. |
289 | +The int data is retreived using :c:func:`drizzle_stmt_get_int`, a call for |
290 | +each column in the row (in example the table only has one column) is made using |
291 | +the ``drizzle_stmt_get_`` functions. |
292 | |
293 | When we are done the statement is closed and cleaned up using |
294 | :c:func:`drizzle_stmt_close`. It can also be reused with |
295 | @@ -45,7 +43,7 @@ |
296 | printf("Params: %" PRIu16 "\n", drizzle_stmt_param_count(stmt)); |
297 | |
298 | uint32_t val= 1; |
299 | - ret = drizzle_stmt_bind_param(stmt, 0, DRIZZLE_COLUMN_TYPE_LONG, &val, 4, DRIZZLE_BIND_OPTION_NONE); |
300 | + ret = drizzle_stmt_set_int(stmt, 0, val, false); |
301 | |
302 | ret = drizzle_stmt_execute(stmt); |
303 | |
304 | @@ -54,8 +52,8 @@ |
305 | printf("Rows found: %" PRIu64 "\n", drizzle_stmt_row_count(stmt)); |
306 | while (drizzle_stmt_fetch(stmt) != DRIZZLE_RETURN_ROW_END) |
307 | { |
308 | - uint32_t *res_val; |
309 | - res_val= (uint32_t*)drizzle_stmt_item_data(stmt, 0); |
310 | + uint32_t res_val; |
311 | + res_val= drizzle_stmt_get_int(stmt, 0, &ret); |
312 | printf("Got value: %" PRIu32 "\n", *res_val); |
313 | } |
314 | ret = drizzle_stmt_close(stmt); |
315 | |
316 | === modified file 'rpm/spec.in' |
317 | --- rpm/spec.in 2012-12-31 00:19:49 +0000 |
318 | +++ rpm/spec.in 2013-01-04 21:00:30 +0000 |
319 | @@ -53,8 +53,7 @@ |
320 | %{_libdir}/libdrizzle.a |
321 | %{_libdir}/libdrizzle.la |
322 | %{_libdir}/libdrizzle.so |
323 | -%{_libdir}/libdrizzle.so.5 |
324 | -%{_libdir}/libdrizzle.so.5.0.1 |
325 | +%{_libdir}/libdrizzle.so.* |
326 | %{_bindir}/drizzle_binlogs |
327 | %{_bindir}/libdrizzle-config |
328 |