2005-05-08 23:56:58 +02:00
|
|
|
disable_query_log;
|
|
|
|
-- source include/test_outfile.inc
|
|
|
|
eval set @tmpdir="$MYSQL_TEST_DIR/var/tmp";
|
|
|
|
enable_query_log;
|
|
|
|
-- source include/have_outfile.inc
|
2005-05-13 23:01:40 +02:00
|
|
|
|
2000-12-28 02:56:38 +01:00
|
|
|
#
|
|
|
|
# test of into outfile|dumpfile
|
|
|
|
#
|
|
|
|
|
2004-10-10 11:40:24 +02:00
|
|
|
--disable_warnings
|
|
|
|
drop table if exists t1;
|
|
|
|
--enable_warnings
|
|
|
|
|
2005-05-08 23:56:58 +02:00
|
|
|
create table t1 (`a` blob);
|
|
|
|
insert into t1 values("hello world"),("Hello mars"),(NULL);
|
|
|
|
disable_query_log;
|
|
|
|
eval select * into outfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.1" from t1;
|
|
|
|
enable_query_log;
|
|
|
|
select load_file(concat(@tmpdir,"/outfile-test.1"));
|
|
|
|
disable_query_log;
|
|
|
|
eval select * into dumpfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.2" from t1 limit 1;
|
|
|
|
enable_query_log;
|
|
|
|
select load_file(concat(@tmpdir,"/outfile-test.2"));
|
|
|
|
disable_query_log;
|
|
|
|
eval select * into dumpfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.3" from t1 where a is null;
|
|
|
|
enable_query_log;
|
|
|
|
select load_file(concat(@tmpdir,"/outfile-test.3"));
|
2000-12-28 02:56:38 +01:00
|
|
|
|
2005-05-08 23:56:58 +02:00
|
|
|
# the following should give errors
|
|
|
|
|
2005-05-09 09:33:45 +02:00
|
|
|
#disabled as error message has variable path
|
|
|
|
#disable_query_log;
|
|
|
|
#--error 1086
|
|
|
|
#eval select * into outfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.1" from t1;
|
|
|
|
#--error 1086
|
|
|
|
#eval select * into dumpfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.2" from t1;
|
|
|
|
#--error 1086
|
|
|
|
#eval select * into dumpfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.3" from t1;
|
|
|
|
#enable_query_log;
|
2005-05-08 23:56:58 +02:00
|
|
|
select load_file(concat(@tmpdir,"/outfile-test.not-exist"));
|
|
|
|
--exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.1
|
|
|
|
--exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.2
|
|
|
|
--exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.3
|
|
|
|
drop table t1;
|
|
|
|
|
|
|
|
# Bug#8191
|
|
|
|
disable_query_log;
|
|
|
|
eval select 1 into outfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.4";
|
|
|
|
enable_query_log;
|
|
|
|
select load_file(concat(@tmpdir,"/outfile-test.4"));
|
|
|
|
--exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.4
|
2004-10-10 11:40:24 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Bug #5382: 'explain select into outfile' crashes the server
|
|
|
|
#
|
|
|
|
|
|
|
|
CREATE TABLE t1 (a INT);
|
|
|
|
EXPLAIN
|
|
|
|
SELECT *
|
|
|
|
INTO OUTFILE '/tmp/t1.txt'
|
|
|
|
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
|
|
|
|
FROM t1;
|
|
|
|
DROP TABLE t1;
|