mirror of
				https://github.com/MariaDB/server.git
				synced 2025-10-24 07:13:33 +03:00 
			
		
		
		
	Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into neptunus.(none):/home/msvensson/mysql/mysql-4.1
This commit is contained in:
		| @@ -513,3 +513,10 @@ t1	CREATE TABLE `t1` ( | |||||||
|   KEY `c2` USING BTREE (`c2`) |   KEY `c2` USING BTREE (`c2`) | ||||||
| ) ENGINE=MyISAM DEFAULT CHARSET=latin1 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1 | ||||||
| DROP TABLE t1; | DROP TABLE t1; | ||||||
|  | flush tables; | ||||||
|  | SHOW TABLE STATUS like 't1'; | ||||||
|  | Name	Engine	Version	Row_format	Rows	Avg_row_length	Data_length	Max_data_length	Index_length	Data_free	Auto_increment	Create_time	Update_time	Check_time	Collation	Checksum	Create_options	Comment | ||||||
|  | t1	NULL	NULL	NULL	NULL	#	#	#	#	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Incorrect information in file: './test/t1.frm' | ||||||
|  | show create table t1; | ||||||
|  | ERROR HY000: Incorrect information in file: './test/t1.frm' | ||||||
|  | drop table t1; | ||||||
|   | |||||||
| @@ -378,4 +378,17 @@ create table t1 ( | |||||||
| SHOW CREATE TABLE t1; | SHOW CREATE TABLE t1; | ||||||
| DROP TABLE t1; | DROP TABLE t1; | ||||||
|  |  | ||||||
|  | # Test for BUG#93: 4.1 protocl crash on corupted frm and SHOW TABLE STATUS | ||||||
|  |  | ||||||
|  | flush tables; | ||||||
|  |  | ||||||
|  | # Create a junk frm file on disk | ||||||
|  | system echo "this is a junk file for test" >> var/master-data/test/t1.frm ; | ||||||
|  | --replace_column 6 # 7 # 8 # 9 # | ||||||
|  | SHOW TABLE STATUS like 't1'; | ||||||
|  | --error 1033 | ||||||
|  | show create table t1; | ||||||
|  | drop table t1; | ||||||
|  |  | ||||||
|  |  | ||||||
| # End of 4.1 tests | # End of 4.1 tests | ||||||
|   | |||||||
| @@ -6899,98 +6899,6 @@ static void test_prepare_grant() | |||||||
| } | } | ||||||
| #endif /* EMBEDDED_LIBRARY */ | #endif /* EMBEDDED_LIBRARY */ | ||||||
|  |  | ||||||
| /* |  | ||||||
|   Test a crash when invalid/corrupted .frm is used in the |  | ||||||
|   SHOW TABLE STATUS |  | ||||||
|   bug #93 (reported by serg@mysql.com). |  | ||||||
| */ |  | ||||||
|  |  | ||||||
| static void test_frm_bug() |  | ||||||
| { |  | ||||||
|   MYSQL_STMT *stmt; |  | ||||||
|   MYSQL_BIND bind[2]; |  | ||||||
|   MYSQL_RES  *result; |  | ||||||
|   MYSQL_ROW  row; |  | ||||||
|   FILE       *test_file; |  | ||||||
|   char       data_dir[FN_REFLEN]; |  | ||||||
|   char       test_frm[FN_REFLEN]; |  | ||||||
|   int        rc; |  | ||||||
|  |  | ||||||
|   myheader("test_frm_bug"); |  | ||||||
|  |  | ||||||
|   mysql_autocommit(mysql, TRUE); |  | ||||||
|  |  | ||||||
|   rc= mysql_query(mysql, "drop table if exists test_frm_bug"); |  | ||||||
|   myquery(rc); |  | ||||||
|  |  | ||||||
|   rc= mysql_query(mysql, "flush tables"); |  | ||||||
|   myquery(rc); |  | ||||||
|  |  | ||||||
|   stmt= mysql_simple_prepare(mysql, "show variables like 'datadir'"); |  | ||||||
|   check_stmt(stmt); |  | ||||||
|  |  | ||||||
|   rc= mysql_stmt_execute(stmt); |  | ||||||
|   check_execute(stmt, rc); |  | ||||||
|  |  | ||||||
|   bind[0].buffer_type= MYSQL_TYPE_STRING; |  | ||||||
|   bind[0].buffer= data_dir; |  | ||||||
|   bind[0].buffer_length= FN_REFLEN; |  | ||||||
|   bind[0].is_null= 0; |  | ||||||
|   bind[0].length= 0; |  | ||||||
|   bind[1]= bind[0]; |  | ||||||
|  |  | ||||||
|   rc= mysql_stmt_bind_result(stmt, bind); |  | ||||||
|   check_execute(stmt, rc); |  | ||||||
|  |  | ||||||
|   rc= mysql_stmt_fetch(stmt); |  | ||||||
|   check_execute(stmt, rc); |  | ||||||
|  |  | ||||||
|   if (!opt_silent) |  | ||||||
|     fprintf(stdout, "\n data directory: %s", data_dir); |  | ||||||
|  |  | ||||||
|   rc= mysql_stmt_fetch(stmt); |  | ||||||
|   DIE_UNLESS(rc == MYSQL_NO_DATA); |  | ||||||
|  |  | ||||||
|   strxmov(test_frm, data_dir, "/", current_db, "/", "test_frm_bug.frm", NullS); |  | ||||||
|  |  | ||||||
|   if (!opt_silent) |  | ||||||
|     fprintf(stdout, "\n test_frm: %s", test_frm); |  | ||||||
|  |  | ||||||
|   if (!(test_file= my_fopen(test_frm, (int) (O_RDWR | O_CREAT), MYF(MY_WME)))) |  | ||||||
|   { |  | ||||||
|     fprintf(stdout, "\n ERROR: my_fopen failed for '%s'", test_frm); |  | ||||||
|     fprintf(stdout, "\n test cancelled"); |  | ||||||
|     exit(1); |  | ||||||
|   } |  | ||||||
|   if (!opt_silent) |  | ||||||
|     fprintf(test_file, "this is a junk file for test"); |  | ||||||
|  |  | ||||||
|   rc= mysql_query(mysql, "SHOW TABLE STATUS like 'test_frm_bug'"); |  | ||||||
|   myquery(rc); |  | ||||||
|  |  | ||||||
|   result= mysql_store_result(mysql); |  | ||||||
|   mytest(result);/* It can't be NULL */ |  | ||||||
|  |  | ||||||
|   rc= my_process_result_set(result); |  | ||||||
|   DIE_UNLESS(rc == 1); |  | ||||||
|  |  | ||||||
|   mysql_data_seek(result, 0); |  | ||||||
|  |  | ||||||
|   row= mysql_fetch_row(result); |  | ||||||
|   mytest(row); |  | ||||||
|  |  | ||||||
|   if (!opt_silent) |  | ||||||
|     fprintf(stdout, "\n Comment: %s", row[17]); |  | ||||||
|   DIE_UNLESS(row[17] != 0); |  | ||||||
|  |  | ||||||
|   mysql_free_result(result); |  | ||||||
|   mysql_stmt_close(stmt); |  | ||||||
|  |  | ||||||
|   my_fclose(test_file, MYF(0)); |  | ||||||
|   mysql_query(mysql, "drop table if exists test_frm_bug"); |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /* Test DECIMAL conversion */ | /* Test DECIMAL conversion */ | ||||||
|  |  | ||||||
| static void test_decimal_bug() | static void test_decimal_bug() | ||||||
| @@ -11976,7 +11884,6 @@ static struct my_tests_st my_tests[]= { | |||||||
| #ifndef EMBEDDED_LIBRARY | #ifndef EMBEDDED_LIBRARY | ||||||
|   { "test_prepare_grant", test_prepare_grant }, |   { "test_prepare_grant", test_prepare_grant }, | ||||||
| #endif | #endif | ||||||
|   { "test_frm_bug", test_frm_bug }, |  | ||||||
|   { "test_explain_bug", test_explain_bug }, |   { "test_explain_bug", test_explain_bug }, | ||||||
|   { "test_decimal_bug", test_decimal_bug }, |   { "test_decimal_bug", test_decimal_bug }, | ||||||
|   { "test_nstmts", test_nstmts }, |   { "test_nstmts", test_nstmts }, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user