Re: WO Equivalent of prepared statement
Re: WO Equivalent of prepared statement
- Subject: Re: WO Equivalent of prepared statement
- From: Kieran Kelleher <email@hidden>
- Date: Mon, 27 Oct 2008 21:02:42 -0400
Hi Randy,
For multi-million row operations you have some choices:
1) The WO database-vendor-agnostic way which is *very* fast and
bypasses all validation, editing context, etc., you can work directly
with the EOAdaptorChannel. Wonder has convenience methods that do this
for you in:
ERXEOAccessUtilities
insertRow
insertRows
deleteRowsDescribedByQualifier
updateRowsDescribedByQualifier
Before inserting a bunch of new "rows", you can grab a bunch of
primary keys with
primaryKeysForNewRows
... and just add them to the raw row records you create before
inserting them.
This is as fast as you will get without going raw SQL and to be
honest, I am not sure if raw SQL gives much advantage.
2) Sometimes, you want to just execute some SQL statement because that
is what you have to do for some situation ..... in that case, you can
take an approach like this:
- Construct your raw SQL statement
- Get raw rows result (NSDictionary representations of the SQL result)
using EOUtilities.rawRowsForSQL( ... );
3) You can also work with the database in an abstract way directly
using EOAdaptorChannel ..... get one with:
ERXJDBCUtilities.adaptorChannelWithUserAndPassword( ...)
....... have a look at API for EOAdaptorChannel, EOSQLExpression
and the source for ERXJDBCUtilities for reusable functionality....
Now if you don't use Wonder, then download the source and see the
above mentiond methods for how to do it.
HTH, Kieran
On Oct 27, 2008, at 5:04 PM, Randy Wigginton wrote:
I am processing millions of rows of data, and the output is very
large tables. I would like to use an equivalent of
preparedstatements for my writing&updating; there is less need for
transactional integrity and more need of raw speed. Is there
anything in WebObjects or Wonder to help with this?
I understand I could use raw sql, but that would involve massive
amounts of parsing on the part of the database; a prepared statement
handle would allow me to simply pass values and minimize the work
needed by the database.
TIA,
randy
_______________________________________________
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
_______________________________________________
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