46
46
* Common definitions
49
drizzle_result_st *drizzle_result_create(drizzle_con_st *con)
51
return drizzle_result_create_with(con, NULL);
54
drizzle_result_st *drizzle_result_create_with(drizzle_con_st *con,
55
drizzle_result_st *result)
49
drizzle_result_st *drizzle_result_create(drizzle_con_st *con,
50
drizzle_result_st *result)
57
52
if (result == NULL)
117
110
drizzle_result_st *drizzle_result_clone(drizzle_con_st *con,
118
drizzle_result_st *source)
111
drizzle_result_st *result,
112
drizzle_result_st *from)
120
drizzle_result_st *result= drizzle_result_create(con);
114
result= drizzle_result_create(con, result);
121
115
if (result == NULL)
126
result->options= source->options;
120
result->options|= from->options & ~DRIZZLE_RESULT_ALLOCATED;
128
drizzle_result_set_info(result, source->info);
129
result->error_code= source->error_code;
130
drizzle_result_set_sqlstate(result, source->sqlstate);
131
result->warning_count= source->warning_count;
132
result->insert_id= source->insert_id;
133
result->affected_rows= source->affected_rows;
134
result->column_count= source->column_count;
135
result->row_count= source->row_count;
122
drizzle_result_set_info(result, from->info);
123
result->error_code= from->error_code;
124
drizzle_result_set_sqlstate(result, from->sqlstate);
125
result->warning_count= from->warning_count;
126
result->insert_id= from->insert_id;
127
result->affected_rows= from->affected_rows;
128
result->column_count= from->column_count;
129
result->row_count= from->row_count;
156
151
if (result->options & DRIZZLE_RESULT_BUFFER_ROW)
158
for (size_t x= 0; x < result->row_count; x++)
160
drizzle_row_free(result, result->row_list->at(x));
153
for (x= 0; x < result->row_count; x++)
154
drizzle_row_free(result, result->row_list->at(static_cast<size_t>(x)));
163
156
delete result->row_list;
164
157
delete result->field_sizes_list;
170
163
if (result->con->result_list == result)
171
164
result->con->result_list= result->next;
174
166
if (result->prev)
175
167
result->prev->next= result->next;
177
168
if (result->next)
178
169
result->next->prev= result->prev;
180
if (result->_options.is_allocated)
171
if (result->options & DRIZZLE_RESULT_ALLOCATED)
186
175
void drizzle_result_free_all(drizzle_con_st *con)
324
313
if (drizzle_state_none(con))
326
con->result= drizzle_result_create_with(con, result);
315
con->result= drizzle_result_create(con, result);
327
316
if (con->result == NULL)
329
318
*ret_ptr= DRIZZLE_RETURN_MEMORY;