Debian Codegraph @

mysql-test/suite/x/t/macros/sample_tables.macro

raw
1 ## This include file contains following macros:
2 #
3 # * Create_table_xtbl_with_phrase_and_prio
4 # * Create_collection_coll_with_phrase_and_prio
5 #
6
7
8 -->macro Create_table_xtbl_with_phrase_and_prio
9 echo # Create table "xtbl" and fill it with data;
10 quiet;
11 noquery_result;
12 DROP TABLE IF EXISTS xtbl;
13 CREATE TABLE xtbl (phrase VARCHAR(30), prio INTEGER);
14 INSERT INTO xtbl (phrase, prio) VALUES ('Alice has a cat', 1);
15 INSERT INTO xtbl (phrase, prio) VALUES ('Bob has a dog 1', 2);
16 INSERT INTO xtbl (phrase, prio) VALUES ('Peppa has a teddy', 1);
17 INSERT INTO xtbl (phrase, prio) VALUES ('Bob has a dog 2', 3);
18 query_result;
19 noquiet;
20 -->endmacro
21
22
23 -->macro internal_coll_insert %ROW%
24 Mysqlx.Crud.Insert {
25 collection {
26 name: "coll"
27 schema: "xtest"
28 }
29 data_model: DOCUMENT
30 row {
31 field {
32 type: LITERAL
33 literal {
34 type: V_STRING
35 v_string {
36 value: "%ROW%"
37 }
38 }}
39 }
40 }
41 recvresult;
42 -->endmacro
43
44
45 -->macro Create_collection_coll_with_phrase_and_prio
46 quiet;
47 noquery_result;
48 DROP TABLE IF EXISTS coll;
49 echo # Create collection "coll" and fill it with data;
50 stmtadmin create_collection {"schema":"xtest","name":"coll"};
51 recvresult;
52 callmacro internal_coll_insert {\"foo\": \"Alice has a cat\", \"prio\": 1};
53 callmacro internal_coll_insert {\"foo\": \"Bob has a dog 1\", \"prio\": 2};
54 callmacro internal_coll_insert {\"foo\": \"Peppa has a teddy\", \"prio\": 1};
55 callmacro internal_coll_insert {\"foo\": \"Bob has a dog 2\", \"prio\": 3};
56 noquiet;
57 query_result;
58 -->endmacro