~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to libdrizzle-1.0/result.cc

  • Committer: Brian Aker
  • Date: 2011-11-30 17:23:18 UTC
  • mto: This revision was merged to the branch mainline in revision 2466.
  • Revision ID: brian@tangent.org-20111130172318-3lfw8f73h0uycpda
Fix compiling issues for 1.0, and cleanup header files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
 
56
56
  if (result == NULL)
57
57
  {
58
 
    result= malloc(sizeof(drizzle_result_st));
 
58
    result= new drizzle_result_st;
59
59
    if (result == NULL)
60
60
    {
61
61
      drizzle_set_error(con->drizzle, "drizzle_result_create", "malloc");
93
93
    return NULL;
94
94
  }
95
95
 
96
 
  result->options|= (from->options &
97
 
                     (drizzle_result_options_t)~DRIZZLE_RESULT_ALLOCATED);
 
96
  result->options|= (from->options & ~int(DRIZZLE_RESULT_ALLOCATED));
98
97
 
99
98
  drizzle_result_set_info(result, from->info);
100
99
  result->error_code= from->error_code;
352
351
 
353
352
    if (result->row_list_size < result->row_count)
354
353
    {
355
 
      row_list= realloc(result->row_list, sizeof(drizzle_row_t) *
356
 
                        ((size_t)(result->row_list_size) +
357
 
                         DRIZZLE_ROW_GROW_SIZE));
 
354
      row_list= (drizzle_row_t *)realloc(result->row_list, sizeof(drizzle_row_t) * ((size_t)(result->row_list_size) + DRIZZLE_ROW_GROW_SIZE));
358
355
      if (row_list == NULL)
359
356
      {
360
357
        drizzle_row_free(result, row);
365
362
 
366
363
      result->row_list= row_list;
367
364
 
368
 
      field_sizes_list= realloc(result->field_sizes_list, sizeof(size_t *) *
369
 
                                ((size_t)(result->row_list_size) +
370
 
                                 DRIZZLE_ROW_GROW_SIZE));
 
365
      field_sizes_list= (size_t **)realloc(result->field_sizes_list, sizeof(size_t *) * ((size_t)(result->row_list_size) + DRIZZLE_ROW_GROW_SIZE));
371
366
      if (field_sizes_list == NULL)
372
367
      {
373
368
        drizzle_row_free(result, row);
472
467
  if (is_eof)
473
468
    result->options|= DRIZZLE_RESULT_EOF_PACKET;
474
469
  else
475
 
    result->options&= (drizzle_result_options_t)~DRIZZLE_RESULT_EOF_PACKET;
 
470
    result->options&= ~int(DRIZZLE_RESULT_EOF_PACKET);
476
471
}
477
472
 
478
473
void drizzle_result_set_info(drizzle_result_st *result, const char *info)
605
600
    /* We can ignore the returns since we've buffered the entire packet. */
606
601
    con->result->affected_rows= drizzle_unpack_length(con, &ret);
607
602
    con->result->insert_id= drizzle_unpack_length(con, &ret);
608
 
    con->status= drizzle_get_byte2(con->buffer_ptr);
 
603
    con->status= drizzle_con_status_t(drizzle_get_byte2(con->buffer_ptr));
609
604
    con->result->warning_count= drizzle_get_byte2(con->buffer_ptr + 2);
610
605
    con->buffer_ptr+= 4;
611
606
    con->buffer_size-= 5;
623
618
  {
624
619
    con->result->options= DRIZZLE_RESULT_EOF_PACKET;
625
620
    con->result->warning_count= drizzle_get_byte2(con->buffer_ptr + 1);
626
 
    con->status= drizzle_get_byte2(con->buffer_ptr + 3);
 
621
    con->status= drizzle_con_status_t(drizzle_get_byte2(con->buffer_ptr + 3));
627
622
    con->buffer_ptr+= 5;
628
623
    con->buffer_size-= 5;
629
624
    con->packet_size-= 5;