Return-Path: Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: (qmail 23349 invoked from network); 6 Nov 2009 14:30:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 6 Nov 2009 14:30:32 -0000 Received: (qmail 75965 invoked by uid 500); 6 Nov 2009 14:30:32 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 75854 invoked by uid 500); 6 Nov 2009 14:30:31 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 75845 invoked by uid 99); 6 Nov 2009 14:30:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Nov 2009 14:30:31 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Nov 2009 14:30:29 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id E69162388905; Fri, 6 Nov 2009 14:30:07 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r833409 - /commons/proper/dbutils/trunk/xdocs/examples.xml Date: Fri, 06 Nov 2009 14:30:07 -0000 To: commits@commons.apache.org From: dfabulich@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20091106143007.E69162388905@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dfabulich Date: Fri Nov 6 14:30:07 2009 New Revision: 833409 URL: http://svn.apache.org/viewvc?rev=833409&view=rev Log: [DBUTILS-62] Fix example page according to Java 5 version Submitted by: Julien Aymé Modified: commons/proper/dbutils/trunk/xdocs/examples.xml Modified: commons/proper/dbutils/trunk/xdocs/examples.xml URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/xdocs/examples.xml?rev=833409&r1=833408&r2=833409&view=diff ============================================================================== --- commons/proper/dbutils/trunk/xdocs/examples.xml (original) +++ commons/proper/dbutils/trunk/xdocs/examples.xml Fri Nov 6 14:30:07 2009 @@ -46,8 +46,8 @@ h = new ResultSetHandler() { + public Object[] handle(ResultSet rs) throws SQLException { if (!rs.next()) { return null; } @@ -69,8 +69,8 @@ QueryRunner run = new QueryRunner(dataSource); // Execute the query and get the results back from the handler -Object[] result = (Object[]) run.query( - "SELECT * FROM Person WHERE name=?", "John Doe", h); +Object[] result = run.query( + "SELECT * FROM Person WHERE name=?", h, "John Doe"); ]]> @@ -82,15 +82,15 @@

h = ... // Define a handler the same as above example // No DataSource so we must handle Connections manually QueryRunner run = new QueryRunner(); Connection conn = ... // open a connection try{ - Object[] result = (Object[]) run.query( - conn, "SELECT * FROM Person WHERE name=?", "John Doe", h); + Object[] result = run.query( + conn, "SELECT * FROM Person WHERE name=?", h, "John Doe"); // do something with the result } finally { @@ -107,24 +107,25 @@

+ @@ -149,16 +150,18 @@

+ h = new BeanHandler(Person.class); // Execute the SQL statement with one replacement parameter and // return the results in a new Person object generated by the BeanHandler. -Person p = (Person) run.query( - "SELECT * FROM Person WHERE name=?", "John Doe", h); +Person p = run.query( + "SELECT * FROM Person WHERE name=?", h, "John Doe"); +]]>

@@ -167,15 +170,17 @@

+> h = new BeanListHandler(Person.class); // Execute the SQL statement and return the results in a List of // Person objects generated by the BeanListHandler. -List persons = (List) run.query("SELECT * FROM Person", h); +List persons = run.query("SELECT * FROM Person", h); +]]>