~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item/field.cc

  • Committer: Monty Taylor
  • Date: 2010-10-19 21:51:42 UTC
  • mto: This revision was merged to the branch mainline in revision 1870.
  • Revision ID: mordred@inaugust.com-20101019215142-bwof1oqrswj9ms3v
Add a constrained_value class which allows us to set compile-time
constraints on a value.

Show diffs side-by-side

added added

removed removed

Lines of Context:
111
111
{
112
112
  Table *table= (Table *) arg;
113
113
  if (field->getTable() == table || !table)
114
 
    field->getTable()->setReadSet(field->position());
 
114
    field->getTable()->setReadSet(field->field_index);
115
115
 
116
116
  return 0;
117
117
}
323
323
  switch (result_field->result_type()) {
324
324
  case INT_RESULT:
325
325
    return result_field->val_int() != 0;
326
 
 
327
326
  case DECIMAL_RESULT:
328
 
    {
329
 
      my_decimal decimal_value;
330
 
      my_decimal *val= result_field->val_decimal(&decimal_value);
331
 
      if (val)
332
 
        return !my_decimal_is_zero(val);
333
 
      return 0;
334
 
    }
335
 
 
 
327
  {
 
328
    my_decimal decimal_value;
 
329
    my_decimal *val= result_field->val_decimal(&decimal_value);
 
330
    if (val)
 
331
      return !my_decimal_is_zero(val);
 
332
    return 0;
 
333
  }
336
334
  case REAL_RESULT:
337
335
  case STRING_RESULT:
338
336
    return result_field->val_real() != 0.0;
339
 
 
340
337
  case ROW_RESULT:
 
338
  default:
341
339
    assert(0);
342
340
    return 0;                                   // Shut up compiler
343
341
  }
344
 
 
345
 
  assert(0);
346
 
  return 0;                                   // Shut up compiler
347
342
}
348
343
 
349
344
 
704
699
    {
705
700
      Item_ref *rf;
706
701
      rf= new Item_ref(context,
707
 
                       (cached_table->getSchemaName()[0] ? cached_table->getSchemaName() : 0),
 
702
                       (cached_table->db[0] ? cached_table->db : 0),
708
703
                       (char*) cached_table->alias, (char*) field_name);
709
704
      if (!rf)
710
705
        return -1;
907
902
      current_bitmap= table->write_set;
908
903
      other_bitmap=   table->read_set;
909
904
    }
910
 
    //if (! current_bitmap->testAndSet(field->position()))
911
 
    if (! current_bitmap->test(field->position()))
 
905
    //if (! current_bitmap->testAndSet(field->field_index))
 
906
    if (! current_bitmap->test(field->field_index))
912
907
    {
913
 
      if (! other_bitmap->test(field->position()))
 
908
      if (! other_bitmap->test(field->field_index))
914
909
      {
915
910
        /* First usage of column */
916
911
        table->used_fields++;                     // Used to optimize loops
1268
1263
  {
1269
1264
    char buff[MAX_FIELD_WIDTH];
1270
1265
    String tmp(buff,sizeof(buff),str->charset());
1271
 
    field->val_str_internal(&tmp);
 
1266
    field->val_str(&tmp);
1272
1267
    if (field->is_null())  {
1273
1268
      str->append("NULL");
1274
1269
    }