| 1 |
|
| 2 |
--write_file $MYSQL_TMP_DIR/resultset.xpl |
| 3 |
-->import assert_messages.macro |
| 4 |
-->import assert_notices.macro |
| 5 |
-->import crud_insert.macro |
| 6 |
|
| 7 |
-->echo |
| 8 |
-->echo |
| 9 |
-->echo ## Test setup |
| 10 |
|
| 11 |
## |
| 12 |
## Execution of SQL through X Protocol can generate flow |
| 13 |
## described by following UML flow: |
| 14 |
## |
| 15 |
## ... |
| 16 |
## loop has more resultsets or not at end of fetch |
| 17 |
## group resultset |
| 18 |
## loop has more columns |
| 19 |
## server --> client: ColumnMetaData |
| 20 |
## end |
| 21 |
## loop has more rows |
| 22 |
## server --> client: Row |
| 23 |
## end |
| 24 |
## end |
| 25 |
## alt has more resultsets |
| 26 |
## server --> client: FetchDoneMoreResultsets |
| 27 |
## end |
| 28 |
## end |
| 29 |
## loop has more OUT-paramsets or not at end of fetch |
| 30 |
## server --> client: FetchDoneMoreOutParams |
| 31 |
## group resultset |
| 32 |
## loop has more columns |
| 33 |
## server --> client: ColumnMetaData |
| 34 |
## end |
| 35 |
## loop has more rows |
| 36 |
## server --> client: Row |
| 37 |
## end |
| 38 |
## end |
| 39 |
## end |
| 40 |
## alt at end of all resultsets |
| 41 |
## server --> client: FetchDone |
| 42 |
## else cursor is opened |
| 43 |
## server --> client: FetchSuspended |
| 44 |
## end |
| 45 |
## ... |
| 46 |
## |
| 47 |
## Following suite is going to ensure that all CRUD |
| 48 |
## executions work according to this flow. |
| 49 |
## |
| 50 |
|
| 51 |
## Test case description: |
| 52 |
-->echo |
| 53 |
-->echo |
| 54 |
-->echo ## I. Validate simple resultsets for CRUD messages |
| 55 |
-->echo # |
| 56 |
-->echo # 1. Assert resultset for CRUD-delete message |
| 57 |
-->echo # 2. Assert resultset for CRUD-update message |
| 58 |
-->echo # 3. Assert resultset for CRUD-create message (table with auto_inc column) |
| 59 |
-->echo # 4. Assert resultset for CRUD-create message (table without auto_inc column) |
| 60 |
-->echo # 5. Assert resultset for CRUD-read message |
| 61 |
-->echo |
| 62 |
-->echo ## II. Validate simple resultset with warnings |
| 63 |
-->echo # |
| 64 |
-->echo # 1. Assert one resultsets for select queries |
| 65 |
|
| 66 |
-->echo |
| 67 |
-->echo # |
| 68 |
-->echo # I.1 |
| 69 |
Mysqlx.Crud.Delete { |
| 70 |
collection { |
| 71 |
name: "xtable" |
| 72 |
} |
| 73 |
data_model: TABLE |
| 74 |
criteria { |
| 75 |
type: OPERATOR |
| 76 |
operator { |
| 77 |
name: "==" |
| 78 |
param { |
| 79 |
type: IDENT |
| 80 |
identifier { |
| 81 |
name: "prio" |
| 82 |
} |
| 83 |
} |
| 84 |
param { |
| 85 |
type: LITERAL |
| 86 |
literal { |
| 87 |
type: V_SINT |
| 88 |
v_signed_int: 3 |
| 89 |
} |
| 90 |
} |
| 91 |
} |
| 92 |
} |
| 93 |
} |
| 94 |
-->callmacro Assert_notice_session_state ROWS_AFFECTED v_unsigned_int:1 |
| 95 |
-->callmacro Assert_message Mysqlx.Sql.StmtExecuteOk |
| 96 |
|
| 97 |
-->echo |
| 98 |
-->echo # |
| 99 |
-->echo # I.2 |
| 100 |
Mysqlx.Crud.Update { |
| 101 |
collection { |
| 102 |
name: "xtable" |
| 103 |
} |
| 104 |
data_model: TABLE |
| 105 |
operation { |
| 106 |
source { |
| 107 |
name: "prio" |
| 108 |
} |
| 109 |
operation: SET |
| 110 |
value { |
| 111 |
type: OPERATOR |
| 112 |
operator { |
| 113 |
name: "-" |
| 114 |
param { |
| 115 |
type: IDENT |
| 116 |
identifier { |
| 117 |
name: "prio" |
| 118 |
} |
| 119 |
} |
| 120 |
param { |
| 121 |
type: LITERAL |
| 122 |
literal { |
| 123 |
type: V_SINT |
| 124 |
v_signed_int: 1 |
| 125 |
} |
| 126 |
} |
| 127 |
} |
| 128 |
} |
| 129 |
} |
| 130 |
} |
| 131 |
-->callmacro Assert_notice_session_state PRODUCED_MESSAGE type: V_STRING |
| 132 |
-->callmacro Assert_notice_session_state ROWS_AFFECTED v_unsigned_int:4 |
| 133 |
-->callmacro Assert_message Mysqlx.Sql.StmtExecuteOk |
| 134 |
|
| 135 |
-->echo |
| 136 |
-->echo # |
| 137 |
-->echo # I.3 |
| 138 |
Mysqlx.Crud.Insert { |
| 139 |
collection { |
| 140 |
name: "xtable" |
| 141 |
} |
| 142 |
data_model: TABLE |
| 143 |
row { |
| 144 |
field { |
| 145 |
type: LITERAL |
| 146 |
literal { |
| 147 |
type: V_STRING |
| 148 |
v_string { |
| 149 |
value: "sixth" |
| 150 |
} |
| 151 |
} |
| 152 |
} |
| 153 |
field { |
| 154 |
type: LITERAL |
| 155 |
literal { |
| 156 |
type: V_SINT |
| 157 |
v_signed_int: 3 |
| 158 |
} |
| 159 |
} |
| 160 |
} |
| 161 |
upsert: false |
| 162 |
} |
| 163 |
-->callmacro Assert_notice_session_state ROWS_AFFECTED v_unsigned_int:1 |
| 164 |
-->callmacro Assert_message Mysqlx.Sql.StmtExecuteOk |
| 165 |
|
| 166 |
-->echo |
| 167 |
-->echo # |
| 168 |
-->echo # I.4 |
| 169 |
Mysqlx.Crud.Insert { |
| 170 |
collection { |
| 171 |
name: "xtable_with_pk" |
| 172 |
} |
| 173 |
|
| 174 |
projection { |
| 175 |
name: "description" |
| 176 |
} |
| 177 |
|
| 178 |
data_model: TABLE |
| 179 |
row { |
| 180 |
field { |
| 181 |
type: LITERAL |
| 182 |
literal { |
| 183 |
type: V_STRING |
| 184 |
v_string { |
| 185 |
value: "test" |
| 186 |
} |
| 187 |
} |
| 188 |
} |
| 189 |
} |
| 190 |
upsert: false |
| 191 |
} |
| 192 |
-->callmacro Assert_notice_session_state ROWS_AFFECTED v_unsigned_int:1 |
| 193 |
-->callmacro Assert_notice_session_state GENERATED_INSERT_ID v_unsigned_int: 2 |
| 194 |
-->callmacro Assert_message Mysqlx.Sql.StmtExecuteOk |
| 195 |
|
| 196 |
-->echo |
| 197 |
-->echo # |
| 198 |
-->echo # I.5 |
| 199 |
Mysqlx.Crud.Find { |
| 200 |
collection { |
| 201 |
name: "xtable" |
| 202 |
} |
| 203 |
data_model: TABLE |
| 204 |
projection { |
| 205 |
alias:"prio" |
| 206 |
source { |
| 207 |
type: IDENT |
| 208 |
identifier { |
| 209 |
name: "prio" |
| 210 |
} |
| 211 |
} |
| 212 |
} |
| 213 |
} |
| 214 |
-->callmacro Assert_metadata SINT "prio" |
| 215 |
-->callmacro Assert_rows 5 |
| 216 |
-->callmacro Assert_message Mysqlx.Resultset.FetchDone |
| 217 |
-->callmacro Assert_message Mysqlx.Sql.StmtExecuteOk |
| 218 |
|
| 219 |
|
| 220 |
-->echo |
| 221 |
-->echo # |
| 222 |
-->echo # II.1 |
| 223 |
Mysqlx.Crud.Find { |
| 224 |
collection { |
| 225 |
name: "xtable" |
| 226 |
} |
| 227 |
data_model: TABLE |
| 228 |
projection { |
| 229 |
alias:"name" |
| 230 |
source { |
| 231 |
type: OPERATOR |
| 232 |
operator { |
| 233 |
name: "/" |
| 234 |
param { |
| 235 |
type: LITERAL |
| 236 |
literal { |
| 237 |
type: V_SINT |
| 238 |
v_signed_int: 1 |
| 239 |
} |
| 240 |
} |
| 241 |
param { |
| 242 |
type: IDENT |
| 243 |
identifier { |
| 244 |
name: "prio" |
| 245 |
} |
| 246 |
} |
| 247 |
} |
| 248 |
} |
| 249 |
} |
| 250 |
} |
| 251 |
-->callmacro Assert_metadata DECIMAL "name" |
| 252 |
-->callmacro Assert_rows 5 |
| 253 |
-->callmacro Assert_message Mysqlx.Resultset.FetchDone |
| 254 |
## ER_DIVISION_BY_ZERO == 1365 |
| 255 |
-->callmacro Assert_notice_warning WARNING 1365 |
| 256 |
-->callmacro Assert_notice_warning WARNING 1365 |
| 257 |
-->callmacro Assert_message Mysqlx.Sql.StmtExecuteOk |
| 258 |
|
| 259 |
EOF |
| 260 |
|
| 261 |
source sample_tables.inc; |