[CDBI] sth_to_objects on sth from direct SQL with joins

Oliver Jeeves oj at defuturo.co.uk
Fri Nov 24 13:52:20 GMT 2006

Right, I don't know if the subject of this message really makes any
sense, but at least it's an attempt.

So anyway, my problem.

I'm constructing a fairly complex search that could cover relationships
between a number of tables. The way I'm doing this, is to manually build
up the SQL query (ick, I know), execute it, and then use
sth_to_objects() to convert the results to CDBI objects.

According to this page on the wiki:


This should work. Obviously this isn't official documentation.

I've found that this doesn't work when you're joining tables that have
similarly named columns.

In particular, I'm using an object factory as I've described here:


and my overridden construct method is getting a type value from the
joined table, not the table for the class that sth_to_objects was called on.

Ideally, I'd just use something like DeepAbstractSearch or Sweet (yes
Matt, or DBIx::Class), but being able to additional modules in the
production environment means either finding a repository somewhere that
provides and maintains packages for them, or packaging them ourselves
and maintaining the packages, so I'd like to explore solutions not
involving these first.

Any suggestions would be greatly appreciated.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://lists.digitalcraftsmen.net/pipermail/classdbi/attachments/20061124/a5549dd8/signature.pgp

More information about the ClassDBI mailing list