• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: WO Equivalent of prepared statement
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WO Equivalent of prepared statement


  • Subject: Re: WO Equivalent of prepared statement
  • From: Randy Wigginton <email@hidden>
  • Date: Mon, 27 Oct 2008 19:16:45 -0700

Actually, these methods will not be as fast as a prepared statement; they will require parsing, then preparation of an execution plan on the part of the database. A prepared statement will allow the database to only do the work it needs to, as values are passed to the already prepared execution plan.

In a high volume environment, use of non-prepared statements is a very bad idea. I have witnessed such usage take down a major site.

It looks like I can obtain a JDBC Context, and from that a JDBC connection. From there I can create a prepared statement and do what needs to be done.



On Oct 27, 2008, at 6:02 PM, Kieran Kelleher wrote:

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
References: 
 >WO Equivalent of prepared statement (From: "Randy Wigginton" <email@hidden>)
 >Re: WO Equivalent of prepared statement (From: Kieran Kelleher <email@hidden>)

  • Prev by Date: Re: WO Equivalent of prepared statement
  • Next by Date: Re: WO Equivalent of prepared statement
  • Previous by thread: Re: WO Equivalent of prepared statement
  • Next by thread: Re: WO Equivalent of prepared statement
  • Index(es):
    • Date
    • Thread