Hi Ken, I'm using EOUtilities.rawRowsForSQL
Here's an example from my code > public int numOfTotalMessages(EOEditingContext ec) { > String sqlTerm = "SELECT COUNT(*) FROM PMSMessage WHERE ownerUserID = > "+this.primaryKey(); > NSArray resultsRows = EOUtilities.rawRowsForSQL(ec, "PMSModel", > sqlTerm, new NSArray("count")); > return ((Number) ((NSDictionary) > resultsRows.objectAtIndex(0)).objectForKey("count")).intValue(); > } It takes 4 params: 1. an EOEditingContext. Take one you already have or create a new one. 2. the "name" of your model as String. 3. a SQL term. Just write plain SQL or even MySQL dialect (if you use MySQL only) 3. an array of key-names that are used in the dictionaries returned. In case of a count-query, it's pretty useless, since you get exactly one result row with a one-line dict. OK? C.U.CW -- The three great virtues of a programmer are Laziness, Impatience and Hubris. (Randal Schwartz) > On 20.10.2016, at 17:39, Ken Anderson <kenli...@anderhome.com> wrote: > > All, > > Now that I have a good idea about charting, I now need to build the values > that will be used for the charts. Because of the volume of data, this will > be a new entity that will have a bunch of totals computed and stored. > > To generate the values, I need to run SQL selects that will return counts for > me to store. Something like this: > > select count(distinct friendID) from MemberFriend where id in (select > distinct memberFriendID from Fitlove where occurredAt between '2016-10-19 > 00:00:00' and '2016-10-19 23:59:59'); > > In searching around, it seems like > ERXSQLQueryWithBindingsUtilities.rawRowsForSqlWithBindings would be perfect, > but I have no idea how to generate the correct query and to setup the binding > properly (using mysql 5.5). > > Can anyone point me to some resources for doing raw rows with bindings with > mysql? > > Thanks! > Ken > _______________________________________________ > 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: > https://lists.apple.com/mailman/options/webobjects-dev/cw%40i4innovation.de > > This email sent to c...@i4innovation.de
signature.asc
Description: Message signed with OpenPGP using GPGMail
_______________________________________________ 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: https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com