~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to libdrizzle-1.0/result.c

  • Committer: Mark Atwood
  • Date: 2011-11-22 17:04:41 UTC
  • mfrom: (2462.1.3 drizzle-include)
  • Revision ID: me@mark.atwood.name-20111122170441-5dehm0e0ax20z19b
mergeĀ lp:~brianaker/drizzle/fedora-16-fixes

Show diffs side-by-side

added added

removed removed

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