86
79
drizzle_result_st *result,
87
80
drizzle_result_st *from)
89
// A NULL con will return a NULL result
90
82
result= drizzle_result_create(con, result);
91
83
if (result == NULL)
96
86
result->options|= (from->options &
97
87
(drizzle_result_options_t)~DRIZZLE_RESULT_ALLOCATED);
111
101
void drizzle_result_free(drizzle_result_st *result)
118
103
drizzle_column_st *column;
121
106
for (column= result->column_list; column != NULL; column= result->column_list)
123
107
drizzle_column_free(column);
126
109
free(result->column_buffer);
140
123
if (result->con->result_list == result)
141
124
result->con->result_list= result->next;
144
126
if (result->prev)
146
127
result->prev->next= result->next;
148
128
if (result->next)
150
129
result->next->prev= result->prev;
153
131
if (result->options & DRIZZLE_RESULT_ALLOCATED)
159
135
void drizzle_result_free_all(drizzle_con_st *con)
166
137
while (con->result_list != NULL)
168
138
drizzle_result_free(con->result_list);
172
141
drizzle_con_st *drizzle_result_drizzle_con(drizzle_result_st *result)
179
143
return result->con;
182
146
bool drizzle_result_eof(drizzle_result_st *result)
189
148
return result->options & DRIZZLE_RESULT_EOF_PACKET;
192
151
const char *drizzle_result_info(drizzle_result_st *result)
199
153
return result->info;
202
156
const char *drizzle_result_error(drizzle_result_st *result)
209
158
return result->info;
212
161
uint16_t drizzle_result_error_code(drizzle_result_st *result)
219
163
return result->error_code;
222
166
const char *drizzle_result_sqlstate(drizzle_result_st *result)
229
168
return result->sqlstate;
232
171
uint16_t drizzle_result_warning_count(drizzle_result_st *result)
239
173
return result->warning_count;
242
176
uint64_t drizzle_result_insert_id(drizzle_result_st *result)
249
178
return result->insert_id;
252
181
uint64_t drizzle_result_affected_rows(drizzle_result_st *result)
259
183
return result->affected_rows;
262
186
uint16_t drizzle_result_column_count(drizzle_result_st *result)
269
188
return result->column_count;
272
191
uint64_t drizzle_result_row_count(drizzle_result_st *result)
279
193
return result->row_count;
287
201
drizzle_result_st *result,
288
202
drizzle_return_t *ret_ptr)
290
drizzle_return_t unused;
298
*ret_ptr= DRIZZLE_RETURN_INVALID_ARGUMENT;
302
204
if (drizzle_state_none(con))
304
206
con->result= drizzle_result_create(con, result);
406
298
drizzle_return_t drizzle_result_write(drizzle_con_st *con,
407
299
drizzle_result_st *result, bool flush)
411
return DRIZZLE_RETURN_INVALID_ARGUMENT;
414
301
if (drizzle_state_none(con))
416
303
con->result= result;
438
320
const drizzle_field_t *field,
439
321
const size_t *size)
446
325
result->con->packet_size= 0;
448
for (uint16_t x= 0; x < result->column_count; x++)
327
for (x= 0; x < result->column_count; x++)
450
329
if (field[x] == NULL)
451
330
result->con->packet_size++;
494
361
void drizzle_result_set_error(drizzle_result_st *result, const char *error)
501
363
drizzle_result_set_info(result, error);
504
366
void drizzle_result_set_error_code(drizzle_result_st *result,
505
367
uint16_t error_code)
512
369
result->error_code= error_code;
515
372
void drizzle_result_set_sqlstate(drizzle_result_st *result,
516
373
const char *sqlstate)
523
375
if (sqlstate == NULL)
525
376
result->sqlstate[0]= 0;
529
379
strncpy(result->sqlstate, sqlstate, DRIZZLE_MAX_SQLSTATE_SIZE + 1);
534
384
void drizzle_result_set_warning_count(drizzle_result_st *result,
535
385
uint16_t warning_count)
542
387
result->warning_count= warning_count;
545
390
void drizzle_result_set_insert_id(drizzle_result_st *result,
546
391
uint64_t insert_id)
553
393
result->insert_id= insert_id;
556
396
void drizzle_result_set_affected_rows(drizzle_result_st *result,
557
397
uint64_t affected_rows)
564
399
result->affected_rows= affected_rows;
567
402
void drizzle_result_set_column_count(drizzle_result_st *result,
568
403
uint16_t column_count)
575
405
result->column_count= column_count;