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