On 6/5/07, Brandon Black <[EMAIL PROTECTED]> wrote:
On 6/5/07, John Goulah <[EMAIL PROTECTED]> wrote:
> So I've noticed that search returns a "resultset"
> (MyApp::ResultSet::Tablename) and find returns a "row_object"
> (MyApp::Model::MyDB::Tablename). I suppose this makes some
> sense since search may return many rows while find is designed to find
one
> row. However it seems that its more useful to deal with the resultset
> object, for example if I have defined my own custom resultset functions
> within, I can reuse this returned object to call them, perhaps even
using
> some of the already populated fields as parts of the where clause (such
as a
> primary key like user_id). Maybe not the best idea, but seems easier
than
> passing the same user_id into each query. In any case, is there any
way to
> force/cast the "row_object" into a result set, or are we stuck with only
> using search if we want a ResultSet back?
>
If you want to find a single record, you use ->find(), if you want a
resultset which represents a single record, you use ->search({
pk_colname => "pk_value" });
-- Brandon
Sure I understand that, I suppose more specifically then my question is why
not have one common object returned by both functions? In any case, I
guess it doesn't matter much, I can just use search since it seems thats
what I need-
Thanks,
John
_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/