~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to libdrizzle/row.cc

  • Committer: Mark Atwood
  • Date: 2011-12-20 02:32:53 UTC
  • mfrom: (2469.1.1 drizzle-build)
  • Revision ID: me@mark.atwood.name-20111220023253-bvu0kr14kwsdvz7g
mergeĀ lp:~brianaker/drizzle/deprecate-pbms

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Drizzle Client & Protocol Library
 
1
/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 
 
2
 *
 
3
 *  Drizzle Client & Protocol Library
3
4
 *
4
5
 * Copyright (C) 2008 Eric Day (eday@oddments.org)
5
6
 * All rights reserved.
39
40
 * @brief Row definitions
40
41
 */
41
42
 
42
 
#include "common.h"
 
43
#include <libdrizzle-1.0/common.h>
43
44
 
44
45
/*
45
46
 * Client definitions
75
76
  if (result->row == NULL)
76
77
  {
77
78
    if (drizzle_row_read(result, ret_ptr) == 0 || *ret_ptr != DRIZZLE_RETURN_OK)
 
79
    {
78
80
      return NULL;
 
81
    }
79
82
 
80
 
    result->row= malloc((sizeof(drizzle_field_t) + sizeof(size_t)) *
81
 
                        result->column_count);
 
83
    result->row= (drizzle_row_t)malloc((sizeof(drizzle_field_t) + sizeof(size_t)) * result->column_count);
82
84
    if (result->row == NULL)
83
85
    {
84
86
      drizzle_set_error(result->con->drizzle, "drizzle_row_buffer", "malloc");
94
96
    field= drizzle_field_buffer(result, &total, ret_ptr);
95
97
    if (*ret_ptr == DRIZZLE_RETURN_ROW_END)
96
98
      break;
 
99
 
97
100
    if (*ret_ptr != DRIZZLE_RETURN_OK)
98
101
    {
99
102
      if (*ret_ptr != DRIZZLE_RETURN_IO_WAIT)
119
122
 
120
123
void drizzle_row_free(drizzle_result_st *result, drizzle_row_t row)
121
124
{
122
 
  uint16_t x;
123
 
 
124
 
  for (x= 0; x < result->column_count; x++)
125
 
      drizzle_field_free(row[x]);
 
125
  for (uint16_t x= 0; x < result->column_count; x++)
 
126
  {
 
127
    drizzle_field_free(row[x]);
 
128
  }
126
129
 
127
130
  free(row);
128
131
}
203
206
    /* Got EOF packet, no more rows. */
204
207
    con->result->row_current= 0;
205
208
    con->result->warning_count= drizzle_get_byte2(con->buffer_ptr + 1);
206
 
    con->status= drizzle_get_byte2(con->buffer_ptr + 3);
 
209
    con->status= drizzle_con_status_t(drizzle_get_byte2(con->buffer_ptr + 3));
207
210
    con->buffer_ptr+= 5;
208
211
    con->buffer_size-= 5;
209
212
  }
214
217
    return DRIZZLE_RETURN_OK;
215
218
  }
216
219
  else if (con->result->options & DRIZZLE_RESULT_ROW_BREAK)
217
 
    con->result->options&= (drizzle_result_options_t)~DRIZZLE_RESULT_ROW_BREAK;
 
220
  {
 
221
    con->result->options&= ~int(DRIZZLE_RESULT_ROW_BREAK);
 
222
  }
218
223
  else
219
224
  {
220
225
    con->result->row_count++;