Loading include/my_bitmap.h +2 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,8 @@ extern my_bool bitmap_is_prefix(const MY_BITMAP *map, uint prefix_size); extern my_bool bitmap_is_set(const MY_BITMAP *map, uint bitmap_bit); extern my_bool bitmap_is_set_all(const MY_BITMAP *map); extern my_bool bitmap_is_subset(const MY_BITMAP *map1, const MY_BITMAP *map2); extern my_bool bitmap_test_and_set(MY_BITMAP *map, uint bitmap_bit); extern my_bool bitmap_fast_test_and_set(MY_BITMAP *map, uint bitmap_bit); extern uint bitmap_set_next(MY_BITMAP *map); extern uint bitmap_get_first(const MY_BITMAP *map); extern uint bitmap_bits_set(const MY_BITMAP *map); Loading mysql-test/r/view.result +15 −0 Original line number Diff line number Diff line Loading @@ -754,6 +754,8 @@ create view v1 as select * from t1; create view v2 as select * from t2; insert into v1 values (1); insert into v2 values (1); Warnings: Warning 1423 Field of view 'test.v2' underlying table doesn't have a default value create view v3 (a,b) as select v1.col1 as a, v2.col1 as b from v1, v2 where v1.col1 = v2.col1; select * from v3; a b Loading Loading @@ -1850,3 +1852,16 @@ SELECT * FROM v1; SUBSTRING_INDEX("dkjhgd:kjhdjh", ":", 1) dkjhgd drop view v1; set sql_mode='strict_all_tables'; CREATE TABLE t1 (col1 INT NOT NULL, col2 INT NOT NULL) ENGINE = INNODB; CREATE VIEW v1 (vcol1) AS SELECT col1 FROM t1; CREATE VIEW v2 (vcol1) AS SELECT col1 FROM t1 WHERE col2 > 2; INSERT INTO t1 (col1) VALUES(12); ERROR HY000: Field 'col2' doesn't have a default value INSERT INTO v1 (vcol1) VALUES(12); ERROR HY000: Field of view 'test.v1' underlying table doesn't have a default value INSERT INTO v2 (vcol1) VALUES(12); ERROR HY000: Field of view 'test.v2' underlying table doesn't have a default value set sql_mode=default; drop view v2,v1; drop table t1; mysql-test/t/view.test +18 −0 Original line number Diff line number Diff line Loading @@ -1696,3 +1696,21 @@ drop view v1; CREATE VIEW v1 AS SELECT SUBSTRING_INDEX("dkjhgd:kjhdjh", ":", 1); SELECT * FROM v1; drop view v1; # # Correct inserting data check (absence of default value) for view # underlying tables (BUG#6443) # set sql_mode='strict_all_tables'; CREATE TABLE t1 (col1 INT NOT NULL, col2 INT NOT NULL) ENGINE = INNODB; CREATE VIEW v1 (vcol1) AS SELECT col1 FROM t1; CREATE VIEW v2 (vcol1) AS SELECT col1 FROM t1 WHERE col2 > 2; -- error 1364 INSERT INTO t1 (col1) VALUES(12); -- error 1423 INSERT INTO v1 (vcol1) VALUES(12); -- error 1423 INSERT INTO v2 (vcol1) VALUES(12); set sql_mode=default; drop view v2,v1; drop table t1; mysys/my_bitmap.c +45 −0 Original line number Diff line number Diff line Loading @@ -109,6 +109,51 @@ void bitmap_set_bit(MY_BITMAP *map, uint bitmap_bit) } /* test if bit already set and set it if it was not (thread unsafe method) SYNOPSIS bitmap_fast_test_and_set() MAP bit map struct BIT bit number RETURN 0 bit was not set !=0 bit was set */ my_bool bitmap_fast_test_and_set(MY_BITMAP *map, uint bitmap_bit) { uchar *byte= map->bitmap + (bitmap_bit / 8); uchar bit= 1 << ((bitmap_bit) & 7); uchar res= (*byte) & bit; *byte|= bit; return res; } /* test if bit already set and set it if it was not (thread safe method) SYNOPSIS bitmap_fast_test_and_set() map bit map struct bitmap_bit bit number RETURN 0 bit was not set !=0 bit was set */ my_bool bitmap_test_and_set(MY_BITMAP *map, uint bitmap_bit) { my_bool res; DBUG_ASSERT(map->bitmap && bitmap_bit < map->bitmap_size*8); bitmap_lock(map); res= bitmap_fast_test_and_set(map, bitmap_bit); bitmap_unlock(map); } uint bitmap_set_next(MY_BITMAP *map) { uchar *bitmap=map->bitmap; Loading sql/field.h +1 −0 Original line number Diff line number Diff line Loading @@ -86,6 +86,7 @@ class Field utype unireg_check; uint32 field_length; // Length of field uint field_index; // field number in fields array uint16 flags; uchar null_bit; // Bit used to test null bit Loading Loading
include/my_bitmap.h +2 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,8 @@ extern my_bool bitmap_is_prefix(const MY_BITMAP *map, uint prefix_size); extern my_bool bitmap_is_set(const MY_BITMAP *map, uint bitmap_bit); extern my_bool bitmap_is_set_all(const MY_BITMAP *map); extern my_bool bitmap_is_subset(const MY_BITMAP *map1, const MY_BITMAP *map2); extern my_bool bitmap_test_and_set(MY_BITMAP *map, uint bitmap_bit); extern my_bool bitmap_fast_test_and_set(MY_BITMAP *map, uint bitmap_bit); extern uint bitmap_set_next(MY_BITMAP *map); extern uint bitmap_get_first(const MY_BITMAP *map); extern uint bitmap_bits_set(const MY_BITMAP *map); Loading
mysql-test/r/view.result +15 −0 Original line number Diff line number Diff line Loading @@ -754,6 +754,8 @@ create view v1 as select * from t1; create view v2 as select * from t2; insert into v1 values (1); insert into v2 values (1); Warnings: Warning 1423 Field of view 'test.v2' underlying table doesn't have a default value create view v3 (a,b) as select v1.col1 as a, v2.col1 as b from v1, v2 where v1.col1 = v2.col1; select * from v3; a b Loading Loading @@ -1850,3 +1852,16 @@ SELECT * FROM v1; SUBSTRING_INDEX("dkjhgd:kjhdjh", ":", 1) dkjhgd drop view v1; set sql_mode='strict_all_tables'; CREATE TABLE t1 (col1 INT NOT NULL, col2 INT NOT NULL) ENGINE = INNODB; CREATE VIEW v1 (vcol1) AS SELECT col1 FROM t1; CREATE VIEW v2 (vcol1) AS SELECT col1 FROM t1 WHERE col2 > 2; INSERT INTO t1 (col1) VALUES(12); ERROR HY000: Field 'col2' doesn't have a default value INSERT INTO v1 (vcol1) VALUES(12); ERROR HY000: Field of view 'test.v1' underlying table doesn't have a default value INSERT INTO v2 (vcol1) VALUES(12); ERROR HY000: Field of view 'test.v2' underlying table doesn't have a default value set sql_mode=default; drop view v2,v1; drop table t1;
mysql-test/t/view.test +18 −0 Original line number Diff line number Diff line Loading @@ -1696,3 +1696,21 @@ drop view v1; CREATE VIEW v1 AS SELECT SUBSTRING_INDEX("dkjhgd:kjhdjh", ":", 1); SELECT * FROM v1; drop view v1; # # Correct inserting data check (absence of default value) for view # underlying tables (BUG#6443) # set sql_mode='strict_all_tables'; CREATE TABLE t1 (col1 INT NOT NULL, col2 INT NOT NULL) ENGINE = INNODB; CREATE VIEW v1 (vcol1) AS SELECT col1 FROM t1; CREATE VIEW v2 (vcol1) AS SELECT col1 FROM t1 WHERE col2 > 2; -- error 1364 INSERT INTO t1 (col1) VALUES(12); -- error 1423 INSERT INTO v1 (vcol1) VALUES(12); -- error 1423 INSERT INTO v2 (vcol1) VALUES(12); set sql_mode=default; drop view v2,v1; drop table t1;
mysys/my_bitmap.c +45 −0 Original line number Diff line number Diff line Loading @@ -109,6 +109,51 @@ void bitmap_set_bit(MY_BITMAP *map, uint bitmap_bit) } /* test if bit already set and set it if it was not (thread unsafe method) SYNOPSIS bitmap_fast_test_and_set() MAP bit map struct BIT bit number RETURN 0 bit was not set !=0 bit was set */ my_bool bitmap_fast_test_and_set(MY_BITMAP *map, uint bitmap_bit) { uchar *byte= map->bitmap + (bitmap_bit / 8); uchar bit= 1 << ((bitmap_bit) & 7); uchar res= (*byte) & bit; *byte|= bit; return res; } /* test if bit already set and set it if it was not (thread safe method) SYNOPSIS bitmap_fast_test_and_set() map bit map struct bitmap_bit bit number RETURN 0 bit was not set !=0 bit was set */ my_bool bitmap_test_and_set(MY_BITMAP *map, uint bitmap_bit) { my_bool res; DBUG_ASSERT(map->bitmap && bitmap_bit < map->bitmap_size*8); bitmap_lock(map); res= bitmap_fast_test_and_set(map, bitmap_bit); bitmap_unlock(map); } uint bitmap_set_next(MY_BITMAP *map) { uchar *bitmap=map->bitmap; Loading
sql/field.h +1 −0 Original line number Diff line number Diff line Loading @@ -86,6 +86,7 @@ class Field utype unireg_check; uint32 field_length; // Length of field uint field_index; // field number in fields array uint16 flags; uchar null_bit; // Bit used to test null bit Loading