@Test public void testMySqlWithLastNullsSelectWithOrderByAscAndNullsFirstShouldBeEmulated() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" nulls first"; final String expected = "SELECT `product_id`\n" + "FROM `foodmart`.`product`\n" + "ORDER BY `product_id` IS NULL DESC, `product_id`"; sql(query).dialect(mySqlDialect(NullCollation.LAST)).ok(expected); }
@Test public void testMySqlWithFirstNullsSelectWithOrderByDescAndNullsFirstShouldNotBeEmulated() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" desc nulls first"; final String expected = "SELECT `product_id`\n" + "FROM `foodmart`.`product`\n" + "ORDER BY `product_id` DESC"; sql(query).dialect(mySqlDialect(NullCollation.FIRST)).ok(expected); }
@Test public void testMySqlWithFirstNullsSelectWithOrderByAscAndNullsLastShouldBeEmulated() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" nulls last"; final String expected = "SELECT `product_id`\n" + "FROM `foodmart`.`product`\n" + "ORDER BY `product_id` IS NULL, `product_id`"; sql(query).dialect(mySqlDialect(NullCollation.FIRST)).ok(expected); }
@Test public void testMySqlWithLastNullsSelectWithOrderByAscAndNullsLastShouldNotBeEmulated() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" nulls last"; final String expected = "SELECT `product_id`\n" + "FROM `foodmart`.`product`\n" + "ORDER BY `product_id`"; sql(query).dialect(mySqlDialect(NullCollation.LAST)).ok(expected); }
@Test public void testMySqlWithLastNullsSelectWithOrderByDescAndNullsFirstShouldBeEmulated() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" desc nulls first"; final String expected = "SELECT `product_id`\n" + "FROM `foodmart`.`product`\n" + "ORDER BY `product_id` IS NULL DESC, `product_id` DESC"; sql(query).dialect(mySqlDialect(NullCollation.LAST)).ok(expected); }
@Test public void testMySqlWithHighNullsSelectWithOrderByAscNullsLastAndNoEmulation() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" nulls last"; final String expected = "SELECT `product_id`\n" + "FROM `foodmart`.`product`\n" + "ORDER BY `product_id`"; sql(query).dialect(mySqlDialect(NullCollation.HIGH)).ok(expected); }
@Test public void testMySqlWithHighNullsSelectWithOrderByAscNullsFirstAndNullEmulation() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" nulls first"; final String expected = "SELECT `product_id`\n" + "FROM `foodmart`.`product`\n" + "ORDER BY `product_id` IS NULL DESC, `product_id`"; sql(query).dialect(mySqlDialect(NullCollation.HIGH)).ok(expected); }
@Test public void testMySqlWithHighNullsSelectWithOrderByAscNullsFirstAndNullEmulation() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" nulls first"; final String expected = "SELECT `product_id`\n" + "FROM `foodmart`.`product`\n" + "ORDER BY `product_id` IS NULL DESC, `product_id`"; sql(query).dialect(mySqlDialect(NullCollation.HIGH)).ok(expected); }
@Test public void testMySqlWithHighNullsSelectWithOrderByDescNullsLastAndNullEmulation() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" desc nulls last"; final String expected = "SELECT `product_id`\n" + "FROM `foodmart`.`product`\n" + "ORDER BY `product_id` IS NULL, `product_id` DESC"; sql(query).dialect(mySqlDialect(NullCollation.HIGH)).ok(expected); }
@Test public void testMySqlWithFirstNullsSelectWithOrderByDescAndNullsLastShouldBeEmulated() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" desc nulls last"; final String expected = "SELECT `product_id`\n" + "FROM `foodmart`.`product`\n" + "ORDER BY `product_id` IS NULL, `product_id` DESC"; sql(query).dialect(mySqlDialect(NullCollation.FIRST)).ok(expected); }
@Test public void testMySqlWithLastNullsSelectWithOrderByAscAndNullsLastShouldNotBeEmulated() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" nulls last"; final String expected = "SELECT `product_id`\n" + "FROM `foodmart`.`product`\n" + "ORDER BY `product_id`"; sql(query).dialect(mySqlDialect(NullCollation.LAST)).ok(expected); }
@Test public void testMySqlWithFirstNullsSelectWithOrderByDescAndNullsLastShouldBeEmulated() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" desc nulls last"; final String expected = "SELECT `product_id`\n" + "FROM `foodmart`.`product`\n" + "ORDER BY `product_id` IS NULL, `product_id` DESC"; sql(query).dialect(mySqlDialect(NullCollation.FIRST)).ok(expected); }
@Test public void testMySqlWithHighNullsSelectWithOrderByAscNullsLastAndNoEmulation() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" nulls last"; final String expected = "SELECT `product_id`\n" + "FROM `foodmart`.`product`\n" + "ORDER BY `product_id`"; sql(query).dialect(mySqlDialect(NullCollation.HIGH)).ok(expected); }
@Test public void testMySqlWithFirstNullsSelectWithOrderByDescAndNullsFirstShouldNotBeEmulated() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" desc nulls first"; final String expected = "SELECT `product_id`\n" + "FROM `foodmart`.`product`\n" + "ORDER BY `product_id` DESC"; sql(query).dialect(mySqlDialect(NullCollation.FIRST)).ok(expected); }
@Test public void testMySqlWithFirstNullsSelectWithOrderByAscAndNullsLastShouldBeEmulated() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" nulls last"; final String expected = "SELECT `product_id`\n" + "FROM `foodmart`.`product`\n" + "ORDER BY `product_id` IS NULL, `product_id`"; sql(query).dialect(mySqlDialect(NullCollation.FIRST)).ok(expected); }
@Test public void testMySqlWithLastNullsSelectWithOrderByDescAndNullsLastShouldNotBeEmulated() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" desc nulls last"; final String expected = "SELECT `product_id`\n" + "FROM `foodmart`.`product`\n" + "ORDER BY `product_id` DESC"; sql(query).dialect(mySqlDialect(NullCollation.LAST)).ok(expected); }
@Test public void testMySqlWithHighNullsSelectWithOrderByDescNullsFirstAndNoEmulation() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" desc nulls first"; final String expected = "SELECT `product_id`\n" + "FROM `foodmart`.`product`\n" + "ORDER BY `product_id` DESC"; sql(query).dialect(mySqlDialect(NullCollation.HIGH)).ok(expected); }
@Test public void testMySqlWithLastNullsSelectWithOrderByDescAndNullsFirstShouldBeEmulated() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" desc nulls first"; final String expected = "SELECT `product_id`\n" + "FROM `foodmart`.`product`\n" + "ORDER BY `product_id` IS NULL DESC, `product_id` DESC"; sql(query).dialect(mySqlDialect(NullCollation.LAST)).ok(expected); }
@Test public void testMySqlWithLastNullsSelectWithOrderByAscAndNullsFirstShouldBeEmulated() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" nulls first"; final String expected = "SELECT `product_id`\n" + "FROM `foodmart`.`product`\n" + "ORDER BY `product_id` IS NULL DESC, `product_id`"; sql(query).dialect(mySqlDialect(NullCollation.LAST)).ok(expected); }
@Test public void testMySqlWithLastNullsSelectWithOrderByDescAndNullsLastShouldNotBeEmulated() { final String query = "select \"product_id\" from \"product\"\n" + "order by \"product_id\" desc nulls last"; final String expected = "SELECT `product_id`\n" + "FROM `foodmart`.`product`\n" + "ORDER BY `product_id` DESC"; sql(query).dialect(mySqlDialect(NullCollation.LAST)).ok(expected); }