in my experience this wont cause a problem. any reasonable db keeps a count
of the total rows in any given table. the size() query is most likely select
count(*) from foo, which will use that stored count. and even if there is
something more dynamic to it, the db will most likely put that statement in
a cache and use that.

so basically, dont cry wolf until you actually encounter the problem. you
can play what-if for a long time :)

-igor

On 6/10/07, Lec <[EMAIL PROTECTED]> wrote:


Igor,

      if calling paging 1,2,3 n.... each time requires a call to
iterator(first, count) and size(), which means a call to db, wouldn't this
way, it ll give a bottleneck at the database layer? Imagine there are
about
concurrent 5000 users doing the paging....im sure the database will
slowdown
significantly? can it be any way where iterator() can return the size
value
as well, just to reduce to one query rather than 2 queries being made each
time the paging is executed?



igor.vaynberg wrote:
>
> the iterator() and size() are not meant to be used "together" and there
is
> no, nor ever be, a contract that guarantees any ordering of invocations
> between these two methods.
>
> size() is meant to return the total number of rows
>
> iterator() is used to return a window that will be displayed
>
> those are the only contracts.
>
> what exactly is the problem?
>
> -Igor
>
>
> On 4/4/06, Frank Silbermann <[EMAIL PROTECTED]> wrote:
>>
>>     I have a question about the intended use of the DataTable
components
>> provided in Wicket Extensions.  The DataTable relies upon an
>> IDataProvider
>> to provide the data.  To do this, we implement:
>>
>> "Iterator iterate(first, count)"
>>
>> Lacking any advice to the contrary, I assumed that this is the method
>> which would retrieve data from the database, but this does not seem to
be
>> working well for me.
>>
>> My database query is parameterized based on page-component model
values,
>> and these may change with each rendering. My problem is that when one
>> rendering presents a short data set, on the next rendering the
DataTable
>> is
>> not always requesting all of the rows.  The "count" seems to be
affected
>> by the number of rows returned by the previous rendering.
>>
>> I suspect this is because my implementation of  "int DataProvider.size
()"
>> assumes that it will be called _*after*_ "Iterator iterate(first,
count)"
>> pulls down the data – so it's always one rendering behind.
>>
>> Should I give the "int IDataProvider.size()" method the responsibility
>> for
>> figuring out the query string and going to the database?  (How else
would
>> it be able to tell the DataProvider how many rows to request?)
>>
>>
>>
>
>

--
View this message in context:
http://www.nabble.com/RE%3A--Contract-for-%22Iterator-IDataProvider.iterator%28int-first%2C-int-count%29%22-----tf1395451.html#a11054989
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to