| 1 |
## generated |
| 2 |
## Rel: Find a valid row with projection |
| 3 |
|
| 4 |
--source include/xplugin_preamble.inc |
| 5 |
--source include/xplugin_create_user.inc |
| 6 |
|
| 7 |
create schema xtest default charset 'utf8mb4'; |
| 8 |
|
| 9 |
## Test starts here |
| 10 |
--write_file $MYSQL_TMP_DIR/find_table_find_rows_proj.xpl |
| 11 |
## Test data |
| 12 |
-->sql |
| 13 |
use xtest; |
| 14 |
CREATE TABLE `city` ( |
| 15 |
`ID` int(11) NOT NULL auto_increment, |
| 16 |
`Name` char(35) NOT NULL default '', |
| 17 |
`CountryCode` char(3) NOT NULL default '', |
| 18 |
`District` char(20) NOT NULL default '', |
| 19 |
`Population` int(11) NOT NULL default '0', |
| 20 |
PRIMARY KEY (`ID`) |
| 21 |
); |
| 22 |
INSERT INTO `city` VALUES (1,'Kabul','AFG','Kabol',1780000); |
| 23 |
INSERT INTO `city` VALUES (2,'Qandahar','AFG','Qandahar',237500); |
| 24 |
INSERT INTO `city` VALUES (3,'Herat','AFG','Herat',186800); |
| 25 |
INSERT INTO `city` VALUES (4,'Mazar-e-Sharif','AFG','Balkh',127800); |
| 26 |
INSERT INTO `city` VALUES (5,'Amsterdam','NLD','Noord-Holland',731200); |
| 27 |
INSERT INTO `city` VALUES (6,'Rotterdam','NLD','Zuid-Holland',593321); |
| 28 |
INSERT INTO `city` VALUES (7,'Haag','NLD','Zuid-Holland',440900); |
| 29 |
INSERT INTO `city` VALUES (8,'Utrecht','NLD','Utrecht',234323); |
| 30 |
INSERT INTO `city` VALUES (9,'Eindhoven','NLD','Noord-Brabant',201843); |
| 31 |
INSERT INTO `city` VALUES (10,'Tilburg','NLD','Noord-Brabant',193238); |
| 32 |
INSERT INTO `city` VALUES (11,'Groningen','NLD','Groningen',172701); |
| 33 |
INSERT INTO `city` VALUES (12,'Breda','NLD','Noord-Brabant',160398); |
| 34 |
INSERT INTO `city` VALUES (13,'Apeldoorn','NLD','Gelderland',153491); |
| 35 |
INSERT INTO `city` VALUES (14,'Nijmegen','NLD','Gelderland',152463); |
| 36 |
INSERT INTO `city` VALUES (15,'Enschede','NLD','Overijssel',149544); |
| 37 |
INSERT INTO `city` VALUES (16,'Haarlem','NLD','Noord-Holland',148772); |
| 38 |
-->endsql |
| 39 |
Mysqlx.Crud.Find { |
| 40 |
collection { |
| 41 |
name: "city" |
| 42 |
schema: "xtest" |
| 43 |
} |
| 44 |
data_model: TABLE |
| 45 |
projection { |
| 46 |
source { |
| 47 |
type: IDENT |
| 48 |
identifier { |
| 49 |
name: "Name" |
| 50 |
} |
| 51 |
} |
| 52 |
} |
| 53 |
projection { |
| 54 |
source { |
| 55 |
type: IDENT |
| 56 |
identifier { |
| 57 |
name: "Population" |
| 58 |
} |
| 59 |
} |
| 60 |
alias: "Pop" |
| 61 |
} |
| 62 |
criteria { |
| 63 |
type: OPERATOR |
| 64 |
operator { |
| 65 |
name: "<" |
| 66 |
param { |
| 67 |
type: IDENT |
| 68 |
identifier { |
| 69 |
name: "Population" |
| 70 |
} |
| 71 |
} |
| 72 |
param { |
| 73 |
type: LITERAL |
| 74 |
literal { |
| 75 |
type: V_SINT |
| 76 |
v_signed_int: 150000 |
| 77 |
} |
| 78 |
} |
| 79 |
} |
| 80 |
} |
| 81 |
} |
| 82 |
|
| 83 |
## expect Mysqlx.Resultset.ColumnMetaData |
| 84 |
-->recv |
| 85 |
## expect Mysqlx.Resultset.ColumnMetaData |
| 86 |
-->recv |
| 87 |
## expect Mysqlx.Resultset.Row |
| 88 |
-->recv |
| 89 |
## expect Mysqlx.Resultset.Row |
| 90 |
-->recv |
| 91 |
## expect Mysqlx.Resultset.Row |
| 92 |
-->recv |
| 93 |
## expect Mysqlx.Resultset.FetchDone |
| 94 |
-->recv |
| 95 |
## expect Mysqlx.Sql.StmtExecuteOk |
| 96 |
-->recv |
| 97 |
EOF |
| 98 |
|
| 99 |
--exec $MYSQLXTEST -ux_root --password='' --file=$MYSQL_TMP_DIR/find_table_find_rows_proj.xpl 2>&1 |
| 100 |
|
| 101 |
## Cleanup |
| 102 |
--source ../include/xplugin_cleanup.inc |