@Test public void testExplainUpsert() { final String sql = "explain plan for upsert into emps1 values (1, 2)"; final String expected = "EXPLAIN PLAN INCLUDING ATTRIBUTES" + " WITH IMPLEMENTATION FOR\n" + "UPSERT INTO `EMPS1`\n" + "VALUES (ROW(1, 2))"; if (isReserved("UPSERT")) { sql(sql).ok(expected); } }
@Test public void testUpsertSelect() { final String sql = "upsert into emps select * from emp as e"; final String expected = "UPSERT INTO `EMPS`\n" + "(SELECT *\n" + "FROM `EMP` AS `E`)"; if (isReserved("UPSERT")) { sql(sql).ok(expected); } }
@Test public void testNullIf() { checkExp( "nullif(v1,v2)", "(NULLIF(`V1`, `V2`))"); if (isReserved("NULLIF")) { checkExpFails( "1 + ^nullif^ + 3", "(?s)Encountered \"nullif \\+\" at line 1, column 5.*"); } }
@Test public void testUpsertValues() { final String expected = "UPSERT INTO `EMPS`\n" + "VALUES (ROW(1, 'Fredkin'))"; final String sql = "upsert into emps values (1,'Fredkin')"; if (isReserved("UPSERT")) { sql(sql) .ok(expected) .node(not(isDdl())); } }
"VALUES (ROW((`A` SIMILAR TO (`B` LIKE (`C` SIMILAR TO `D` ESCAPE `E`) ESCAPE `F`))))"); if (isReserved("ESCAPE")) { if (isReserved("ESCAPE")) { if (isReserved("ESCAPE")) { checkFails( "values a like b || c ^escape^ and false",