Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pr/131' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
rusher committed Jan 16, 2019
2 parents 71858d6 + 196b46c commit 0294357
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public enum DefaultOptions {
"Session timeout is defined by the wait_timeout "
+ "server variable. Setting interactiveClient to true will tell the server to use the interactive_timeout "
+ "server variable.", false),
DUMP_QUERY_ON_EXCEPTION("dumpQueriesOnException", Boolean.TRUE, "1.1.0",
DUMP_QUERY_ON_EXCEPTION("dumpQueriesOnException", Boolean.FALSE, "1.1.0",
"If set to 'true', an exception is thrown "
+ "during query execution containing a query string.", false),
USE_OLD_ALIAS_METADATA_BEHAVIOR("useOldAliasMetadataBehavior", Boolean.FALSE, "1.1.9",
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/mariadb/jdbc/internal/util/Options.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public class Options implements Cloneable {
public boolean createDatabaseIfNotExist;
public String serverTimezone;
public boolean nullCatalogMeansCurrent = true;
public boolean dumpQueriesOnException = true;
public boolean dumpQueriesOnException;
public boolean useOldAliasMetadataBehavior;
public boolean allowLocalInfile = true;
public boolean cachePrepStmts = true;
Expand Down
14 changes: 13 additions & 1 deletion src/test/java/org/mariadb/jdbc/DriverTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,7 @@ public void dumpQueryOnSyntaxException() {
assertTrue(sqle.getCause().getMessage().contains("Query is: " + syntacticallyWrongQuery));
}
}

/* Check that query contains SQL statement, if dumpQueryOnException is true */
@Test
public void dumpQueryOnException() throws Exception {
Expand All @@ -1166,6 +1166,18 @@ public void dumpQueryOnException() throws Exception {
}
}

/* Check that query does not contains SQL statement by default */
@Test
public void shouldNotDumpQueryOnExceptionByDefault() throws Exception {
String selectFromNonExistingTable = "select * from mango";
try {
Statement st = sharedConnection.createStatement();
st.execute(selectFromNonExistingTable);
} catch (SQLException sqle) {
assertFalse(sqle.getCause().getMessage().contains("Query is: " + selectFromNonExistingTable));
}
}

/* CONJ-14
* getUpdateCount(), getResultSet() should indicate "no more results" with
* (getUpdateCount() == -1 && getResultSet() == null)
Expand Down

0 comments on commit 0294357

Please sign in to comment.