mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
client/mysqltest.c
generate a bigger reject file ( full in most cases) if the master result file is 0 length sql/sql_show.cc fixed 3 bugs in SHOW CREATE TABLE New test case shw000001 for SHOW CREATE TABLE bugs BitKeeper/etc/ignore: Added BitKeeper/tmp/bkOF1wtJ scripts/mysqldumpslow to the ignore list client/mysqltest.c: generate a bigger reject file ( full in most cases) if the master result file is 0 length sql/sql_show.cc: fixed 3 bugs in SHOW CREATE TABLE
This commit is contained in:
@ -274,3 +274,5 @@ mysql-test/var/slave-data/test/choo.frm
|
||||
mysql-test/var/slave-data/test/choo.MYD
|
||||
mysql-test/var/slave-data/test/choo.MYI
|
||||
mysql-test/var/tmp/README
|
||||
BitKeeper/tmp/bkOF1wtJ
|
||||
scripts/mysqldumpslow
|
||||
|
@ -45,7 +45,7 @@
|
||||
#define PAD_SIZE 128
|
||||
#define MAX_CONS 1024
|
||||
#define MAX_INCLUDE_DEPTH 16
|
||||
|
||||
#define LAZY_GUESS_BUF_SIZE 8192
|
||||
|
||||
int record = 0, verbose = 0, silent = 0;
|
||||
const char* record_mode = "r";
|
||||
@ -615,7 +615,7 @@ int run_query(MYSQL* mysql, struct query* q)
|
||||
unsigned long* lengths;
|
||||
char* val;
|
||||
int len;
|
||||
|
||||
int guess_result_size;
|
||||
|
||||
if(q->record_file[0])
|
||||
{
|
||||
@ -625,10 +625,29 @@ int run_query(MYSQL* mysql, struct query* q)
|
||||
{
|
||||
if(stat(q->record_file, &info))
|
||||
die("Error %d on stat of record file '%s'", errno, q->record_file);
|
||||
/* let the developer be lazy and generate a .reject file
|
||||
* by touching the the result file and running the test
|
||||
* in that case, we need a buffer large enough to hold the
|
||||
* entire rejected result
|
||||
*/
|
||||
guess_result_size = (info.st_size ? info.st_size :
|
||||
LAZY_GUESS_BUF_SIZE) + PAD_SIZE;
|
||||
/* if we guess wrong, the result will be truncated */
|
||||
/* if the master result file is 0 length, the developer */
|
||||
/* wants to generate reject file, edit it, and then move into
|
||||
* the master result location - in this case we should just
|
||||
* allocate a buffer that is large enough for the kind of result
|
||||
* that a human would want to examine - hope 8 K is enough
|
||||
* if this is a real test, the result should be exactly the length
|
||||
* of the master file if it is correct. If it is wrong and is
|
||||
* longer, we should be able to tell what is wrong by looking
|
||||
* at the first "correct" number of bytes
|
||||
*/
|
||||
if(!(p_res_buf = res_buf =
|
||||
(char*)malloc(info.st_size + PAD_SIZE)))
|
||||
die("malloc() failed trying to allocate %d bytes", info.st_size);
|
||||
res_buf_end = res_buf + info.st_size + PAD_SIZE;
|
||||
(char*)malloc(guess_result_size)))
|
||||
die("malloc() failed trying to allocate %d bytes",
|
||||
guess_result_size);
|
||||
res_buf_end = res_buf + guess_result_size;;
|
||||
}
|
||||
}
|
||||
|
||||
|
5
mysql-test/r/3.23/shw000001.result
Normal file
5
mysql-test/r/3.23/shw000001.result
Normal file
@ -0,0 +1,5 @@
|
||||
Table Create Table
|
||||
test CREATE TABLE `test` (
|
||||
`test_set` set('val1','val2','val3') NOT NULL default '',
|
||||
`name` char(20) default 'O''Brien'
|
||||
) TYPE=MyISAM COMMENT='it''s a table'
|
7
mysql-test/t/3.23/shw000001.test
Normal file
7
mysql-test/t/3.23/shw000001.test
Normal file
@ -0,0 +1,7 @@
|
||||
use test;
|
||||
drop table if exists test;
|
||||
create table test (
|
||||
test_set set( 'val1', 'val2', 'val3' ) not null default '',
|
||||
name char(20) default 'O''Brien'
|
||||
) comment = 'it\'s a table' ;
|
||||
@r/3.23/shw000001.result show create table test ;
|
@ -732,7 +732,8 @@ store_create_info(THD *thd, TABLE *table, String *packet)
|
||||
type.set(tmp,sizeof(tmp));
|
||||
field->val_str(&type,&type);
|
||||
packet->append('\'');
|
||||
packet->append(type.ptr(),type.length());
|
||||
if(type.length())
|
||||
append_unescaped(packet, type.c_ptr());
|
||||
packet->append('\'');
|
||||
}
|
||||
else if (field->maybe_null())
|
||||
@ -818,6 +819,12 @@ store_create_info(THD *thd, TABLE *table, String *packet)
|
||||
packet->append(" CHECKSUM=1", 11);
|
||||
if (table->db_create_options & HA_OPTION_DELAY_KEY_WRITE)
|
||||
packet->append(" DELAY_KEY_WRITE=1",18);
|
||||
if(table->comment)
|
||||
{
|
||||
packet->append(" COMMENT='", 10);
|
||||
append_unescaped(packet, table->comment);
|
||||
packet->append('\'');
|
||||
}
|
||||
|
||||
|
||||
DBUG_RETURN(0);
|
||||
|
Reference in New Issue
Block a user