~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to server/field.h

  • Committer: Brian Aker
  • Date: 2008-07-10 19:37:55 UTC
  • mfrom: (51.1.67 remove-dbug)
  • Revision ID: brian@tangent.org-20080710193755-f5g761uieqa3wxmt
Merge.

Show diffs side-by-side

added added

removed removed

Lines of Context:
127
127
  virtual String *val_str(String*,String *)=0;
128
128
  String *val_int_as_str(String *val_buffer, my_bool unsigned_flag);
129
129
  /*
130
 
   str_needs_quotes() returns TRUE if the value returned by val_str() needs
 
130
   str_needs_quotes() returns true if the value returned by val_str() needs
131
131
   to be quoted when used in constructing an SQL query.
132
132
  */
133
 
  virtual bool str_needs_quotes() { return FALSE; }
 
133
  virtual bool str_needs_quotes() { return false; }
134
134
  virtual Item_result result_type () const=0;
135
135
  virtual Item_result cmp_type () const { return result_type(); }
136
136
  virtual Item_result cast_to_int_type () const { return result_type(); }
163
163
  /*
164
164
    This method is used to return the size of the data in a row-based
165
165
    replication row record. The default implementation of returning 0 is
166
 
    designed to allow fields that do not use metadata to return TRUE (1)
 
166
    designed to allow fields that do not use metadata to return true (1)
167
167
    from compatible_field_size() which uses this function in the comparison.
168
168
    The default value for field metadata for fields that do not have 
169
169
    metadata is 0. Thus, 0 == 0 means the fields are compatible in size.
283
283
   */
284
284
  size_t last_null_byte() const {
285
285
    size_t bytes= do_last_null_byte();
286
 
    DBUG_PRINT("debug", ("last_null_byte() ==> %ld", (long) bytes));
287
 
    DBUG_ASSERT(bytes <= table->s->null_bytes);
 
286
    assert(bytes <= table->s->null_bytes);
288
287
    return bytes;
289
288
  }
290
289
 
298
297
    use field->val_int() for comparison.  Used to optimize clauses like
299
298
    'a_column BETWEEN date_const, date_const'.
300
299
  */
301
 
  virtual bool can_be_compared_as_longlong() const { return FALSE; }
 
300
  virtual bool can_be_compared_as_longlong() const { return false; }
302
301
  virtual void free() {}
303
302
  virtual Field *new_field(MEM_ROOT *root, struct st_table *new_table,
304
303
                           bool keep_type);
392
391
  */
393
392
  uchar *pack(uchar *to, const uchar *from)
394
393
  {
395
 
    DBUG_ENTER("Field::pack");
396
394
    uchar *result= this->pack(to, from, UINT_MAX, table->s->db_low_byte_first);
397
 
    DBUG_RETURN(result);
 
395
    return(result);
398
396
  }
399
397
 
400
398
  virtual const uchar *unpack(uchar* to, const uchar *from,
404
402
  */
405
403
  const uchar *unpack(uchar* to, const uchar *from)
406
404
  {
407
 
    DBUG_ENTER("Field::unpack");
408
405
    const uchar *result= unpack(to, from, 0U, table->s->db_low_byte_first);
409
 
    DBUG_RETURN(result);
 
406
    return(result);
410
407
  }
411
408
 
412
409
  virtual uchar *pack_key(uchar* to, const uchar *from,
448
445
  virtual bool get_time(MYSQL_TIME *ltime);
449
446
  virtual CHARSET_INFO *charset(void) const { return &my_charset_bin; }
450
447
  virtual CHARSET_INFO *sort_charset(void) const { return charset(); }
451
 
  virtual bool has_charset(void) const { return FALSE; }
 
448
  virtual bool has_charset(void) const { return false; }
452
449
  virtual void set_charset(CHARSET_INFO *charset_arg __attribute__((__unused__)))
453
450
  { }
454
451
  virtual enum Derivation derivation(void) const
609
606
  uint32 max_display_length() { return field_length; }
610
607
  friend class Create_field;
611
608
  my_decimal *val_decimal(my_decimal *);
612
 
  virtual bool str_needs_quotes() { return TRUE; }
 
609
  virtual bool str_needs_quotes() { return true; }
613
610
  bool compare_str_field_flags(Create_field *new_field, uint32 flags);
614
611
  uint is_equal(Create_field *new_field);
615
612
};
944
941
  void sort_string(uchar *buff,uint length);
945
942
  uint32 pack_length() const { return 8; }
946
943
  void sql_type(String &str) const;
947
 
  bool can_be_compared_as_longlong() const { return TRUE; }
 
944
  bool can_be_compared_as_longlong() const { return true; }
948
945
  uint32 max_display_length() { return 20; }
949
946
  virtual uchar *pack(uchar* to, const uchar *from,
950
947
                      uint max_length __attribute__((__unused__)),
1131
1128
  void sort_string(uchar *buff,uint length);
1132
1129
  uint32 pack_length() const { return 4; }
1133
1130
  void sql_type(String &str) const;
1134
 
  bool can_be_compared_as_longlong() const { return TRUE; }
 
1131
  bool can_be_compared_as_longlong() const { return true; }
1135
1132
  bool zero_pack() const { return 0; }
1136
1133
  void set_time();
1137
1134
  virtual void set_default()
1189
1186
  String *val_str(String*,String *);
1190
1187
  bool send_binary(Protocol *protocol);
1191
1188
  void sql_type(String &str) const;
1192
 
  bool can_be_compared_as_longlong() const { return TRUE; }
 
1189
  bool can_be_compared_as_longlong() const { return true; }
1193
1190
};
1194
1191
 
1195
1192
 
1222
1219
  void sort_string(uchar *buff,uint length);
1223
1220
  uint32 pack_length() const { return 3; }
1224
1221
  void sql_type(String &str) const;
1225
 
  bool can_be_compared_as_longlong() const { return TRUE; }
 
1222
  bool can_be_compared_as_longlong() const { return true; }
1226
1223
  bool zero_pack() const { return 1; }
1227
1224
  bool get_date(MYSQL_TIME *ltime,uint fuzzydate);
1228
1225
  bool get_time(MYSQL_TIME *ltime);
1259
1256
  void sort_string(uchar *buff,uint length);
1260
1257
  uint32 pack_length() const { return 3; }
1261
1258
  void sql_type(String &str) const;
1262
 
  bool can_be_compared_as_longlong() const { return TRUE; }
 
1259
  bool can_be_compared_as_longlong() const { return true; }
1263
1260
  bool zero_pack() const { return 1; }
1264
1261
};
1265
1262
 
