~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field.cc

  • Committer: Brian Aker
  • Date: 2011-02-20 21:00:32 UTC
  • mfrom: (2181.2.6 drizzle-build)
  • Revision ID: brian@tangent.org-20110220210032-fc9g8qugt0n1yjr6
Brian Aker 2011-02-20 Merge in additional header bits for strerror_r
Brian Aker 2011-02-20 Create CONST on additional Field methods.
Brian Aker 2011-02-19 Further commit const on field.
Brian Aker 2011-02-18 This fixes DEBUG based compiles.
Brian Aker 2011-02-18 Protect all of the val_* methods from modification.

Show diffs side-by-side

added added

removed removed

Lines of Context:
746
746
  return 0;
747
747
}
748
748
 
749
 
bool Field::is_null(ptrdiff_t row_offset)
 
749
bool Field::is_null(ptrdiff_t row_offset) const
750
750
{
751
751
  return null_ptr ?
752
752
    (null_ptr[row_offset] & null_bit ? true : false) :
753
753
    table->null_row;
754
754
}
755
755
 
756
 
bool Field::is_real_null(ptrdiff_t row_offset)
 
756
bool Field::is_real_null(ptrdiff_t row_offset) const
757
757
{
758
758
  return null_ptr ? (null_ptr[row_offset] & null_bit ? true : false) : false;
759
759
}
760
760
 
761
 
bool Field::is_null_in_record(const unsigned char *record)
 
761
bool Field::is_null_in_record(const unsigned char *record) const
762
762
{
763
763
  if (! null_ptr)
764
764
    return false;
765
765
  return test(record[(uint32_t) (null_ptr -table->getInsertRecord())] & null_bit);
766
766
}
767
767
 
768
 
bool Field::is_null_in_record_with_offset(ptrdiff_t with_offset)
 
768
bool Field::is_null_in_record_with_offset(ptrdiff_t with_offset) const
769
769
{
770
770
  if (! null_ptr)
771
771
    return false;
784
784
    null_ptr[row_offset]&= (unsigned char) ~null_bit;
785
785
}
786
786
 
787
 
bool Field::maybe_null(void)
 
787
bool Field::maybe_null(void) const
788
788
{
789
789
  return null_ptr != 0 || table->maybe_null;
790
790
}
791
791
 
792
 
bool Field::real_maybe_null(void)
 
792
bool Field::real_maybe_null(void) const
793
793
{
794
794
  return null_ptr != 0;
795
795
}
851
851
{
852
852
}
853
853
 
854
 
void Field::hash(uint32_t *nr, uint32_t *nr2)
 
854
void Field::hash(uint32_t *nr, uint32_t *nr2) const
855
855
{
856
856
  if (is_null())
857
857
  {
943
943
  return(result);
944
944
}
945
945
 
946
 
type::Decimal *Field::val_decimal(type::Decimal *)
 
946
type::Decimal *Field::val_decimal(type::Decimal *) const
947
947
{
948
948
  /* This never have to be called */
949
949
  assert(0);
1012
1012
  return copy->length+ store_length;
1013
1013
}
1014
1014
 
1015
 
bool Field::get_date(type::Time &ltime, uint32_t fuzzydate)
 
1015
bool Field::get_date(type::Time &ltime, uint32_t fuzzydate) const
1016
1016
{
1017
1017
  char buff[type::Time::MAX_STRING_LENGTH];
1018
1018
  String tmp(buff,sizeof(buff),&my_charset_bin),*res;
1019
1019
 
1020
1020
  assert(getTable() and getTable()->getSession());
1021
1021
 
1022
 
  if (not (res=val_str_internal(&tmp)) or
 
1022
  if (not (res= val_str_internal(&tmp)) or
1023
1023
      str_to_datetime_with_warn(getTable()->getSession(),
1024
1024
                                res->ptr(), res->length(),
1025
1025
                                &ltime, fuzzydate) <= type::DRIZZLE_TIMESTAMP_ERROR)
1030
1030
  return false;
1031
1031
}
1032
1032
 
1033
 
bool Field::get_time(type::Time &ltime)
 
1033
bool Field::get_time(type::Time &ltime) const
1034
1034
{
1035
1035
  char buff[type::Time::MAX_STRING_LENGTH];
1036
1036
  String tmp(buff,sizeof(buff),&my_charset_bin),*res;
1253
1253
  }
1254
1254
}
1255
1255
 
1256
 
bool Field::isReadSet() 
 
1256
bool Field::isReadSet() const 
1257
1257
1258
1258
  return table->isReadSet(field_index); 
1259
1259
}