cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Morley Howell" <morle...@cogeco.ca>
Subject RE: Multiple DB Inserts for XSP?
Date Fri, 23 Jan 2004 21:00:59 GMT

I don't know anything about XSP, so can't help you there. Just thought I'd
point out that the timestamps between the inserts appear to be a few
milliseconds apart, not a few seconds.

> -----Original Message-----
> From: Brent L Johnson [mailto:brent@bjohnson.net]
> Sent: Friday January 23, 2004 3:33 PM
> To: users@cocoon.apache.org
> Subject: Multiple DB Inserts for XSP?
>
>
> I'm using the authentication framework to handle logins
> on the site I'm working on.  When the login is handled successfully the
> pipeline should do a map:generate for an XSP that does a database insert
> into a login_log table.
>
> But - when I login.. I get TWO rows into the database,
> for one single insert.  I'm not sure how this is happening.. sometimes
> the timestamp between the inserts is 2-3 seconds.
>
> Its only me logging in.. no one else.. this is just really driving me
> crazy.  Here's is the auth snippet from my sitemap:
>
>     <map:match pattern="performLogin.html">
>         <map:act type="auth-loggedIn">
>             <map:parameter name="handler" value="authhandler"/>
>             <map:redirect-to uri="main.html"/>
>         </map:act>
>         <map:act type="auth-login">
>             <map:parameter name="handler" value="authhandler"/>
>             <map:parameter name="parameter_userid"
> value="{request-param:userid}"/>
>             <map:parameter name="parameter_password"
> value="{request-param:password}"/>
>
>             <map:generate type="serverpages" src="loginComplete.xsp"/>
>             <map:transform src="styles/welcome.xsl" type="xslt"/>
>             <map:transform src="styles/main.xsl"/>
>             <map:serialize type="html"/>
>         </map:act>
>         <!-- authentication failed: -->
>         <map:generate src="login.xml"/>
>         <map:transform src="styles/main.xsl">
>             <map:parameter name="failure" value="true"/>
>         </map:transform>
>         <map:serialize type="html"/>
>     </map:match>
>
> And here is the exact esql code I'm using in loginComplete.xsp (where
> the insert is being done):
>
>     <esql:connection>
>         <esql:pool>tpptools</esql:pool>
>         <esql:execute-query>
>             <esql:query>
>                 insert into login_log (login, timestamp, host, results)
> values (<esql:parameter><xsp-request:get-parameter
> name="userid"/></esql:parameter>, NOW(),
> <esql:parameter><xsp-request:get-remote-host/></esql:parameter>,
> 'SUCCESS');
>             </esql:query>
>         </esql:execute-query>
>     </esql:connection>
>
> I've searched.. there is no other code that inserts data into this
> table.  And that file only appears ONCE in the whole sitemap.xmap file.
> Right there in performLogin.html.
>
> I cleared out my database table, tried a single login.. and here are the
> results:
> +----+-------+---------------------+---------+---------------+
> | id | login | timestamp           | results | host          |
> +----+-------+---------------------+---------+---------------+
> | 17 | vha   | 2004-01-23 15:01:18 | SUCCESS | 192.168.1.200 |
> | 18 | vha   | 2004-01-23 15:01:21 | SUCCESS | 192.168.1.200 |
> +----+-------+---------------------+---------+---------------+
>
> Does anyone have any idea why it's doing this?  I'm sure it some small
> stupid mistake on my part.. but I'm have a hard time trying to pin down
> why this code would be executing twice.
>
> And notice that 3 second gap in the timestamp.  That seems strange. I've
> seen it as large as 5 seconds.. sometimes its the same.
>
> Any help would be greatly appreciated.
>
> Thanks,
>
> - Brent
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message