Permalink
Browse files

fix: added test for move and fixed checkstyle errors

  • Loading branch information...
davecramer committed Apr 15, 2016
1 parent 72945b0 commit fc598512f7e2b89f6a026ef69d4c0225a44db060
Showing with 19 additions and 6 deletions.
  1. +19 −6 pgjdbc/src/test/java/org/postgresql/test/jdbc3/CompositeQueryParseTest.java
@@ -70,7 +70,7 @@ public void testMultipleTrailingSemicolons() {
public void testHasReturning() {
List<NativeQuery> queries = Parser.parseJdbcSql("insert into foo (a,b,c) values (?,?,?) returning a", true, true, false, true, true);
List<NativeQuery> queries = Parser.parseJdbcSql("insert into foo (a,b,c) values (?,?,?) RetuRning a", true, true, false, true, true);
NativeQuery query = queries.get(0);
assertTrue("The parser should find the word returning", query.command.isReturningKeywordPresent());
@@ -89,9 +89,8 @@ public void testHasReturning() {
}
public void testHasDelete()
{
List<NativeQuery> queries = Parser.parseJdbcSql("delete from foo where a=1", true, true, false, true, true);
public void testHasDelete() {
List<NativeQuery> queries = Parser.parseJdbcSql("DeLeTe from foo where a=1", true, true, false, true, true);
NativeQuery query = queries.get(0);
assertTrue("This is a delete command", query.command.getType() == DMLCommandType.DELETE);
@@ -100,15 +99,29 @@ public void testHasDelete()
assertFalse("This is not a delete command", query.command.getType() == DMLCommandType.DELETE);
}
public void testisMove() {
List<NativeQuery> queries = Parser.parseJdbcSql("MoVe NEXT FROM FOO", true, true, false, true, true);
NativeQuery query = queries.get(0);
assertTrue("This is a move command", query.command.getType() == DMLCommandType.MOVE);
queries = Parser.parseJdbcSql("update foo set (a=?,b=?,c=?)", true, true, false, true, true);
query = queries.get(0);
assertFalse("This is not a move command", query.command.getType() == DMLCommandType.MOVE);
}
public void testIsInsert() {
List<NativeQuery> queries = Parser.parseJdbcSql("insert into foo (a,b,c) values (?,?,?) returning a", true, true, false, true, true);
List<NativeQuery> queries = Parser.parseJdbcSql("InSeRt into foo (a,b,c) values (?,?,?) returning a", true, true, false, true, true);
NativeQuery query = queries.get(0);
assertTrue("This is an insert command", query.command.getType() == DMLCommandType.INSERT);
queries = Parser.parseJdbcSql("update foo set (a=?,b=?,c=?)", true, true, false, true, true);
query = queries.get(0);
assertFalse("This is not insert command", query.command.getType() == DMLCommandType.INSERT);
assertFalse("This is not an insert command", query.command.getType() == DMLCommandType.INSERT);
queries = Parser.parseJdbcSql("select 1 as insert", true, true, false, true, true);
query = queries.get(0);

0 comments on commit fc59851

Please sign in to comment.