mirror of
				https://github.com/MariaDB/server.git
				synced 2025-10-30 04:26:45 +03:00 
			
		
		
		
	Problem: Too confusing error message when cannot convert
between string and column character sets on INSERT and UPDATE.
Fix: producing a better error message, instead of "Data too long"
in such cases
Additional changes: Adding "DROP TABLE IF EXISTS" into several
tests to be safe against failures in previous tests. 
mysql-test/include/strict_autoinc.inc:
  Adding DROP TABLE to be safe against previous tests failure.
mysql-test/r/ctype_recoding.result:
  Fixing test results
mysql-test/r/ctype_utf8.result:
  Fixing test results
mysql-test/r/fulltext.result:
  Fixing test results
mysql-test/r/strict_autoinc_1myisam.result:
  Adding DROP TABLE to be safe against previous tests failure.
mysql-test/r/strict_autoinc_2innodb.result:
  Adding DROP TABLE to be safe against previous tests failure.
mysql-test/r/strict_autoinc_3heap.result:
  Adding DROP TABLE to be safe against previous tests failure.
mysql-test/r/strict_autoinc_4bdb.result:
  Adding DROP TABLE to be safe against previous tests failure.
mysql-test/r/strict_autoinc_5ndb.result:
  Adding DROP TABLE to be safe against previous tests failure.
sql/field.cc:
  - producing better error messages than
    "DATA TRUNCATED" or "DATA TOO LONG" (in strict mode)
    in case of "not well formed source" and
    "cannot convert to field character set"
  - Performance improvements: copying directly to
    the target, instead of using an intermediate
    String.
  - Moving duplicate code into report_data_too_long() function.
sql/sql_string.cc:
  Adding a new function to convert strings between character sets,
  but not more than "nchar" characters - a helper function for
  Field_string::store(), Field_varstring::store() and Field_blob::store().
sql/sql_string.h:
  Adding new function prototype.
		
	
		
			
				
	
	
		
			33 lines
		
	
	
		
			619 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			619 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| #
 | |
| # Test for strict-mode autoincrement
 | |
| #
 | |
| 
 | |
| --disable_warnings
 | |
| drop table if exists t1;
 | |
| --enable_warnings
 | |
| 
 | |
| set @org_mode=@@sql_mode;
 | |
| eval create table t1
 | |
| (
 | |
|   `a` tinyint(4) NOT NULL auto_increment,
 | |
|   primary key (`a`)
 | |
| ) engine = $type ;
 | |
| set @@sql_mode='strict_all_tables';
 | |
| --error ER_WARN_DATA_OUT_OF_RANGE
 | |
| insert into t1 values(1000);
 | |
| select count(*) from t1;
 | |
| 
 | |
| set auto_increment_increment=1000;
 | |
| set auto_increment_offset=700;
 | |
| --error ER_WARN_DATA_OUT_OF_RANGE
 | |
| insert into t1 values(null);
 | |
| select count(*) from t1;
 | |
| 
 | |
| set @@sql_mode=@org_mode;
 | |
| insert into t1 values(null);
 | |
| select * from t1;
 | |
| 
 | |
| drop table t1;
 | |
| 
 | |
| # End of test
 |