| 1 |
############# mysql-test\t\sql_notes_func.test ############################ |
| 2 |
# # |
| 3 |
# Variable Name: sql_notes # |
| 4 |
# Scope: SESSION # |
| 5 |
# Access Type: Dynamic # |
| 6 |
# Data Type: BOOLEAN # |
| 7 |
# Default Value: 1 TRUE # |
| 8 |
# Values: 1 TRUE, 0 FALSE # |
| 9 |
# # |
| 10 |
# # |
| 11 |
# Creation Date: 2008-02-25 # |
| 12 |
# Author: Sharique Abdullah # |
| 13 |
# # |
| 14 |
# Description: Test Cases of Dynamic System Variable "sql_notes" # |
| 15 |
# that checks behavior of this variable in the following ways# |
| 16 |
# * Functionality based on different values # |
| 17 |
# # |
| 18 |
# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html # |
| 19 |
# # |
| 20 |
########################################################################### |
| 21 |
|
| 22 |
# Due to suppressed warnings the pc-protocol is disabled |
| 23 |
--disable_ps_protocol |
| 24 |
|
| 25 |
--echo ** Setup ** |
| 26 |
--echo |
| 27 |
# |
| 28 |
# Setup |
| 29 |
# |
| 30 |
|
| 31 |
SET @default_sql_notes = @@sql_notes; |
| 32 |
|
| 33 |
--echo '#--------------------FN_DYNVARS_162_01-------------------------#' |
| 34 |
# |
| 35 |
# Value ON |
| 36 |
# |
| 37 |
|
| 38 |
SET SESSION sql_notes = ON; |
| 39 |
|
| 40 |
--echo creating a temporary table |
| 41 |
CREATE TEMPORARY TABLE t1(a varchar(20), b varchar(20)); |
| 42 |
--echo conditionally dropping the table twice so that a note generates |
| 43 |
|
| 44 |
DROP TABLE IF EXISTS t1; |
| 45 |
|
| 46 |
SELECT @@warning_count; |
| 47 |
--echo 0 Expected |
| 48 |
|
| 49 |
# |
| 50 |
#This line generates A Note warning |
| 51 |
# |
| 52 |
DROP TABLE IF EXISTS t1; |
| 53 |
|
| 54 |
SELECT @@warning_count; |
| 55 |
--echo 1 Expected |
| 56 |
|
| 57 |
--echo '#--------------------FN_DYNVARS_162_02-------------------------#' |
| 58 |
# |
| 59 |
# Value OFF |
| 60 |
# |
| 61 |
|
| 62 |
SET SESSION sql_notes = OFF; |
| 63 |
|
| 64 |
--echo creating a temporary table |
| 65 |
CREATE TEMPORARY TABLE t1(a varchar(20), b varchar(20)); |
| 66 |
--echo conditionally dropping the table twice so that a note generates |
| 67 |
|
| 68 |
DROP TABLE IF EXISTS t1; |
| 69 |
|
| 70 |
SELECT @@warning_count; |
| 71 |
--echo 0 Expected |
| 72 |
|
| 73 |
# |
| 74 |
#This line generates A Note warning |
| 75 |
# |
| 76 |
DROP TABLE IF EXISTS t1; |
| 77 |
|
| 78 |
SELECT @@warning_count; |
| 79 |
--echo 0 Expected |
| 80 |
|
| 81 |
--echo '#------------------FN_DYNVARS_162_03---------------------------#' |
| 82 |
# |
| 83 |
# Session data integrity check & GLOBAL Value check |
| 84 |
# |
| 85 |
|
| 86 |
--echo ** Connecting con_int1 using root ** |
| 87 |
connect (con_int1,localhost,root,,); |
| 88 |
|
| 89 |
--echo ** Connection con_int1 ** |
| 90 |
connection con_int1; |
| 91 |
SELECT @@SESSION.sql_notes; |
| 92 |
--echo 1 / TRUE Expected |
| 93 |
|
| 94 |
SET SESSION sql_notes = FALSE; |
| 95 |
|
| 96 |
--echo ** Connecting con_int2 using root ** |
| 97 |
connect (con_int2,localhost,root,,); |
| 98 |
|
| 99 |
--echo ** Connection con_int2 ** |
| 100 |
connection con_int2; |
| 101 |
SELECT @@SESSION.sql_notes; |
| 102 |
--echo 1 / TRUE Expected |
| 103 |
|
| 104 |
SET SESSION sql_notes = TRUE; |
| 105 |
|
| 106 |
--echo ** Connection con_int2 ** |
| 107 |
connection con_int2; |
| 108 |
SELECT @@SESSION.sql_notes; |
| 109 |
--echo 1 / TRUE Expected |
| 110 |
|
| 111 |
--echo ** Connection con_int1 ** |
| 112 |
connection con_int1; |
| 113 |
SELECT @@SESSION.sql_notes; |
| 114 |
--echo 0 / FALSE Expected |
| 115 |
|
| 116 |
--echo ** Connection default ** |
| 117 |
connection default; |
| 118 |
--echo Disconnecting Connections con_int1, con_int2 |
| 119 |
disconnect con_int1; |
| 120 |
disconnect con_int2; |
| 121 |
|
| 122 |
|
| 123 |
# |
| 124 |
# Cleanup |
| 125 |
# |
| 126 |
|
| 127 |
SET SESSION sql_notes = @default_sql_notes; |
| 128 |
|
| 129 |
--disable_warnings |
| 130 |
DROP TABLE IF EXISTS t1; |
| 131 |
--enable_warnings |
| 132 |
|
| 133 |
--enable_ps_protocol |
| 134 |
|