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