Re: database views and webobojects
Re: database views and webobojects
- Subject: Re: database views and webobojects
- From: Theodore Petrosky <email@hidden>
- Date: Mon, 14 Jun 2010 03:28:55 -0700 (PDT)
I think I am almost there....
don't laugh but here is what I am doing...
String theSQL = "SELECT sum(c_amount_of_time) as c_amount_of_time FROM t_e_time et WHERE c_user_id = '" +
userList.objectAtIndex(i).primaryKey() + "' AND " +
"et.c_job_id IN (SELECT id FROM t_job WHERE c_project_id = '" + theProject().primaryKey() + "')";
NSArray<?> result;
result = EOUtilities.rawRowsForSQL(timeListEC, "TheWorkTrackerModel", theSQL, new NSArray<Object>(new String[] {"c_amount_of_time"}));
NSLog.out.appendln(" **************** result = " + result);
my log shows..... **************** result = ({c_amount_of_time = 12; })
ouch.. If I run the above SQL in the terminal, I get:
LOG: statement: select sum(c_amount_of_time) from t_e_time et where c_user_id = 3 and
et.c_job_id IN (SELECT id FROM t_job WHERE c_project_id = 16);
sum
-------------
12.50000000
(1 row)
what happened to the decimal...??
Ted
--- On Mon, 6/14/10, Chuck Hill <email@hidden> wrote:
> From: Chuck Hill <email@hidden>
> Subject: Re: database views and webobojects
> To: "Theodore Petrosky" <email@hidden>
> Cc: email@hidden
> Date: Monday, June 14, 2010, 1:02 AM
>
> On Jun 12, 2010, at 8:00 AM, Theodore Petrosky wrote:
>
> > How would I do something like this in WO?
> >
> > two tables t_e_time, t_user
> >
> > I have been hacking on both the qualifier and sort to
> see where I could create the group by clause...
> >
> > this is what I want to accomplish...
> >
> > SELECT t1.c_user_id, sum(t1.c_amount_of_time),
> t2.c_first_name, t2.c_last_name
> > FROM t_e_time t1
> > JOIN t_user t2
> > ON t1.c_user_id = t2.id GROUP BY
> t1.c_user_id, t2.c_first_name,
> t2.c_last_name;
> >
> > I found ERXGroupingFetchSpecification but I can
> not find an example and without that I am lost...
>
> That seems to be a "work in progress". The results of
> a group by is data not EOs. EOF does not really handle
> this as it is focused on EOs. You could do this
> in-memory, but I guess
>
>
> > I expect that eventually I should move this to a
> procedure on the database to speed it up.. but maybe this
> will do just fine...
>
> That could work and then use
> EOUtilities.rawRowsForStoredProcedureNamed to get the
> results as an NSArray of dictionaries.
>
>
> Chuck
>
> --
> 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