Re: fetch limit vs FrontBase
Re: fetch limit vs FrontBase
- Subject: Re: fetch limit vs FrontBase
- From: Ramsey Gurley <email@hidden>
- Date: Thu, 05 Mar 2015 09:48:50 -0700
ERXSQLHelper has a FrontBaseSQLHelper subclass which implements limitExpressionForSQL(). Assuming that works, you could try
EOFetchSpecification spec = … //your fetch spec here
EOModel model = EOModelGroup.defaultGroup().entityNamed(spec.entityName()).model();
ERXSQLHelper sqlHelper = ERXSQLHelper.newSQLHelper(ec, model.name());
String sql = sqlHelper.limitExpressionForSQL(null, spec, “", start, end);
EOFetchSpecification fs = new EOFetchSpecification(spec.entityName(), null, null);
fs.setHints(new NSDictionary(sql, EODatabaseContext.CustomQueryExpressionHintKey));
On Mar 5, 2015, at 6:16 AM, OC <email@hidden> wrote:
> Hello there,
>
> unless I am missing something, it looks like with FrontBase, EOF/Wonder alas limits fetches application-side, e.g., my code
>
> ===
> def fs=...
> fs.fetchLimit=1
> ec.objectsWithFetchSpecification(fs)
> ===
>
> with SQL logging switched on yields a result of
>
> ===
> 14:00:57.072 DEBUG === Begin Internal Transaction
> 14:00:57.073 DEBUG evaluateExpression: <com.webobjects.jdbcadaptor.FrontbasePlugIn$FrontbaseExpression: "SELECT t0."C_EDITED_AUCTION_ID", t0."C_CREATION_DATE", t0."C_CREATOR_ID", t0."C_IP_ADDRESS", t0."C_KIND", t0."C_MARKET_ID", t0."C_TITLE", t0."C_UID", t0."C_EDITED_USER_ID" FROM "T_AUDIT" t0 ORDER BY t0."C_CREATION_DATE" ASC" withBindings: >
> 14:00:57.592 DEBUG fetch canceled
> 14:00:57.592 DEBUG 1 row(s) processed
> 14:00:57.600 DEBUG === Commit Internal Transaction
> ===
>
> FrontBase, nevertheless, does support fetch limits with the TOP syntax, e.g., this SQL would work database-level:
>
> ===
> SELECT TOP(1) t0."C_EDITED_AUCTION_ID", t0."C_CREATION_DATE", t0."C_CREATOR_ID", t0."C_IP_ADDRESS", t0."C_KIND", t0."C_MARKET_ID", t0."C_TITLE", t0."C_UID", t0."C_EDITED_USER_ID" FROM "T_AUDIT" t0 ORDER BY t0."C_CREATION_DATE" ASC
> ===
>
> Is there anything I could do to fix that my applicatio(s) really use this and don't try to fetch the complete table?
>
> Thanks,
> OC
>
>
> _______________________________________________
> 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
_______________________________________________
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