|
| 1 | +###Relational |
| 2 | +Database showcase::simple::store::TestDatabase |
| 3 | +( |
| 4 | + Table INTDEMO0 |
| 5 | + ( |
| 6 | + LEFTARG INTEGER, |
| 7 | + RIGHTARG INTEGER |
| 8 | + ) |
| 9 | +) |
| 10 | + |
| 11 | + |
| 12 | +###Pure |
| 13 | +function demo::bitOr(): meta::pure::metamodel::relation::Relation<meta::pure::metamodel::type::Any>[*] |
| 14 | +{ |
| 15 | + #>{showcase::simple::store::TestDatabase.INTDEMO0}#->from( |
| 16 | + showcase::simple::connection::TestRuntime |
| 17 | + )->extend( |
| 18 | + ~[ |
| 19 | + bitOr: x|$x.LEFTARG->bitOr( |
| 20 | + $x.RIGHTARG |
| 21 | + ) |
| 22 | + ] |
| 23 | + ) |
| 24 | +} |
| 25 | + |
| 26 | +function demo::bitShiftLeft(): meta::pure::metamodel::relation::Relation<meta::pure::metamodel::type::Any>[*] |
| 27 | +{ |
| 28 | + #>{showcase::simple::store::TestDatabase.INTDEMO0}#->from( |
| 29 | + showcase::simple::connection::TestRuntime |
| 30 | + )->extend( |
| 31 | + ~[ |
| 32 | + bitShiftLeft: x|$x.LEFTARG->bitShiftLeft( |
| 33 | + $x.RIGHTARG |
| 34 | + ) |
| 35 | + ] |
| 36 | + ) |
| 37 | +} |
| 38 | + |
| 39 | +function demo::bitXor(): meta::pure::metamodel::relation::Relation<meta::pure::metamodel::type::Any>[*] |
| 40 | +{ |
| 41 | + #>{showcase::simple::store::TestDatabase.INTDEMO0}#->from( |
| 42 | + showcase::simple::connection::TestRuntime |
| 43 | + )->extend( |
| 44 | + ~[ |
| 45 | + bitXor: x|$x.LEFTARG->bitXor( |
| 46 | + $x.RIGHTARG |
| 47 | + ) |
| 48 | + ] |
| 49 | + ) |
| 50 | +} |
| 51 | + |
| 52 | +function demo::xor(): meta::pure::metamodel::relation::Relation<meta::pure::metamodel::type::Any>[*] |
| 53 | +{ |
| 54 | + #>{showcase::simple::store::TestDatabase.INTDEMO0}#->from( |
| 55 | + showcase::simple::connection::TestRuntime |
| 56 | + )->extend( |
| 57 | + ~[ |
| 58 | + LeftGreater: x|$x.LEFTARG > |
| 59 | + $x.RIGHTARG, |
| 60 | + RightGreater: x|$x.LEFTARG < |
| 61 | + $x.RIGHTARG |
| 62 | + ] |
| 63 | + )->extend( |
| 64 | + ~[ |
| 65 | + XOR: x|$x.LeftGreater->xor( |
| 66 | + $x.RightGreater |
| 67 | + ) |
| 68 | + ] |
| 69 | + ) |
| 70 | +} |
| 71 | + |
| 72 | +function demo::bitNot(): meta::pure::metamodel::relation::Relation<meta::pure::metamodel::type::Any>[*] |
| 73 | +{ |
| 74 | + #>{showcase::simple::store::TestDatabase.INTDEMO0}#->from( |
| 75 | + showcase::simple::connection::TestRuntime |
| 76 | + )->extend( |
| 77 | + ~[ |
| 78 | + bitNotLeft: x|$x.LEFTARG->bitNot(), |
| 79 | + bitNotRight: x|$x.RIGHTARG->bitNot() |
| 80 | + ] |
| 81 | + ) |
| 82 | +} |
| 83 | + |
| 84 | +function demo::bitShiftRight(): meta::pure::metamodel::relation::Relation<meta::pure::metamodel::type::Any>[*] |
| 85 | +{ |
| 86 | + #>{showcase::simple::store::TestDatabase.INTDEMO0}#->from( |
| 87 | + showcase::simple::connection::TestRuntime |
| 88 | + )->extend( |
| 89 | + ~[ |
| 90 | + bitShiftRight: x|$x.LEFTARG->bitShiftRight( |
| 91 | + $x.RIGHTARG |
| 92 | + ) |
| 93 | + ] |
| 94 | + ) |
| 95 | +} |
| 96 | + |
| 97 | +function demo::bitAnd(): meta::pure::metamodel::relation::Relation<meta::pure::metamodel::type::Any>[*] |
| 98 | +{ |
| 99 | + #>{showcase::simple::store::TestDatabase.INTDEMO0}#->from( |
| 100 | + showcase::simple::connection::TestRuntime |
| 101 | + )->extend( |
| 102 | + ~[ |
| 103 | + bitAnd: x|$x.LEFTARG->bitAnd( |
| 104 | + $x.RIGHTARG |
| 105 | + ) |
| 106 | + ] |
| 107 | + ) |
| 108 | +} |
| 109 | + |
| 110 | + |
| 111 | +###Connection |
| 112 | +RelationalDatabaseConnection showcase::simple::connection::TestConnection |
| 113 | +{ |
| 114 | + store: showcase::simple::store::TestDatabase; |
| 115 | + type: H2; |
| 116 | + specification: LocalH2 |
| 117 | + { |
| 118 | + testDataSetupSqls: [ |
| 119 | + '\nDrop table if exists INTDEMO0;\nCreate Table INTDEMO0(LEFTARG INTEGER, RIGHTARG INTEGER);\nInsert into INTDEMO0 (LEFTARG, RIGHTARG) values (1, 0);\nInsert into INTDEMO0 (LEFTARG, RIGHTARG) values (0, -1);\nInsert into INTDEMO0 (LEFTARG, RIGHTARG) values (-1, -1);\nInsert into INTDEMO0 (LEFTARG, RIGHTARG) values (1, 1);\n\n' |
| 120 | + ]; |
| 121 | + }; |
| 122 | + auth: DefaultH2; |
| 123 | +} |
| 124 | + |
| 125 | + |
| 126 | +###Runtime |
| 127 | +Runtime showcase::simple::connection::TestRuntime |
| 128 | +{ |
| 129 | + mappings: |
| 130 | + [ |
| 131 | + ]; |
| 132 | + connections: |
| 133 | + [ |
| 134 | + showcase::simple::store::TestDatabase: |
| 135 | + [ |
| 136 | + connection: showcase::simple::connection::TestConnection |
| 137 | + ] |
| 138 | + ]; |
| 139 | +} |
0 commit comments