Re: Problems with set_sql and iterators
[prev]
[thread]
[next]
[Date index for 2005/06/20]
Jacinta Richardson wrote:
[snip]
> It seems to me that either CDBI should throw an exception because the
> search results don't fill in all values of the primary keys for this
> class, or CDBI should behave differently (from how it does) in a boolean
> context.
>
> Since CDBI *can* be used to perform aggregate searches on the tables the
> classes are defined for, and since aggregate searches can't keep the
> primary key information intact, it seems to me that this overload to
> bool which marks the objects as false is strange. There is obviously
> data there, I wish to use it, why say the object is false?
In Class::DBI all objects correspond to a an actual row in the database
and thus does not work with aggregate searches. Just because C::D
doesn't complain loudly when you're doing it doesn't mean it will work.
Maybe it should croak/die when you try to inflate a result row into an
object that doesn't have all the primary keys. I'm sure a patch would be
welcome.
If you still want to use aggregate searches in your C::D based classes
you can use your database handle (db_Main) to execute straight SQL and
return the corresponding data structure, just don't try and turn them
into C::D objects (sth_to_objects, construct, etc).
> If it's not considered a good idea to perform this sort of aggregate
> search through CDBI like this then the documentation should say so.
If it wasn't clear in the docs, then you're probably right. I'm sure
Tony would accept would accept doc patches for the upcoming release.
--
Michael Peters
Developer
Plus Three, LP
|
(message missing)
|