~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to libdrizzle-2.0/row.cc

  • Committer: Brian Aker
  • Date: 2011-11-04 21:06:16 UTC
  • mto: This revision was merged to the branch mainline in revision 2450.
  • Revision ID: brian@tangent.org-20111104210616-2at42agch94dkwb0
Additional fixes for libdrizzle.

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
                                 drizzle_return_t *ret_ptr)
70
70
{
71
71
  size_t total;
 
72
  drizzle_field_t field;
72
73
  drizzle_row_t row;
73
74
 
74
 
  if (result == NULL)
75
 
  {
76
 
    return drizzle_row_t();
77
 
  }
78
 
 
79
 
  drizzle_return_t unused;
80
 
  if (ret_ptr == NULL)
81
 
  {
82
 
    ret_ptr= &unused;
83
 
  }
84
 
 
85
75
  if (result->row == NULL)
86
76
  {
87
77
    if (drizzle_row_read(result, ret_ptr) == 0 || *ret_ptr != DRIZZLE_RETURN_OK)
88
 
    {
89
78
      return NULL;
90
 
    }
91
 
 
92
 
    result->row= new (std::nothrow) drizzle_row_t_type[result->column_count *2];
93
 
 
94
 
    if (result->row == NULL)
95
 
    {
96
 
      *ret_ptr= DRIZZLE_RETURN_MEMORY;
97
 
      return drizzle_row_t();
98
 
    }
 
79
 
 
80
    result->row= new drizzle_row_t_type[result->column_count *2];
99
81
    result->field_sizes= reinterpret_cast<size_t *>(result->row + result->column_count);
100
82
  }
101
83
 
102
84
  while (1)
103
85
  {
104
 
    drizzle_field_t field= drizzle_field_buffer(result, &total, ret_ptr);
 
86
    field= drizzle_field_buffer(result, &total, ret_ptr);
105
87
    if (*ret_ptr == DRIZZLE_RETURN_ROW_END)
106
 
    {
107
88
      break;
108
 
    }
109
 
 
110
89
    if (*ret_ptr != DRIZZLE_RETURN_OK)
111
90
    {
112
91
      if (*ret_ptr != DRIZZLE_RETURN_IO_WAIT)
226
205
    return DRIZZLE_RETURN_OK;
227
206
  }
228
207
  else if (con->result->options & DRIZZLE_RESULT_ROW_BREAK)
229
 
  {
230
208
    con->result->options&= ~DRIZZLE_RESULT_ROW_BREAK;
231
 
  }
232
209
  else
233
210
  {
234
211
    con->result->row_count++;
237
214
  }
238
215
 
239
216
  drizzle_state_pop(con);
240
 
 
241
217
  return DRIZZLE_RETURN_OK;
242
218
}
243
219
 
261
237
  con->buffer_size+= 4;
262
238
 
263
239
  drizzle_state_pop(con);
264
 
 
265
240
  return DRIZZLE_RETURN_OK;
266
241
}