mirror of
				https://github.com/MariaDB/server.git
				synced 2025-10-30 04:26:45 +03:00 
			
		
		
		
	Under strict mode MySQL will generate an error message if there was any conversion when assigning data to a field. Added checking of date/datetime fields. If strict mode, give error if we have not given value to field without a default value (for INSERT) client/mysqltest.c: Added --exit as an option to abort a test in a middle (good for debugging) include/my_time.h: Added flags to allow checking of dates in strict mode include/mysql_com.h: Added flag to check if field has a default value or not include/mysqld_error.h: New error messages for strict mode include/sql_state.h: Fixed SQL states (for strict mode tests) mysql-test/r/auto_increment.result: Updated error messages mysql-test/r/func_sapdb.result: Added test for ALLOW_INVALID_DATES mysql-test/r/func_str.result: Updated error messages mysql-test/r/func_time.result: Updated error messages mysql-test/r/insert.result: Updated error messages mysql-test/r/loaddata.result: Updated error messages mysql-test/r/select.result: Updated error messages mysql-test/r/sp.result: Updated error messages mysql-test/r/timezone2.result: Updated error messages mysql-test/r/type_datetime.result: Updated error messages mysql-test/r/type_decimal.result: Updated error messages mysql-test/r/type_float.result: Updated error messages mysql-test/r/type_ranges.result: Updated error messages mysql-test/r/type_time.result: Updated error messages mysql-test/r/type_uint.result: Updated error messages mysql-test/r/warnings.result: Updated error messages mysql-test/t/func_sapdb.test: Aded test sql-common/my_time.c: Added checking of dates sql/field.cc: Better error messages Optimization of warning handling (by introducing of check_int()) Changed to use my_strtoll10() sql/field.h: Added check_int() sql/item_func.cc: Warnings when dividing by NULL sql/item_func.h: Warnings when dividing by NULL sql/item_timefunc.cc: Testing of date/datetime Use macros instead of constants sql/mysql_priv.h: New modes (part of strict mode) sql/mysqld.cc: New modes (part of strict mode) sql/opt_range.cc: Simple optimizations sql/protocol.cc: Add note/warning level to find_handler() sql/set_var.cc: Added mode 'traditional' sql/share/czech/errmsg.txt: New error messages for strict mode sql/share/danish/errmsg.txt: New error messages for strict mode sql/share/dutch/errmsg.txt: New error messages for strict mode sql/share/english/errmsg.txt: New error messages for strict mode sql/share/estonian/errmsg.txt: New error messages for strict mode sql/share/french/errmsg.txt: New error messages for strict mode sql/share/german/errmsg.txt: New error messages for strict mode sql/share/greek/errmsg.txt: New error messages for strict mode sql/share/hungarian/errmsg.txt: New error messages for strict mode sql/share/italian/errmsg.txt: New error messages for strict mode sql/share/japanese/errmsg.txt: New error messages for strict mode sql/share/korean/errmsg.txt: New error messages for strict mode sql/share/norwegian-ny/errmsg.txt: New error messages for strict mode sql/share/norwegian/errmsg.txt: New error messages for strict mode sql/share/polish/errmsg.txt: New error messages for strict mode sql/share/portuguese/errmsg.txt: New error messages for strict mode sql/share/romanian/errmsg.txt: New error messages for strict mode sql/share/russian/errmsg.txt: New error messages for strict mode sql/share/serbian/errmsg.txt: New error messages for strict mode sql/share/slovak/errmsg.txt: New error messages for strict mode sql/share/spanish/errmsg.txt: New error messages for strict mode sql/share/swedish/errmsg.txt: New error messages for strict mode sql/share/ukrainian/errmsg.txt: New error messages for strict mode sql/sp_rcontext.cc: Add note/warning level to find_handler() sql/sp_rcontext.h: Add note/warning level to find_handler() sql/sql_base.cc: Fix bug for detecting crashed table sql/sql_class.cc: Variables for strct mode sql/sql_class.h: Variables for strct mode sql/sql_error.cc: In strict mode, convert warnings to errors sql/sql_insert.cc: Strict mode If strict mode, give error if we have not given value to field without a default value sql/sql_load.cc: Strict mode sql/sql_parse.cc: Strict mode. Add flag to field if it doesn't have a default value sql/sql_select.cc: Added comment Prepare for upper level handling of table->status sql/sql_union.cc: Added THD to write_record() sql/sql_update.cc: Strict mode sql/table.cc: Handling of default values sql/time.cc: Checking of dates
		
			
				
	
	
		
			69 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			69 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| drop table if exists t1;
 | |
