• 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: Fetching from related object
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fetching from related object


  • Subject: Re: Fetching from related object
  • From: Randall Perry <email@hidden>
  • Date: Mon, 26 Apr 2004 14:37:12 -0400

on 4/26/04 10:20 AM, Arturo Pirez at email@hidden wrote:

>
> Do you know how to turn on SQL logging?  Could you do that and take a
> look at the sql being generated?
> Also, are you using the pgSQL plug-in?
> ----
I'm using PostgresqlPlugin and eomodeler plugin from hexdreams.

Turned SQL logging on. If I don't force the fetch with this line:
custFetchSpec.setPrefetchingRelationshipKeyPaths(new NSArray("logs"));

I get one query on cust_view (username/pw changed):

[2004-04-26 14:17:22 EDT] <WorkerThread1>  evaluateExpression:
<com.webobjects.jdbcadaptor.PostgresqlExpression: "SELECT t0.comments,
t0.contact, t0.cust, t0.cust_no, t0.division, t0.email, t0.enter_date,
t0.filecode, t0.hold, t0.mod_date, RTRIM(t0.password), t0.profit,
t0.profit_div, t0.user_name, t0.vendor FROM public.cust_view t0 WHERE
(t0.user_name = ? AND t0.password = ?)" withBindings: 1:"acme"(userName),
2:"xxxxxxx"(password)>

If I force the fetch I get an additional query on log:

[2004-04-26 14:27:00 EDT] <WorkerThread1>  evaluateExpression:
<com.webobjects.jdbcadaptor.PostgresqlExpression: "SELECT t0.comments,
t0.cust_no, t0.date_time, t0.division, t0.errors, t0.filekey, t0.filename,
t0.filesize, t0.linecount, t0.log_no, t0.status, RTRIM(t0.type),
t0.upload_time, t0.vendor FROM public.log t0, public.cust_view T1 WHERE
(T1.password = ? AND T1.user_name = ?) AND t0.cust_no = T1.cust_no"
withBindings: 1:"xxxxxxx"(password), 2:"acme"(userName)>



> Here's a listing of the relevant code:
>
>> From DirectAction.java
> ----------------------
>
> public WOActionResults loginAction() {
>
>   NSArray custInfo;
>   NSArray logInfo;
>   EOEditingContext ec = new EOEditingContext();   // create an editing
> context
>
>   String userName  = ((String)request().formValueForKey("login")).trim();
> // grab form values and trim
>   String passWord  = ((String)request().formValueForKey("pass")).trim();
>
>   // set filter on query using userName and passWord vars passed from form
>   EOQualifier qual = EOQualifier.qualifierWithQualifierFormat("userName =
> '" + userName + "' and password = '" + passWord + "'", null);
>   // create fetchSpec with qualifier
>   EOFetchSpecification custFetchSpec = new
> EOFetchSpecification("CustView", qual, null);
>
>   // fetch cust record
>   custInfo = ec.objectsWithFetchSpecification(custFetchSpec);
>
>   // fetch associated log records
>   logInfo = (NSArray)custInfo.valueForKey("logs");
>
>   ...
>   ...
> }

--
Randall Perry
sysTame

Xserve Web Hosting/Co-location
Website Development/Promotion
Mac Consulting/Sales

http://www.systame.com/
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Fetching from related object
      • From: Arturo Pérez <email@hidden>
References: 
 >Re: Fetching from related object (From: Arturo Pérez <email@hidden>)

  • Prev by Date: Re: Fetching from related object
  • Next by Date: WORepetition error
  • Previous by thread: Re: Fetching from related object
  • Next by thread: Re: Fetching from related object
  • Index(es):
    • Date
    • Thread