Re: fetch limit vs FrontBase
Re: fetch limit vs FrontBase
- Subject: Re: fetch limit vs FrontBase
- From: Patrick Middleton <email@hidden>
- Date: Thu, 05 Mar 2015 15:08:33 +0000
Was there about 15 years ago, with WO 5.1 and Sybase.
Some JDBC drivers (and ODBC drivers too!) don't support server-side
fetch limits, or don't support server-side return rowset buffering,
or don't usefully support cancel().
So what has to happen is that the client library (JDBC driver) as
used by the app has to read everything, and perhaps buffer
everything, and if you wanted the first 10 rows out of 50000, then
you start to see behaviour where either the client library has to
read all the rows before EOF sees any, or once EOF has all the number
of rows you requested, it then has to read all the other rows too to
leave the connection in a state where you/EOF/the JDBC driver can
issue more SQL.
What I did, based on some code an Apple engineer emailed directly,
was make my own JDBCEOAdaptor framework, that mostly subclassed stuff
in the existing JDBCEOAdaptor framework, but where I overrode
cancelFetch() so that if it detected a suitable Sybase JDBC driver,
it worked through the EOF object graph to get the at
java.sql.Connection instance, which was an instance of a class in the
Sybase JDBC driver, and called -its- cancel() method.
If you want to use the 'top' syntax, find the documentation for
classes like com.webobjects.eoaccess.EOSQLExpression and (I'm
guessing) com.webobjects.jdbcadaptor.JDBCExpression, then work out
how you're going to make use of the EOF delegation API. I think I
might be overriding JDBCExpression.selectStatementForAttributes(...)
to call super, see if I set a fetch limit in the fetch specification
which is one of the arguments, and if I did, using
JDBCExpression.statement() and JDBCExpression.setStatement() to
insert my "top(..)" clause.
But I am doing this from memory from 10-15 years ago!
-- Patrick
On 5 Mar 2015, at 13:16, OC 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:
40onestep.co.uk
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