| 1 |
# |
| 2 |
# Setup_Schema |
| 3 |
# |
| 4 |
-->macro Setup_Schema |
| 5 |
stmtsql DROP TABLE IF EXISTS xtest.xdoc; |
| 6 |
recvresult; |
| 7 |
stmtsql CREATE TABLE xtest.xdoc(doc JSON); |
| 8 |
recvresult; |
| 9 |
varlet %RESULT_PATCH_STRING% "bar"; |
| 10 |
varlet %RESULT_PATCH_NULL% null; |
| 11 |
varlet %RESULT_PATCH_ARRAY% ["c"]; |
| 12 |
varlet %RESULT_PATCH_ID% {"a": "foo", "_id": "foo"}; |
| 13 |
varlet %OBJECT% Table1; |
| 14 |
varlet %OBJECT_COLUMN% name: "doc"; |
| 15 |
-->endmacro |
| 16 |
|
| 17 |
|
| 18 |
# |
| 19 |
# Document_UpdatePatch_Find |
| 20 |
# |
| 21 |
-->macro Document_UpdatePatch_Find %ERROR% %DOC% %PATCH% %EXPECT% |
| 22 |
echo # Verification of JSON patch [%DOC% patch %PATCH% = %EXPECT%]; |
| 23 |
quiet; |
| 24 |
noquery_result; |
| 25 |
callmacro Crud_insert Table1 'xdoc' Row_octet '%DOC%'; |
| 26 |
callmacro Crud_update Table1 'xdoc' Op_octets |
| 27 |
name: "doc" MERGE_PATCH '%PATCH%'; |
| 28 |
callmacro Crud_find Table1 'xdoc'; |
| 29 |
callmacro Crud_delete Table1 'xdoc'; |
| 30 |
recvresult; |
| 31 |
expecterror %ERROR%; |
| 32 |
recvresult; |
| 33 |
recvtovar %RESULT%; |
| 34 |
recvresult; |
| 35 |
noquiet; |
| 36 |
query_result; |
| 37 |
assert_eq %EXPECT% %RESULT%; |
| 38 |
echo; |
| 39 |
-->endmacro |
| 40 |
|
| 41 |
|
| 42 |
# |
| 43 |
# Document_UpdatePatchObj_Find |
| 44 |
# |
| 45 |
-->macro Document_UpdatePatchObj_Find %ERROR% %DOC% %OBJ% %EXPECT% |
| 46 |
echo # Verification of JSON patch [%DOC% patch PROTOBUF_EXPR = %EXPECT%]; |
| 47 |
quiet; |
| 48 |
noquery_result; |
| 49 |
callmacro Crud_insert Table1 'xdoc' Row_octet '%DOC%'; |
| 50 |
callmacro Crud_update Table1 'xdoc' Op_object |
| 51 |
name: "doc" MERGE_PATCH %OBJ%; |
| 52 |
callmacro Crud_find Table1 'xdoc'; |
| 53 |
callmacro Crud_delete Table1 'xdoc'; |
| 54 |
recvresult; |
| 55 |
expecterror %ERROR%; |
| 56 |
recvresult; |
| 57 |
recvtovar %RESULT%; |
| 58 |
recvresult; |
| 59 |
noquiet; |
| 60 |
query_result; |
| 61 |
assert_eq %EXPECT% %RESULT%; |
| 62 |
echo; |
| 63 |
-->endmacro |
| 64 |
|
| 65 |
|
| 66 |
# |
| 67 |
# Document_OnlyTable_UpdatePatch_Find |
| 68 |
# |
| 69 |
-->macro Document_OnlyTable_UpdatePatch_Find %ERROR% %DOC% %PATCH% %EXPECT% |
| 70 |
-->callmacro Document_UpdatePatch_Find %ERROR% %DOC% %PATCH% %EXPECT% |
| 71 |
-->endmacro |
| 72 |
|
| 73 |
|
| 74 |
# |
| 75 |
# DocumentProtobuf_OnlyTable_UpdatePatch_Find |
| 76 |
# |
| 77 |
-->macro DocumentNull_OnlyTable_UpdatePatch_Find %ERROR% %PATCH% %EXPECT% |
| 78 |
echo # Verification of JSON patch [NULL patch %PATCH% = %EXPECT%]; |
| 79 |
quiet; |
| 80 |
noquery_result; |
| 81 |
callmacro Crud_insert Table1 'xdoc' Row_null; |
| 82 |
callmacro Crud_update Table1 'xdoc' Op_octets |
| 83 |
name: "doc" MERGE_PATCH '%PATCH%'; |
| 84 |
callmacro Crud_find Table1 'xdoc'; |
| 85 |
callmacro Crud_delete Table1 'xdoc'; |
| 86 |
recvresult; |
| 87 |
expecterror %ERROR%; |
| 88 |
recvresult; |
| 89 |
recvtovar %RESULT%; |
| 90 |
recvresult; |
| 91 |
noquiet; |
| 92 |
query_result; |
| 93 |
assert_eq %EXPECT% %RESULT%; |
| 94 |
echo; |
| 95 |
-->endmacro |