~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to libdrizzle-2.0/field.cc

  • Committer: Mark Atwood
  • Date: 2011-11-20 08:50:16 UTC
  • mfrom: (2461.1.2 drizzle-build)
  • Revision ID: me@mark.atwood.name-20111120085016-2o4no5btx18x2gws
mergeĀ lp:~brianaker/drizzle/libdrizzle-refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
drizzle_field_t drizzle_field_buffer(drizzle_result_st *result, size_t *total,
78
78
                                     drizzle_return_t *ret_ptr)
79
79
{
80
 
  drizzle_field_t field;
81
80
  size_t offset= 0;
82
81
  size_t size= 0;
83
82
 
84
 
  field= drizzle_field_read(result, &offset, &size, total, ret_ptr);
 
83
  drizzle_return_t unused;
 
84
  if (ret_ptr == NULL)
 
85
  {
 
86
    ret_ptr= &unused;
 
87
  }
 
88
 
 
89
  drizzle_field_t field= drizzle_field_read(result, &offset, &size, total, ret_ptr);
85
90
  if (*ret_ptr != DRIZZLE_RETURN_OK)
 
91
  {
86
92
    return NULL;
 
93
  }
87
94
 
88
95
  if (field == NULL)
89
96
  {
93
100
 
94
101
  if (result->field_buffer == NULL)
95
102
  {
96
 
    result->field_buffer= new drizzle_field_t_type[(*total) + 1];
 
103
    result->field_buffer= new (std::nothrow) drizzle_field_t_type[(*total) + 1];
 
104
 
 
105
    if (result->field_buffer == NULL)
 
106
    {
 
107
      *ret_ptr= DRIZZLE_RETURN_MEMORY;
 
108
      *total= 0;
 
109
      return NULL;
 
110
    }
97
111
  }
98
112
 
99
113
  memcpy(result->field_buffer + offset, field, size);
102
116
  {
103
117
    field= drizzle_field_read(result, &offset, &size, total, ret_ptr);
104
118
    if (*ret_ptr != DRIZZLE_RETURN_OK)
 
119
    {
105
120
      return NULL;
 
121
    }
106
122
 
107
123
    memcpy(result->field_buffer + offset, field, size);
108
124
  }