You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Henri Yandell (JIRA)" <ji...@apache.org> on 2007/01/31 07:22:05 UTC
[jira] Closed: (DBUTILS-27) [dbutils] QueryRunner.count(String,
...) methods for SELECT COUNT(...) sql
[ https://issues.apache.org/jira/browse/DBUTILS-27?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Henri Yandell closed DBUTILS-27.
--------------------------------
Resolution: Won't Fix
Thanks Michael; marking as WONTFIX.
> [dbutils] QueryRunner.count(String, ...) methods for SELECT COUNT(...) sql
> ---------------------------------------------------------------------------
>
> Key: DBUTILS-27
> URL: https://issues.apache.org/jira/browse/DBUTILS-27
> Project: Commons DbUtils
> Issue Type: Improvement
> Environment: Operating System: All
> Platform: All
> Reporter: Michael Heuer
> Priority: Minor
> Fix For: 1.2
>
> Attachments: count.java, count.java, diff.txt
>
>
> Found that I was repeating the same bit of code over and over again when executing SELECT COUNT(...)
> sql queries with QueryRunner, so I thought I might code this up into a set of static methods for possible
> inclusion in commons-dbutils.
> e.g.
> Connection conn;
> String sql = "select count(*) from tablename where column0 = ? and column1 = ?";
> from:
> int count = 0;
> Object result = QueryRunner.query(conn, sql, new Object[] { "foo", "bar" }, new ScalarHandler());
> if (result != null) {
> count = ((Integer) result).intValue();
> }
> to:
> int count = QueryRunner.count(conn, sql, new Object[] { "foo", "bar" });
> See attached diff.txt.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org