[SearchBuilder-devel] [RFC] ROADMAP

Ruslan U. Zakirov Ruslan.Zakirov at miet.ru
Thu Jun 9 20:52:08 EDT 2005


UPDATE:

fix next corner case:
        * new collection
        * CounAll returns 0
        * Limit collection
        * CountAll returns correct value
        * UnLimit or apply other limit(only change must_redo_search)
        * CountAll returns old value

Could be fixed in one line change in CountAll sub, but interfere with
Pages. When you call NextPage or other page walking methods
must_redo_search bcomes true also so CountAll after NextPage force
useless query.


Ruslan U. Zakirov wrote:
> Updates to ROADMAP according to talk on #rt channel
> 
> 
> Ruslan U. Zakirov wrote:
> 
>>     Hello.
>>
>> Here is what I found when was developing for SB.
>>
>> Things should/could be done in 1.x releases:
>> * cover as much as possible code with tests
>>
>> * IsLast is not consistent
>>
>> * LoadFromHash doesn't return any errors as other Load* methods do
>> ** IMHO it should report back missing PK fields
>>
>> * Don't prevent DBI from die or reporting errors, now we have control
>> with RaiseErrors and PrintErrors in Handle.pm. We should just check
>> for $sth is defined and check $sth->err if fetch* methods returns undef.
>>
>>
>> Things should be done in 2 release:
>> * switch to lover case API
>> ** patch capitalization.pm to support converting from lower caseto upper.
>>
>> * get rid of Class::ReturnValue or implement it in all distribution,
>> we should choose one error handling method for internal SB errors.
> 
> 
> Jesse, said that he prefer Class::ReturnValue stay.
> 
>>
>> * rework&review pages support, now I can't write next code:
>> while( $records->NextPage ) {
>>     while( my $rec = $records->Next ) {
>>         ...
>>     }
>> }
>> Now(version 1.30_02) I can't even write tests for pages functionality,
>> because I stuck with bugs in Count&Pages support.
>> It's possible to do next thing:
>> my $count_all = $recs->CountAll;
>> do {
>>     # print $rec->Count;
>>     while( my $r = $recs->Next ) { }
>>     # print $rec->Count;
>> } while( $recs->NextPage < $count_all );
>> But try uncomment that prints with different combinations.
>>
>> * Count&CountAll should be merged into one method - Count, that always
>> returns how many records we can fetch with applied limits no matter
>> use we pages or not to fetch it.
> 
> 
> Now, Count should return number of records that would be fetched. This
> mean if we use pages then it should return number of records on the
> current page.
> But CountAll returns how many records we could fetch in according to
> limits, no matter use we pages or not.
> So roadmap for this:
> ** document differences of the methods
> ** write tests that all it works as expected, for example now Count
> returns wrong value if we call RowsPerPage(X) first and then call Count
> before any row iss fetched, see previous code example
> 
>>
>> * New methods: Prev, Current. Refactor collection walking:
>> ** $sb->{itemscount} can be undef, what means that we are in the begin
>> or end of the set.
>> ** Current, returns undef if $sb->{itemscount} is undef, in other case
>> returns record from array using $sb->{itemscount} as index.
>> ** IsLast and IsFirst return undef if current is not defined, and
>> return 0 or 1 in other cases.
>> ** First and Last - work as before, return undef or object.
>> ** GotoItem supports undef as argument and returns undef or object.
>> ** Next walks forward, returns first object if Current is undef, if
>> there is no Next in set drops $sb->{itemscount} to undef and returns
>> undef.
>> ** Prev walks backward and works like Next, but if Current is undef it
>> starts from Last record.
> 
> 
> This is not discussed.
> 
>>
>>
>> Wait for your comments.
>>
>> -- 
>> Regards, Ruslan.
>> _______________________________________________
>> SearchBuilder-devel mailing list
>> SearchBuilder-devel at bestpractical.com
>> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/searchbuilder-devel
>>
>>
> 



More information about the SearchBuilder-devel mailing list