damil / dbix-datamodel Goto Github PK
View Code? Open in Web Editor NEWUML-based Object-Relational Mapping (ORM) framework for Perl
Home Page: https://metacpan.org/pod/DBIx::DataModel
UML-based Object-Relational Mapping (ORM) framework for Perl
Home Page: https://metacpan.org/pod/DBIx::DataModel
When is it possible to use -result_as
with select
queries?
My use case: I create a statement object with an initial set of parameters and then add further -where
parameters according to the values of some filters using $statement->refine
. The last step is to output the results; depending on the type of output required, I might want a statement handle (-result_as => $sth
) or a DBIx::DataModel::Statement
object, i.e.
my $stt = $self->schema( $schema )->table( $table )->select( %args );
...
$stt->refine( -where => %where_args );
...
# ready to output
if ( $format eq 'csv' ) {
# use a statement handle
my $sth = ???; # !! is this possible?
# output as CSV
# $csv->print( $io, $sth->{NAME_lc} );
# ...
}
else {
# use DBIx::DataModel::Statement object
...
}
Once I've created the initial $stt object, it is in status refined
and I can only add more -where
args at this point. If I try running $stt->reset
I can get back to status new
but adding the old arguments with -result_as => 'sth'
still leaves me with a DBIx::DataModel::Statement
object, not the statement handle that I'd like to use.
It's really useful to be able to call $stt->refine
to add parameters to an existing query. Is there any way to get a DBI statement handle out of the DBIx::DataModel::Statement
object?
Relationships between tables can be declared either as Association() or as Composition().
When choosing Composition(), a metadata list of "components" is generated. The algorithm for generating this list has a bug : it includes the composite class as a "component" of its ... component classes, therefore generating a circular structure.
In consequence the auto_expand($with_recursion) method generates an infinite loop.
When using Data::Dump https://metacpan.org/module/Data::Dump, dump on a DBIDM blessed hash will crash if the hash is a result of a join.
The offending string will look something like this:
activity|a<=>process|p<=>domain|d=
as part of
'My::Schema::AutoJoin::Task|t<=>activity|a<=>process|p<=>domain|d'
This is probably a bug on Data::Dump rather than DBIDM, but I putting here for tracking until I can generate a simple test case to log against Data::Dump
Being able to pull data from related tables is very handy, but is there a way to add an ORDER BY
clause without using $row->expand()
, or have a default ORDER_BY
clause as part of the association?
For example, I have an object with 20+ different compositions/associations to fetch; it would be very handy to set the order that i want each association fetched in as part of the data model.
(This is probably going beyond what DBIx::DataModel is meant for, but I was just wondering if it was possible without specifying it using $row->expand( 'association', ( -order_by => 'whatever' ) )
.)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.