]> source.dussan.org Git - iciql.git/commitdiff
Added alternative method signatures to avoid subtle varargs bugs
authorJames Moger <james.moger@gmail.com>
Thu, 8 Dec 2011 19:27:23 +0000 (14:27 -0500)
committerJames Moger <james.moger@gmail.com>
Thu, 8 Dec 2011 19:27:23 +0000 (14:27 -0500)
docs/05_releases.mkd
src/com/iciql/Constants.java
src/com/iciql/Db.java

index abc8791396264f9474738459d9fa5dcd145d191f..9a7d13e98248ccd1f7c87e0e814509de920510f8 100644 (file)
@@ -6,14 +6,20 @@
 \r
 **%VERSION%** ([zip](http://code.google.com/p/iciql/downloads/detail?name=%ZIP%)|[jar](http://code.google.com/p/iciql/downloads/detail?name=%JAR%)) &nbsp; *released %BUILDDATE%*\r
 \r
+- Added list alternatives to the varargs methods because it was too easy to forget list.toArray() for the varargs methods  \r
+List<T> Db.executeQuery(Class<? extends T> modelClass, String sql, List<?> args)\r
+ResultSet executeQuery(String sql, List<?> args)\r
+\r
+### Older Releases\r
+\r
+**0.7.3** &nbsp; *released 2011-12-06*\r
+\r
 - api change release (API v8)\r
 - Fixed JOIN ON primitives\r
 - Fixed GROUP BY primitives\r
 - Fixed primitive references when selecting into a custom type with primitives\r
 - Improved fluent/type-safety of joins\r
 \r
-### Older Releases\r
-\r
 **0.7.2** &nbsp; *released 2011-11-30*\r
 \r
 - generated models are now serializable with a default serial version id of 1\r
index 5c1bfc0868037956eb9fe2c3008297a96edc352f..37f0c2b949300ba8258a7a60b419986c806e39be 100644 (file)
@@ -25,11 +25,11 @@ public class Constants {
 \r
        // The build script extracts this exact line so be careful editing it\r
        // and only use A-Z a-z 0-9 .-_ in the string.\r
-       public static final String VERSION = "0.7.3";\r
+       public static final String VERSION = "0.7.4-SNAPSHOT";\r
 \r
        // The build script extracts this exact line so be careful editing it\r
        // and only use A-Z a-z 0-9 .-_ in the string.\r
-       public static final String VERSION_DATE = "2011-12-06";\r
+       public static final String VERSION_DATE = "PENDING";\r
 \r
        // The build script extracts this exact line so be careful editing it\r
        // and only use A-Z a-z 0-9 .-_ in the string.\r
index 05d7f46a6bf2156aa5b969261ec7b64fbdc8f10e..e05ec564fcd0c9f806ebacf2a4feadd0479f1482 100644 (file)
@@ -448,6 +448,26 @@ public class Db {
                return (TableDefinition<T>) classMap.get(clazz);\r
        }\r
 \r
+\r
+       /**\r
+        * Run a SQL query directly against the database.\r
+        * \r
+        * Be sure to close the ResultSet with\r
+        * \r
+        * <pre>\r
+        * JdbcUtils.closeSilently(rs, true);\r
+        * </pre>\r
+        * \r
+        * @param sql\r
+        *            the SQL statement\r
+        * @param args\r
+        *            optional object arguments for x=? tokens in query\r
+        * @return the result set\r
+        */\r
+       public ResultSet executeQuery(String sql, List<?> args) {\r
+               return executeQuery(sql, args.toArray());\r
+       }\r
+       \r
        /**\r
         * Run a SQL query directly against the database.\r
         * \r
@@ -480,6 +500,20 @@ public class Db {
                }\r
        }\r
 \r
+       /**\r
+        * Run a SQL query directly against the database and map the results to the\r
+        * model class.\r
+        * \r
+        * @param modelClass\r
+        *            the model class to bind the query ResultSet rows into.\r
+        * @param sql\r
+        *            the SQL statement\r
+        * @return the result set\r
+        */\r
+       public <T> List<T> executeQuery(Class<? extends T> modelClass, String sql, List<?> args) {\r
+               return executeQuery(modelClass, sql, args.toArray());\r
+       }\r
+       \r
        /**\r
         * Run a SQL query directly against the database and map the results to the\r
         * model class.\r