| create table t1 (a date, b date, c date not null, d date);
 | |
| load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',';
 | |
| Warnings:
 | |
| Warning	1265	Data truncated for column 'a' at row 1
 | |
| Warning	1265	Data truncated for column 'c' at row 1
 | |
| Warning	1265	Data truncated for column 'd' at row 1
 | |
| Warning	1265	Data truncated for column 'a' at row 2
 | |
| Warning	1265	Data truncated for column 'b' at row 2
 | |
| Warning	1265	Data truncated for column 'd' at row 2
 | |
| load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES;
 | |
| SELECT * from t1;
 | |
| a	b	c	d
 | |
| 0000-00-00	NULL	0000-00-00	0000-00-00
 | |
| 0000-00-00	0000-00-00	0000-00-00	0000-00-00
 | |
| 2003-03-03	2003-03-03	2003-03-03	NULL
 | |
| 2003-03-03	2003-03-03	2003-03-03	NULL
 | |
| truncate table t1;
 | |
| load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
 | |
| Warnings:
 | |
| Warning	1265	Data truncated for column 'c' at row 1
 | |
| Warning	1265	Data truncated for column 'd' at row 1
 | |
| Warning	1265	Data truncated for column 'b' at row 2
 | |
| Warning	1265	Data truncated for column 'd' at row 2
 | |
| SELECT * from t1;
 | |
| a	b	c	d
 | |
| NULL	NULL	0000-00-00	0000-00-00
 | |
| NULL	0000-00-00	0000-00-00	0000-00-00
 | |
| NULL	2003-03-03	2003-03-03	NULL
 | |
| drop table t1;
 | |
| create table t1 (a text, b text);
 | |
| load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
 | |
| Warnings:
 | |
| Warning	1261	Row 3 doesn't contain data for all columns
 | |
| select concat('|',a,'|'), concat('|',b,'|') from t1;
 | |
| concat('|',a,'|')	concat('|',b,'|')
 | |
| |Field A|	|Field B|
 | |
| |Field 1|	|Field 2' 
 | |
| Field 3,'Field 4|
 | |
| |Field 5' ,'Field 6|	NULL
 | |
| |Field 6|	| 'Field 7'|
 | |
| drop table t1;
 | |
| create table t1 (a int, b char(10));
 | |
| load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
 | |
| Warnings:
 | |
| Warning	1264	Out of range value adjusted for column 'a' at row 3
 | |
| Warning	1262	Row 3 was truncated; it contained more data than there were input columns
 | |
| Warning	1264	Out of range value adjusted for column 'a' at row 5
 | |
| Warning	1262	Row 5 was truncated; it contained more data than there were input columns
 | |
| select * from t1;
 | |
| a	b
 | |
| 1	row 1
 | |
| 2	row 2
 | |
| 0	1234567890
 | |
| 3	row 3
 | |
| 0	1234567890
 | |
| truncate table t1;
 | |
| load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
 | |
| Warnings:
 | |
| Warning	1264	Out of range value adjusted for column 'a' at row 4
 | |
| Warning	1261	Row 4 doesn't contain data for all columns
 | |
| select * from t1;
 | |
| a	b
 | |
| 1	row 1
 | |
| 2	row 2
 | |
| 3	row 3
 | |
| 0	
 | |
| drop table t1;
 |