Skip to content

Commit

Permalink
ulvi is never wrong it seems
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbae committed Jul 27, 2018
1 parent 4ffb9cb commit 2e80254
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2601,7 +2601,7 @@ private boolean checkAndRemoveCommentsAndSpace(boolean checkForSemicolon) {
}

if (localUserSQL.substring(0, 2).equalsIgnoreCase("--")) {
int temp = localUserSQL.indexOf("\n") + 2;
int temp = localUserSQL.indexOf("\n") + 1;
localUserSQL = localUserSQL.substring(temp);
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void testComments() throws Exception {
boolean.class, boolean.class, boolean.class);
method.setAccessible(true);

assertEquals((String) method.invoke(pstmt, false, false, false, false), "PeterTable");
assertEquals("PeterTable", (String) method.invoke(pstmt, false, false, false, false));
}
}

Expand All @@ -94,7 +94,7 @@ public void testBrackets() throws Exception {
boolean.class, boolean.class, boolean.class);
method.setAccessible(true);

assertEquals((String) method.invoke(pstmt, false, false, false, false), "[Peter[]]Table]");
assertEquals("[Peter[]]Table]", (String) method.invoke(pstmt, false, false, false, false));
}
}

Expand All @@ -113,7 +113,7 @@ public void testDoubleQuotes() throws Exception {
boolean.class, boolean.class, boolean.class);
method.setAccessible(true);

assertEquals((String) method.invoke(pstmt, false, false, false, false), "\"Peter\"\"\"\"Table\"");
assertEquals("\"Peter\"\"\"\"Table\"", (String) method.invoke(pstmt, false, false, false, false));
}
}

Expand Down Expand Up @@ -147,7 +147,7 @@ public void testAll() throws Exception {
columnListExpected.add("c4");

for (int i = 0; i < columnListExpected.size(); i++) {
assertEquals(columnList.get(i), columnListExpected.get(i));
assertEquals(columnListExpected.get(i), columnList.get(i));
}
}
}
Expand Down Expand Up @@ -197,7 +197,7 @@ public void testAllcolumns() throws Exception {

rs.next();
for (int i = 0; i < expected.length; i++) {
assertEquals(rs.getObject(i + 1).toString(), expected[i].toString());
assertEquals(expected[i].toString(), rs.getObject(i + 1).toString());
}
}
}
Expand Down Expand Up @@ -243,7 +243,7 @@ public void testMixColumns() throws Exception {
rs.next();
for (int i = 0; i < expected.length; i++) {
if (null != rs.getObject(i + 1)) {
assertEquals(rs.getObject(i + 1).toString(), expected[i].toString());
assertEquals(expected[i].toString(), rs.getObject(i + 1).toString());
}
}
}
Expand Down Expand Up @@ -287,7 +287,7 @@ public void testNullOrEmptyColumns() throws Exception {
rs.next();
for (int i = 0; i < expected.length; i++) {
if (null != rs.getObject(i + 1)) {
assertEquals(rs.getObject(i + 1), expected[i]);
assertEquals(expected[i], rs.getObject(i + 1));
}
}
}
Expand Down Expand Up @@ -326,7 +326,7 @@ public void testAllFilledColumns() throws Exception {

rs.next();
for (int i = 0; i < expected.length; i++) {
assertEquals(rs.getObject(i + 1), expected[i]);
assertEquals(expected[i], rs.getObject(i + 1));
}
}
}
Expand Down Expand Up @@ -354,7 +354,7 @@ public void testSquareBracketAgainstDB() throws Exception {
ResultSet rs = stmt.executeQuery("SELECT * FROM " + squareBracketTableName);
rs.next();

assertEquals(rs.getObject(1), 1);
assertEquals(1, rs.getObject(1));
}
}

Expand All @@ -381,7 +381,7 @@ public void testDoubleQuoteAgainstDB() throws Exception {
ResultSet rs = stmt.executeQuery("SELECT * FROM " + doubleQuoteTableName);
rs.next();

assertEquals(rs.getObject(1), 1);
assertEquals(1, rs.getObject(1));
}
}

