~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to libdrizzle-2.0/result.cc

  • Committer: Brian Aker
  • Date: 2011-11-27 01:25:57 UTC
  • mto: This revision was merged to the branch mainline in revision 2465.
  • Revision ID: brian@tangent.org-20111127012557-vxph9h1v32v3m1bz
Move result over to being behind API.

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
 * Common definitions
47
47
 */
48
48
 
49
 
drizzle_result_st *drizzle_result_create(drizzle_con_st *con,
50
 
                                         drizzle_result_st *result)
 
49
drizzle_result_st *drizzle_result_create(drizzle_con_st *con)
 
50
{
 
51
  return drizzle_result_create_with(con, NULL);
 
52
}
 
53
 
 
54
drizzle_result_st *drizzle_result_create_with(drizzle_con_st *con,
 
55
                                              drizzle_result_st *result)
51
56
{
52
57
  if (result == NULL)
53
58
  {
110
115
}
111
116
 
112
117
drizzle_result_st *drizzle_result_clone(drizzle_con_st *con,
113
 
                                        drizzle_result_st *result,
114
 
                                        drizzle_result_st *from)
 
118
                                        drizzle_result_st *source)
115
119
{
116
 
  result= drizzle_result_create(con, result);
 
120
  drizzle_result_st *result= drizzle_result_create(con);
117
121
  if (result == NULL)
118
122
  {
119
123
    return NULL;
120
124
  }
121
125
 
122
 
  result->options= from->options;
 
126
  result->options= source->options;
123
127
 
124
 
  drizzle_result_set_info(result, from->info);
125
 
  result->error_code= from->error_code;
126
 
  drizzle_result_set_sqlstate(result, from->sqlstate);
127
 
  result->warning_count= from->warning_count;
128
 
  result->insert_id= from->insert_id;
129
 
  result->affected_rows= from->affected_rows;
130
 
  result->column_count= from->column_count;
131
 
  result->row_count= from->row_count;
 
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;
132
136
 
133
137
  return result;
134
138
}
136
140
void drizzle_result_free(drizzle_result_st *result)
137
141
{
138
142
  drizzle_column_st *column;
139
 
  uint64_t x;
140
143
 
141
144
  if (result == NULL)
142
145
  {
152
155
 
153
156
  if (result->options & DRIZZLE_RESULT_BUFFER_ROW)
154
157
  {
155
 
    for (x= 0; x < result->row_count; x++)
156
 
      drizzle_row_free(result, result->row_list->at(static_cast<size_t>(x)));
 
158
    for (size_t x= 0; x < result->row_count; x++)
 
159
    {
 
160
      drizzle_row_free(result, result->row_list->at(x));
 
161
    }
157
162
 
158
163
    delete result->row_list;
159
164
    delete result->field_sizes_list;
318
323
 
319
324
  if (drizzle_state_none(con))
320
325
  {
321
 
    con->result= drizzle_result_create(con, result);
 
326
    con->result= drizzle_result_create_with(con, result);
322
327
    if (con->result == NULL)
323
328
    {
324
329
      *ret_ptr= DRIZZLE_RETURN_MEMORY;