summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2003-02-12 21:55:37 +0200
committerunknown <monty@mashka.mysql.fi>2003-02-12 21:55:37 +0200
commitfcb61f5917ee69bba91bd6a926db2eab4ac3eeb5 (patch)
tree3ac37e452f15c8f05e9d1f338a6050281f838048 /mysql-test
parent363fd89b92de2fc58e7910f7a27684308656ebda (diff)
downloadmariadb-git-fcb61f5917ee69bba91bd6a926db2eab4ac3eeb5.tar.gz
Fixed a lot of wrong memory references as reported by valgrind
Portability fixes Added new client function: mysql_get_server_version() New server help code (From Victor Vagin) Fixed wrong usage of binary() Disabled RTREE usage for now. BitKeeper/etc/ignore: added scripts/fill_help_tables.sql client/mysql.cc: Some fixes when using 'help' cmd-line-utils/libedit/compat.h: Portability fix cmd-line-utils/libedit/fgetln.c: Portability fix include/mysql.h: Added new client function: mysql_get_server_version() libmysql/libmysql.c: Added new client function: mysql_get_server_version() libmysqld/libmysqld.c: Fixed prototype mysql-test/install_test_db.sh: Added creation of help tables mysql-test/r/connect.result: Added help tables mysql-test/r/myisam.result: Test of RTREE index mysql-test/r/type_ranges.result: updated results mysql-test/t/myisam.test: Test of RTREE index mysql-test/t/type_ranges.test: Updated test mysys/charset.c: Indentation change mysys/my_symlink.c: Removed compiler warning scripts/fill_help_tables.sh: Update for new help tables sql/field.cc: Indentation changes sql/filesort.cc: Optimized character set usage sql/item_cmpfunc.cc: Fix wrong usage of binary() sql/item_cmpfunc.h: Fix wrong usage of binary() sql/item_func.cc: Fix wrong usage of binary() sql/item_func.h: Fix wrong usage of binary() sql/item_strfunc.cc: Fix wrong usage of binary() sql/item_sum.cc: Fix wrong usage of binary() sql/item_sum.h: Fix wrong usage of binary() sql/key.cc: Indentation change sql/lex.h: HELP -> HELP_SYM sql/mysql_priv.h: Make get_field() more general sql/password.c: Indentation change + variable initialisation moved sql/sql_acl.cc: Make get_field() more general sql/sql_base.cc: Added comments + assertion for double call to mysql_lock_tables sql/sql_cache.cc: Indentation changes sql/sql_class.h: Added need_strxnfrm to SORT_FIELD to be able to optimise character set handling in filesort sql/sql_derived.cc: Renamed variables sql/sql_help.cc: New help functions (from Victor Vagin) sql/sql_lex.cc: Removed variables that doesn't have to be initialized for each query sql/sql_lex.h: Removed not used variable (olap) sql/sql_parse.cc: Fixed (not fatal) access of unitialized memory Indentation / code cleanup sql/sql_prepare.cc: Indentaion cleanup sql/sql_table.cc: Disabled RTREE until 5.0 sql/sql_udf.cc: Make get_field() more general sql/sql_yacc.yy: Removed access to uninitialized memory Always set offset_limit and select_limit when using LIMIT (removed warnings) Allow usage of 'help week' sql/table.cc: Make get_field() more general More comments sql/table.h: Fixded type of TABLE_LIST->derived sql/time.cc: Stricter date / datetime handling (to be able to handle timestamps with days and microseconds) strings/ctype-bin.c: Added cha
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/install_test_db.sh43
-rw-r--r--mysql-test/r/connect.result9
-rw-r--r--mysql-test/r/help.result123
-rw-r--r--mysql-test/r/myisam.result5
-rw-r--r--mysql-test/r/type_ranges.result2
-rw-r--r--mysql-test/t/help.test50
-rw-r--r--mysql-test/t/myisam.test9
-rw-r--r--mysql-test/t/type_ranges.test2
8 files changed, 241 insertions, 2 deletions
diff --git a/mysql-test/install_test_db.sh b/mysql-test/install_test_db.sh
index 990c763efc8..fc3e00d8501 100644
--- a/mysql-test/install_test_db.sh
+++ b/mysql-test/install_test_db.sh
@@ -66,6 +66,9 @@ c_h="" i_h=""
c_u="" i_u=""
c_f="" i_f=""
c_t="" c_c=""
+c_hl="" c_hl=""
+c_hc="" c_hc=""
+c_clr="" c_clr=""
# Check for old tables
if test ! -f $mdata/db.frm
@@ -207,6 +210,42 @@ then
c_c="$c_c comment='Column privileges';"
fi
+if test ! -f $mdata/help_topic.frm
+then
+ c_hl="$c_hl CREATE TABLE help_topic ("
+ c_hl="$c_hl help_topic_id int unsigned not null auto_increment,"
+ c_hl="$c_hl name varchar(64) not null,"
+ c_hl="$c_hl description text not null,"
+ c_hl="$c_hl example text not null,"
+ c_hl="$c_hl url varchar(128) not null,"
+ c_hl="$c_hl primary key (help_topic_id),"
+ c_hl="$c_hl unique index (name)"
+ c_hl="$c_hl )"
+ c_hl="$c_hl comment='help topics';"
+fi
+
+if test ! -f $mdata/help_category.frm
+then
+ c_clr="$c_clr CREATE TABLE help_category ("
+ c_clr="$c_clr help_category_id smallint unsigned not null auto_increment,"
+ c_clr="$c_clr name varchar(64) not null,"
+ c_clr="$c_clr url varchar(128) not null,"
+ c_clr="$c_clr primary key (help_category_id),"
+ c_clr="$c_clr unique index (name)"
+ c_clr="$c_clr )"
+ c_clr="$c_clr comment='help topics-categories relation';"
+fi
+
+if test ! -f $mdata/help_relation.frm
+then
+ c_hc="$c_hc CREATE TABLE help_relation ("
+ c_hc="$c_hc help_topic_id int unsigned not null references help_topic,"
+ c_hc="$c_hc help_category_id smallint unsigned not null references help_category,"
+ c_hc="$c_hc primary key (help_category_id, help_topic_id),"
+ c_hc="$c_hc )"
+ c_hc="$c_hc comment='categories of help topics';"
+fi
+
mysqld_boot=" $execdir/mysqld --no-defaults --bootstrap --skip-grant-tables \
--basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb $EXTRA_ARG"
echo "running $mysqld_boot"
@@ -227,6 +266,10 @@ $i_f
$c_t
$c_c
+
+$c_hl
+$c_hc
+$c_clr
END_OF_DATA
then
exit 0
diff --git a/mysql-test/r/connect.result b/mysql-test/r/connect.result
index 3e9091462d8..b7243ac5d0b 100644
--- a/mysql-test/r/connect.result
+++ b/mysql-test/r/connect.result
@@ -3,6 +3,9 @@ Tables_in_mysql
columns_priv
db
func
+help_category
+help_relation
+help_topic
host
tables_priv
user
@@ -15,6 +18,9 @@ Tables_in_mysql
columns_priv
db
func
+help_category
+help_relation
+help_topic
host
tables_priv
user
@@ -27,6 +33,9 @@ Tables_in_mysql
columns_priv
db
func
+help_category
+help_relation
+help_topic
host
tables_priv
user
diff --git a/mysql-test/r/help.result b/mysql-test/r/help.result
new file mode 100644
index 00000000000..4da4a84d4ad
--- /dev/null
+++ b/mysql-test/r/help.result
@@ -0,0 +1,123 @@
+truncate mysql.help_topic;
+truncate mysql.help_category;
+truncate mysql.help_relation;
+insert into mysql.help_topic(name,description,example)values('impossible_function_1','description of \n impossible_function1','example of \n impossible_function1');
+SELECT @topic1_id:=LAST_INSERT_ID();
+@topic1_id:=LAST_INSERT_ID()
+1
+insert into mysql.help_topic(name,description,example)values('impossible_function_2','description of \n impossible_function2','example of \n impossible_function2');
+SELECT @topic2_id:=LAST_INSERT_ID();
+@topic2_id:=LAST_INSERT_ID()
+2
+insert into mysql.help_topic(name,description,example)values('impossible_function_3','description of \n impossible_function3','example of \n impossible_function3');
+SELECT @topic3_id:=LAST_INSERT_ID();
+@topic3_id:=LAST_INSERT_ID()
+3
+insert into mysql.help_category(name)values('impossible_category_1');
+SELECT @category1_id:=LAST_INSERT_ID();
+@category1_id:=LAST_INSERT_ID()
+1
+insert into mysql.help_category(name)values('impossible_category_2');
+SELECT @category2_id:=LAST_INSERT_ID();
+@category2_id:=LAST_INSERT_ID()
+2
+insert into mysql.help_relation(help_category_id,help_topic_id)values(@category1_id,@topic1_id);
+insert into mysql.help_relation(help_category_id,help_topic_id)values(@category1_id,@topic2_id);
+insert into mysql.help_relation(help_category_id,help_topic_id)values(@category2_id,@topic2_id);
+insert into mysql.help_relation(help_category_id,help_topic_id)values(@category2_id,@topic3_id);
+help 'function_of_my_dream';
+Name Category
+impossible_category_1 Y
+impossible_category_2 Y
+help '%possible_f%';
+Name Category
+impossible_function_1 N
+impossible_function_2 N
+impossible_function_3 N
+help 'impossible_func%';
+Name Category
+impossible_function_1 N
+impossible_function_2 N
+impossible_function_3 N
+help 'impossible_category%';
+Name Category
+impossible_category_1 Y
+impossible_category_2 Y
+help 'impossible_%';
+Name Category
+impossible_function_1 N
+impossible_function_2 N
+impossible_function_3 N
+impossible_category_1 Y
+impossible_category_2 Y
+help '%function_2';
+Name Category Description Example
+impossible_function_2 N description of
+ impossible_function2 example of
+ impossible_function2
+help '%category_2';
+Name Category Description Example
+impossible_category_2 Y impossible_function_2
+impossible_function_3
+
+help 'impossible_function_1';
+Name Category Description Example
+impossible_function_1 N description of
+ impossible_function1 example of
+ impossible_function1
+help 'impossible_category_1';
+Name Category Description Example
+impossible_category_1 Y impossible_function_1
+impossible_function_2
+
+alter table mysql.help_topic type=innodb;
+alter table mysql.help_category type=innodb;
+alter table mysql.help_relation type=innodb;
+help 'function_of_my_dream';
+Name Category
+impossible_category_1 Y
+impossible_category_2 Y
+help '%ble_f%';
+Name Category
+impossible_function_1 N
+impossible_function_2 N
+impossible_function_3 N
+help 'impossible_func%';
+Name Category
+impossible_function_1 N
+impossible_function_2 N
+impossible_function_3 N
+help 'impossible_category%';
+Name Category
+impossible_category_1 Y
+impossible_category_2 Y
+help 'impossible_%';
+Name Category
+impossible_function_1 N
+impossible_function_2 N
+impossible_function_3 N
+impossible_category_1 Y
+impossible_category_2 Y
+help '%function_2';
+Name Category Description Example
+impossible_function_2 N description of
+ impossible_function2 example of
+ impossible_function2
+help '%category_2';
+Name Category Description Example
+impossible_category_2 Y impossible_function_2
+impossible_function_3
+
+help 'impossible_function_1';
+Name Category Description Example
+impossible_function_1 N description of
+ impossible_function1 example of
+ impossible_function1
+help 'impossible_category_1';
+Name Category Description Example
+impossible_category_1 Y impossible_function_1
+impossible_function_2
+
+alter table mysql.help_topic type=myisam;
+alter table mysql.help_category type=myisam;
+alter table mysql.help_relation type=myisam;
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
index 23610be36c4..c0914e23992 100644
--- a/mysql-test/r/myisam.result
+++ b/mysql-test/r/myisam.result
@@ -364,3 +364,8 @@ explain select * from t1 use index() where c=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
drop table t1,t2;
+CREATE TABLE t1 (`a` int(11) NOT NULL default '0', `b` int(11) NOT NULL default '0', UNIQUE KEY `a` USING RTREE (`a`,`b`)) TYPE=MyISAM;
+This version of MySQL doesn't yet support 'RTREE INDEX'
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
diff --git a/mysql-test/r/type_ranges.result b/mysql-test/r/type_ranges.result
index 19f1ac2b4d7..8215977ea39 100644
--- a/mysql-test/r/type_ranges.result
+++ b/mysql-test/r/type_ranges.result
@@ -85,7 +85,7 @@ CREATE INDEX test3 on t1 ( medium ) ;
DROP INDEX test ON t1;
insert into t1 values (10, 1,1,1,1,1,1,1,1,1,1,1,1,1,NULL,0,0,0,1,1,1,1,'one','one');
insert into t1 values (NULL,2,2,2,2,2,2,2,2,2,2,2,2,2,NULL,NULL,NULL,NULL,NULL,NULL,2,2,'two','two,one');
-insert into t1 values (0,1/3,3,3,3,3,3,3,3,3,3,3,3,3,NULL,'19970303','10:10:10','19970303 101010','','','','3',3,3);
+insert into t1 values (0,1/3,3,3,3,3,3,3,3,3,3,3,3,3,NULL,'19970303','10:10:10','19970303101010','','','','3',3,3);
insert into t1 values (0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,NULL,19970807,080706,19970403090807,-1,-1,-1,'-1',-1,-1);
insert into t1 values (0,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,NULL,0,0,0,-4294967295,-4294967295,-4294967295,'-4294967295',0,"one,two,tree");
insert into t1 values (0,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,NULL,0,0,0,4294967295,4294967295,4294967295,'4294967295',0,0);
diff --git a/mysql-test/t/help.test b/mysql-test/t/help.test
new file mode 100644
index 00000000000..c36b670c6b3
--- /dev/null
+++ b/mysql-test/t/help.test
@@ -0,0 +1,50 @@
+-- source include/have_innodb.inc
+
+truncate mysql.help_topic;
+truncate mysql.help_category;
+truncate mysql.help_relation;
+
+insert into mysql.help_topic(name,description,example)values('impossible_function_1','description of \n impossible_function1','example of \n impossible_function1');
+SELECT @topic1_id:=LAST_INSERT_ID();
+insert into mysql.help_topic(name,description,example)values('impossible_function_2','description of \n impossible_function2','example of \n impossible_function2');
+SELECT @topic2_id:=LAST_INSERT_ID();
+insert into mysql.help_topic(name,description,example)values('impossible_function_3','description of \n impossible_function3','example of \n impossible_function3');
+SELECT @topic3_id:=LAST_INSERT_ID();
+
+insert into mysql.help_category(name)values('impossible_category_1');
+SELECT @category1_id:=LAST_INSERT_ID();
+insert into mysql.help_category(name)values('impossible_category_2');
+SELECT @category2_id:=LAST_INSERT_ID();
+
+insert into mysql.help_relation(help_category_id,help_topic_id)values(@category1_id,@topic1_id);
+insert into mysql.help_relation(help_category_id,help_topic_id)values(@category1_id,@topic2_id);
+insert into mysql.help_relation(help_category_id,help_topic_id)values(@category2_id,@topic2_id);
+insert into mysql.help_relation(help_category_id,help_topic_id)values(@category2_id,@topic3_id);
+
+help 'function_of_my_dream';
+help '%possible_f%';
+help 'impossible_func%';
+help 'impossible_category%';
+help 'impossible_%';
+help '%function_2';
+help '%category_2';
+help 'impossible_function_1';
+help 'impossible_category_1';
+
+alter table mysql.help_topic type=innodb;
+alter table mysql.help_category type=innodb;
+alter table mysql.help_relation type=innodb;
+
+help 'function_of_my_dream';
+help '%ble_f%';
+help 'impossible_func%';
+help 'impossible_category%';
+help 'impossible_%';
+help '%function_2';
+help '%category_2';
+help 'impossible_function_1';
+help 'impossible_category_1';
+
+alter table mysql.help_topic type=myisam;
+alter table mysql.help_category type=myisam;
+alter table mysql.help_relation type=myisam;
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
index ed08b1cbacb..3cce93840e0 100644
--- a/mysql-test/t/myisam.test
+++ b/mysql-test/t/myisam.test
@@ -352,3 +352,12 @@ explain select * from t1 force index (a) where a=0 or a=2;
explain select * from t1 where c=1;
explain select * from t1 use index() where c=1;
drop table t1,t2;
+
+#
+# Test RTREE index
+#
+--error 1235
+CREATE TABLE t1 (`a` int(11) NOT NULL default '0', `b` int(11) NOT NULL default '0', UNIQUE KEY `a` USING RTREE (`a`,`b`)) TYPE=MyISAM;
+# INSERT INTO t1 VALUES (1,1),(1,1);
+# DELETE FROM rt WHERE a<1;
+DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/t/type_ranges.test b/mysql-test/t/type_ranges.test
index 53bfb063b2c..767012d0b34 100644
--- a/mysql-test/t/type_ranges.test
+++ b/mysql-test/t/type_ranges.test
@@ -55,7 +55,7 @@ DROP INDEX test ON t1;
insert into t1 values (10, 1,1,1,1,1,1,1,1,1,1,1,1,1,NULL,0,0,0,1,1,1,1,'one','one');
insert into t1 values (NULL,2,2,2,2,2,2,2,2,2,2,2,2,2,NULL,NULL,NULL,NULL,NULL,NULL,2,2,'two','two,one');
-insert into t1 values (0,1/3,3,3,3,3,3,3,3,3,3,3,3,3,NULL,'19970303','10:10:10','19970303 101010','','','','3',3,3);
+insert into t1 values (0,1/3,3,3,3,3,3,3,3,3,3,3,3,3,NULL,'19970303','10:10:10','19970303101010','','','','3',3,3);
insert into t1 values (0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,NULL,19970807,080706,19970403090807,-1,-1,-1,'-1',-1,-1);
insert into t1 values (0,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,NULL,0,0,0,-4294967295,-4294967295,-4294967295,'-4294967295',0,"one,two,tree");
insert into t1 values (0,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,NULL,0,0,0,4294967295,4294967295,4294967295,'4294967295',0,0);