You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Yann <yl...@ims.ltd.uk> on 2000/07/14 12:54:16 UTC
Note on using SLECT COUNT(*) with the XSP SQL tag lib
Right, I have a simple SQL query (SELECT COUNT(*) FROM Whatever). For some
reason I got the following XSP SQL tag lib exception:
java.lang.ArrayIndexOutOfBoundsException
at org.apache.xerces.dom.DocumentImpl.isXMLName(DocumentImpl.java:1245)
at org.apache.xerces.dom.DocumentImpl.createElement(DocumentImpl.java:377)
at
org.apache.cocoon.processor.xsp.library.sql.XSPSQLLibrary.createElement(XSPS
QLLibrary.java:264)
at
org.apache.cocoon.processor.xsp.library.sql.XSPSQLLibrary.processQuery(XSPSQ
LLibrary.java:207)
at
_D_._Apache._jakarta_tomcat._webapps._root._eTranscrib._view._doviewtranscri
ptions.populateDocument(_doviewtranscriptions.java:170)
at org.apache.cocoon.processor.xsp.XSPPage.getDocument(XSPPage.java:96)
at
org.apache.cocoon.processor.xsp.XSPProcessor.process(XSPProcessor.java:456)
at org.apache.cocoon.Engine.handle(Engine.java:305)
at org.apache.cocoon.Cocoon.service(Cocoon.java:167)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:390)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:523)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:146)
at
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:334
)
at java.lang.Thread.run(Unknown Source)
I have been using XSP tag lib for a while and within the same page another
query works fine. So I knew everything was setup properly. I mean, for a
SELECT COUNT query, you are assured to get at least one row back (well only
one to be precise).
Anyway, after a bit of thinking, I realised that I might have to specify a
column name as such:
SELECT COUNT(*) AS TheCount FROM Whatever
And it worked!!!!
I thought I would share this discovering with other XSP SQL tag lib users.
Yann.
Re: Note on using SLECT COUNT(*) with the XSP SQL tag lib
Posted by Geoff Drake <ge...@mandes.com>.
You will need to check that your SQL Engine supports column aliases, if
it does try
SELECT COUNT(*) AS NUMROWS FROM xxxxx
This will give you a column called NUMROWS
i.e. <NUMROWS>11</NUMROWS>
The AS xxxx might be different on your engine.
Regards
Geoff
Ulrich Mayring wrote:
> Yann wrote:
> >
> > Right, I have a simple SQL query (SELECT COUNT(*) FROM Whatever).
>
> The SQL processor returns something like <NULL>11</NULL>, if count(*)
> were to come out to 11.
>
> Ulrich
>
> --
> Ulrich Mayring
> DENIC eG, Systementwicklung
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
Re: Note on using SLECT COUNT(*) with the XSP SQL tag lib
Posted by "Jason Y. Lee" <ja...@panix.com>.
> Yann wrote:
> >
> > Right, I have a simple SQL query (SELECT COUNT(*) FROM Whatever).
>
> The SQL processor returns something like <NULL>11</NULL>, if count(*)
> were to come out to 11.
Shouldn't "SELECT COUNT(*) count FROM table" work?
- Jason
Re: Note on using SLECT COUNT(*) with the XSP SQL tag lib
Posted by Ulrich Mayring <ul...@denic.de>.
Yann wrote:
>
> Right, I have a simple SQL query (SELECT COUNT(*) FROM Whatever).
The SQL processor returns something like <NULL>11</NULL>, if count(*)
were to come out to 11.
Ulrich
--
Ulrich Mayring
DENIC eG, Systementwicklung
Re: Note on using SLECT COUNT(*) with the XSP SQL tag lib
Posted by Donald Ball <ba...@webslingerZ.com>.
thanks for reminding me - i've added a note to this effect in the sql
logicsheet docs.
- donald