[CDBI] sth_to_objects on sth from direct SQL with joins

Oliver Jeeves <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.class-dbi
Message-ID <[email protected]>
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:

http://wiki.class-dbi.com/wiki/Directly_execute_SQL

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:

http://wiki.class-dbi.com/wiki/Implementing_an_object_factory

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.

-Oli

_______________________________________________
ClassDBI mailing list
ClassDBI-Ra3b/[email protected]
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFZvkYSbWXajvTQ+URAisZAJ9C2UVlHX1X9aNAhXI2SLnzIqaEZACghZw0
C8mH2iyNGU2D9ji7Zpc3j6k=
=zwG4
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.