~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table.cc

  • Committer: Brian Aker
  • Date: 2008-08-19 21:53:32 UTC
  • Revision ID: brian@tangent.org-20080819215332-yoofgyn48ydie0ds
Refactor of Table methods.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3103
3103
}
3104
3104
 
3105
3105
 
3106
 
size_t max_row_length(Table *table, const uchar *data)
 
3106
size_t Table::max_row_length(const uchar *data)
3107
3107
{
3108
 
  size_t length= table->getRecordLength() + 2 * table->sizeFields();
3109
 
  uint *const beg= table->getBlobField();
3110
 
  uint *const end= beg + table->sizeBlobFields();
 
3108
  size_t length= getRecordLength() + 2 * sizeFields();
 
3109
  uint *const beg= getBlobField();
 
3110
  uint *const end= beg + sizeBlobFields();
3111
3111
 
3112
3112
  for (uint *ptr= beg ; ptr != end ; ++ptr)
3113
3113
  {
3114
 
    Field_blob* const blob= (Field_blob*) table->field[*ptr];
 
3114
    Field_blob* const blob= (Field_blob*) field[*ptr];
3115
3115
    length+= blob->get_length((const uchar*)
3116
 
                              (data + blob->offset(table->record[0]))) +
 
3116
                              (data + blob->offset(record[0]))) +
3117
3117
      HA_KEY_BLOB_LENGTH;
3118
3118
  }
3119
3119
  return length;
3120
3120
}
3121
3121
 
3122
 
void Field_iterator_table::set(TableList *table) 
3123
 
3124
 
  ptr= table->table->field; 
3125
 
}
3126
 
 
3127
 
 
3128
3122
/*
3129
3123
  Check type of .frm if we are not going to parse it
3130
3124
 
4660
4654
  return(1);
4661
4655
}
4662
4656
 
 
4657
my_bitmap_map *Table::use_all_columns(MY_BITMAP *bitmap)
 
4658
{
 
4659
  my_bitmap_map *old= bitmap->bitmap;
 
4660
  bitmap->bitmap= s->all_set.bitmap;
 
4661
  return old;
 
4662
}
 
4663
 
 
4664
void Table::restore_column_map(my_bitmap_map *old)
 
4665
{
 
4666
  read_set->bitmap= old;
 
4667
}
 
4668
 
 
4669
 
 
4670
/*****************************************************************************
 
4671
  The different ways to read a record
 
4672
  Returns -1 if row was not found, 0 if row was found and 1 on errors
 
4673
*****************************************************************************/
 
4674
 
 
4675
/** Help function when we get some an error from the table handler. */
 
4676
 
 
4677
int Table::report_error(int error)
 
4678
{
 
4679
  if (error == HA_ERR_END_OF_FILE || error == HA_ERR_KEY_NOT_FOUND)
 
4680
  {
 
4681
    status= STATUS_GARBAGE;
 
4682
    return -1;                                  // key not found; ok
 
4683
  }
 
4684
  /*
 
4685
    Locking reads can legally return also these errors, do not
 
4686
    print them to the .err log
 
4687
  */
 
4688
  if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT)
 
4689
    sql_print_error(_("Got error %d when reading table '%s'"),
 
4690
                    error, s->path.str);
 
4691
  file->print_error(error,MYF(0));
 
4692
 
 
4693
  return 1;
 
4694
}
 
4695
 
4663
4696
 
4664
4697
/*****************************************************************************
4665
4698
** Instansiate templates