You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by simone cecchini <si...@kiosco.org> on 2001/02/01 08:58:49 UTC

esql and INSERT statement

hi all,

i am trying to use the esql taglib to insert some rows in a database table. (am i using cocoon 1.8 with the included esql taglib and mysql as a rdbms, with mm.mysql-2.0.2 drivers)
i put the complete 'insert ' statement between the esql:query tags and specify a esql:error-results content, to manage error conditions. this really inserts the row into the database, but also produces - always - the error-results content. the message reported (caught with the esql:get-message tag) is 'ResultSet is from UPDATE. No Data' which is fairly correct, but which is not [fired by] a real error. (btw tampering a little with the code of the esql logicsheet, you can realize that the reason of such behaviour is the call to the method '_esql_session.resultset.next()', which is called in any case)
this prevents me from distinguishing the previously stated error from 'real ones' (those that lead to data not being inserted), the latter meant to be output to the user.
can someone give me some suggestion to solve this problem? do i have to re write part of the esql logicsheet (i would be pretty scared in doing this ;-) ) or should i 'change my mind'?

thanks

Re: esql and INSERT statement

Posted by simone cecchini <si...@kiosco.org>.
thanks for your suggestion. i'll start working immediately.
bye

At 03:10 2/1/01 -0500, you wrote:
>On Thu, 1 Feb 2001, simone cecchini wrote:
>
>> i am trying to use the esql taglib to insert some rows in a database
>> table. (am i using cocoon 1.8 with the included esql taglib and mysql
>> as a rdbms, with mm.mysql-2.0.2 drivers) i put the complete 'insert '
>> statement between the esql:query tags and specify a esql:error-results
>> content, to manage error conditions. this really inserts the row into
>> the database, but also produces - always - the error-results content.
>> the message reported (caught with the esql:get-message tag) is
>> 'ResultSet is from UPDATE. No Data' which is fairly correct, but which
>> is not [fired by] a real error. (btw tampering a little with the code
>> of the esql logicsheet, you can realize that the reason of such
>> behaviour is the call to the method '_esql_session.resultset.next()',
>> which is called in any case) this prevents me from distinguishing the
>> previously stated error from 'real ones' (those that lead to data not
>> being inserted), the latter meant to be output to the user. can
>> someone give me some suggestion to solve this problem? do i have to re
>> write part of the esql logicsheet (i would be pretty scared in doing
>> this ;-) ) or should i 'change my mind'?
>
>the resultset.next() method should not be called in your case. if you'll
>look at the source more carefully, you'll see that the esql class checks
>to see if the execute method returns true (a resultset) or false (an
>update count). if true, it invokes esql:results. if false, it invokes
>esql:update-results.
>
>things for you to try:
>
>1. upgrade to latest cocoon from cvs. note that the esql schema changed
>significantly from 1.8 to 1.8.1. it is more or less finalized now.
>
>2. put debugging code in the esql logicsheet to try to see what's really
>happening.
>
>3. make sure that the mysql jdbc driver is returning the correct results
>from the Statement.execute() method
>
>- donald
>
>
>---------------------------------------------------------------------
>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: <co...@xml.apache.org>
>For additional commands, e-mail: <co...@xml.apache.org>
>
>

Re: esql and INSERT statement

Posted by Donald Ball <ba...@webslingerZ.com>.
On Thu, 1 Feb 2001, simone cecchini wrote:

> i am trying to use the esql taglib to insert some rows in a database
> table. (am i using cocoon 1.8 with the included esql taglib and mysql
> as a rdbms, with mm.mysql-2.0.2 drivers) i put the complete 'insert '
> statement between the esql:query tags and specify a esql:error-results
> content, to manage error conditions. this really inserts the row into
> the database, but also produces - always - the error-results content.
> the message reported (caught with the esql:get-message tag) is
> 'ResultSet is from UPDATE. No Data' which is fairly correct, but which
> is not [fired by] a real error. (btw tampering a little with the code
> of the esql logicsheet, you can realize that the reason of such
> behaviour is the call to the method '_esql_session.resultset.next()',
> which is called in any case) this prevents me from distinguishing the
> previously stated error from 'real ones' (those that lead to data not
> being inserted), the latter meant to be output to the user. can
> someone give me some suggestion to solve this problem? do i have to re
> write part of the esql logicsheet (i would be pretty scared in doing
> this ;-) ) or should i 'change my mind'?

the resultset.next() method should not be called in your case. if you'll
look at the source more carefully, you'll see that the esql class checks
to see if the execute method returns true (a resultset) or false (an
update count). if true, it invokes esql:results. if false, it invokes
esql:update-results.

things for you to try:

1. upgrade to latest cocoon from cvs. note that the esql schema changed
significantly from 1.8 to 1.8.1. it is more or less finalized now.

2. put debugging code in the esql logicsheet to try to see what's really
happening.

3. make sure that the mysql jdbc driver is returning the correct results
from the Statement.execute() method

- donald