Re: Feedback about issue with MySQL and get primary key
Re: Feedback about issue with MySQL and get primary key
- Subject: Re: Feedback about issue with MySQL and get primary key
- From: Chuck Hill <email@hidden>
- Date: Wed, 07 Sep 2011 10:20:56 -0700
Hi Philippe,
On 2011-09-04, at 7:49 AM, Philippe Rabier wrote:
> Hi all,
>
> Not a question but a feedback if you have the same issue but I don't have explanation and I didn't look for any.
>
> Env:
> WO 5.4.3, java 6 on Mac OS X 10.6.7, Eclipse 3.4, Wonder a bit old (several months), MySQL v5.0.88
>
> Context:
> DA where informations are checked, fetched then if everything is fine, informations are saved. At the end, we write into a log the request plus the result and some informations (IP address, …).
>
> When informations are saved, I decided to use EOUtilities.rawRowsForSQL to execute an insert sql command in order to optimize the complete R-R.
I think that is the root of the problem: "EOUtilities.rawRowsForSQL" and "execute an insert sql command". rawRows is for a SELECT and uses evaluateExpression. That is not compatible with an INSERT statement. My guess is that it leaves something inside EOF in a bad state. What you should use for this is ERXEOAccessUtilities.evaluateSQLWithEntityNamed.
Chuck
>
> Then I write into the log the request, result, … as I said.
>
> If the insert command is executed, when the log is saved (through its editingContext), I got an exception when the adaptor tries to get a new primary key:
>
> Sep 04 14:52:56 YNP_NOWebServicesApp[5000] DEBUG NSLog - Searching for primary key value for NO_Sent_Notification_Request_Log_TEST
> Sep 04 14:52:56 YNP_NOWebServicesApp[5000] DEBUG NSLog - evaluateExpression: <com.webobjects.jdbcadaptor._MySQLPlugIn$MySQLExpression: "SELECT PK FROM EO_PK_TABLE WHERE NAME = 'NO_Sent_Notification_Request_Log_TEST' FOR UPDATE" withBindings: >
> Sep 04 14:52:56 YNP_NOWebServicesApp[5000] INFO er.extensions.ERXAdaptorChannelDelegate.sqlLogging - "Unknown"@795485135 expression took 232 ms: SELECT PK FROM EO_PK_TABLE WHERE NAME = 'NO_Sent_Notification_Request_Log_TEST' FOR UPDATE
> Sep 04 14:52:56 YNP_NOWebServicesApp[5000] DEBUG NSLog - fetch canceled
> Sep 04 14:52:56 YNP_NOWebServicesApp[5000] DEBUG NSLog - 0 row(s) processed
> Sep 04 14:52:56 YNP_NOWebServicesApp[5000] INFO er.transaction.adaptor.Exceptions - Database Exception occured: java.lang.IllegalArgumentException: Array is empty
>
> If I replace EOUtilities.rawRowsForSQL with ERXEOAccessUtilities.insertRow(ec, NOAppOpenedAfterPushEvent.Keys.ENTITY_NAME, dic), everything works great.
>
> For those who were wondering why I wanted to use EOUtilities.rawRowsForSQL(), the reason is that I wanted to use "INSERT DELAYED INTO ".
>
> Have a good sunday.
>
> Philippe
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden