[teiid-commits] teiid SVN: r1530 - trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/api.
teiid-commits at lists.jboss.org
teiid-commits at lists.jboss.org
Wed Oct 14 19:40:04 EDT 2009
Author: vhalbert at redhat.com
Date: 2009-10-14 19:40:04 -0400 (Wed, 14 Oct 2009)
New Revision: 1530
Modified:
trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/api/AbstractQueryTest.java
Log:
Teiid 773 - refactored out the create statement calls so that an extending class can create a statement based on other parameters that connection.createStatement(...) can accept.
Modified: trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/api/AbstractQueryTest.java
===================================================================
--- trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/api/AbstractQueryTest.java 2009-10-06 15:20:35 UTC (rev 1529)
+++ trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/api/AbstractQueryTest.java 2009-10-14 23:40:04 UTC (rev 1530)
@@ -112,15 +112,15 @@
if (params != null && params.length > 0) {
if (sql.startsWith("exec ")) { //$NON-NLS-1$
sql = sql.substring(5);
- this.internalStatement = this.internalConnection.prepareCall("{?=call "+sql+"}"); //$NON-NLS-1$ //$NON-NLS-2$
+ this.internalStatement = createPrepareCallStatement(sql);
} else {
- this.internalStatement = this.internalConnection.prepareStatement(sql);
+ this.internalStatement = createPrepareStatement(sql);
}
setParameters((PreparedStatement)this.internalStatement, params);
assignExecutionProperties(this.internalStatement);
result = ((PreparedStatement)this.internalStatement).execute();
} else {
- this.internalStatement = this.internalConnection.createStatement();
+ this.internalStatement = createStatement();
assignExecutionProperties(this.internalStatement);
result = this.internalStatement.execute(sql);
}
@@ -138,6 +138,20 @@
}
return false;
}
+
+ protected Statement createPrepareCallStatement(String sql) throws SQLException{
+ return this.internalConnection.prepareCall("{?=call "+sql+"}");
+ }
+
+ protected Statement createPrepareStatement(String sql) throws SQLException{
+ return this.internalConnection.prepareStatement(sql);
+ }
+
+ protected Statement createStatement() throws SQLException{
+ return this.internalConnection.createStatement();
+ }
+
+
private void setParameters(PreparedStatement stmt, Object[] params) throws SQLException{
for (int i = 0; i < params.length; i++) {
@@ -163,7 +177,7 @@
}
}
- this.internalStatement = this.internalConnection.createStatement();
+ this.internalStatement = createStatement();
assignExecutionProperties(this.internalStatement);
if (timeout != -1) {
More information about the teiid-commits
mailing list