summaryrefslogtreecommitdiff
path: root/sql/field.h
diff options
context:
space:
mode:
authorunknown <dlenev@mysql.com>2005-01-18 17:04:16 +0300
committerunknown <dlenev@mysql.com>2005-01-18 17:04:16 +0300
commitb1a0f67a03e782495e027588c7c7bc204f0a82b6 (patch)
treeba4ac7a22bf24436c9fa3c06cda870301965b7f5 /sql/field.h
parent15017480a7d7aba65df4fcab00a922aa8fc0cf01 (diff)
downloadmariadb-git-b1a0f67a03e782495e027588c7c7bc204f0a82b6.tar.gz
Clean up in implementation of f_is_geom()/f_is_bitfield()/f_is_enum()
macros. It does not fixes any bugs in 4.0. But it prevents from future error in any bugfixes that may use these macros. Also after merging into 4.1 tree this cleanup will fix bug #7884 "Able to add invalid unique index on TIMESTAMP prefix". sql/field.h: Since FIELDFLAG_INTERVAL, FIELDFLAG_BITFIELD, FIELDFLAG_BLOB and FIELDFLAG_GEOM flags occupy the same space as number of decimals for FIELDFLAG_NUMBER fields, it is safer to check in "f_is_geom()"-type macros that we have non-number field, like we already do in f_is_blob() macro.
Diffstat (limited to 'sql/field.h')
-rw-r--r--sql/field.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/sql/field.h b/sql/field.h
index c42f5f63f0c..87a9732b41e 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -1101,10 +1101,10 @@ bool test_if_int(const char *str,int length);
#define FIELDFLAG_NUMBER 2
#define FIELDFLAG_ZEROFILL 4
#define FIELDFLAG_PACK 120 // Bits used for packing
-#define FIELDFLAG_INTERVAL 256
-#define FIELDFLAG_BITFIELD 512 // mangled with dec!
-#define FIELDFLAG_BLOB 1024 // mangled with dec!
-#define FIELDFLAG_GEOM 2048
+#define FIELDFLAG_INTERVAL 256 // mangled with decimals!
+#define FIELDFLAG_BITFIELD 512 // mangled with decimals!
+#define FIELDFLAG_BLOB 1024 // mangled with decimals!
+#define FIELDFLAG_GEOM 2048 // mangled with decimals!
#define FIELDFLAG_LEFT_FULLSCREEN 8192
#define FIELDFLAG_RIGHT_FULLSCREEN 16384
#define FIELDFLAG_FORMAT_NUMBER 16384 // predit: ###,,## in output
@@ -1128,10 +1128,10 @@ bool test_if_int(const char *str,int length);
#define f_decimals(x) ((uint8) (((x) >> FIELDFLAG_DEC_SHIFT) & FIELDFLAG_MAX_DEC))
#define f_is_alpha(x) (!f_is_num(x))
#define f_is_binary(x) ((x) & FIELDFLAG_BINARY)
-#define f_is_enum(x) ((x) & FIELDFLAG_INTERVAL)
-#define f_is_bitfield(x) ((x) & FIELDFLAG_BITFIELD)
+#define f_is_enum(x) (((x) & (FIELDFLAG_INTERVAL | FIELDFLAG_NUMBER)) == FIELDFLAG_INTERVAL)
+#define f_is_bitfield(x) (((x) & (FIELDFLAG_BITFIELD | FIELDFLAG_NUMBER)) == FIELDFLAG_BITFIELD)
#define f_is_blob(x) (((x) & (FIELDFLAG_BLOB | FIELDFLAG_NUMBER)) == FIELDFLAG_BLOB)
-#define f_is_geom(x) ((x) & FIELDFLAG_GEOM)
+#define f_is_geom(x) (((x) & (FIELDFLAG_GEOM | FIELDFLAG_NUMBER)) == FIELDFLAG_GEOM)
#define f_is_equ(x) ((x) & (1+2+FIELDFLAG_PACK+31*256))
#define f_settype(x) (((int) x) << FIELDFLAG_PACK_SHIFT)
#define f_maybe_null(x) (x & FIELDFLAG_MAYBE_NULL)