File tree Expand file tree Collapse file tree 6 files changed +39
-16
lines changed Expand file tree Collapse file tree 6 files changed +39
-16
lines changed Original file line number Diff line number Diff line change @@ -1051,18 +1051,20 @@ class Command
10511051 if (msg.get ())
10521052 {
10531053 bool failed = false ;
1054- if (msg->GetDescriptor ()->full_name () != " Mysqlx.Error" ||
1055- (uint32_t )ngs::stoi (args) != static_cast <Mysqlx::Error*>(msg.get ())->code ())
1056- {
1057- std::cout << error () << " Was expecting Error " << args <<" , but got:" << eoerr ();
1058- failed = true ;
1059- }
1060- else
1061- {
1062- std::cout << " Got expected error:\n " ;
1063- }
10641054 try
10651055 {
1056+ const int expected_error_code = mysqlxtest::get_error_code_by_text (args);
1057+ if (msg->GetDescriptor ()->full_name () != " Mysqlx.Error" ||
1058+ expected_error_code != (int )static_cast <Mysqlx::Error*>(msg.get ())->code ())
1059+ {
1060+ std::cout << error () << " Was expecting Error " << args <<" , but got:" << eoerr ();
1061+ failed = true ;
1062+ }
1063+ else
1064+ {
1065+ std::cout << " Got expected error:\n " ;
1066+ }
1067+
10661068 std::cout << message_to_text (*msg) << " \n " ;
10671069 if (failed && OPT_fatal_errors)
10681070 return Stop_with_success;
Original file line number Diff line number Diff line change @@ -261,7 +261,7 @@ message ModifyView {
261261 optional ViewCheckOption check = 5 ;
262262
263263 repeated string column = 6 ;
264- required Find stmt = 7 ;
264+ optional Find stmt = 7 ;
265265}
266266
267267
Original file line number Diff line number Diff line change @@ -23,6 +23,9 @@ namespace xpl {
2323
2424template <typename M>
2525void View_statement_builder::build_common (const M &msg) const {
26+ if (!msg.has_stmt ())
27+ throw ngs::Error_code (ER_X_INVALID_ARGUMENT, " The field that defines the select statement is required" );
28+
2629 if (msg.has_algorithm ()) add_algorithm (msg.algorithm ());
2730 if (msg.has_definer ()) add_definer (msg.definer ());
2831 if (msg.has_security ()) add_sql_security (msg.security ());
Original file line number Diff line number Diff line change @@ -9,6 +9,17 @@ SHOW CREATE VIEW xtest.xview;
99View Create View character_set_client collation_connection
1010xview CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `xtest`.`xview` AS select `xtest`.`xtable`.`first` AS `first` from `xtest`.`xtable` latin1 latin1_swedish_ci
1111
12+ Modify view (missing stmt)
13+ --------------------------
14+ Got expected error:
15+ Mysqlx.Error {
16+ severity: ERROR
17+ code: 5012
18+ msg: "The field that defines the select statement is required"
19+ sql_state: "HY000"
20+ }
21+
22+
1223Modify view (stmt)
1324------------------
1425Mysqlx.Ok {
@@ -103,7 +114,7 @@ View Create View character_set_client collation_connection
103114xview CREATE ALGORITHM=MERGE DEFINER=`xuser`@`localhost` SQL SECURITY DEFINER VIEW `xtest`.`xview` AS select `xtest`.`xtable`.`second` AS `third` from `xtest`.`xtable` utf8mb4 utf8mb4_general_ci
1041150 rows affected
105116Variable_name Value
106- Mysqlx_crud_modify_view 10
117+ Mysqlx_crud_modify_view 11
1071180 rows affected
108119Mysqlx.Ok {
109120 msg: "bye!"
Original file line number Diff line number Diff line change @@ -28,6 +28,12 @@ SHOW CREATE VIEW xtest.xview
2828-->endsql
2929-->endmacro
3030
31+ -->title -Modify view (missing stmt)
32+ Mysqlx.Crud.ModifyView {
33+ collection { name: "xview" schema: "xtest" }
34+ algorithm: TEMPTABLE
35+ }
36+ -->recverror ER_X_INVALID_ARGUMENT
3137
3238-->title -Modify view (stmt)
3339-->callmacro Modify_view second doc # Mysqlx.Ok
@@ -83,7 +89,7 @@ SHOW CREATE VIEW xtest.xview;
8389--exec $MYSQLXTEST -uroot --password='' --file=$xtest_file 2>&1
8490
8591--let $assert_text= Global status of 'Mysqlx_crud_modify_view'
86- --let $assert_cond= [SHOW GLOBAL STATUS LIKE \'Mysqlx_crud_modify_view\', Value, 1] = 10
92+ --let $assert_cond= [SHOW GLOBAL STATUS LIKE \'Mysqlx_crud_modify_view\', Value, 1] = 11
8793--source include/assert.inc
8894
8995
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ Mysqlx.Crud.CreateView {
3636 }
3737}
3838-->recvuntil Mysqlx.Ok
39+
3940-->sql
4041SHOW CREATE VIEW xtest.view_c;
4142-->endsql
@@ -53,7 +54,7 @@ Mysqlx.Crud.ModifyView {
5354 }
5455 }
5556}
56- -->recverror 1368
57+ -->recverror ER_VIEW_NONUPD_CHECK
5758
5859
5960-->title -Run select query on view.
@@ -87,7 +88,7 @@ Mysqlx.Crud.Find {
8788 collection { name: "view_d" schema: "xtest"}
8889 data_model: DOCUMENT
8990}
90- -->recverror 1356
91+ -->recverror ER_VIEW_INVALID
9192
9293
9394-->title -Error on create view for non privilege user
@@ -99,7 +100,7 @@ Mysqlx.Crud.CreateView {
99100 data_model: TABLE
100101 }
101102}
102- -->recverror 1142
103+ -->recverror ER_TABLEACCESS_DENIED_ERROR
103104-->closesession
104105
105106
You can’t perform that action at this time.
0 commit comments