| 1 |
############## mysql-test\t\local_infile_func.test ############################ |
| 2 |
# # |
| 3 |
# Variable Name: local_infile # |
| 4 |
# Scope: GLOBAL # |
| 5 |
# Access Type: Dynamic # |
| 6 |
# Data Type: Boolean # |
| 7 |
# Default Value: 1 # |
| 8 |
# Valid Values: # |
| 9 |
# # |
| 10 |
# # |
| 11 |
# Creation Date: 2008-03-08 # |
| 12 |
# Author: Rizwan Maredia # |
| 13 |
# # |
| 14 |
# Description: Test Cases of Dynamic System Variable "local_infile" # |
| 15 |
# that checks behavior of this variable # |
| 16 |
# # |
| 17 |
# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # |
| 18 |
# server-system-variables.html#option_mysqld_local_infile # |
| 19 |
# # |
| 20 |
################################################################################ |
| 21 |
|
| 22 |
--source include/not_embedded.inc |
| 23 |
|
| 24 |
--echo '#--------------------FN_DYNVARS_037_01-------------------------#' |
| 25 |
#################################################################### |
| 26 |
# Check if setting local_infile is changed in every new connection # |
| 27 |
#################################################################### |
| 28 |
|
| 29 |
SET @@global.local_infile = 0; |
| 30 |
|
| 31 |
# con1 will be default connection from now on |
| 32 |
connect (con1,localhost,root,,,,); |
| 33 |
connection con1; |
| 34 |
SELECT @@global.local_infile; |
| 35 |
SET @@global.local_infile = 1; |
| 36 |
|
| 37 |
connect (con2,localhost,root,,,,); |
| 38 |
connection con2; |
| 39 |
SELECT @@global.local_infile; |
| 40 |
disconnect con2; |
| 41 |
|
| 42 |
|
| 43 |
--echo '#--------------------FN_DYNVARS_037_02-------------------------#' |
| 44 |
###################################################### |
| 45 |
# Begin the functionality Testing of local_infile # |
| 46 |
###################################################### |
| 47 |
|
| 48 |
connection con1; |
| 49 |
|
| 50 |
#============================================================= |
| 51 |
--echo '-----Checking LOAD DATA when local_infile is 1-------' |
| 52 |
#============================================================= |
| 53 |
SET @@global.local_infile = 1; |
| 54 |
--disable_warnings |
| 55 |
DROP TABLE IF EXISTS t1; |
| 56 |
--enable_warnings |
| 57 |
|
| 58 |
create table t1(a int); |
| 59 |
|
| 60 |
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
| 61 |
eval LOAD DATA LOCAL INFILE |
| 62 |
'$MYSQLTEST_VARDIR/std_data/numbers.txt' INTO TABLE test.t1; |
| 63 |
|
| 64 |
SELECT count(*) from t1; |
| 65 |
|
| 66 |
#============================================================= |
| 67 |
--echo '-----Checking LOAD DATA when local_infile is 0-------' |
| 68 |
#============================================================= |
| 69 |
SET @@global.local_infile = 0; |
| 70 |
|
| 71 |
--disable_warnings |
| 72 |
DROP TABLE IF EXISTS t1; |
| 73 |
--enable_warnings |
| 74 |
create table t1(a int); |
| 75 |
|
| 76 |
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
| 77 |
--Error ER_LOAD_INFILE_CAPABILITY_DISABLED |
| 78 |
eval LOAD DATA LOCAL INFILE |
| 79 |
'$MYSQLTEST_VARDIR/std_data/numbers.txt' INTO TABLE test.t1; |
| 80 |
|
| 81 |
SELECT count(*) from t1; |
| 82 |
|
| 83 |
# clean up and restore |
| 84 |
DROP TABLE t1; |
| 85 |
SET @@global.local_infile = 1; |
| 86 |
###################################################### |
| 87 |
# Endo of functionality Testing for local_infile # |
| 88 |
###################################################### |