~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-20 18:59:19 UTC
  • mto: (2463.1.1 drizzle-include)
  • mto: This revision was merged to the branch mainline in revision 2465.
  • Revision ID: brian@tangent.org-20111120185919-8a0og41w2nn8redh
Small correction to style.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
 * @brief Row definitions
40
40
 */
41
41
 
42
 
#include "common.h"
 
42
#include <libdrizzle-2.0/common.h>
43
43
 
44
44
/*
45
45
 * Client definitions
69
69
                                 drizzle_return_t *ret_ptr)
70
70
{
71
71
  size_t total;
72
 
  drizzle_field_t field;
73
72
  drizzle_row_t row;
74
73
 
 
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
 
75
85
  if (result->row == NULL)
76
86
  {
77
87
    if (drizzle_row_read(result, ret_ptr) == 0 || *ret_ptr != DRIZZLE_RETURN_OK)
 
88
    {
78
89
      return NULL;
79
 
 
80
 
    result->row= new drizzle_row_t_type[result->column_count *2];
 
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
    }
81
99
    result->field_sizes= reinterpret_cast<size_t *>(result->row + result->column_count);
82
100
  }
83
101
 
84
102
  while (1)
85
103
  {
86
 
    field= drizzle_field_buffer(result, &total, ret_ptr);
 
104
    drizzle_field_t field= drizzle_field_buffer(result, &total, ret_ptr);
87
105
    if (*ret_ptr == DRIZZLE_RETURN_ROW_END)
 
106
    {
88
107
      break;
 
108
    }
 
109
 
89
110
    if (*ret_ptr != DRIZZLE_RETURN_OK)
90
111
    {
91
112
      if (*ret_ptr != DRIZZLE_RETURN_IO_WAIT)
205
226
    return DRIZZLE_RETURN_OK;
206
227
  }
207
228
  else if (con->result->options & DRIZZLE_RESULT_ROW_BREAK)
 
229
  {
208
230
    con->result->options&= ~DRIZZLE_RESULT_ROW_BREAK;
 
231
  }
209
232
  else
210
233
  {
211
234
    con->result->row_count++;
214
237
  }
215
238
 
216
239
  drizzle_state_pop(con);
 
240
 
217
241
  return DRIZZLE_RETURN_OK;
218
242
}
219
243
 
237
261
  con->buffer_size+= 4;
238
262
 
239
263
  drizzle_state_pop(con);
 
264
 
240
265
  return DRIZZLE_RETURN_OK;
241
266
}