Re: Problems with set_sql and iterators

[prev] [thread] [next] [Date index for 2005/06/20]

From: Michael Peters
Subject: Re: Problems with set_sql and iterators
Date: 13:30 on 20 Jun 2005
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)

Problems with set_sql and iterators
Jacinta Richardson 07:50 on 20 Jun 2005

Re: Problems with set_sql and iterators
Tony Bowden 08:29 on 20 Jun 2005

Re: Problems with set_sql and iterators
Jacinta Richardson 09:01 on 20 Jun 2005

Re: Problems with set_sql and iterators
merlyn (Randal L. Schwartz) 10:13 on 20 Jun 2005

Re: Problems with set_sql and iterators
Jacinta Richardson 11:44 on 20 Jun 2005

Re: Problems with set_sql and iterators
William Ross 12:51 on 20 Jun 2005

Re: Problems with set_sql and iterators
Michael Peters 13:30 on 20 Jun 2005

Re: Problems with set_sql and iterators
Jacinta Richardson 00:37 on 21 Jun 2005

Re: Problems with set_sql and iterators
Tony Bowden 13:57 on 20 Jun 2005

Generated at 16:37 on 28 Jul 2005 by mariachi v0.52