Expand Down Expand Up @@ -410,7 +410,7 @@ public void testSchemaAgainstDB() throws Exception {
ResultSet rs = stmt.executeQuery("SELECT * FROM " + schemaTableName);
rs.next();

assertEquals(rs.getObject(1), 1);
assertEquals(1, rs.getObject(1));
}
}

Expand All @@ -437,7 +437,7 @@ public void testColumnNameMixAgainstDB() throws Exception {
ResultSet rs = stmt.executeQuery("SELECT * FROM " + squareBracketTableName);
rs.next();

assertEquals(rs.getObject(1), 1);
assertEquals(1, rs.getObject(1));
}
}

Expand Down Expand Up @@ -486,7 +486,7 @@ public void testAllColumnsLargeBatch() throws Exception {

rs.next();
for (int i = 0; i < expected.length; i++) {
assertEquals(rs.getObject(i + 1).toString(), expected[i].toString());
assertEquals(expected[i].toString(), rs.getObject(i + 1).toString());
}
}
}
Expand All @@ -511,7 +511,7 @@ public void testIllegalNumberOfArgNoColumnList() throws Exception {
pstmt.executeBatch();
throw new Exception("Test did not throw an exception when it was expected.");
} catch (BatchUpdateException e) {
assertEquals(e.getMessage(), "Column name or number of supplied values does not match table definition.");
assertEquals("Column name or number of supplied values does not match table definition.", e.getMessage());
}

invalid = "insert into " + tableName + " (c1, c2, c3) values (?, ?,? ,?) ";
Expand All @@ -532,8 +532,7 @@ public void testIllegalNumberOfArgNoColumnList() throws Exception {
pstmt.executeBatch();
throw new Exception("Test did not throw an exception when it was expected.");
} catch (BatchUpdateException e) {
assertEquals(e.getMessage(),
"There are fewer columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement.");
assertEquals("There are fewer columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement.", e.getMessage());
}
}

Expand All @@ -557,7 +556,7 @@ public void testNonParameterizedQuery() throws Exception {
pstmt.executeBatch();
throw new Exception("Test did not throw an exception when it was expected.");
} catch (BatchUpdateException e) {
assertEquals(e.getMessage(), "Incorrect syntax near the keyword 'table'.");
assertEquals("Incorrect syntax near the keyword 'table'.", e.getMessage());
}

invalid = "insert into " + tableName + " values ('?', ?,? ,?) ";
Expand All @@ -577,7 +576,7 @@ public void testNonParameterizedQuery() throws Exception {
pstmt.executeBatch();
throw new Exception("Test did not throw an exception when it was expected.");
} catch (BatchUpdateException e) {
assertEquals(e.getMessage(), "Column name or number of supplied values does not match table definition.");
assertEquals("Column name or number of supplied values does not match table definition.", e.getMessage());
}
}

Expand Down Expand Up @@ -612,10 +611,10 @@ public void testNonSupportedColumns() throws Exception {

ResultSet rs = stmt.executeQuery("SELECT * FROM " + unsupportedTableName);
rs.next();
assertEquals(Geometry.STGeomFromWKB((byte[]) rs.getObject(1)).toString(), g1.toString());
assertEquals(Geography.STGeomFromWKB((byte[]) rs.getObject(2)).toString(), g2.toString());
assertEquals(rs.getObject(3), myTimestamp);
assertEquals(rs.getObject(4), myTimestamp);
assertEquals(g1.toString(), Geometry.STGeomFromWKB((byte[]) rs.getObject(1)).toString());
assertEquals(g2.toString(), Geography.STGeomFromWKB((byte[]) rs.getObject(2)).toString());
assertEquals(myTimestamp, rs.getObject(3));
assertEquals(myTimestamp, rs.getObject(4));
}
}

Expand Down

0 comments on commit 2e80254

Please sign in to comment.