Merge lp:~linuxjedi/libdrizzle/5.1-api-fixes into lp:libdrizzle
- 5.1-api-fixes
- Merge into libdrizzle-redux
Proposed by
Andrew Hutchings
Status: | Merged | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Approved by: | Andrew Hutchings | ||||||||||||||||||||
Approved revision: | 84 | ||||||||||||||||||||
Merged at revision: | 80 | ||||||||||||||||||||
Proposed branch: | lp:~linuxjedi/libdrizzle/5.1-api-fixes | ||||||||||||||||||||
Merge into: | lp:libdrizzle | ||||||||||||||||||||
Diff against target: |
1469 lines (+359/-161) 40 files modified
cli/drizzle_binlogs.c (+3/-3) docs/api/binlog.rst (+2/-2) docs/api/connection.rst (+2/-3) docs/api/constants.rst (+47/-2) docs/api/query.rst (+2/-2) docs/api/statement.rst (+56/-1) docs/api/structs.rst (+1/-35) docs/examples/binlog.rst (+1/-1) libdrizzle-5.1/binlog.h (+2/-2) libdrizzle-5.1/column.h (+1/-1) libdrizzle-5.1/conn.h (+1/-1) libdrizzle-5.1/conn_client.h (+2/-3) libdrizzle-5.1/query.h (+1/-1) libdrizzle-5.1/return.h (+1/-0) libdrizzle-5.1/statement.h (+19/-1) libdrizzle-5.1/verbose.h (+1/-2) libdrizzle/binlog.cc (+5/-5) libdrizzle/column.cc (+2/-2) libdrizzle/column.h (+1/-1) libdrizzle/command.cc (+3/-3) libdrizzle/conn.cc (+11/-8) libdrizzle/drizzle.cc (+1/-2) libdrizzle/drizzle_local.h (+4/-4) libdrizzle/error.cc (+1/-0) libdrizzle/handshake.cc (+7/-7) libdrizzle/pack.cc (+13/-13) libdrizzle/pack.h (+13/-13) libdrizzle/query.cc (+7/-7) libdrizzle/statement.cc (+12/-12) libdrizzle/statement_local.h (+3/-0) libdrizzle/statement_param.cc (+105/-0) libdrizzle/structs.h (+9/-9) tests/unit/column.c (+2/-2) tests/unit/hex.c (+1/-1) tests/unit/insert_id.c (+2/-2) tests/unit/query.c (+2/-2) tests/unit/row.c (+2/-2) tests/unit/statement.c (+8/-2) tests/unit/statement_char.c (+1/-2) tests/unit/unbuffered_query.c (+2/-2) |
||||||||||||||||||||
To merge this branch: | bzr merge lp:~linuxjedi/libdrizzle/5.1-api-fixes | ||||||||||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Drizzle Trunk | Pending | ||
Review via email: mp+142007@code.launchpad.net |
Commit message
Description of the change
Fixups in many areas of the API
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'cli/drizzle_binlogs.c' |
2 | --- cli/drizzle_binlogs.c 2012-12-28 23:07:33 +0000 |
3 | +++ cli/drizzle_binlogs.c 2013-01-05 11:52:22 +0000 |
4 | @@ -138,7 +138,7 @@ |
5 | drizzle_st *_connect(void); |
6 | FILE *create_binlog_file(char *binlog_file); |
7 | void get_binlogs(drizzle_st *con); |
8 | -void write_binlog(FILE* file, const uint8_t* data, uint32_t len); |
9 | +void write_binlog(FILE* file, const unsigned char* data, uint32_t len); |
10 | |
11 | bool get_system_user(char *dest, uint8_t len) |
12 | { |
13 | @@ -236,7 +236,7 @@ |
14 | |
15 | while(1) |
16 | { |
17 | - write_binlog(outfile, (uint8_t *)DRIZZLE_BINLOG_MAGIC, 4); |
18 | + write_binlog(outfile, (unsigned char *)DRIZZLE_BINLOG_MAGIC, 4); |
19 | while(1) |
20 | { |
21 | ret= drizzle_binlog_get_next_event(result); |
22 | @@ -274,7 +274,7 @@ |
23 | drizzle_result_free(result); |
24 | } |
25 | |
26 | -void write_binlog(FILE* file, const uint8_t* data, uint32_t len) |
27 | +void write_binlog(FILE* file, const unsigned char* data, uint32_t len) |
28 | { |
29 | if (len) |
30 | { |
31 | |
32 | === modified file 'docs/api/binlog.rst' |
33 | --- docs/api/binlog.rst 2012-12-22 08:54:15 +0000 |
34 | +++ docs/api/binlog.rst 2013-01-05 11:52:22 +0000 |
35 | @@ -83,14 +83,14 @@ |
36 | :param result: The result set for the binlog stream |
37 | :returns: The extra event flags |
38 | |
39 | -.. c:function:: const uint8_t* drizzle_binlog_event_data(drizzle_result_st *result) |
40 | +.. c:function:: const unsigned char* drizzle_binlog_event_data(drizzle_result_st *result) |
41 | |
42 | Get the event data for the event received using :c:func:`drizzle_binlog_get_next_event` |
43 | |
44 | :param result: The result set for the binlog stream |
45 | :returns: A pointer to the event data |
46 | |
47 | -.. c:function:: const uint8_t *drizzle_binlog_event_raw_data(drizzle_result_st *result) |
48 | +.. c:function:: const unsigned char* drizzle_binlog_event_raw_data(drizzle_result_st *result) |
49 | |
50 | Get the raw event data (including header) for the event received using :c:func:`drizzle_binlog_get_next_event` |
51 | |
52 | |
53 | === modified file 'docs/api/connection.rst' |
54 | --- docs/api/connection.rst 2013-01-04 20:47:22 +0000 |
55 | +++ docs/api/connection.rst 2013-01-05 11:52:22 +0000 |
56 | @@ -229,14 +229,13 @@ |
57 | :param con: A connection object |
58 | :returns: A :c:type:`drizzle_return_t` response for the quit command sent to the server |
59 | |
60 | -.. c:function:: drizzle_result_st* drizzle_select_db(drizzle_st *con, const char *db, drizzle_return_t *ret_ptr) |
61 | +.. c:function:: drizzle_return_t drizzle_select_db(drizzle_st *con, const char *db) |
62 | |
63 | Change the current default database |
64 | |
65 | :param con: A connection object |
66 | :param db: The new default database |
67 | - :param ret_ptr: A pointer to a :c:type:`drizzle_return_t` to store the return status into |
68 | - :returns: A newly allocated result object |
69 | + :returns: A :c:type:`drizzle_return_t` response |
70 | |
71 | .. c:function:: drizzle_result_st* drizzle_shutdown(drizzle_st *con, drizzle_return_t *ret_ptr) |
72 | |
73 | |
74 | === modified file 'docs/api/constants.rst' |
75 | --- docs/api/constants.rst 2012-12-23 14:57:06 +0000 |
76 | +++ docs/api/constants.rst 2013-01-05 11:52:22 +0000 |
77 | @@ -156,6 +156,26 @@ |
78 | |
79 | No more data to retrieve |
80 | |
81 | + .. py:data:: DRIZZLE_RETURN_STMT_ERROR |
82 | + |
83 | + A prepared statment error has occurred |
84 | + |
85 | + .. py:data:: DRIZZLE_RETURN_BINLOG_CRC |
86 | + |
87 | + A checksum error has occurred in a MySQL 5.6 binlog |
88 | + |
89 | + .. py:data:: DRIZZLE_RETURN_TRUNCATED |
90 | + |
91 | + The result has been truncated |
92 | + |
93 | + .. py:data:: DRIZZLE_RETURN_INVALID_CONVERSION |
94 | + |
95 | + The data type cannot be converted into the requested type |
96 | + |
97 | + .. py:data:: DRIZZLE_RETURN_NOT_FOUND |
98 | + |
99 | + The requested column was not found |
100 | + |
101 | Connection |
102 | ---------- |
103 | |
104 | @@ -1050,14 +1070,18 @@ |
105 | |
106 | RBR Delete rows event for MySQL 5.1 pre-release |
107 | |
108 | - .. py:data:: DRIZZLE_EVENT_TYPE_WRITE_ROWS |
109 | + .. py:data:: DRIZZLE_EVENT_TYPE_V1_WRITE_ROWS |
110 | |
111 | RBR Write rows event |
112 | |
113 | - .. py:data:: DRIZZLE_EVENT_TYPE_UPDATE_ROWS |
114 | + .. py:data:: DRIZZLE_EVENT_TYPE_V1_UPDATE_ROWS |
115 | |
116 | RBR Update rows event |
117 | |
118 | + .. py:data:: DRIZZLE_EVENT_TYPE_V1_DELETE_ROWS |
119 | + |
120 | + RBR Delete rows event |
121 | + |
122 | .. py:data:: DRIZZLE_EVENT_TYPE_INCIDENT |
123 | |
124 | Replication incident message |
125 | @@ -1066,4 +1090,25 @@ |
126 | |
127 | Repliaction heartbeat event |
128 | |
129 | + .. py:data:: DRIZZLE_EVENT_TYPE_IGNORABLE |
130 | + |
131 | + .. py:data:: DRIZZLE_EVENT_TYPE_ROWS_QUERY |
132 | + |
133 | + .. py:data:: DRIZZLE_EVENT_TYPE_V2_WRITE_ROWS |
134 | + |
135 | + A MySQL 5.6 RBR Write rows event |
136 | + |
137 | + .. py:data:: DRIZZLE_EVENT_TYPE_V2_UPDATE_ROWS |
138 | + |
139 | + A MySQL 5.6 RBR Update rows event |
140 | + |
141 | + .. py:data:: DRIZZLE_EVENT_TYPE_V2_DELETE_ROWS |
142 | + |
143 | + A MySQL 5.6 RBR Delete rows event |
144 | + |
145 | + .. py:data:: DRIZZLE_EVENT_TYPE_GTID |
146 | + |
147 | + .. py:data:: DRIZZLE_EVENT_TYPE_ANONYMOUS_GTID |
148 | + |
149 | + .. py:data:: DRIZZLE_EVENT_TYPE_PREVIOUS_GTIDS |
150 | |
151 | |
152 | === modified file 'docs/api/query.rst' |
153 | --- docs/api/query.rst 2012-12-22 08:54:15 +0000 |
154 | +++ docs/api/query.rst 2013-01-05 11:52:22 +0000 |
155 | @@ -51,7 +51,7 @@ |
156 | :param from_size: the length of the source string |
157 | :returns: the length of the 'to' string or -1 upon error due to empty parameters or overflow |
158 | |
159 | -.. c:function:: bool drizzle_hex_string(char *to, const uint8_t *from, const size_t from_size) |
160 | +.. c:function:: bool drizzle_hex_string(char *to, const unsigned char *from, const size_t from_size) |
161 | |
162 | Convert data into a hexadecimal string of the data. |
163 | |
164 | @@ -269,7 +269,7 @@ |
165 | :param column: A column object |
166 | :returns: The number of decimal places |
167 | |
168 | -.. c:function:: const uint8_t* drizzle_column_default_value(drizzle_column_st *column, size_t *size) |
169 | +.. c:function:: const unsigned char* drizzle_column_default_value(drizzle_column_st *column, size_t *size) |
170 | |
171 | Gets the default value for a given column |
172 | |
173 | |
174 | === modified file 'docs/api/statement.rst' |
175 | --- docs/api/statement.rst 2013-01-04 20:47:22 +0000 |
176 | +++ docs/api/statement.rst 2013-01-05 11:52:22 +0000 |
177 | @@ -130,7 +130,7 @@ |
178 | :param stmt: The prepared statement object |
179 | :returns: A return status code, :py:const:`DRIZZLE_RETURN_OK` upon success |
180 | |
181 | -.. c:function:: drizzle_return_t drizzle_stmt_send_long_data(drizzle_stmt_st *stmt, uint16_t param_num, uint8_t *data, size_t len) |
182 | +.. c:function:: drizzle_return_t drizzle_stmt_send_long_data(drizzle_stmt_st *stmt, uint16_t param_num, unsigned char *data, size_t len) |
183 | |
184 | Send long binary data packet |
185 | |
186 | @@ -171,6 +171,15 @@ |
187 | :param ret_ptr: A pointer to a :c:type:`drizzle_return_t` to store the return status into |
188 | :returns: True if NULL |
189 | |
190 | +.. c:function:: bool drizzle_stmt_get_is_null_from_name(drizzle_stmt_st *stmt, const char *column_name, drizzle_return_t *ret_ptr) |
191 | + |
192 | + Check if a column for a fetched row is set to NULL using a column name |
193 | + |
194 | + :param stmt: The prepared statement object |
195 | + :param column_name: The column name to get |
196 | + :param ret_ptr: A pointer to a :c:type:`drizzle_return_t` to store the return status into, :py:const:`DRIZZLE_RETURN_NOT_FOUND` if the column name cannot be found |
197 | + :returns: True if NULL |
198 | + |
199 | .. c:function:: bool drizzle_stmt_get_is_unsigned(drizzle_stmt_st *stmt, uint16_t column_number, drizzle_return_t *ret_ptr) |
200 | |
201 | Check if a column for a fetched row is unsigned |
202 | @@ -180,6 +189,15 @@ |
203 | :param ret_ptr: A pointer to a :c:type:`drizzle_return_t` to store the return status into |
204 | :returns: True if unsigned |
205 | |
206 | +.. c:function:: bool drizzle_stmt_get_is_unsigned_from_name(drizzle_stmt_st *stmt, const char *column_name, drizzle_return_t *ret_ptr) |
207 | + |
208 | + Check if a column for a fetched row is unsigned using a column name |
209 | + |
210 | + :param stmt: The prepared statement object |
211 | + :param column_name: The column name to get |
212 | + :param ret_ptr: A pointer to a :c:type:`drizzle_return_t` to store the return status into, :py:const:`DRIZZLE_RETURN_NOT_FOUND` if the column name cannot be found |
213 | + :returns: True if unsigned |
214 | + |
215 | .. c:function:: const char *drizzle_stmt_get_string(drizzle_stmt_st *stmt, uint16_t column_number, size_t *len, drizzle_return_t *ret_ptr) |
216 | |
217 | Get the string value for a column of a fetched row (int types are automatically converted) |
218 | @@ -190,6 +208,16 @@ |
219 | :param ret_ptr: A pointer to a :c:type:`drizzle_return_t` to store the return status into |
220 | :returns: A pointer to the string value |
221 | |
222 | +.. c:function:: const char *drizzle_stmt_get_string_from_name(drizzle_stmt_st *stmt, const char *column_name, size_t *len, drizzle_return_t *ret_ptr) |
223 | + |
224 | + Get the string value for a column of a fetched row (int types are automatically converted) using a column name |
225 | + |
226 | + :param stmt: The prepared statement object |
227 | + :param column_name: The column name to get |
228 | + :param len: A pointer to a :c:type:`size_t` to store the result length into |
229 | + :param ret_ptr: A pointer to a :c:type:`drizzle_return_t` to store the return status into, :py:const:`DRIZZLE_RETURN_NOT_FOUND` if the column name cannot be found |
230 | + :returns: A pointer to the string value |
231 | + |
232 | .. c:function:: uint32_t drizzle_stmt_get_int(drizzle_stmt_st *stmt, uint16_t column_number, drizzle_return_t *ret_ptr) |
233 | |
234 | Get the int value for a column of a fetched row |
235 | @@ -199,6 +227,15 @@ |
236 | :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 |
237 | :returns: The int value |
238 | |
239 | +.. c:function:: uint32_t drizzle_stmt_get_int_from_name(drizzle_stmt_st *stmt, const char *column_name, drizzle_return_t *ret_ptr) |
240 | + |
241 | + Get the int value for a column of a fetched row using a column name |
242 | + |
243 | + :param stmt: The prepared statement object |
244 | + :param column_name: The column name to get |
245 | + :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, :py:const:`DRIZZLE_RETURN_NOT_FOUND` if the column name cannot be found |
246 | + :returns: The int value |
247 | + |
248 | .. c:function:: uint64_t drizzle_stmt_get_bigint(drizzle_stmt_st *stmt, uint16_t column_number, drizzle_return_t *ret_ptr) |
249 | |
250 | Get the bigint value for a column of a fetched row |
251 | @@ -208,6 +245,15 @@ |
252 | :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 |
253 | :returns: The bigint value |
254 | |
255 | +.. c:function:: uint64_t drizzle_stmt_get_bigint_from_name(drizzle_stmt_st *stmt, const char *column_name, drizzle_return_t *ret_ptr) |
256 | + |
257 | + Get the bigint value for a column of a fetched row using a column name |
258 | + |
259 | + :param stmt: The prepared statement object |
260 | + :param column_name: The column name to get |
261 | + :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, :py:const:`DRIZZLE_RETURN_NOT_FOUND` if the column name cannot be found |
262 | + :returns: The bigint value |
263 | + |
264 | .. c:function:: double drizzle_stmt_get_double(drizzle_stmt_st *stmt, uint16_t column_number, drizzle_return_t *ret_ptr) |
265 | |
266 | Get the double value for a column of a fetched row |
267 | @@ -217,6 +263,15 @@ |
268 | :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 |
269 | :returns: The double value |
270 | |
271 | +.. c:function:: double drizzle_stmt_get_double_from_name(drizzle_stmt_st *stmt, const char *column_name, drizzle_return_t *ret_ptr) |
272 | + |
273 | + Get the double value for a column of a fetched row from a column name |
274 | + |
275 | + :param stmt: The prepared statement object |
276 | + :param column_name: The column name to get |
277 | + :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, :py:const:`DRIZZLE_RETURN_NOT_FOUND` if the column name cannot be found |
278 | + :returns: The double value |
279 | + |
280 | .. c:function:: drizzle_return_t drizzle_stmt_close(drizzle_stmt_st *stmt) |
281 | |
282 | Close and free a prepared statement |
283 | |
284 | === modified file 'docs/api/structs.rst' |
285 | --- docs/api/structs.rst 2012-12-23 14:44:44 +0000 |
286 | +++ docs/api/structs.rst 2013-01-05 11:52:22 +0000 |
287 | @@ -19,41 +19,7 @@ |
288 | |
289 | .. c:type:: drizzle_datetime_st |
290 | |
291 | - The struct for passing a date/time to/from the prepared statement API |
292 | - |
293 | - .. c:member:: uint16_t year |
294 | - |
295 | - The year part of the date |
296 | - |
297 | - .. c:member:: uint8_t month |
298 | - |
299 | - The month part of the date |
300 | - |
301 | - .. c:member:: uint32_t day |
302 | - |
303 | - The day part of the date |
304 | - |
305 | - .. c:member:: uint16_t hour |
306 | - |
307 | - The hour part of the time |
308 | - |
309 | - .. c:member:: uint8_t minute |
310 | - |
311 | - The minute part of the time |
312 | - |
313 | - .. c:member:: uint8_t second |
314 | - |
315 | - The second part of the time |
316 | - |
317 | - .. c:member:: uint32_t microsecond |
318 | - |
319 | - The microsecond part of the time |
320 | - |
321 | - .. c:member:: bool negative |
322 | - |
323 | - Is the time negative |
324 | - |
325 | - |
326 | + The internal struct for passing a date/time to/from the prepared statement API |
327 | Binlog |
328 | ------ |
329 | |
330 | |
331 | === modified file 'docs/examples/binlog.rst' |
332 | --- docs/examples/binlog.rst 2012-12-24 10:20:04 +0000 |
333 | +++ docs/examples/binlog.rst 2013-01-05 11:52:22 +0000 |
334 | @@ -38,7 +38,7 @@ |
335 | while (ret == DRIZZLE_RETURN_OK) |
336 | { |
337 | uint32_t i, length; |
338 | - const uint8_t *data; |
339 | + const unsigned char *data; |
340 | ret= drizzle_binlog_get_event(result); |
341 | if (ret != DRIZZLE_RETURN_OK) |
342 | break; |
343 | |
344 | === modified file 'libdrizzle-5.1/binlog.h' |
345 | --- libdrizzle-5.1/binlog.h 2012-12-31 00:19:49 +0000 |
346 | +++ libdrizzle-5.1/binlog.h 2013-01-05 11:52:22 +0000 |
347 | @@ -73,10 +73,10 @@ |
348 | uint16_t drizzle_binlog_event_extra_flags(drizzle_result_st *result); |
349 | |
350 | DRIZZLE_API |
351 | -const uint8_t *drizzle_binlog_event_data(drizzle_result_st *result); |
352 | +const unsigned char *drizzle_binlog_event_data(drizzle_result_st *result); |
353 | |
354 | DRIZZLE_API |
355 | -const uint8_t *drizzle_binlog_event_raw_data(drizzle_result_st *result); |
356 | +const unsigned char *drizzle_binlog_event_raw_data(drizzle_result_st *result); |
357 | |
358 | DRIZZLE_API |
359 | uint32_t drizzle_binlog_event_raw_length(drizzle_result_st *result); |
360 | |
361 | === modified file 'libdrizzle-5.1/column.h' |
362 | --- libdrizzle-5.1/column.h 2012-12-30 11:18:18 +0000 |
363 | +++ libdrizzle-5.1/column.h 2013-01-05 11:52:22 +0000 |
364 | @@ -145,7 +145,7 @@ |
365 | * Get default value for a column. |
366 | */ |
367 | DRIZZLE_API |
368 | -const uint8_t *drizzle_column_default_value(drizzle_column_st *column, |
369 | +const unsigned char *drizzle_column_default_value(drizzle_column_st *column, |
370 | size_t *size); |
371 | |
372 | /** @} */ |
373 | |
374 | === modified file 'libdrizzle-5.1/conn.h' |
375 | --- libdrizzle-5.1/conn.h 2012-12-30 11:18:18 +0000 |
376 | +++ libdrizzle-5.1/conn.h 2013-01-05 11:52:22 +0000 |
377 | @@ -307,7 +307,7 @@ |
378 | * @return Scramble buffer for connection. |
379 | */ |
380 | DRIZZLE_API |
381 | -const uint8_t *drizzle_scramble(const drizzle_st *con); |
382 | +const unsigned char *drizzle_scramble(const drizzle_st *con); |
383 | |
384 | /** |
385 | * Get capabilities for a connection. |
386 | |
387 | === modified file 'libdrizzle-5.1/conn_client.h' |
388 | --- libdrizzle-5.1/conn_client.h 2012-12-29 21:44:53 +0000 |
389 | +++ libdrizzle-5.1/conn_client.h 2013-01-05 11:52:22 +0000 |
390 | @@ -83,9 +83,8 @@ |
391 | * failure this will be NULL. |
392 | */ |
393 | DRIZZLE_API |
394 | -drizzle_result_st *drizzle_select_db(drizzle_st *con, |
395 | - const char *db, |
396 | - drizzle_return_t *ret_ptr); |
397 | +drizzle_return_t drizzle_select_db(drizzle_st *con, |
398 | + const char *db); |
399 | |
400 | /** |
401 | * Send a shutdown message to the server. |
402 | |
403 | === modified file 'libdrizzle-5.1/query.h' |
404 | --- libdrizzle-5.1/query.h 2012-12-22 08:54:15 +0000 |
405 | +++ libdrizzle-5.1/query.h 2013-01-05 11:52:22 +0000 |
406 | @@ -90,7 +90,7 @@ |
407 | ssize_t drizzle_escape_string(char *to, const size_t max_to_size, const char *from, const size_t from_size); |
408 | |
409 | DRIZZLE_API |
410 | -bool drizzle_hex_string(char *to, const uint8_t *from, const size_t from_size); |
411 | +bool drizzle_hex_string(char *to, const unsigned char *from, const size_t from_size); |
412 | |
413 | DRIZZLE_API |
414 | bool drizzle_mysql_password_hash(char *to, const char *from, const size_t from_size); |
415 | |
416 | === modified file 'libdrizzle-5.1/return.h' |
417 | --- libdrizzle-5.1/return.h 2012-12-30 20:08:04 +0000 |
418 | +++ libdrizzle-5.1/return.h 2013-01-05 11:52:22 +0000 |
419 | @@ -73,6 +73,7 @@ |
420 | DRIZZLE_RETURN_BINLOG_CRC, |
421 | DRIZZLE_RETURN_TRUNCATED, |
422 | DRIZZLE_RETURN_INVALID_CONVERSION, |
423 | + DRIZZLE_RETURN_NOT_FOUND, |
424 | DRIZZLE_RETURN_MAX /* Always add new codes to the end before this one. */ |
425 | }; |
426 | |
427 | |
428 | === modified file 'libdrizzle-5.1/statement.h' |
429 | --- libdrizzle-5.1/statement.h 2012-12-31 09:54:55 +0000 |
430 | +++ libdrizzle-5.1/statement.h 2013-01-05 11:52:22 +0000 |
431 | @@ -48,7 +48,7 @@ |
432 | drizzle_return_t drizzle_stmt_execute(drizzle_stmt_st *stmt); |
433 | |
434 | DRIZZLE_API |
435 | -drizzle_return_t drizzle_stmt_send_long_data(drizzle_stmt_st *stmt, uint16_t param_num, uint8_t *data, size_t len); |
436 | +drizzle_return_t drizzle_stmt_send_long_data(drizzle_stmt_st *stmt, uint16_t param_num, unsigned char *data, size_t len); |
437 | |
438 | DRIZZLE_API |
439 | drizzle_return_t drizzle_stmt_reset(drizzle_stmt_st *stmt); |
440 | @@ -108,23 +108,41 @@ |
441 | 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); |
442 | |
443 | DRIZZLE_API |
444 | +bool drizzle_stmt_get_is_null_from_name(drizzle_stmt_st *stmt, const char *column_name, drizzle_return_t *ret_ptr); |
445 | + |
446 | +DRIZZLE_API |
447 | bool drizzle_stmt_get_is_null(drizzle_stmt_st *stmt, uint16_t column_number, drizzle_return_t *ret_ptr); |
448 | |
449 | DRIZZLE_API |
450 | +bool drizzle_stmt_get_is_unsigned_from_name(drizzle_stmt_st *stmt, const char *column_name, drizzle_return_t *ret_ptr); |
451 | + |
452 | +DRIZZLE_API |
453 | bool drizzle_stmt_get_is_unsigned(drizzle_stmt_st *stmt, uint16_t column_number, drizzle_return_t *ret_ptr); |
454 | |
455 | DRIZZLE_API |
456 | +const char *drizzle_stmt_get_string_from_name(drizzle_stmt_st *stmt, const char *column_name, size_t *len, drizzle_return_t *ret_ptr); |
457 | + |
458 | +DRIZZLE_API |
459 | const char *drizzle_stmt_get_string(drizzle_stmt_st *stmt, uint16_t column_number, size_t *len, drizzle_return_t *ret_ptr); |
460 | |
461 | DRIZZLE_API |
462 | uint32_t drizzle_stmt_get_int(drizzle_stmt_st *stmt, uint16_t column_number, drizzle_return_t *ret_ptr); |
463 | |
464 | DRIZZLE_API |
465 | +uint32_t drizzle_stmt_get_int_from_name(drizzle_stmt_st *stmt, const char *column_name, drizzle_return_t *ret_ptr); |
466 | + |
467 | +DRIZZLE_API |
468 | +uint64_t drizzle_stmt_get_bigint_from_name(drizzle_stmt_st *stmt, const char *column_name, drizzle_return_t *ret_ptr); |
469 | + |
470 | +DRIZZLE_API |
471 | uint64_t drizzle_stmt_get_bigint(drizzle_stmt_st *stmt, uint16_t column_number, drizzle_return_t *ret_ptr); |
472 | |
473 | DRIZZLE_API |
474 | double drizzle_stmt_get_double(drizzle_stmt_st *stmt, uint16_t column_number, drizzle_return_t *ret_ptr); |
475 | |
476 | +DRIZZLE_API |
477 | +double drizzle_stmt_get_double_from_name(drizzle_stmt_st *stmt, const char *column_name, drizzle_return_t *ret_ptr); |
478 | + |
479 | #ifdef __cplusplus |
480 | } |
481 | #endif |
482 | |
483 | === modified file 'libdrizzle-5.1/verbose.h' |
484 | --- libdrizzle-5.1/verbose.h 2012-12-18 11:36:28 +0000 |
485 | +++ libdrizzle-5.1/verbose.h 2013-01-05 11:52:22 +0000 |
486 | @@ -42,11 +42,10 @@ |
487 | enum drizzle_verbose_t |
488 | { |
489 | DRIZZLE_VERBOSE_NEVER, |
490 | - DRIZZLE_VERBOSE_FATAL, |
491 | + DRIZZLE_VERBOSE_CRITICAL, |
492 | DRIZZLE_VERBOSE_ERROR, |
493 | DRIZZLE_VERBOSE_INFO, |
494 | DRIZZLE_VERBOSE_DEBUG, |
495 | - DRIZZLE_VERBOSE_CRAZY, |
496 | DRIZZLE_VERBOSE_MAX |
497 | }; |
498 | |
499 | |
500 | === modified file 'libdrizzle/binlog.cc' |
501 | --- libdrizzle/binlog.cc 2012-12-29 17:31:57 +0000 |
502 | +++ libdrizzle/binlog.cc 2013-01-05 11:52:22 +0000 |
503 | @@ -45,8 +45,8 @@ |
504 | uint32_t start_position, |
505 | drizzle_return_t *ret_ptr) |
506 | { |
507 | - uint8_t data[128]; |
508 | - uint8_t *ptr; |
509 | + unsigned char data[128]; |
510 | + unsigned char *ptr; |
511 | uint8_t len= 0, fn_len= 0; |
512 | drizzle_result_st *result; |
513 | |
514 | @@ -179,7 +179,7 @@ |
515 | return result->binlog_event->extra_flags; |
516 | } |
517 | |
518 | -const uint8_t *drizzle_binlog_event_data(drizzle_result_st *result) |
519 | +const unsigned char *drizzle_binlog_event_data(drizzle_result_st *result) |
520 | { |
521 | if ((result == NULL) || (result->binlog_event == NULL)) |
522 | { |
523 | @@ -189,7 +189,7 @@ |
524 | return result->binlog_event->data; |
525 | } |
526 | |
527 | -const uint8_t *drizzle_binlog_event_raw_data(drizzle_result_st *result) |
528 | +const unsigned char *drizzle_binlog_event_raw_data(drizzle_result_st *result) |
529 | { |
530 | if ((result == NULL) || (result->binlog_event == NULL)) |
531 | { |
532 | @@ -306,7 +306,7 @@ |
533 | con->buffer_ptr+= 27; |
534 | con->buffer_size-= 27; |
535 | con->packet_size-= 27; |
536 | - binlog_event->data= (uint8_t*)realloc(binlog_event->data, binlog_event->length); |
537 | + binlog_event->data= (unsigned char*)realloc(binlog_event->data, binlog_event->length); |
538 | /* 5.6.1 or higher is automatic checksums on */ |
539 | if (binlog_event->type == DRIZZLE_EVENT_TYPE_FORMAT_DESCRIPTION) |
540 | { |
541 | |
542 | === modified file 'libdrizzle/column.cc' |
543 | --- libdrizzle/column.cc 2012-12-26 10:02:04 +0000 |
544 | +++ libdrizzle/column.cc 2013-01-05 11:52:22 +0000 |
545 | @@ -242,7 +242,7 @@ |
546 | return column->decimals; |
547 | } |
548 | |
549 | -const uint8_t *drizzle_column_default_value(drizzle_column_st *column, |
550 | +const unsigned char *drizzle_column_default_value(drizzle_column_st *column, |
551 | size_t *size) |
552 | { |
553 | if (column == NULL) |
554 | @@ -442,7 +442,7 @@ |
555 | */ |
556 | |
557 | void drizzle_column_set_default_value(drizzle_column_st *column, |
558 | - const uint8_t *default_value, |
559 | + const unsigned char *default_value, |
560 | size_t size) |
561 | { |
562 | if (column == NULL) |
563 | |
564 | === modified file 'libdrizzle/column.h' |
565 | --- libdrizzle/column.h 2012-12-30 11:18:18 +0000 |
566 | +++ libdrizzle/column.h 2013-01-05 11:52:22 +0000 |
567 | @@ -43,7 +43,7 @@ |
568 | drizzle_column_st *drizzle_column_create(drizzle_result_st *result); |
569 | |
570 | void drizzle_column_set_default_value(drizzle_column_st *column, |
571 | - const uint8_t *default_value, |
572 | + const unsigned char *default_value, |
573 | size_t size); |
574 | |
575 | |
576 | |
577 | === modified file 'libdrizzle/command.cc' |
578 | --- libdrizzle/command.cc 2012-12-22 08:54:15 +0000 |
579 | +++ libdrizzle/command.cc 2013-01-05 11:52:22 +0000 |
580 | @@ -50,8 +50,8 @@ |
581 | |
582 | drizzle_return_t drizzle_state_command_write(drizzle_st *con) |
583 | { |
584 | - uint8_t *start; |
585 | - uint8_t *ptr; |
586 | + unsigned char *start; |
587 | + unsigned char *ptr; |
588 | drizzle_return_t ret; |
589 | |
590 | if (con == NULL) |
591 | @@ -102,7 +102,7 @@ |
592 | con->packet_number= 1; |
593 | ptr= start; |
594 | ptr[3]= 0; |
595 | - ptr[4]= (uint8_t)(con->command); |
596 | + ptr[4]= (unsigned char)(con->command); |
597 | ptr+= 5; |
598 | |
599 | if (con->command == DRIZZLE_COMMAND_CHANGE_USER) |
600 | |
601 | === modified file 'libdrizzle/conn.cc' |
602 | --- libdrizzle/conn.cc 2013-01-04 10:21:06 +0000 |
603 | +++ libdrizzle/conn.cc 2013-01-05 11:52:22 +0000 |
604 | @@ -567,7 +567,7 @@ |
605 | return con->thread_id; |
606 | } |
607 | |
608 | -const uint8_t *drizzle_scramble(const drizzle_st *con) |
609 | +const unsigned char *drizzle_scramble(const drizzle_st *con) |
610 | { |
611 | if (con == NULL) |
612 | { |
613 | @@ -671,13 +671,16 @@ |
614 | return DRIZZLE_RETURN_INVALID_ARGUMENT; |
615 | } |
616 | |
617 | -drizzle_result_st *drizzle_select_db(drizzle_st *con, |
618 | - const char *db, |
619 | - drizzle_return_t *ret_ptr) |
620 | +drizzle_return_t drizzle_select_db(drizzle_st *con, |
621 | + const char *db) |
622 | { |
623 | + drizzle_result_st *result; |
624 | + drizzle_return_t ret; |
625 | drizzle_set_db(con, db); |
626 | - return drizzle_command_write(con, NULL, DRIZZLE_COMMAND_INIT_DB, |
627 | - db, strlen(db), strlen(db), ret_ptr); |
628 | + result= drizzle_command_write(con, NULL, DRIZZLE_COMMAND_INIT_DB, |
629 | + db, strlen(db), strlen(db), &ret); |
630 | + drizzle_result_free(result); |
631 | + return ret; |
632 | } |
633 | |
634 | drizzle_result_st *drizzle_shutdown(drizzle_st *con, |
635 | @@ -780,7 +783,7 @@ |
636 | } |
637 | |
638 | con->command= command; |
639 | - con->command_data= (uint8_t *)data; |
640 | + con->command_data= (unsigned char *)data; |
641 | con->command_size= size; |
642 | con->command_offset= 0; |
643 | con->command_total= total; |
644 | @@ -789,7 +792,7 @@ |
645 | } |
646 | else if (con->command_data == NULL) |
647 | { |
648 | - con->command_data= (uint8_t *)data; |
649 | + con->command_data= (unsigned char *)data; |
650 | con->command_size= size; |
651 | } |
652 | |
653 | |
654 | === modified file 'libdrizzle/drizzle.cc' |
655 | --- libdrizzle/drizzle.cc 2012-12-30 02:23:50 +0000 |
656 | +++ libdrizzle/drizzle.cc 2013-01-05 11:52:22 +0000 |
657 | @@ -55,11 +55,10 @@ |
658 | static const char *_verbose_name[DRIZZLE_VERBOSE_MAX]= |
659 | { |
660 | "NEVER", |
661 | - "FATAL", |
662 | + "CRITICAL", |
663 | "ERROR", |
664 | "INFO", |
665 | "DEBUG", |
666 | - "CRAZY" |
667 | }; |
668 | |
669 | /** @} */ |
670 | |
671 | === modified file 'libdrizzle/drizzle_local.h' |
672 | --- libdrizzle/drizzle_local.h 2012-12-30 11:18:18 +0000 |
673 | +++ libdrizzle/drizzle_local.h 2013-01-05 11:52:22 +0000 |
674 | @@ -106,10 +106,10 @@ |
675 | { |
676 | va_list args; |
677 | |
678 | - if (con->verbose >= DRIZZLE_VERBOSE_FATAL) |
679 | + if (con->verbose >= DRIZZLE_VERBOSE_CRITICAL) |
680 | { |
681 | va_start(args, format); |
682 | - drizzle_log(con, DRIZZLE_VERBOSE_FATAL, format, args); |
683 | + drizzle_log(con, DRIZZLE_VERBOSE_CRITICAL, format, args); |
684 | va_end(args); |
685 | } |
686 | } |
687 | @@ -170,10 +170,10 @@ |
688 | { |
689 | va_list args; |
690 | |
691 | - if (con->verbose >= DRIZZLE_VERBOSE_CRAZY) |
692 | + if (con->verbose >= DRIZZLE_VERBOSE_DEBUG) |
693 | { |
694 | va_start(args, format); |
695 | - drizzle_log(con, DRIZZLE_VERBOSE_CRAZY, format, args); |
696 | + drizzle_log(con, DRIZZLE_VERBOSE_DEBUG, format, args); |
697 | va_end(args); |
698 | } |
699 | } |
700 | |
701 | === modified file 'libdrizzle/error.cc' |
702 | --- libdrizzle/error.cc 2012-12-30 20:08:04 +0000 |
703 | +++ libdrizzle/error.cc 2013-01-05 11:52:22 +0000 |
704 | @@ -72,6 +72,7 @@ |
705 | case DRIZZLE_RETURN_BINLOG_CRC: return "DRIZZLE_RETURN_BINLOG_CRC"; |
706 | case DRIZZLE_RETURN_TRUNCATED: return "DRIZZLE_RETURN_TRUNCATED"; |
707 | case DRIZZLE_RETURN_INVALID_CONVERSION: return "DRIZZLE_RETURN_INVALID_CONVERSION"; |
708 | + case DRIZZLE_RETURN_NOT_FOUND: return "DRIZZLE_RETURN_NOT_FOUND"; |
709 | case DRIZZLE_RETURN_MAX: return "DRIZZLE_RETURN_MAX"; |
710 | } |
711 | |
712 | |
713 | === modified file 'libdrizzle/handshake.cc' |
714 | --- libdrizzle/handshake.cc 2012-12-22 13:07:06 +0000 |
715 | +++ libdrizzle/handshake.cc 2013-01-05 11:52:22 +0000 |
716 | @@ -81,7 +81,7 @@ |
717 | |
718 | drizzle_return_t drizzle_state_handshake_server_read(drizzle_st *con) |
719 | { |
720 | - uint8_t *ptr; |
721 | + unsigned char *ptr; |
722 | int extra_length; |
723 | unsigned char* packet_end; |
724 | |
725 | @@ -128,7 +128,7 @@ |
726 | } |
727 | |
728 | /* Look for null-terminated server version string. */ |
729 | - ptr= (uint8_t*)memchr(con->buffer_ptr, 0, con->buffer_size - 1); |
730 | + ptr= (unsigned char*)memchr(con->buffer_ptr, 0, con->buffer_size - 1); |
731 | if (ptr == NULL) |
732 | { |
733 | drizzle_set_error(con, "drizzle_state_handshake_server_read", |
734 | @@ -218,7 +218,7 @@ |
735 | |
736 | drizzle_return_t drizzle_state_handshake_server_write(drizzle_st *con) |
737 | { |
738 | - uint8_t *ptr; |
739 | + unsigned char *ptr; |
740 | |
741 | if (con == NULL) |
742 | { |
743 | @@ -371,7 +371,7 @@ |
744 | con->buffer_ptr+= 23; |
745 | |
746 | /* Look for null-terminated user string. */ |
747 | - uint8_t *ptr= (uint8_t*)memchr(con->buffer_ptr, 0, con->buffer_size - 32); |
748 | + unsigned char *ptr= (unsigned char*)memchr(con->buffer_ptr, 0, con->buffer_size - 32); |
749 | if (ptr == NULL) |
750 | { |
751 | drizzle_set_error(con, "drizzle_state_handshake_client_read", |
752 | @@ -430,7 +430,7 @@ |
753 | } |
754 | else |
755 | { |
756 | - ptr= (uint8_t*)memchr(con->buffer_ptr, 0, con->buffer_size - |
757 | + ptr= (unsigned char*)memchr(con->buffer_ptr, 0, con->buffer_size - |
758 | (34 + strlen(con->user) + scramble_size)); |
759 | if (ptr == NULL) |
760 | { |
761 | @@ -513,7 +513,7 @@ |
762 | |
763 | drizzle_return_t drizzle_state_handshake_client_write(drizzle_st *con) |
764 | { |
765 | - uint8_t *ptr; |
766 | + unsigned char *ptr; |
767 | int capabilities; |
768 | #ifdef USE_OPENSSL |
769 | int ssl_ret; |
770 | @@ -600,7 +600,7 @@ |
771 | |
772 | drizzle_return_t drizzle_state_handshake_ssl_client_write(drizzle_st *con) |
773 | { |
774 | - uint8_t *ptr; |
775 | + unsigned char *ptr; |
776 | int capabilities; |
777 | |
778 | drizzle_log_debug(con, "drizzle_state_handshake_ssl_client_write"); |
779 | |
780 | === modified file 'libdrizzle/pack.cc' |
781 | --- libdrizzle/pack.cc 2012-12-23 01:05:57 +0000 |
782 | +++ libdrizzle/pack.cc 2013-01-05 11:52:22 +0000 |
783 | @@ -57,7 +57,7 @@ |
784 | * Compute hash from password and scramble. |
785 | */ |
786 | static drizzle_return_t _pack_scramble_hash(drizzle_st *con, |
787 | - uint8_t *buffer); |
788 | + unsigned char *buffer); |
789 | |
790 | /** @} */ |
791 | |
792 | @@ -65,7 +65,7 @@ |
793 | * Public definitions |
794 | */ |
795 | |
796 | -uint8_t *drizzle_pack_length(uint64_t number, uint8_t *ptr) |
797 | +unsigned char *drizzle_pack_length(uint64_t number, unsigned char *ptr) |
798 | { |
799 | if (number < 251) |
800 | { |
801 | @@ -157,7 +157,7 @@ |
802 | return length; |
803 | } |
804 | |
805 | -uint8_t *drizzle_pack_string(char *string, uint8_t *ptr) |
806 | +unsigned char *drizzle_pack_string(char *string, unsigned char *ptr) |
807 | { |
808 | if (string == NULL) |
809 | { |
810 | @@ -176,7 +176,7 @@ |
811 | return ptr; |
812 | } |
813 | |
814 | -uint8_t *drizzle_pack_binary(uint8_t *data, size_t len, uint8_t *ptr) |
815 | +unsigned char *drizzle_pack_binary(unsigned char *data, size_t len, unsigned char *ptr) |
816 | { |
817 | ptr= drizzle_pack_length(len, ptr); |
818 | if (len > 0) |
819 | @@ -188,7 +188,7 @@ |
820 | return ptr; |
821 | } |
822 | |
823 | -uint8_t *drizzle_pack_time(drizzle_datetime_st *time, uint8_t *ptr) |
824 | +unsigned char *drizzle_pack_time(drizzle_datetime_st *time, unsigned char *ptr) |
825 | { |
826 | uint8_t length= 0; |
827 | |
828 | @@ -213,7 +213,7 @@ |
829 | return ptr+length; |
830 | } |
831 | |
832 | -uint8_t *drizzle_pack_datetime(drizzle_datetime_st *datetime, uint8_t *ptr) |
833 | +unsigned char *drizzle_pack_datetime(drizzle_datetime_st *datetime, unsigned char *ptr) |
834 | { |
835 | uint8_t length= 0; |
836 | |
837 | @@ -245,7 +245,7 @@ |
838 | return ptr + length; |
839 | } |
840 | |
841 | -void drizzle_unpack_time(drizzle_field_t field, size_t length, uint8_t *data) |
842 | +void drizzle_unpack_time(drizzle_field_t field, size_t length, unsigned char *data) |
843 | { |
844 | drizzle_datetime_st *datetime= (drizzle_datetime_st*) data; |
845 | memset(datetime, 0, length); |
846 | @@ -266,7 +266,7 @@ |
847 | } |
848 | } |
849 | |
850 | -void drizzle_unpack_datetime(drizzle_field_t field, size_t length, uint8_t *data) |
851 | +void drizzle_unpack_datetime(drizzle_field_t field, size_t length, unsigned char *data) |
852 | { |
853 | drizzle_datetime_st *datetime= (drizzle_datetime_st*) data; |
854 | memset(datetime, 0, length); |
855 | @@ -332,7 +332,7 @@ |
856 | return DRIZZLE_RETURN_OK; |
857 | } |
858 | |
859 | -uint8_t *drizzle_pack_auth(drizzle_st *con, uint8_t *ptr, |
860 | +unsigned char *drizzle_pack_auth(drizzle_st *con, unsigned char *ptr, |
861 | drizzle_return_t *ret_ptr) |
862 | { |
863 | drizzle_return_t unused_ret; |
864 | @@ -408,11 +408,11 @@ |
865 | */ |
866 | |
867 | static drizzle_return_t _pack_scramble_hash(drizzle_st *con, |
868 | - uint8_t *buffer) |
869 | + unsigned char *buffer) |
870 | { |
871 | SHA1_CTX ctx; |
872 | - uint8_t hash_tmp1[SHA1_DIGEST_LENGTH]; |
873 | - uint8_t hash_tmp2[SHA1_DIGEST_LENGTH]; |
874 | + unsigned char hash_tmp1[SHA1_DIGEST_LENGTH]; |
875 | + unsigned char hash_tmp2[SHA1_DIGEST_LENGTH]; |
876 | |
877 | if (SHA1_DIGEST_LENGTH != DRIZZLE_MAX_SCRAMBLE_SIZE) |
878 | { |
879 | @@ -431,7 +431,7 @@ |
880 | |
881 | /* First hash the password. */ |
882 | SHA1Init(&ctx); |
883 | - SHA1Update(&ctx, (uint8_t *)(con->password), strlen(con->password)); |
884 | + SHA1Update(&ctx, (unsigned char *)(con->password), strlen(con->password)); |
885 | SHA1Final(hash_tmp1, &ctx); |
886 | |
887 | /* Second, hash the password hash. */ |
888 | |
889 | === modified file 'libdrizzle/pack.h' |
890 | --- libdrizzle/pack.h 2012-12-30 02:23:50 +0000 |
891 | +++ libdrizzle/pack.h 2013-01-05 11:52:22 +0000 |
892 | @@ -58,7 +58,7 @@ |
893 | * Pack length-encoded number. |
894 | */ |
895 | |
896 | -uint8_t *drizzle_pack_length(uint64_t number, uint8_t *ptr); |
897 | +unsigned char *drizzle_pack_length(uint64_t number, unsigned char *ptr); |
898 | |
899 | /** |
900 | * Unpack length-encoded number. |
901 | @@ -70,17 +70,17 @@ |
902 | * Pack length-encoded string. |
903 | */ |
904 | |
905 | -uint8_t *drizzle_pack_string(char *string, uint8_t *ptr); |
906 | - |
907 | -uint8_t *drizzle_pack_binary(uint8_t *data, size_t len, uint8_t *ptr); |
908 | - |
909 | -uint8_t *drizzle_pack_time(drizzle_datetime_st *time, uint8_t *ptr); |
910 | - |
911 | -uint8_t *drizzle_pack_datetime(drizzle_datetime_st *datetime, uint8_t *ptr); |
912 | - |
913 | -void drizzle_unpack_time(drizzle_field_t field, size_t length, uint8_t *data); |
914 | - |
915 | -void drizzle_unpack_datetime(drizzle_field_t field, size_t length, uint8_t *data); |
916 | +unsigned char *drizzle_pack_string(char *string, unsigned char *ptr); |
917 | + |
918 | +unsigned char *drizzle_pack_binary(unsigned char *data, size_t len, unsigned char *ptr); |
919 | + |
920 | +unsigned char *drizzle_pack_time(drizzle_datetime_st *time, unsigned char *ptr); |
921 | + |
922 | +unsigned char *drizzle_pack_datetime(drizzle_datetime_st *datetime, unsigned char *ptr); |
923 | + |
924 | +void drizzle_unpack_time(drizzle_field_t field, size_t length, unsigned char *data); |
925 | + |
926 | +void drizzle_unpack_datetime(drizzle_field_t field, size_t length, unsigned char *data); |
927 | |
928 | /** |
929 | * Unpack length-encoded string. |
930 | @@ -91,7 +91,7 @@ |
931 | /** |
932 | * Pack user, scramble, and db. |
933 | */ |
934 | -uint8_t *drizzle_pack_auth(drizzle_st *con, uint8_t *ptr, |
935 | +unsigned char *drizzle_pack_auth(drizzle_st *con, unsigned char *ptr, |
936 | drizzle_return_t *ret_ptr); |
937 | |
938 | /** @} */ |
939 | |
940 | === modified file 'libdrizzle/query.cc' |
941 | --- libdrizzle/query.cc 2012-12-22 08:54:15 +0000 |
942 | +++ libdrizzle/query.cc 2013-01-05 11:52:22 +0000 |
943 | @@ -47,7 +47,7 @@ |
944 | drizzle_return_t *ret_ptr) |
945 | { |
946 | return drizzle_command_write(con, NULL, DRIZZLE_COMMAND_QUERY, |
947 | - (uint8_t *)query, size, size, ret_ptr); |
948 | + (unsigned char *)query, size, size, ret_ptr); |
949 | } |
950 | |
951 | drizzle_result_st *drizzle_query_str(drizzle_st *con, |
952 | @@ -62,7 +62,7 @@ |
953 | size_t size= strlen(query); |
954 | |
955 | return drizzle_command_write(con, NULL, DRIZZLE_COMMAND_QUERY, |
956 | - (uint8_t *)query, size, size, ret_ptr); |
957 | + (unsigned char *)query, size, size, ret_ptr); |
958 | } |
959 | |
960 | |
961 | @@ -135,7 +135,7 @@ |
962 | return to_size; |
963 | } |
964 | |
965 | -bool drizzle_hex_string(char *to, const uint8_t *from, const size_t from_size) |
966 | +bool drizzle_hex_string(char *to, const unsigned char *from, const size_t from_size) |
967 | { |
968 | if (to == NULL || from == NULL || from_size == 0) |
969 | { |
970 | @@ -143,7 +143,7 @@ |
971 | } |
972 | |
973 | static const char hex_map[]= "0123456789ABCDEF"; |
974 | - const uint8_t *from_end; |
975 | + const unsigned char *from_end; |
976 | |
977 | for (from_end= from + from_size; from != from_end; from++) |
978 | { |
979 | @@ -164,11 +164,11 @@ |
980 | } |
981 | |
982 | SHA1_CTX ctx; |
983 | - uint8_t hash_tmp1[SHA1_DIGEST_LENGTH]; |
984 | - uint8_t hash_tmp2[SHA1_DIGEST_LENGTH]; |
985 | + unsigned char hash_tmp1[SHA1_DIGEST_LENGTH]; |
986 | + unsigned char hash_tmp2[SHA1_DIGEST_LENGTH]; |
987 | |
988 | SHA1Init(&ctx); |
989 | - SHA1Update(&ctx, (const uint8_t*)from, from_size); |
990 | + SHA1Update(&ctx, (const unsigned char*)from, from_size); |
991 | SHA1Final(hash_tmp1, &ctx); |
992 | |
993 | SHA1Init(&ctx); |
994 | |
995 | === modified file 'libdrizzle/statement.cc' |
996 | --- libdrizzle/statement.cc 2012-12-31 10:02:02 +0000 |
997 | +++ libdrizzle/statement.cc 2013-01-05 11:52:22 +0000 |
998 | @@ -116,9 +116,9 @@ |
999 | drizzle_bind_st *param_ptr; |
1000 | size_t param_lengths= 0; |
1001 | size_t buffer_size= 0; |
1002 | - uint8_t *buffer; |
1003 | - uint8_t *buffer_pos; |
1004 | - uint8_t *data_pos; |
1005 | + unsigned char *buffer; |
1006 | + unsigned char *buffer_pos; |
1007 | + unsigned char *data_pos; |
1008 | drizzle_return_t ret; |
1009 | |
1010 | /* Calculate param lengths */ |
1011 | @@ -141,7 +141,7 @@ |
1012 | + (stmt->param_count * 2) /* Parameter type data */ |
1013 | + param_lengths; /* Parameter data */ |
1014 | |
1015 | - buffer = (uint8_t*)malloc(buffer_size); |
1016 | + buffer = (unsigned char*)malloc(buffer_size); |
1017 | if (buffer == NULL) |
1018 | { |
1019 | drizzle_set_error(stmt->con, __func__, "malloc"); |
1020 | @@ -258,7 +258,7 @@ |
1021 | case DRIZZLE_COLUMN_TYPE_STRING: |
1022 | case DRIZZLE_COLUMN_TYPE_DECIMAL: |
1023 | case DRIZZLE_COLUMN_TYPE_NEWDECIMAL: |
1024 | - data_pos= drizzle_pack_binary((uint8_t*)param_ptr->data, param_ptr->length, data_pos); |
1025 | + data_pos= drizzle_pack_binary((unsigned char*)param_ptr->data, param_ptr->length, data_pos); |
1026 | break; |
1027 | /* These types aren't handled yet, most are for older MySQL versions */ |
1028 | case DRIZZLE_COLUMN_TYPE_INT24: |
1029 | @@ -316,10 +316,10 @@ |
1030 | return ret; |
1031 | } |
1032 | |
1033 | -drizzle_return_t drizzle_stmt_send_long_data(drizzle_stmt_st *stmt, uint16_t param_num, uint8_t *data, size_t len) |
1034 | +drizzle_return_t drizzle_stmt_send_long_data(drizzle_stmt_st *stmt, uint16_t param_num, unsigned char *data, size_t len) |
1035 | { |
1036 | drizzle_return_t ret; |
1037 | - uint8_t *buffer; |
1038 | + unsigned char *buffer; |
1039 | |
1040 | if ((stmt == NULL) || (param_num >= stmt->param_count)) |
1041 | { |
1042 | @@ -336,7 +336,7 @@ |
1043 | /* TODO: rework drizzle_command_write so we can send a header and we don't |
1044 | * need this copy |
1045 | * */ |
1046 | - buffer= (uint8_t*)malloc(len + 6); |
1047 | + buffer= (unsigned char*)malloc(len + 6); |
1048 | |
1049 | drizzle_set_byte4(buffer, stmt->id); |
1050 | drizzle_set_byte2(&buffer[4], param_num); |
1051 | @@ -355,7 +355,7 @@ |
1052 | drizzle_return_t drizzle_stmt_reset(drizzle_stmt_st *stmt) |
1053 | { |
1054 | drizzle_return_t ret; |
1055 | - uint8_t buffer[4]; |
1056 | + unsigned char buffer[4]; |
1057 | uint16_t current_param; |
1058 | |
1059 | if (stmt == NULL) |
1060 | @@ -474,12 +474,12 @@ |
1061 | memcpy(param->data, row[column_counter], 8); |
1062 | break; |
1063 | case DRIZZLE_COLUMN_TYPE_TIME: |
1064 | - drizzle_unpack_time(row[column_counter], param->length, (uint8_t*)param->data); |
1065 | + drizzle_unpack_time(row[column_counter], param->length, (unsigned char*)param->data); |
1066 | break; |
1067 | case DRIZZLE_COLUMN_TYPE_DATE: |
1068 | case DRIZZLE_COLUMN_TYPE_DATETIME: |
1069 | case DRIZZLE_COLUMN_TYPE_TIMESTAMP: |
1070 | - drizzle_unpack_datetime(row[column_counter], param->length, (uint8_t*)param->data); |
1071 | + drizzle_unpack_datetime(row[column_counter], param->length, (unsigned char*)param->data); |
1072 | break; |
1073 | case DRIZZLE_COLUMN_TYPE_TINY_BLOB: |
1074 | case DRIZZLE_COLUMN_TYPE_MEDIUM_BLOB: |
1075 | @@ -544,7 +544,7 @@ |
1076 | |
1077 | drizzle_return_t drizzle_stmt_close(drizzle_stmt_st *stmt) |
1078 | { |
1079 | - uint8_t buffer[4]; |
1080 | + unsigned char buffer[4]; |
1081 | drizzle_return_t ret; |
1082 | |
1083 | if (stmt == NULL) |
1084 | |
1085 | === modified file 'libdrizzle/statement_local.h' |
1086 | --- libdrizzle/statement_local.h 2012-12-30 20:08:04 +0000 |
1087 | +++ libdrizzle/statement_local.h 2013-01-05 11:52:22 +0000 |
1088 | @@ -59,6 +59,9 @@ |
1089 | DRIZZLE_LOCAL |
1090 | char *timestamp_to_string(drizzle_bind_st *param, drizzle_datetime_st *timestamp); |
1091 | |
1092 | +DRIZZLE_LOCAL |
1093 | +uint16_t drizzle_stmt_column_lookup(drizzle_result_st *result, const char *column_name, drizzle_return_t *ret_ptr); |
1094 | + |
1095 | #ifdef __cplusplus |
1096 | } |
1097 | #endif |
1098 | |
1099 | === modified file 'libdrizzle/statement_param.cc' |
1100 | --- libdrizzle/statement_param.cc 2012-12-31 09:54:55 +0000 |
1101 | +++ libdrizzle/statement_param.cc 2013-01-05 11:52:22 +0000 |
1102 | @@ -168,6 +168,21 @@ |
1103 | return drizzle_stmt_set_param(stmt, param_num, DRIZZLE_COLUMN_TYPE_TIME, timestamp, 0, false, true); |
1104 | } |
1105 | |
1106 | +bool drizzle_stmt_get_is_null_from_name(drizzle_stmt_st *stmt, const char *column_name, drizzle_return_t *ret_ptr) |
1107 | +{ |
1108 | + uint16_t column_number; |
1109 | + if ((stmt == NULL) || (stmt->result_params == NULL)) |
1110 | + { |
1111 | + *ret_ptr= DRIZZLE_RETURN_INVALID_ARGUMENT; |
1112 | + } |
1113 | + column_number= drizzle_stmt_column_lookup(stmt->prepare_result, column_name, ret_ptr); |
1114 | + if (*ret_ptr != DRIZZLE_RETURN_OK) |
1115 | + { |
1116 | + return 0; |
1117 | + } |
1118 | + return drizzle_stmt_get_is_null(stmt, column_number, ret_ptr); |
1119 | +} |
1120 | + |
1121 | bool drizzle_stmt_get_is_null(drizzle_stmt_st *stmt, uint16_t column_number, drizzle_return_t *ret_ptr) |
1122 | { |
1123 | if ((stmt == NULL) || (stmt->result_params == NULL) || (column_number >= stmt->execute_result->column_count)) |
1124 | @@ -180,6 +195,21 @@ |
1125 | return stmt->result_params[column_number].options.is_null; |
1126 | } |
1127 | |
1128 | +bool drizzle_stmt_get_is_unsigned_from_name(drizzle_stmt_st *stmt, const char *column_name, drizzle_return_t *ret_ptr) |
1129 | +{ |
1130 | + uint16_t column_number; |
1131 | + if ((stmt == NULL) || (stmt->result_params == NULL)) |
1132 | + { |
1133 | + *ret_ptr= DRIZZLE_RETURN_INVALID_ARGUMENT; |
1134 | + } |
1135 | + column_number= drizzle_stmt_column_lookup(stmt->prepare_result, column_name, ret_ptr); |
1136 | + if (*ret_ptr != DRIZZLE_RETURN_OK) |
1137 | + { |
1138 | + return 0; |
1139 | + } |
1140 | + return drizzle_stmt_get_is_unsigned(stmt, column_number, ret_ptr); |
1141 | +} |
1142 | + |
1143 | bool drizzle_stmt_get_is_unsigned(drizzle_stmt_st *stmt, uint16_t column_number, drizzle_return_t *ret_ptr) |
1144 | { |
1145 | if ((stmt == NULL) || (stmt->result_params == NULL) || (column_number >= stmt->execute_result->column_count)) |
1146 | @@ -192,6 +222,21 @@ |
1147 | return stmt->result_params[column_number].options.is_unsigned; |
1148 | } |
1149 | |
1150 | +const char *drizzle_stmt_get_string_from_name(drizzle_stmt_st *stmt, const char *column_name, size_t *len, drizzle_return_t *ret_ptr) |
1151 | +{ |
1152 | + uint16_t column_number; |
1153 | + if ((stmt == NULL) || (stmt->result_params == NULL)) |
1154 | + { |
1155 | + *ret_ptr= DRIZZLE_RETURN_INVALID_ARGUMENT; |
1156 | + } |
1157 | + column_number= drizzle_stmt_column_lookup(stmt->prepare_result, column_name, ret_ptr); |
1158 | + if (*ret_ptr != DRIZZLE_RETURN_OK) |
1159 | + { |
1160 | + return 0; |
1161 | + } |
1162 | + return drizzle_stmt_get_string(stmt, column_number, len, ret_ptr); |
1163 | +} |
1164 | + |
1165 | const char *drizzle_stmt_get_string(drizzle_stmt_st *stmt, uint16_t column_number, size_t *len, drizzle_return_t *ret_ptr) |
1166 | { |
1167 | char *val; |
1168 | @@ -276,6 +321,21 @@ |
1169 | return val; |
1170 | } |
1171 | |
1172 | +uint32_t drizzle_stmt_get_int_from_name(drizzle_stmt_st *stmt, const char *column_name, drizzle_return_t *ret_ptr) |
1173 | +{ |
1174 | + uint16_t column_number; |
1175 | + if ((stmt == NULL) || (stmt->result_params == NULL)) |
1176 | + { |
1177 | + *ret_ptr= DRIZZLE_RETURN_INVALID_ARGUMENT; |
1178 | + } |
1179 | + column_number= drizzle_stmt_column_lookup(stmt->prepare_result, column_name, ret_ptr); |
1180 | + if (*ret_ptr != DRIZZLE_RETURN_OK) |
1181 | + { |
1182 | + return 0; |
1183 | + } |
1184 | + return drizzle_stmt_get_int(stmt, column_number, ret_ptr); |
1185 | +} |
1186 | + |
1187 | uint32_t drizzle_stmt_get_int(drizzle_stmt_st *stmt, uint16_t column_number, drizzle_return_t *ret_ptr) |
1188 | { |
1189 | uint32_t val; |
1190 | @@ -350,6 +410,21 @@ |
1191 | return val; |
1192 | } |
1193 | |
1194 | +uint64_t drizzle_stmt_get_bigint_from_name(drizzle_stmt_st *stmt, const char *column_name, drizzle_return_t *ret_ptr) |
1195 | +{ |
1196 | + uint16_t column_number; |
1197 | + if ((stmt == NULL) || (stmt->result_params == NULL)) |
1198 | + { |
1199 | + *ret_ptr= DRIZZLE_RETURN_INVALID_ARGUMENT; |
1200 | + } |
1201 | + column_number= drizzle_stmt_column_lookup(stmt->prepare_result, column_name, ret_ptr); |
1202 | + if (*ret_ptr != DRIZZLE_RETURN_OK) |
1203 | + { |
1204 | + return 0; |
1205 | + } |
1206 | + return drizzle_stmt_get_bigint(stmt, column_number, ret_ptr); |
1207 | +} |
1208 | + |
1209 | uint64_t drizzle_stmt_get_bigint(drizzle_stmt_st *stmt, uint16_t column_number, drizzle_return_t *ret_ptr) |
1210 | { |
1211 | uint32_t val; |
1212 | @@ -420,6 +495,21 @@ |
1213 | return val; |
1214 | } |
1215 | |
1216 | +double drizzle_stmt_get_double_from_name(drizzle_stmt_st *stmt, const char *column_name, drizzle_return_t *ret_ptr) |
1217 | +{ |
1218 | + uint16_t column_number; |
1219 | + if ((stmt == NULL) || (stmt->result_params == NULL)) |
1220 | + { |
1221 | + *ret_ptr= DRIZZLE_RETURN_INVALID_ARGUMENT; |
1222 | + } |
1223 | + column_number= drizzle_stmt_column_lookup(stmt->prepare_result, column_name, ret_ptr); |
1224 | + if (*ret_ptr != DRIZZLE_RETURN_OK) |
1225 | + { |
1226 | + return 0; |
1227 | + } |
1228 | + return drizzle_stmt_get_double(stmt, column_number, ret_ptr); |
1229 | +} |
1230 | + |
1231 | double drizzle_stmt_get_double(drizzle_stmt_st *stmt, uint16_t column_number, drizzle_return_t *ret_ptr) |
1232 | { |
1233 | double val; |
1234 | @@ -557,3 +647,18 @@ |
1235 | } |
1236 | return param->converted_data; |
1237 | } |
1238 | + |
1239 | +uint16_t drizzle_stmt_column_lookup(drizzle_result_st *result, const char *column_name, drizzle_return_t *ret_ptr) |
1240 | +{ |
1241 | + uint16_t current_column; |
1242 | + for (current_column= 0; current_column < result->column_count; current_column++) |
1243 | + { |
1244 | + if (strncmp(column_name, result->column_buffer[current_column].name, DRIZZLE_MAX_COLUMN_NAME_SIZE) == 0) |
1245 | + { |
1246 | + *ret_ptr= DRIZZLE_RETURN_OK; |
1247 | + return current_column; |
1248 | + } |
1249 | + } |
1250 | + *ret_ptr= DRIZZLE_RETURN_NOT_FOUND; |
1251 | + return 0; |
1252 | +} |
1253 | |
1254 | === modified file 'libdrizzle/structs.h' |
1255 | --- libdrizzle/structs.h 2012-12-30 20:08:04 +0000 |
1256 | +++ libdrizzle/structs.h 2013-01-05 11:52:22 +0000 |
1257 | @@ -166,23 +166,23 @@ |
1258 | size_t command_total; |
1259 | size_t packet_size; |
1260 | struct addrinfo *addrinfo_next; |
1261 | - uint8_t *buffer_ptr; |
1262 | - uint8_t *command_buffer; |
1263 | - uint8_t *command_data; |
1264 | + unsigned char *buffer_ptr; |
1265 | + unsigned char *command_buffer; |
1266 | + unsigned char *command_data; |
1267 | void *context; |
1268 | drizzle_context_free_fn *context_free_fn; |
1269 | drizzle_result_st *result; |
1270 | drizzle_result_st *result_list; |
1271 | - uint8_t *scramble; |
1272 | + unsigned char *scramble; |
1273 | union |
1274 | { |
1275 | drizzle_tcp_st tcp; |
1276 | drizzle_uds_st uds; |
1277 | } socket; |
1278 | - uint8_t buffer[DRIZZLE_MAX_BUFFER_SIZE]; |
1279 | + unsigned char buffer[DRIZZLE_MAX_BUFFER_SIZE]; |
1280 | char db[DRIZZLE_MAX_DB_SIZE]; |
1281 | char password[DRIZZLE_MAX_PASSWORD_SIZE]; |
1282 | - uint8_t scramble_buffer[DRIZZLE_MAX_SCRAMBLE_SIZE]; |
1283 | + unsigned char scramble_buffer[DRIZZLE_MAX_SCRAMBLE_SIZE]; |
1284 | char server_version[DRIZZLE_MAX_SERVER_VERSION_SIZE]; |
1285 | char server_extra[DRIZZLE_MAX_SERVER_EXTRA_SIZE]; |
1286 | drizzle_state_fn *state_stack[DRIZZLE_STATE_STACK_SIZE]; |
1287 | @@ -305,8 +305,8 @@ |
1288 | uint16_t flags; |
1289 | uint16_t extra_flags; |
1290 | uint32_t checksum; |
1291 | - uint8_t *data; |
1292 | - uint8_t *raw_data; |
1293 | + unsigned char *data; |
1294 | + unsigned char *raw_data; |
1295 | uint32_t raw_length; |
1296 | }; |
1297 | |
1298 | @@ -331,7 +331,7 @@ |
1299 | drizzle_column_type_t type; |
1300 | int flags; |
1301 | uint8_t decimals; |
1302 | - uint8_t default_value[DRIZZLE_MAX_DEFAULT_VALUE_SIZE]; |
1303 | + unsigned char default_value[DRIZZLE_MAX_DEFAULT_VALUE_SIZE]; |
1304 | size_t default_value_size; |
1305 | }; |
1306 | |
1307 | |
1308 | === modified file 'tests/unit/column.c' |
1309 | --- tests/unit/column.c 2012-12-31 00:06:53 +0000 |
1310 | +++ tests/unit/column.c 2013-01-05 11:52:22 +0000 |
1311 | @@ -71,7 +71,7 @@ |
1312 | drizzle_query_str(con, "CREATE SCHEMA libdrizzle", &ret); |
1313 | ASSERT_EQ_(DRIZZLE_RETURN_OK, ret, "CREATE SCHEMA libdrizzle (%s)", drizzle_error(con)); |
1314 | |
1315 | - drizzle_result_st *result= drizzle_select_db(con, "libdrizzle", &ret); |
1316 | + ret= drizzle_select_db(con, "libdrizzle"); |
1317 | ASSERT_EQ_(DRIZZLE_RETURN_OK, ret, "USE libdrizzle"); |
1318 | |
1319 | drizzle_query_str(con, "create table libdrizzle.t1 (a int primary key auto_increment, b varchar(255), c timestamp default current_timestamp)", &ret); |
1320 | @@ -80,7 +80,7 @@ |
1321 | drizzle_query_str(con, "insert into libdrizzle.t1 (b) values ('this'),('is'),('war')", &ret); |
1322 | ASSERT_TRUE_(ret == DRIZZLE_RETURN_OK, "insert into libdrizzle.t1 (b) values ('this'),('is'),('war')"); |
1323 | |
1324 | - result= drizzle_query_str(con, "select * from libdrizzle.t1", &ret); |
1325 | + drizzle_result_st *result= drizzle_query_str(con, "select * from libdrizzle.t1", &ret); |
1326 | ASSERT_TRUE_(ret == DRIZZLE_RETURN_OK, "select * from libdrizzle.t1"); |
1327 | |
1328 | drizzle_result_buffer(result); |
1329 | |
1330 | === modified file 'tests/unit/hex.c' |
1331 | --- tests/unit/hex.c 2012-12-29 10:49:09 +0000 |
1332 | +++ tests/unit/hex.c 2013-01-05 11:52:22 +0000 |
1333 | @@ -45,7 +45,7 @@ |
1334 | |
1335 | int main(int argc, char* argv[]) |
1336 | { |
1337 | - const uint8_t in[6]= {0x00, 0xFF, 0x7F, 0x80, 0xB9, 0xC0}; |
1338 | + const unsigned char in[6]= {0x00, 0xFF, 0x7F, 0x80, 0xB9, 0xC0}; |
1339 | char out[255]; |
1340 | bool result; |
1341 | |
1342 | |
1343 | === modified file 'tests/unit/insert_id.c' |
1344 | --- tests/unit/insert_id.c 2012-12-31 00:06:53 +0000 |
1345 | +++ tests/unit/insert_id.c 2013-01-05 11:52:22 +0000 |
1346 | @@ -70,13 +70,13 @@ |
1347 | drizzle_query_str(con, "CREATE SCHEMA libdrizzle", &ret); |
1348 | ASSERT_EQ_(DRIZZLE_RETURN_OK, ret, "CREATE SCHEMA libdrizzle (%s)", drizzle_error(con)); |
1349 | |
1350 | - drizzle_result_st *result= drizzle_select_db(con, "libdrizzle", &ret); |
1351 | + ret= drizzle_select_db(con, "libdrizzle"); |
1352 | ASSERT_EQ_(DRIZZLE_RETURN_OK, ret, "USE libdrizzle"); |
1353 | |
1354 | drizzle_query_str(con, "create table libdrizzle.t1 (a int primary key auto_increment, b int)", &ret); |
1355 | ASSERT_EQ_(ret, DRIZZLE_RETURN_OK, "create table libdrizzle.t1 (a int primary key auto_increment, b int)"); |
1356 | |
1357 | - result= drizzle_query_str(con, "insert into libdrizzle.t1 (b) values (1),(2),(3)", &ret); |
1358 | + drizzle_result_st *result= drizzle_query_str(con, "insert into libdrizzle.t1 (b) values (1),(2),(3)", &ret); |
1359 | ASSERT_EQ_(ret, DRIZZLE_RETURN_OK, "insert into libdrizzle.t1 (b) values (1),(2),(3)"); |
1360 | ASSERT_TRUE(result); |
1361 | |
1362 | |
1363 | === modified file 'tests/unit/query.c' |
1364 | --- tests/unit/query.c 2012-12-31 00:06:53 +0000 |
1365 | +++ tests/unit/query.c 2013-01-05 11:52:22 +0000 |
1366 | @@ -71,7 +71,7 @@ |
1367 | drizzle_query_str(con, "CREATE SCHEMA libdrizzle", &ret); |
1368 | ASSERT_EQ_(DRIZZLE_RETURN_OK, ret, "CREATE SCHEMA libdrizzle (%s)", drizzle_error(con)); |
1369 | |
1370 | - drizzle_result_st *result= drizzle_select_db(con, "libdrizzle", &ret); |
1371 | + ret= drizzle_select_db(con, "libdrizzle"); |
1372 | ASSERT_EQ_(DRIZZLE_RETURN_OK, ret, "USE libdrizzle"); |
1373 | |
1374 | drizzle_query_str(con, "create table libdrizzle.t1 (a int)", &ret); |
1375 | @@ -88,7 +88,7 @@ |
1376 | return EXIT_FAILURE; |
1377 | } |
1378 | |
1379 | - result= drizzle_query_str(con, "select * from libdrizzle.t1", &ret); |
1380 | + drizzle_result_st *result= drizzle_query_str(con, "select * from libdrizzle.t1", &ret); |
1381 | if (ret != DRIZZLE_RETURN_OK) |
1382 | { |
1383 | printf("Select failure\n"); |
1384 | |
1385 | === modified file 'tests/unit/row.c' |
1386 | --- tests/unit/row.c 2012-12-31 00:06:53 +0000 |
1387 | +++ tests/unit/row.c 2013-01-05 11:52:22 +0000 |
1388 | @@ -71,7 +71,7 @@ |
1389 | drizzle_query_str(con, "CREATE SCHEMA libdrizzle", &ret); |
1390 | ASSERT_EQ_(DRIZZLE_RETURN_OK, ret, "CREATE SCHEMA libdrizzle (%s)", drizzle_error(con)); |
1391 | |
1392 | - drizzle_result_st *result= drizzle_select_db(con, "libdrizzle", &ret); |
1393 | + ret= drizzle_select_db(con, "libdrizzle"); |
1394 | ASSERT_EQ_(DRIZZLE_RETURN_OK, ret, "USE libdrizzle"); |
1395 | |
1396 | drizzle_query_str(con, "create table libdrizzle.t1 (a int)", &ret); |
1397 | @@ -88,7 +88,7 @@ |
1398 | return EXIT_FAILURE; |
1399 | } |
1400 | |
1401 | - result= drizzle_query_str(con, "select * from libdrizzle.t1", &ret); |
1402 | + drizzle_result_st *result= drizzle_query_str(con, "select * from libdrizzle.t1", &ret); |
1403 | if (ret != DRIZZLE_RETURN_OK) |
1404 | { |
1405 | printf("Select failure\n"); |
1406 | |
1407 | === modified file 'tests/unit/statement.c' |
1408 | --- tests/unit/statement.c 2012-12-31 09:54:55 +0000 |
1409 | +++ tests/unit/statement.c 2013-01-05 11:52:22 +0000 |
1410 | @@ -73,8 +73,7 @@ |
1411 | drizzle_query_str(con, "CREATE SCHEMA libdrizzle", &ret); |
1412 | ASSERT_EQ_(DRIZZLE_RETURN_OK, ret, "CREATE SCHEMA libdrizzle (%s)", drizzle_error(con)); |
1413 | |
1414 | - drizzle_result_st *result= drizzle_select_db(con, "libdrizzle", &ret); |
1415 | - ASSERT_TRUE(result); |
1416 | + ret= drizzle_select_db(con, "libdrizzle"); |
1417 | ASSERT_EQ_(DRIZZLE_RETURN_OK, ret, "USE libdrizzle"); |
1418 | |
1419 | drizzle_query_str(con, "create table libdrizzle.t1 (a int)", &ret); |
1420 | @@ -133,6 +132,13 @@ |
1421 | printf("Retrieved unexpected int value\n"); |
1422 | return EXIT_FAILURE; |
1423 | } |
1424 | + res_val= drizzle_stmt_get_int_from_name(stmt, "a", &ret); |
1425 | + ASSERT_EQ_(DRIZZLE_RETURN_OK, ret, "drizzle_stmt_get_int (char col name)"); |
1426 | + if (res_val != i) |
1427 | + { |
1428 | + printf("Rerieved unexpected int value with char col name\n"); |
1429 | + return EXIT_FAILURE; |
1430 | + } |
1431 | snprintf(comp_val, 3, "%"PRIu32, i); |
1432 | if (strcmp(comp_val, char_val) != 0) |
1433 | { |
1434 | |
1435 | === modified file 'tests/unit/statement_char.c' |
1436 | --- tests/unit/statement_char.c 2012-12-31 09:59:37 +0000 |
1437 | +++ tests/unit/statement_char.c 2013-01-05 11:52:22 +0000 |
1438 | @@ -74,8 +74,7 @@ |
1439 | drizzle_query_str(con, "CREATE SCHEMA libdrizzle", &ret); |
1440 | ASSERT_EQ_(DRIZZLE_RETURN_OK, ret, "CREATE SCHEMA libdrizzle (%s)", drizzle_error(con)); |
1441 | |
1442 | - drizzle_result_st *result= drizzle_select_db(con, "libdrizzle", &ret); |
1443 | - ASSERT_TRUE(result); |
1444 | + ret= drizzle_select_db(con, "libdrizzle"); |
1445 | ASSERT_EQ_(DRIZZLE_RETURN_OK, ret, "USE libdrizzle"); |
1446 | |
1447 | drizzle_query_str(con, "create table libdrizzle.t1 (a varchar(50))", &ret); |
1448 | |
1449 | === modified file 'tests/unit/unbuffered_query.c' |
1450 | --- tests/unit/unbuffered_query.c 2012-12-31 00:06:53 +0000 |
1451 | +++ tests/unit/unbuffered_query.c 2013-01-05 11:52:22 +0000 |
1452 | @@ -71,7 +71,7 @@ |
1453 | drizzle_query_str(con, "CREATE SCHEMA libdrizzle", &ret); |
1454 | ASSERT_EQ_(DRIZZLE_RETURN_OK, ret, "CREATE SCHEMA libdrizzle (%s)", drizzle_error(con)); |
1455 | |
1456 | - drizzle_result_st *result= drizzle_select_db(con, "libdrizzle", &ret); |
1457 | + ret= drizzle_select_db(con, "libdrizzle"); |
1458 | ASSERT_EQ_(DRIZZLE_RETURN_OK, ret, "USE libdrizzle"); |
1459 | |
1460 | drizzle_query_str(con, "create table libdrizzle.t1 (a int)", &ret); |
1461 | @@ -88,7 +88,7 @@ |
1462 | return EXIT_FAILURE; |
1463 | } |
1464 | |
1465 | - result= drizzle_query_str(con, "select * from libdrizzle.t1", &ret); |
1466 | + drizzle_result_st *result= drizzle_query_str(con, "select * from libdrizzle.t1", &ret); |
1467 | if (ret != DRIZZLE_RETURN_OK) |
1468 | { |
1469 | printf("Select failure\n"); |