~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to libdrizzle/result.cc

  • Committer: Mark Atwood
  • Date: 2011-12-16 15:35:52 UTC
  • mfrom: (2472.1.1 drizzle-build)
  • Revision ID: me@mark.atwood.name-20111216153552-0zk0mmf1tt22p92n
mergeĀ lp:~brianaker/drizzle/libdrizzle-valgrind-test-warnings

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
 
1
/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
 
2
 *
2
3
 * Drizzle Client & Protocol Library
3
4
 *
4
5
 * Copyright (C) 2008 Eric Day (eday@oddments.org)
114
115
    return;
115
116
  }
116
117
 
117
 
  drizzle_column_st *column;
118
 
  uint64_t x;
119
 
 
120
 
  for (column= result->column_list; column != NULL; column= result->column_list)
 
118
  for (drizzle_column_st* column= result->column_list; column != NULL; column= result->column_list)
121
119
  {
122
120
    drizzle_column_free(column);
123
121
  }
124
122
 
125
 
  free(result->column_buffer);
 
123
  delete [] result->column_buffer;
126
124
 
127
125
  if (result->options & DRIZZLE_RESULT_BUFFER_ROW)
128
126
  {
129
 
    for (x= 0; x < result->row_count; x++)
 
127
    for (uint64_t x= 0; x < result->row_count; x++)
 
128
    {
130
129
      drizzle_row_free(result, result->row_list[x]);
 
130
    }
131
131
 
132
132
    free(result->row_list);
133
133
    free(result->field_sizes_list);
151
151
 
152
152
  if (result->options & DRIZZLE_RESULT_ALLOCATED)
153
153
  {
154
 
    free(result);
 
154
    delete result;
155
155
  }
156
156
}
157
157
 
433
433
                                  const drizzle_field_t *field,
434
434
                                  const size_t *size)
435
435
{
436
 
  uint16_t x;
437
 
 
438
436
  if (result == NULL)
439
437
  {
440
438
    return;
442
440
 
443
441
  result->con->packet_size= 0;
444
442
 
445
 
  for (x= 0; x < result->column_count; x++)
 
443
  for (uint16_t x= 0; x < result->column_count; x++)
446
444
  {
447
445
    if (field[x] == NULL)
 
446
    {
448
447
      result->con->packet_size++;
 
448
    }
449
449
    else if (size[x] < 251)
 
450
    {
450
451
      result->con->packet_size+= (1 + size[x]);
 
452
    }
451
453
    else if (size[x] < 65536)
 
454
    {
452
455
      result->con->packet_size+= (3 + size[x]);
 
456
    }
453
457
    else if (size[x] < 16777216)
 
458
    {
454
459
      result->con->packet_size+= (4 + size[x]);
 
460
    }
455
461
    else
 
462
    {
456
463
      result->con->packet_size+= (9 + size[x]);
 
464
    }
457
465
  }
458
466
}
459
467