[Dbix-class] Multiple-column subqueries
Robert Rothenberg
robrwo at gmail.com
Thu May 10 23:20:20 GMT 2018
On 10/05/18 18:00, Robert Rothenberg wrote:
> ...
> Assuming that is the way... I am wondering if it's possible to create a new
> result source class at runtime (and if so, how).
After a bit of close reading of the docs and source, the following seems to
work:
# Create the (anonymous) class based on resultset $rs as
# $class = $namespace . "::" . $name
my $schema = $rs->result_source->schema;
$schema->load_classes( { $namespace => [ $name ] } );
return $schema->source( $class )->resultset
Is that all there is?
Ok, there are some complication, such as the table name to use, and the base
class.
Do I really need to register it, or can I get away with returning a
resultset from the result_source_instance, especilly if I want to use it
anonymously?
More information about the DBIx-Class
mailing list