Hi James,
1. I can't really help you with writing stored procedures other than
saying your procedure should be a function that returns a ref_cursor
if you are expecting multiple results.
2. You can fetch using :
public static NSArray rawRowsForStoredProcedureNamed(EOEditingContext
ec, String name,NSDictionary args)
This will return an array of NSDictionary (raw rows).
If this is being used to display results, you are best to leave them
as raw rows and just put a repetition over the array of rows. Bind
your iterator to a dictionary and then use key value coding to get
columns out of the dictionary (be sure to use column names as the
key, not your fancy attribute names). When a user needs to inspect a
row from this list, turn that one row back to an EO using :
public static EOEnterpriseObject objectWithPrimaryKeyValue
(EOEditingContext ec, String entityName, Object value)
Hope this helps.
On Feb 8, 2007, at 5:50 PM, James C. Lee wrote:
Maybe I'm missing something somewhere, but I can't seem to find the
answer.
To optimize things, I'd like to do frequent fetches using Oracle
stored
procedure. There are two parts to this:
1. How do I write the Oracle stored procedure in PL/SQL? What
should be
returned? According to Tom Kyte, this is how it's done:
http://asktom.oracle.com/tkyte/ResultSets/index.html
I was able to create the stored procedure that returns a cursor. But I
couldn't fetch from EOF? Or should the stored procedure return
something
other than a cursor?
2. How do I fetch the result set from an Oracle stored procedure
into EOF?
Ideally, I'd like to fetch the results as EOs, not raw rows.
EOUtilities.rawRowsWithQualifierFormat() doesn't like the store
procedure
that returns a cursor (or maybe I didn't do it correctly?).
And if using this approach, then EOUtilities.objectFromRawRow()
actually
turns the raw rows into faults, resulting yet another trip to the
database,
which is not desirable.
Thanks for your help!
^James
P.S. I sent this in December to the Omnigroup WO mailing list, not
realizing
that there's the Apple WO list (yep, shows my age. :-) No good
solution came
out of it. Hopefully someone here has done this?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/ddenboer%
40apple.com
This email sent to [EMAIL PROTECTED]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to archive@mail-archive.com