1297
1294
  void sort_string(uchar *buff,uint length);
1298
1295
  uint32 pack_length() const { return 8; }
1299
1296
  void sql_type(String &str) const;
1300
 
  bool can_be_compared_as_longlong() const { return TRUE; }
 
1297
  bool can_be_compared_as_longlong() const { return true; }
1301
1298
  bool zero_pack() const { return 1; }
1302
1299
  bool get_date(MYSQL_TIME *ltime,uint fuzzydate);
1303
1300
  bool get_time(MYSQL_TIME *ltime);
1358
1355
  uint size_of() const { return sizeof(*this); }
1359
1356
  enum_field_types real_type() const { return MYSQL_TYPE_STRING; }
1360
1357
  bool has_charset(void) const
1361
 
  { return charset() == &my_charset_bin ? FALSE : TRUE; }
 
1358
  { return charset() == &my_charset_bin ? false : true; }
1362
1359
  Field *new_field(MEM_ROOT *root, struct st_table *new_table, bool keep_type);
1363
1360
  virtual uint get_key_image(uchar *buff,uint length, imagetype type);
1364
1361
private:
1446
1443
  uint size_of() const { return sizeof(*this); }
1447
1444
  enum_field_types real_type() const { return MYSQL_TYPE_VARCHAR; }
1448
1445
  bool has_charset(void) const
1449
 
  { return charset() == &my_charset_bin ? FALSE : TRUE; }
 
1446
  { return charset() == &my_charset_bin ? false : true; }
1450
1447
  Field *new_field(MEM_ROOT *root, struct st_table *new_table, bool keep_type);
1451
1448
  Field *new_key_field(MEM_ROOT *root, struct st_table *new_table,
1452
1449
                       uchar *new_ptr, uchar *new_null_ptr,
1621
1618
  friend int field_conv(Field *to,Field *from);
1622
1619
  uint size_of() const { return sizeof(*this); }
1623
1620
  bool has_charset(void) const
1624
 
  { return charset() == &my_charset_bin ? FALSE : TRUE; }
 
1621
  { return charset() == &my_charset_bin ? false : true; }
1625
1622
  uint32 max_display_length();
1626
1623
  uint is_equal(Create_field *new_field);
1627
1624
  inline bool in_read_set() { return bitmap_is_set(table->read_set, field_index); }
1674
1671
                      uint part __attribute__((__unused__)))
1675
1672
  { return 0; }
1676
1673
  bool eq_def(Field *field);
1677
 
  bool has_charset(void) const { return TRUE; }
 
1674
  bool has_charset(void) const { return true; }
1678
1675
  /* enum and set are sorted as integers */
1679
1676
  CHARSET_INFO *sort_charset(void) const { return &my_charset_bin; }
1680
1677
private:
1697
1694
      flags=(flags & ~ENUM_FLAG) | SET_FLAG;
1698
1695
    }
1699
1696
  int  store(const char *to,uint length,CHARSET_INFO *charset);
1700
 
  int  store(double nr) { return Field_set::store((longlong) nr, FALSE); }
 
1697
  int  store(double nr) { return Field_set::store((longlong) nr, false); }
1701
1698
  int  store(longlong nr, bool unsigned_val);
1702
1699
 
1703
1700
  virtual bool zero_pack() const { return 1; }
1704
1701
  String *val_str(String*,String *);
1705
1702
  void sql_type(String &str) const;
1706
1703
  enum_field_types real_type() const { return MYSQL_TYPE_SET; }
1707
 
  bool has_charset(void) const { return TRUE; }
 
1704
  bool has_charset(void) const { return true; }
1708
1705
};
1709
1706
 
1710
1707