Return-Path: Mailing-List: contact cocoon-dev-help@xml.apache.org; run by ezmlm Delivered-To: mailing list cocoon-dev@xml.apache.org Received: (qmail 82042 invoked from network); 5 Sep 2000 14:27:59 -0000 Received: from unknown (HELO mailhost.experian.co.uk) (194.60.170.33) by locus.apache.org with SMTP; 5 Sep 2000 14:27:59 -0000 Received: from experian.com (unverified) by mailhost.experian.co.uk (Content Technologies SMTPRS 4.1.2) with SMTP id for ; Tue, 5 Sep 2000 15:26:19 +0100 Received: from UKNOTDT-Message_Server by experian.com with Novell_GroupWise; Tue, 05 Sep 2000 15:25:58 +0000 Message-Id: X-Mailer: Novell GroupWise 4.1 Date: Tue, 05 Sep 2000 15:21:16 +0000 From: John Morrison To: cocoon-dev@xml.apache.org Subject: RE: new sql logicsheet! X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N Huh, I don't think my first mail was as clear as I thought *GRIN*! Yep, I ment get the value twice from the same result set. I knew it wasn't possible just using pure JDBC but I wondered if Donald had taken it into account when he wrote the lib and I just missed how to do it. It would appear that Donald just wrapped the result set so if I want to use a value twice I'm going to have to mange his page somehow. I did think of trying to write this functionality around the tag but this is not possible - the queries are taken 'out-of-line' into their own functions and the previous query passed in, so I can't pass arbitary values around easily. Oh well. As time permits... >>> Kevin Sonney 5/September/2000 01:59pm >>> On Tue, 5 Sep 2000, John Morrison wrote: > I know the example is a little contrived, what I'm essentially attempting to > do is get a result from a result set twice. JDBC doesn't like this. What I'd > like to know is if there's a way to get around this limitation in your taglib? If you mean "get two results from the same resultset", I would think the answer is going to be no. JDBC *DOES* support this : ResultSet rs = stmt.executeQuery(queryString); while (rs.next()) { System.out.println(rs.getString("ID")); System.err.println(rs.getString("ID")); } Which you can easily do in esql like so : This gets the same *RESULT* twice. However, if you want to get two results from the same ResultSet in JDBC, it's better to steam it all into a Hashtable or Vector (or List, or whatever) than post-process it : Vector resultList = new Vector(); int resultNumber = 0; while (rs.next()) { resultList.add(rs.getString("ID")); resultNumber++; } for (i=0; i < resultNumber+1; i++) { System.out.println("Current result is "+resultList.get(i)); if (i > 0) { System.out.println("Previous Value is "+resultList.get(i-1)); } System.out.println("--"); } Now all of this would have to be done via some really ugly XSP code, which I'm not coherent enough yet to create (dangit, where's that coffee??? *grin*) -- +-------------------------------------------+ | Kevin Sonney kevin@webslingerZ.com | | Systems Programmer www.webslingerZ.com | +-------------------------------------------+