~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to libdrizzle-1.0/libdrizzle/column.c

  • Committer: Olaf van der Spek
  • Date: 2011-10-24 21:23:54 UTC
  • mto: This revision was merged to the branch mainline in revision 2449.
  • Revision ID: olafvdspek@gmail.com-20111024212354-j32gbc2sbsw0985q
Use str_ref

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
static drizzle_column_type_drizzle_t _column_type_drizzle_map_from[]=
66
66
{
67
67
 DRIZZLE_COLUMN_TYPE_DRIZZLE_MAX, /* 0 */
68
 
 DRIZZLE_COLUMN_TYPE_DRIZZLE_TINY,
 
68
 DRIZZLE_COLUMN_TYPE_DRIZZLE_BOOLEAN,
69
69
 DRIZZLE_COLUMN_TYPE_DRIZZLE_MAX,
70
70
 DRIZZLE_COLUMN_TYPE_DRIZZLE_LONG,
71
71
 DRIZZLE_COLUMN_TYPE_DRIZZLE_MAX,
364
364
      return NULL;
365
365
    }
366
366
 
367
 
    memset(column, 0, sizeof(drizzle_column_st));
368
 
    column->options|= DRIZZLE_COLUMN_ALLOCATED;
 
367
    column->result = result;
 
368
    /* SET BELOW: column->next */
 
369
    column->prev = NULL;
 
370
    column->options= DRIZZLE_COLUMN_ALLOCATED;
 
371
    column->catalog[0] = '\0';
 
372
    column->db[0] = '\0';
 
373
    column->table[0] = '\0';
 
374
    column->orig_table[0] = '\0';
 
375
    column->name[0] = '\0';
 
376
    column->orig_name[0] = '\0';
 
377
    column->charset = 0;
 
378
    column->size = 0;
 
379
    column->max_size = 0;
 
380
    column->type = 0;
 
381
    column->flags = 0;
 
382
    column->decimals = 0;
 
383
    /* UNSET: column->default_value */
 
384
    column->default_value_size = 0;
 
385
 
369
386
  }
370
387
  else
371
 
    memset(column, 0, sizeof(drizzle_column_st));
 
388
  {
 
389
    column->result = result;
 
390
    /* SET BELOW: column->next */
 
391
    column->prev = NULL;
 
392
    column->options= 0;
 
393
    column->catalog[0] = '\0';
 
394
    column->db[0] = '\0';
 
395
    column->table[0] = '\0';
 
396
    column->orig_table[0] = '\0';
 
397
    column->name[0] = '\0';
 
398
    column->orig_name[0] = '\0';
 
399
    column->charset = 0;
 
400
    column->size = 0;
 
401
    column->max_size = 0;
 
402
    column->type = 0;
 
403
    column->flags = 0;
 
404
    column->decimals = 0;
 
405
    /* UNSET: column->default_value */
 
406
    column->default_value_size = 0;
 
407
  }
372
408
 
373
409
  column->result= result;
374
410
 
482
518
 
483
519
drizzle_return_t drizzle_column_skip(drizzle_result_st *result)
484
520
{
 
521
  drizzle_return_t ret;
485
522
  if (drizzle_state_none(result->con))
486
523
  {
487
524
    result->options|= DRIZZLE_RESULT_SKIP_COLUMN;
489
526
    drizzle_state_push(result->con, drizzle_state_column_read);
490
527
    drizzle_state_push(result->con, drizzle_state_packet_read);
491
528
  }
492
 
 
493
 
  return drizzle_state_loop(result->con);
 
529
  ret= drizzle_state_loop(result->con);
 
530
  result->options&= ~DRIZZLE_RESULT_SKIP_COLUMN;
 
531
  return ret;
 
532
}
 
533
 
 
534
drizzle_return_t drizzle_column_skip_all(drizzle_result_st *result)
 
535
{
 
536
  drizzle_return_t ret;
 
537
  uint16_t it;
 
538
 
 
539
  for (it= 1; it <= result->column_count; it++)
 
540
  {
 
541
    ret= drizzle_column_skip(result);
 
542
    if (ret != DRIZZLE_RETURN_OK)
 
543
      return ret;
 
544
  }
 
545
 
 
546
  return DRIZZLE_RETURN_OK;
494
547
}
495
548
 
496
549
drizzle_column_st *drizzle_column_read(drizzle_result_st *result,
753
806
    con->buffer_ptr+= con->packet_size;
754
807
    con->buffer_size-= con->packet_size;
755
808
    con->packet_size= 0;
 
809
    con->result->column_current++;
756
810
 
757
 
    drizzle_state_push(con, drizzle_state_packet_read);
 
811
    drizzle_state_pop(con);
758
812
  }
759
813
  else
760
814
  {