|
From: <pat...@us...> - 2010-01-27 22:42:10
|
Revision: 1030
http://cishell.svn.sourceforge.net/cishell/?rev=1030&view=rev
Author: pataphil
Date: 2010-01-27 22:42:02 +0000 (Wed, 27 Jan 2010)
Log Message:
-----------
* Added the createStatement() DatabaseUtilities.
Modified Paths:
--------------
trunk/core/org.cishell.utilities/src/org/cishell/utilities/DatabaseUtilities.java
Modified: trunk/core/org.cishell.utilities/src/org/cishell/utilities/DatabaseUtilities.java
===================================================================
--- trunk/core/org.cishell.utilities/src/org/cishell/utilities/DatabaseUtilities.java 2010-01-26 18:31:17 UTC (rev 1029)
+++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/DatabaseUtilities.java 2010-01-27 22:42:02 UTC (rev 1030)
@@ -2,6 +2,7 @@
import java.sql.Connection;
import java.sql.SQLException;
+import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -31,7 +32,44 @@
}
return connection;
}
- // TODO: I'd prefer something like createSQLInExpression
+
+ public static Statement createStatement(Connection connection, String messageIfError)
+ throws AlgorithmExecutionException {
+ try {
+ return connection.createStatement();
+ } catch (SQLException e) {
+ throw new AlgorithmExecutionException(messageIfError, e);
+ }
+ }
+
+ public static Statement createStatement(
+ Connection connection,
+ int resultSetType,
+ int resultSetConcurrency,
+ String messageIfError)
+ throws AlgorithmExecutionException {
+ try {
+ return connection.createStatement(resultSetType, resultSetConcurrency);
+ } catch (SQLException e) {
+ throw new AlgorithmExecutionException(messageIfError, e);
+ }
+ }
+
+ public static Statement createStatement(
+ Connection connection,
+ int resultSetType,
+ int resultSetConcurrency,
+ int resultSetHoldability,
+ String messageIfError)
+ throws AlgorithmExecutionException {
+ try {
+ return connection.createStatement(
+ resultSetType, resultSetConcurrency, resultSetHoldability);
+ } catch (SQLException e) {
+ throw new AlgorithmExecutionException(messageIfError, e);
+ }
+ }
+
public static String createSQLInExpression(List<String> columns, List<Map<String, Object>> valueMaps) {
String columnNames = implodeAndWrap(columns);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|