[SearchBuilder-devel] [RFC] ROADMAP
Ruslan U. Zakirov
Ruslan.Zakirov at miet.ru
Thu May 26 09:13:44 EDT 2005
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.
* 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.
* 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.
Wait for your comments.
--
Regards, Ruslan.
More information about the SearchBuilder-devel
mailing list