Added a parameter to allow forcing localTypesMode to on/off at runtime.
authorMarco Zanon <info@marcozanon.com>
Tue, 22 Aug 2017 22:18:21 +0000 (22:18 +0000)
committerMarco Zanon <info@marcozanon.com>
Tue, 22 Aug 2017 22:18:21 +0000 (22:18 +0000)
6.x/src/java/com/marcozanon/macaco/database/MDatabaseConnection.java

index 01e2489c21e2eb3a43b5367cbdff07aa128f0a05..5c05e2a575df4a53b742cee92a6ef832473f4def 100644 (file)
@@ -226,10 +226,14 @@ public class MDatabaseConnection extends MObject {
     /* Statements. */
 
     public MSqlStatementResults executePreparedStatement(String statement) throws MDatabaseConnectionFailureException, MSqlStatementException {
-        return this.executePreparedStatement(statement, new LinkedList<Object>());
+        return this.executePreparedStatement(statement, new LinkedList<Object>(), this.getLocalTypesMode());
     }
 
     public MSqlStatementResults executePreparedStatement(String statement, LinkedList<Object> parameters) throws MDatabaseConnectionFailureException, MSqlStatementException {
+        return this.executePreparedStatement(statement, parameters, this.getLocalTypesMode());
+    }
+
+    public MSqlStatementResults executePreparedStatement(String statement, LinkedList<Object> parameters, boolean localTypesMode) throws MDatabaseConnectionFailureException, MSqlStatementException {
         if (MText.isBlank(statement)) {
             throw new IllegalArgumentException("Invalid 'statement': null or empty.");
         }
@@ -254,7 +258,7 @@ public class MDatabaseConnection extends MObject {
             }
             // Execute the statement and parse the results.
             preparedStatement.execute();
-            results = new MSqlStatementResults(preparedStatement, this.getLocalTypesMode());
+            results = new MSqlStatementResults(preparedStatement, localTypesMode);
             this.logStatement(preparedStatement.toString());
         }
         catch (SQLException exception) {