DBIx::DataModel::Doc::Delta_v1 - Differences introduced in version 1.0
This document is a short enumeration of the main differences introduced in version DBIx::DataModel version 1.0.
DBIx::DataModel
DBIx::DataModel ->Schema(qw/MySchema ..../) ->Table(qw/Table1 .../) ->Table(qw/Table2 .../) ... ->Association(...) ->
instead of
DBIx::DataModel->Schema(qw/MySchema ..../); MySchema->Table(qw/Table1 .../); MySchema->Table(qw/Table2 .../); ... MySchema->Association(...); MySchema->
->Table(qw/Table1 .../) ... ->Association([qw/Table1 .../], [qw/Table2 .../])
->Table(qw/MySchema::Table1 .../) ... ->Association([qw/MySchema::Table1 .../], [qw/MySchema::Table2 .../])
but explicit prefix is still possible
->Table(qw/My::Other::Namespace::Table1 .../) ... ->Association([qw/My::Other::Namespace::Table1 .../], [qw/My::Other::Namespace::Table2 .../])
perl -MDBIx::DataModel::Schema::Generator \ -e "fromDBI('dbi:connection:string')" -- \ -schema My::New::Schema > My/New/Schema.pm perl -MDBIx::DataModel::Schema::Generator \ -e "fromDBIxClass('Some::DBIC::Schema')" -- \ -schema My::New::Schema > My/New/Schema.pm sqlt -f <parser> -t DBIx::DataModel::Schema::Generator <parser_input>
See DBIx::DataModel::Schema::Generator.
For a global view of the class hierarchy, see "Classes" in DBIx::DataModel::Doc::Design.
Classes Table and View both inherit from Source instead of AbstractTable. This internal change should be mostly invisible to users.
Table
View
AbstractTable
The former Cursor class is now called Statement, because it has several new methods for managing the lifecycle of a query statement to the database (bind, sqlize, prepare, execute, etc.).
Cursor
bind
sqlize
prepare
execute
my $view = MySchema->join(qw/Table role1 role2 .../)
my $view = MySchema->ViewFromRoles(qw/Table role1 role2 .../)
my $list = $obj->join(qw/role1 role2 .../) ->select(-columns => ... -where => ...);
my $list = $obj->selectFromRoles(qw/role1 role2 .../) ->(-columns => ... -where => ...);
My::Table->MethodFromJoin(method => qw/role1 role2 .../);
My::Table->MethodFromRoles(method => qw/role1 role2 .../);
See the design doc and reference doc (lifecycle, named placeholders, etc.).
New class method join in a table or view produces a statement that can be executed on instances of that table or view.
join
my $stmt = My::Table->join(qw/role1 role2 .../); $stmt->prepare; foreach my $obj (@instances_of_my_table) { my $list = $stmt->execute($obj)->all; ... # or $stmt->execute($obj); while (my $row = $stmt->next) { ... } }
My::Table->fetch_cached(@primary_key);
MySchema->dbiPrepareMethod('prepareCached');
MySchema->join(qw/Table|a1 role1|a2 .../) ->select(-columns => [qw/a1.c1 a1.c2 a2.c1 a2.c2 .../])
..->join(qw/FirstTable role1|r1 FirstTable.role2 r1.role3|r3 role2.role4/)
My::Table->ColumnType(Date => qw/date1 date2 .../); ... my $rows = My::Table->select(-columns => qw/date1|d1 date2|d2 .../);
my $stmt = $source->select(-columns => ... -where => ... -resultAs => 'fast_statement'); while (my $row = $stmt->next) { work_immedately_with($row); }
my $pairs = MySchema::People->select(-columns => [qw/pers_id firstname/], -resultAs => 'flat_arrayref'); my %hash = @$pairs;
To install DBIx::DataModel, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBIx::DataModel
CPAN shell
perl -MCPAN -e shell install DBIx::DataModel
For more information on module installation, please visit the detailed CPAN module installation guide.