Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 10234 invoked from network); 21 Apr 2004 16:13:57 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 21 Apr 2004 16:13:57 -0000 Received: (qmail 63694 invoked by uid 500); 21 Apr 2004 16:13:27 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 63555 invoked by uid 500); 21 Apr 2004 16:13:25 -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 63495 invoked from network); 21 Apr 2004 16:13:25 -0000 Received: from unknown (HELO imbaspam-nj03.iplex.ssmb.com) (199.67.141.25) by daedalus.apache.org with SMTP; 21 Apr 2004 16:13:25 -0000 Received: from imbarc-nj02.nj.ssmb.com (imbarc-nj02-1 [150.110.178.211]) by imbaspam-nj03.iplex.ssmb.com (8.12.10/8.12.10/SSMB_EXT/evision: 1.29 $) with ESMTP id i3LGDOlZ022736 for ; Wed, 21 Apr 2004 12:13:26 -0400 (EDT) Received: from mailhub-nj04-1.nj.ssmb.com (mailhub-nj04-2.nj.ssmb.com [150.110.236.237]) by imbarc-nj02.nj.ssmb.com (8.12.9/8.12.9/SSMB_QQQ_IN/1.1) with ESMTP id i3LGDCfI000920 for ; Wed, 21 Apr 2004 12:13:12 -0400 (EDT) Received: from exnjsm03.nam.nsroot.net (exnjsm03.nam.nsroot.net [150.110.188.175]) by mailhub-nj04-1.nj.ssmb.com (8.12.10/8.12.10/CG_HUB) with ESMTP id i3LGD97s008155 for ; Wed, 21 Apr 2004 12:13:11 -0400 (EDT) content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.0.6487.1 Subject: RE: [DBUtils] SqlNullCheckedResultSet not replacing nulls Date: Wed, 21 Apr 2004 12:13:01 -0400 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [DBUtils] SqlNullCheckedResultSet not replacing nulls Thread-Index: AcQnuYo0y1mVsIa8SYyVdaR3JMhtIQAAUXLw From: "Anderson, James H [IT]" To: "Jakarta Commons Users List" X-Scanned-By: MIMEDefang 2.36 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 Could you recommend a good debugger? I'm not using an IDE. But, as you pointed out, the invoke() method in DbUtils is pretty = simple, so I'm not sure how this would help, and I'm relectant to try = debugging the Driver code... -----Original Message----- From: David Graham [mailto:grahamdavid1980@yahoo.com] Sent: Wednesday, April 21, 2004 11:53 AM To: Jakarta Commons Users List Subject: RE: [DBUtils] SqlNullCheckedResultSet not replacing nulls --- "Anderson, James H [IT]" wrote: > Is there any good doc on Java reflexion anywhere? I suppose I could = pour > over the javadoc, but from the looks of it that would take days, and I > just don't have the time. Reflection isn't that tough to figure out but it might be faster to step through the DbUtils code in your debugger to find out exactly why the getNull* methods aren't getting called. David >=20 > Thanks, >=20 > jim >=20 > -----Original Message----- > From: David Graham [mailto:grahamdavid1980@yahoo.com] > Sent: Wednesday, April 21, 2004 9:18 AM > To: Jakarta Commons Users List > Subject: Re: [DBUtils] SqlNullCheckedResultSet not replacing nulls >=20 >=20 > 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 :-). >=20 > Here's the relevant method from DbUtils: > http://jakarta.apache.org/commons/dbutils/xref/org/apache/commons/dbutils= /wrappers/SqlNullCheckedResultSet.html#354 >=20 > There's not a lot of logic there that could go wrong. >=20 > David >=20 > --- "Anderson, James H [IT]" wrote: > > In the following code snippet, SqlNullCheckedResultSet is not > replacing > > nulls, neither for String nor Date results. > >=20 > > Anyone have an idea what's wrong? > >=20 > > Thanks, > >=20 > > jim > >=20 > > [...] > >=20 > > try { > > Class.forName("com.mysql.jdbc.Driver").newInstance(); > > conn =3D DriverManager.getConnection(url, user, pswd); > > =20 > > MapListHandler mlh =3D new MapListHandler() { > > public Object handle (ResultSet rs) { > > SqlNullCheckedResultSet wrapper =3D new > > SqlNullCheckedResultSet(rs); > > wrapper.setNullString("--n/a--"); > > wrapper.setNullDate(today); > > rs =3D > > ProxyFactory.instance().createResultSet(wrapper); > > Object returnVal =3D null; > > try { > > System.out.println("*** HERE ***"); > > returnVal =3D super.handle(rs); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > return returnVal; > > } > > }; > >=20 > > QueryRunner run =3D new QueryRunner(); > > List result =3D (List) run.query(conn, query, mlh); > > Iterator it1 =3D result.iterator(); > > while (it1.hasNext()) { > > Map map =3D (Map) it1.next(); > > Set keys =3D map.keySet(); > > Iterator it =3D keys.iterator(); > > while (it.hasNext()) { > > String key =3D (String) it.next(); > > System.out.println(key + ": " + map.get(key)); > > } > > System.out.println(); > > } > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > e.printStackTrace(); > > } finally { > > =20 > > org.apache.commons.dbutils.DbUtils.commitAndCloseQuietly(conn); > > } > > } > >=20 > > = --------------------------------------------------------------------- > > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org > > For additional commands, e-mail: = commons-user-help@jakarta.apache.org > >=20 >=20 >=20 >=20 > =09 > =09 > __________________________________ > Do you Yahoo!? > Yahoo! Photos: High-quality 4x6 digital prints for 25=A2 > http://photos.yahoo.com/ph/print_splash >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: commons-user-help@jakarta.apache.org >=20 >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: commons-user-help@jakarta.apache.org >=20 =09 =09 __________________________________ Do you Yahoo!? Yahoo! Photos: High-quality 4x6 digital prints for 25=A2 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 --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org