Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 97166 invoked from network); 21 Apr 2004 13:18:02 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 21 Apr 2004 13:18:02 -0000 Received: (qmail 79674 invoked by uid 500); 21 Apr 2004 13:17:52 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 79639 invoked by uid 500); 21 Apr 2004 13:17:52 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 79617 invoked from network); 21 Apr 2004 13:17:52 -0000 Received: from unknown (HELO web60806.mail.yahoo.com) (216.155.196.69) by daedalus.apache.org with SMTP; 21 Apr 2004 13:17:52 -0000 Message-ID: <20040421131752.32807.qmail@web60806.mail.yahoo.com> Received: from [24.9.52.44] by web60806.mail.yahoo.com via HTTP; Wed, 21 Apr 2004 06:17:52 PDT Date: Wed, 21 Apr 2004 06:17:52 -0700 (PDT) From: David Graham Subject: Re: [DBUtils] SqlNullCheckedResultSet not replacing nulls To: Jakarta Commons Users List In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Your code looks correct. What JDBC driver are you using? The implementation of SqlNullCheckedResultSet is dependent on ResultSet.wasNull() being implemented properly. Of course, it might be a bug in DbUtils but the test cases pass for this class (unless the tests have bugs too :-). Here's the relevant method from DbUtils: http://jakarta.apache.org/commons/dbutils/xref/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSet.html#354 There's not a lot of logic there that could go wrong. David --- "Anderson, James H [IT]" wrote: > In the following code snippet, SqlNullCheckedResultSet is not replacing > nulls, neither for String nor Date results. > > Anyone have an idea what's wrong? > > Thanks, > > jim > > [...] > > try { > Class.forName("com.mysql.jdbc.Driver").newInstance(); > conn = DriverManager.getConnection(url, user, pswd); > > MapListHandler mlh = new MapListHandler() { > public Object handle (ResultSet rs) { > SqlNullCheckedResultSet wrapper = new > SqlNullCheckedResultSet(rs); > wrapper.setNullString("--n/a--"); > wrapper.setNullDate(today); > rs = > ProxyFactory.instance().createResultSet(wrapper); > Object returnVal = null; > try { > System.out.println("*** HERE ***"); > returnVal = super.handle(rs); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > return returnVal; > } > }; > > QueryRunner run = new QueryRunner(); > List result = (List) run.query(conn, query, mlh); > Iterator it1 = result.iterator(); > while (it1.hasNext()) { > Map map = (Map) it1.next(); > Set keys = map.keySet(); > Iterator it = keys.iterator(); > while (it.hasNext()) { > String key = (String) it.next(); > System.out.println(key + ": " + map.get(key)); > } > System.out.println(); > } > } catch (Exception e) { > System.out.println(e.getMessage()); > e.printStackTrace(); > } finally { > > org.apache.commons.dbutils.DbUtils.commitAndCloseQuietly(conn); > } > } > > --------------------------------------------------------------------- > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: commons-user-help@jakarta.apache.org > __________________________________ Do you Yahoo!? Yahoo! Photos: High-quality 4x6 digital prints for 25� http://photos.yahoo.com/ph/print_splash --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org