From 407ea16f9f8f6d3bd5135783d98b63c0e4704609 Mon Sep 17 00:00:00 2001 From: James Moger Date: Thu, 8 Dec 2011 14:27:23 -0500 Subject: Added alternative method signatures to avoid subtle varargs bugs --- src/com/iciql/Constants.java | 4 ++-- src/com/iciql/Db.java | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/com/iciql/Constants.java b/src/com/iciql/Constants.java index 5c1bfc0..37f0c2b 100644 --- a/src/com/iciql/Constants.java +++ b/src/com/iciql/Constants.java @@ -25,11 +25,11 @@ public class Constants { // The build script extracts this exact line so be careful editing it // and only use A-Z a-z 0-9 .-_ in the string. - public static final String VERSION = "0.7.3"; + public static final String VERSION = "0.7.4-SNAPSHOT"; // The build script extracts this exact line so be careful editing it // and only use A-Z a-z 0-9 .-_ in the string. - public static final String VERSION_DATE = "2011-12-06"; + public static final String VERSION_DATE = "PENDING"; // The build script extracts this exact line so be careful editing it // and only use A-Z a-z 0-9 .-_ in the string. diff --git a/src/com/iciql/Db.java b/src/com/iciql/Db.java index 05d7f46..e05ec56 100644 --- a/src/com/iciql/Db.java +++ b/src/com/iciql/Db.java @@ -448,6 +448,26 @@ public class Db { return (TableDefinition) classMap.get(clazz); } + + /** + * Run a SQL query directly against the database. + * + * Be sure to close the ResultSet with + * + *
+	 * JdbcUtils.closeSilently(rs, true);
+	 * 
+ * + * @param sql + * the SQL statement + * @param args + * optional object arguments for x=? tokens in query + * @return the result set + */ + public ResultSet executeQuery(String sql, List args) { + return executeQuery(sql, args.toArray()); + } + /** * Run a SQL query directly against the database. * @@ -480,6 +500,20 @@ public class Db { } } + /** + * Run a SQL query directly against the database and map the results to the + * model class. + * + * @param modelClass + * the model class to bind the query ResultSet rows into. + * @param sql + * the SQL statement + * @return the result set + */ + public List executeQuery(Class modelClass, String sql, List args) { + return executeQuery(modelClass, sql, args.toArray()); + } + /** * Run a SQL query directly against the database and map the results to the * model class. -- cgit v1.2.3