| 1 |
## generated |
| 2 |
## Index of time related types |
| 3 |
|
| 4 |
--source include/xplugin_preamble.inc |
| 5 |
--source include/xplugin_create_user.inc |
| 6 |
## Test starts here |
| 7 |
CREATE SCHEMA xtest DEFAULT CHARSET 'utf8mb4'; |
| 8 |
|
| 9 |
--let $xtest_file_create= $MYSQL_TMP_DIR/admin_create_index_datetime_mysqlx.xpl |
| 10 |
--write_file $xtest_file_create |
| 11 |
-->quiet |
| 12 |
## Test data |
| 13 |
|
| 14 |
-->stmtadmin create_collection {"schema":"xtest", "name":"dt"} |
| 15 |
-->recvresult |
| 16 |
|
| 17 |
|
| 18 |
-->macro Insert %VALUE% |
| 19 |
Mysqlx.Crud.Insert { |
| 20 |
collection { |
| 21 |
name: "dt" |
| 22 |
schema: "xtest" |
| 23 |
} |
| 24 |
data_model: DOCUMENT |
| 25 |
row { |
| 26 |
field { |
| 27 |
type: LITERAL |
| 28 |
literal { |
| 29 |
type: V_STRING |
| 30 |
v_string { |
| 31 |
value: %VALUE% |
| 32 |
} |
| 33 |
} |
| 34 |
} |
| 35 |
} |
| 36 |
} |
| 37 |
-->recvresult |
| 38 |
-->endmacro |
| 39 |
|
| 40 |
|
| 41 |
-->macro Create_index %INDEX% %UNIQUE% %DOCUMENT_PATH% %TYPE% %REQUIRED% %ERROR% |
| 42 |
-->stmtadmin create_collection_index {"schema":"xtest", "collection":"dt", "name": %INDEX%, "unique": %UNIQUE%, "fields":{"field": %DOCUMENT_PATH%, "type": %TYPE%,"required": %REQUIRED%}} |
| 43 |
-->expecterror %ERROR% |
| 44 |
-->recvresult |
| 45 |
-->endmacro |
| 46 |
|
| 47 |
|
| 48 |
-->callmacro Insert '{"_id": "1", "data": {"datetime": "1976-02-25T01:12:34", "date":"2015-05-27", "time":"10:36:00"}}' |
| 49 |
-->callmacro Insert '{"_id": "2", "data": {"datetime": "2010-03-25T12:02:00", "date":"2014-05-27", "time":"11:36:00"}}' |
| 50 |
-->callmacro Insert '{"_id": "3", "data": {"datetime": "2013-04-05T03:00:34", "date":"2013-05-27", "time":"12:36:00"}}' |
| 51 |
-->callmacro Insert '{"_id": "4", "data": {"datetime": "1982-12-10T03:12:34", "date":"2012-05-27", "time":"13:36:00"}}' |
| 52 |
|
| 53 |
|
| 54 |
-->callmacro Create_index "datetime" false "$.data.datetime" "DATETIME" false 0 |
| 55 |
-->callmacro Create_index "time" false "$.data.time" "TIME" true 0 |
| 56 |
-->callmacro Create_index "date" true "$.data.date" "DATE" false 0 |
| 57 |
|
| 58 |
-->stmtsql SHOW INDEX FROM xtest.dt; |
| 59 |
-->recvresult Table Non_unique Key_name Column_name Null |
| 60 |
EOF |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
--let $xtest_file_drop= $MYSQL_TMP_DIR/admin_drop_index_datetime_mysqlx.xpl |
| 65 |
--write_file $xtest_file_drop |
| 66 |
-->quiet |
| 67 |
## Test data |
| 68 |
|
| 69 |
-->macro Drop_index %INDEX% %ERROR% |
| 70 |
-->stmtadmin drop_collection_index {"schema":"xtest", "collection":"dt", "name": %INDEX%} |
| 71 |
-->expecterror %ERROR% |
| 72 |
-->recvresult |
| 73 |
-->endmacro |
| 74 |
|
| 75 |
|
| 76 |
-->callmacro Drop_index "datetime" 0 |
| 77 |
-->callmacro Drop_index "time" 0 |
| 78 |
-->callmacro Drop_index "PRIMARY" 0 |
| 79 |
-->callmacro Drop_index "" 5013 |
| 80 |
-->callmacro Drop_index "timedate" 1091 |
| 81 |
|
| 82 |
-->stmtsql SHOW INDEX FROM xtest.dt; |
| 83 |
-->recvresult Table Non_unique Key_name Column_name Null |
| 84 |
EOF |
| 85 |
|
| 86 |
--exec $MYSQLXTEST -ux_root --password='' --file=$xtest_file_create 2>&1 |
| 87 |
--exec $MYSQLXTEST -ux_root --password='' --file=$xtest_file_drop 2>&1 |
| 88 |
|
| 89 |
## Cleanup |
| 90 |
--source ../include/xplugin_cleanup.inc |