Hmm, well, I don't think there are problems with my XSP syntax because the
Java seems to be generating correctly, but I guess you're right. It could be
something obscure. So here it is:
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsp="http://apache.org/xsp"
xmlns:esql="http://apache.org/cocoon/SQL/v2"
xmlns:xsp-session="http://apache.org/session/2.0"
xmlns:malin-auth="http://nostromo.com/malin-auth"
version="1.0">
<xsl:template match="xsp:page">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="malin-auth:authenticate">
<xsp:logic>
String userLogin = <xsl:value-of select="login"/>;
String userPass = <xsl:value-of select="password"/>;
</xsp:logic>
<esql:connection>
<esql:pool>mySql</esql:pool>
<esql:execute-query>
<esql:query>
select ID,count(ID) as count from Users where LoginUser='zack'
and Password='password' group by ID
</esql:query>
<esql:results>
<esql:row-results>
<xsp:logic>
int rescount = <esql:get-int
column="count"/>;
int userID = 0;
if (rescount > 0)
{
userID = <esql:get-int
column="ID"/>;
}
</xsp:logic>
<xsp-session:set-attribute
name="malin-uid"><xsp:expr>userID</xsp:expr></xsp-session:set-attribute>
</esql:row-results>
</esql:results>
</esql:execute-query>
</esql:connection>
</xsl:template>
<xsl:template match="malin-auth:get-userid">
<xsp-session:get-attribute name="malin-uid"/>
</xsl:template>
<xsl:template match="@*|node()" priority="-1">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
On 5/2/02 2:12 AM, "Graaf, Edgar de (fin)" <[EMAIL PROTECTED]> wrote:
> Zack,
>
> Please provide the whole XSP.
>
> Regards,
>
> Edgar
>
> -----Oorspronkelijk bericht-----
> Van: Zack Angelo [mailto:[EMAIL PROTECTED]]
> Verzonden: donderdag 2 mei 2002 4:55
> Aan: [EMAIL PROTECTED]
> Onderwerp: Cocoon generated Java throwing SQLException
>
>
> Hey,
>
> I'm having some really peculiar behavior with the ESQL logicsheet. I
> have the following XSP (in my own logicsheet):
>
> <esql:query> select ID,count(ID) as count from Users where
> LoginUser='zack' and Password='password' group by ID</esql:query>
>
> The corresponding Java seems to be generating just fine:
>
> _esql_query = new EsqlQuery( _esql_connection, String.valueOf("select
> ID,count(ID) as count from Users where LoginUser='zack' and
> Password='password' group by ID") );
>
> But, upon execution, I get this exception:
>
> org.apache.cocoon.ProcessingException: Exception in
> ServerPagesGenerator.generate(): java.lang.RuntimeException: Error
> executing statement: select ID,count(ID) as count from Users where
> LoginUser='zack' and Password='password' group by ID:
> java.sql.SQLException: Column not found: Unknown column 'LoginUser' in
> 'where clause'
>
> For some reason it's saying that one of the columns doesn't exist...I
> have no idea why. I've also copied and pasted the SQL query from the
> Java into the mysql client, and it works fine. Any ideas? This just
> seems really strange to me. Thanks in advance.
>
> -Zack Angelo
> Nostromo Corporation
>
>
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> For additional commands, e-mail: <[EMAIL PROTECTED]>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> For additional commands, e-mail: <[EMAIL PROTECTED]>
>
>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>