| 1 |
CREATE SCHEMA IF NOT EXISTS xtest; |
| 2 |
|
| 3 |
command ok |
| 4 |
|
| 5 |
## 1. Prepare malformed insert stmt (no schema) |
| 6 |
# a. Try to execute |
| 7 |
# b. Try to deallocate |
| 8 |
## 2. Prepare correct insert stmt (no placeholders) |
| 9 |
# a. Execute (no params) |
| 10 |
# b. Deallocate |
| 11 |
## 3. Prepare correct stmt (one placeholder) |
| 12 |
# a. Try to execute (no params) |
| 13 |
# b. Execute with param |
| 14 |
# c. Execute with params (one extra to ignore) |
| 15 |
# d. Deallocate |
| 16 |
## 4. Prepare correct stmt (two placeholders) |
| 17 |
# a. Execute with params |
| 18 |
# b. Deallocate |
| 19 |
## 5. Prepare correct stmt (two placeholders in expr) |
| 20 |
# a. Execute with params |
| 21 |
# b. Deallocate |
| 22 |
## 6. Prepare correct stmt (placeholder on _id) |
| 23 |
# a. Execute with param |
| 24 |
# b. Deallocate |
| 25 |
## 7. Prepare correct stmt with upsert (placeholder on "type" field) |
| 26 |
# a. Execute with param "dog" (insert - "dog") |
| 27 |
# b. Execute with param "cat" (update from "dog" to "cat") |
| 28 |
# c. Deallocate |
| 29 |
|
| 30 |
Stmt 1: Prepare malformed insert stmt (no schema) |
| 31 |
================================================= |
| 32 |
Got expected error: |
| 33 |
Mysqlx.Error { |
| 34 |
severity: ERROR |
| 35 |
code: 1049 |
| 36 |
msg: "Unknown database \'nonexistent\'" |
| 37 |
sql_state: "42000" |
| 38 |
} |
| 39 |
|
| 40 |
Verify [Status variable "Mysqlx_prep_prepare" needs to have a value of 1] |
| 41 |
|
| 42 |
Stmt 1.a. Try to execute |
| 43 |
======================== |
| 44 |
Got expected error: Statement with ID=1 was not prepared (code 5110) |
| 45 |
Verify [Status variable "Mysqlx_prep_execute" needs to have a value of 1] |
| 46 |
|
| 47 |
Stmt 1.b. Try to deallocate |
| 48 |
=========================== |
| 49 |
Got expected error: |
| 50 |
Mysqlx.Error { |
| 51 |
severity: ERROR |
| 52 |
code: 5110 |
| 53 |
msg: "Statement with ID=1 was not prepared" |
| 54 |
sql_state: "HY000" |
| 55 |
} |
| 56 |
|
| 57 |
Verify [Status variable "Mysqlx_prep_deallocate" needs to have a value of 1] |
| 58 |
|
| 59 |
Stmt 2: Prepare correct insert stmt (no placeholders) |
| 60 |
===================================================== |
| 61 |
RUN recvok |
| 62 |
Verify [Status variable "Mysqlx_prep_prepare" needs to have a value of 2] |
| 63 |
|
| 64 |
Stmt 2.a. Execute (no params) |
| 65 |
============================= |
| 66 |
|
| 67 |
1 rows affected |
| 68 |
auto-generated id(s): 0000XXXXXXXX0000000000000001 |
| 69 |
Verify ["SELECT count(*) as count FROM xtest.xcol WHERE doc->>'$.pupil' LIKE 'Alice%'" returns in "count" column, following value 1] |
| 70 |
Verify [Status variable "Mysqlx_prep_execute" needs to have a value of 2] |
| 71 |
|
| 72 |
Stmt 2.b.: Deallocate |
| 73 |
===================== |
| 74 |
RUN recvok |
| 75 |
|
| 76 |
Stmt 3: Prepare correct stmt (one placeholder) |
| 77 |
============================================== |
| 78 |
RUN recvok |
| 79 |
Verify [Status variable "Mysqlx_prep_prepare" needs to have a value of 3] |
| 80 |
|
| 81 |
Stmt 3.a. Try to execute (no params) |
| 82 |
==================================== |
| 83 |
Got expected error: There is no argument for statement placeholder at position: 0 (code 5134) |
| 84 |
Verify [Status variable "Mysqlx_prep_execute" needs to have a value of 3] |
| 85 |
|
| 86 |
Stmt 3.b. Execute with param |
| 87 |
============================ |
| 88 |
|
| 89 |
1 rows affected |
| 90 |
auto-generated id(s): 0000XXXXXXXX0000000000000002 |
| 91 |
Verify ["SELECT count(*) as count FROM xtest.xcol WHERE doc->>'$.pupil' LIKE 'Bob%'" returns in "count" column, following value 1] |
| 92 |
Verify [Status variable "Mysqlx_prep_execute" needs to have a value of 4] |
| 93 |
|
| 94 |
Stmt 3.c. Execute with params (one extra to ignore) |
| 95 |
=================================================== |
| 96 |
|
| 97 |
1 rows affected |
| 98 |
auto-generated id(s): 0000XXXXXXXX0000000000000003 |
| 99 |
Verify ["SELECT count(*) as count FROM xtest.xcol WHERE doc->>'$.pupil' LIKE 'Ch%'" returns in "count" column, following value 1] |
| 100 |
Verify [Status variable "Mysqlx_prep_execute" needs to have a value of 5] |
| 101 |
|
| 102 |
Stmt 3.d. Deallocate |
| 103 |
==================== |
| 104 |
RUN recvok |
| 105 |
Verify [Status variable "Mysqlx_prep_deallocate" needs to have a value of 3] |
| 106 |
|
| 107 |
Stmt 4: Prepare correct stmt (two placeholders) |
| 108 |
=============================================== |
| 109 |
RUN recvok |
| 110 |
Verify [Status variable "Mysqlx_prep_prepare" needs to have a value of 4] |
| 111 |
|
| 112 |
Stmt 4.a. Execute with params |
| 113 |
============================= |
| 114 |
|
| 115 |
2 rows affected |
| 116 |
auto-generated id(s): 0000XXXXXXXX0000000000000004 |
| 117 |
Records: 2 Duplicates: 0 Warnings: 0 |
| 118 |
Verify ["SELECT count(*) as count FROM xtest.xcol WHERE doc->>'$.pupil' LIKE 'David%'" returns in "count" column, following value 1] |
| 119 |
Verify ["SELECT count(*) as count FROM xtest.xcol WHERE doc->>'$.pupil' LIKE 'Eva%'" returns in "count" column, following value 1] |
| 120 |
Verify [Status variable "Mysqlx_prep_execute" needs to have a value of 6] |
| 121 |
|
| 122 |
Stmt 4.b. Deallocate |
| 123 |
==================== |
| 124 |
RUN recvok |
| 125 |
Verify [Status variable "Mysqlx_prep_deallocate" needs to have a value of 4] |
| 126 |
|
| 127 |
Stmt 5: Prepare correct stmt (two placeholders in expr) |
| 128 |
======================================================= |
| 129 |
RUN recvok |
| 130 |
Verify [Status variable "Mysqlx_prep_prepare" needs to have a value of 5] |
| 131 |
|
| 132 |
Stmt 5.a. Execute with params |
| 133 |
============================= |
| 134 |
Mysqlx.Notice.Frame { |
| 135 |
type: 3 |
| 136 |
scope: LOCAL |
| 137 |
payload: "Mysqlx.Notice.SessionStateChanged { param: ROWS_AFFECTED\nvalue {\n type: V_UINT\n v_unsigned_int: 1\n}\n }" |
| 138 |
} |
| 139 |
|
| 140 |
Mysqlx.Notice.Frame { |
| 141 |
type: 3 |
| 142 |
scope: LOCAL |
| 143 |
payload: "Mysqlx.Notice.SessionStateChanged { param: GENERATED_DOCUMENT_IDS\nvalue {\n type: V_OCTETS\n v_octets {\n value: \"0000XXXXXXXX0000000000000005\"\n }\n}\n }" |
| 144 |
} |
| 145 |
|
| 146 |
Mysqlx.Sql.StmtExecuteOk { |
| 147 |
} |
| 148 |
|
| 149 |
Verify ["SELECT count(*) as count FROM xtest.xcol WHERE doc->>'$.pupil' LIKE 'Felix%'" returns in "count" column, following value 1] |
| 150 |
Verify [Status variable "Mysqlx_prep_execute" needs to have a value of 7] |
| 151 |
|
| 152 |
Stmt 5.b. Deallocate |
| 153 |
==================== |
| 154 |
RUN recvok |
| 155 |
Verify [Status variable "Mysqlx_prep_deallocate" needs to have a value of 5] |
| 156 |
|
| 157 |
Stmt 6: Prepare correct stmt (placeholder on _id) |
| 158 |
================================================= |
| 159 |
RUN recvok |
| 160 |
Verify [Status variable "Mysqlx_prep_prepare" needs to have a value of 6] |
| 161 |
|
| 162 |
Stmt 6.a. Execute with params |
| 163 |
============================= |
| 164 |
Mysqlx.Notice.Frame { |
| 165 |
type: 3 |
| 166 |
scope: LOCAL |
| 167 |
payload: "Mysqlx.Notice.SessionStateChanged { param: ROWS_AFFECTED\nvalue {\n type: V_UINT\n v_unsigned_int: 1\n}\n }" |
| 168 |
} |
| 169 |
|
| 170 |
Mysqlx.Sql.StmtExecuteOk { |
| 171 |
} |
| 172 |
|
| 173 |
Verify ["SELECT count(*) as count FROM xtest.xcol WHERE doc->>'$.pupil' LIKE 'Felix%'" returns in "count" column, following value 1] |
| 174 |
Verify [Status variable "Mysqlx_prep_execute" needs to have a value of 8] |
| 175 |
|
| 176 |
Stmt 6.b. Deallocate |
| 177 |
==================== |
| 178 |
RUN recvok |
| 179 |
Verify [Status variable "Mysqlx_prep_deallocate" needs to have a value of 6] |
| 180 |
|
| 181 |
Stmt 7: Prepare correct stmt with upsert (placeholder on "type" field) |
| 182 |
====================================================================== |
| 183 |
RUN recvok |
| 184 |
Verify [Status variable "Mysqlx_prep_prepare" needs to have a value of 7] |
| 185 |
|
| 186 |
Stmt 7.a. Execute with param "dog" (insert - "dog") |
| 187 |
=================================================== |
| 188 |
Mysqlx.Notice.Frame { |
| 189 |
type: 3 |
| 190 |
scope: LOCAL |
| 191 |
payload: "Mysqlx.Notice.SessionStateChanged { param: ROWS_AFFECTED\nvalue {\n type: V_UINT\n v_unsigned_int: 1\n}\n }" |
| 192 |
} |
| 193 |
|
| 194 |
Mysqlx.Sql.StmtExecuteOk { |
| 195 |
} |
| 196 |
|
| 197 |
Verify [Status variable "Mysqlx_prep_execute" needs to have a value of 9] |
| 198 |
|
| 199 |
Stmt 7.b. Execute with param "cat" (update from "dog" to "cat") |
| 200 |
=============================================================== |
| 201 |
Mysqlx.Notice.Frame { |
| 202 |
type: 3 |
| 203 |
scope: LOCAL |
| 204 |
payload: "Mysqlx.Notice.SessionStateChanged { param: ROWS_AFFECTED\nvalue {\n type: V_UINT\n v_unsigned_int: 2\n}\n }" |
| 205 |
} |
| 206 |
|
| 207 |
Mysqlx.Sql.StmtExecuteOk { |
| 208 |
} |
| 209 |
|
| 210 |
Verify [Status variable "Mysqlx_prep_execute" needs to have a value of 10] |
| 211 |
|
| 212 |
Stmt 7.c. Deallocate |
| 213 |
==================== |
| 214 |
RUN recvok |
| 215 |
Verify [Status variable "Mysqlx_prep_deallocate" needs to have a value of 7] |
| 216 |
Mysqlx.Ok { |
| 217 |
msg: "bye!" |
| 218 |
} |
| 219 |
ok |