diff options
author | Alexander Nozdrin <alik@sun.com> | 2009-12-11 12:39:38 +0300 |
---|---|---|
committer | Alexander Nozdrin <alik@sun.com> | 2009-12-11 12:39:38 +0300 |
commit | 567671368723c704d60902b4d0ccff951b414552 (patch) | |
tree | 965519a5b0af3f33624c7e16fd61b58d15f42372 /sql/field.h | |
parent | efee0608316e4cc034a3e62d05980eef8530843d (diff) | |
parent | ceefe7bb50b17b72e88851e3b98642e89a4cddae (diff) | |
download | mariadb-git-567671368723c704d60902b4d0ccff951b414552.tar.gz |
Manual merge from mysql-trunk.
Conflicts:
- client/mysqltest.cc
- mysql-test/collections/default.experimental
- mysql-test/suite/rpl/t/disabled.def
- sql/mysqld.cc
- sql/opt_range.cc
- sql/sp.cc
- sql/sql_acl.cc
- sql/sql_partition.cc
- sql/sql_table.cc
Diffstat (limited to 'sql/field.h')
-rw-r--r-- | sql/field.h | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/sql/field.h b/sql/field.h index ae074cc1a30..159e4bf707c 100644 --- a/sql/field.h +++ b/sql/field.h @@ -1,3 +1,6 @@ +#ifndef FIELD_INCLUDED +#define FIELD_INCLUDED + /* Copyright 2000-2008 MySQL AB, 2008, 2009 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify @@ -60,8 +63,8 @@ public: Note that you can use table->in_use as replacement for current_thd member only inside of val_*() and store() members (e.g. you can't use it in cons) */ - struct st_table *table; // Pointer for table - struct st_table *orig_table; // Pointer to original table + TABLE *table; // Pointer for table + TABLE *orig_table; // Pointer to original table const char **table_name, *field_name; LEX_STRING comment; /* Field is part of the following keys */ @@ -301,12 +304,12 @@ public: */ virtual bool can_be_compared_as_longlong() const { return FALSE; } virtual void free() {} - virtual Field *new_field(MEM_ROOT *root, struct st_table *new_table, + virtual Field *new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type); - virtual Field *new_key_field(MEM_ROOT *root, struct st_table *new_table, + virtual Field *new_key_field(MEM_ROOT *root, TABLE *new_table, uchar *new_ptr, uchar *new_null_ptr, uint new_null_bit); - Field *clone(MEM_ROOT *mem_root, struct st_table *new_table); + Field *clone(MEM_ROOT *mem_root, TABLE *new_table); inline void move_field(uchar *ptr_arg,uchar *null_ptr_arg,uchar null_bit_arg) { ptr=ptr_arg; null_ptr=null_ptr_arg; null_bit=null_bit_arg; @@ -1510,7 +1513,7 @@ public: enum_field_types real_type() const { return MYSQL_TYPE_STRING; } bool has_charset(void) const { return charset() == &my_charset_bin ? FALSE : TRUE; } - Field *new_field(MEM_ROOT *root, struct st_table *new_table, bool keep_type); + Field *new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type); virtual uint get_key_image(uchar *buff,uint length, imagetype type); private: int do_save_field_metadata(uchar *first_byte); @@ -1597,8 +1600,8 @@ public: enum_field_types real_type() const { return MYSQL_TYPE_VARCHAR; } bool has_charset(void) const { return charset() == &my_charset_bin ? FALSE : TRUE; } - Field *new_field(MEM_ROOT *root, struct st_table *new_table, bool keep_type); - Field *new_key_field(MEM_ROOT *root, struct st_table *new_table, + Field *new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type); + Field *new_key_field(MEM_ROOT *root, TABLE *new_table, uchar *new_ptr, uchar *new_null_ptr, uint new_null_bit); uint is_equal(Create_field *new_field); @@ -1837,7 +1840,7 @@ public: { flags|=ENUM_FLAG; } - Field *new_field(MEM_ROOT *root, struct st_table *new_table, bool keep_type); + Field *new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type); enum_field_types type() const { return MYSQL_TYPE_STRING; } enum Item_result cmp_type () const { return INT_RESULT; } enum Item_result cast_to_int_type () const { return INT_RESULT; } @@ -1937,9 +1940,12 @@ public: virtual bool str_needs_quotes() { return TRUE; } my_decimal *val_decimal(my_decimal *); int cmp(const uchar *a, const uchar *b) - { - DBUG_ASSERT(ptr == a); - return Field_bit::key_cmp(b, bytes_in_rec+test(bit_len)); + { + DBUG_ASSERT(ptr == a || ptr == b); + if (ptr == a) + return Field_bit::key_cmp(b, bytes_in_rec+test(bit_len)); + else + return Field_bit::key_cmp(a, bytes_in_rec+test(bit_len)) * -1; } int cmp_binary_offset(uint row_offset) { return cmp_offset(row_offset); } @@ -1971,7 +1977,7 @@ public: uint param_data, bool low_byte_first); virtual void set_default(); - Field *new_key_field(MEM_ROOT *root, struct st_table *new_table, + Field *new_key_field(MEM_ROOT *root, TABLE *new_table, uchar *new_ptr, uchar *new_null_ptr, uint new_null_bit); void set_bit_ptr(uchar *bit_ptr_arg, uchar bit_ofs_arg) @@ -2085,7 +2091,7 @@ public: A class for sending info to the client */ -class Send_field { +class Send_field :public Sql_alloc { public: const char *db_name; const char *table_name,*org_table_name; @@ -2188,3 +2194,5 @@ int set_field_to_null_with_conversions(Field *field, bool no_conversions); #define f_no_default(x) (x & FIELDFLAG_NO_DEFAULT) #define f_bit_as_char(x) ((x) & FIELDFLAG_TREAT_BIT_AS_CHAR) #define f_is_hex_escape(x) ((x) & FIELDFLAG_HEX_ESCAPE) + +#endif /* FIELD_INCLUDED */ |