RE: SELECT COUNT
RE: SELECT COUNT
- Subject: RE: SELECT COUNT
- From: <email@hidden>
- Date: Fri, 3 Sep 2004 11:44:05 +0200
- Thread-topic: SELECT COUNT
Hi!
The values for the bind variables are found in EOExpression.bindVariableDictionaries(). Passing the on to the database is going to be a challenge of its own.
There is actually an easier way to get a row count from the database. You should be able to find sample code in the archives of the Omnigroup mailing list. I think this was originally posted by Max Muller. I do have a customized version around, in case you can't find the original.
As this code modifies the EOModel at runtime it may have some thread-safety issues if you are working with multiple EOF stacks.
Pierre
-----Original Message-----
From: email@hidden
[mailto:email@hidden]On Behalf Of Benoit Mangez
Sent: Friday, September 03, 2004 10:59 AM
To: WebObjects (Group)
Subject: SELECT COUNT
Hi,
Just a simple question...
I have an huge EOQualifier (build by the user). I would like to perform
a simple SELECT COUNT(*) FROM myEntity WHERE (huge qualifier) without
fetching the corresponding objects.
I can't find a simple way to do this.
I tried to translate the 'huge qualifier' into SQL using the following
code:
EOAdaptor adaptor = EOAdaptor.adaptorWithModel(anEntity.model());
EOSQLExpressionFactory sqlfac = new
EOSQLExpressionFactory(adaptor);
sqlfac.createExpression(anEntity).setUseBindVariables(true);
EOSQLExpression sql =
sqlfac.selectStatementForAttributes(new NSArray(anAttribute), false,
fs, anEntity);
System.out.println("sql:"+sql.statement());
This works fine with FrontBase, but with Oracle: the bindings are
missing in sql.statement().
Any ideas ?
Benoit Mangez
_______________________________________________
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.
**********************************************************************
This email and any files transmitted with it are intended solely for
the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the sender
of this message. (email@hidden)
This email message has been checked for the presence of computer
viruses; however this protection does not ensure this message is
virus free.
Banque centrale du Luxembourg; Tel ++352-4774-1; http://www.bcl.lu
**********************************************************************
_______________________________________________
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.