Main > Programming > Libraries >

DBIx::DataModel 0.21

DBIx::DataModel 0.21

Sponsored Links

DBIx::DataModel 0.21 Ranking & Summary

RankingClick at the star to rank
Ranking Level
User Review: 0 (0 times)
File size: 0.041 MB
Platform: Any Platform
License: Perl Artistic License
Price:
Downloads: 1134
Date added: 2006-09-20
Publisher: Laurent Dami

DBIx::DataModel 0.21 description

DBIx::DataModel is a Perl module with Classes and UML-style Associations on top of DBI.

SYNOPSIS

in file "MySchema.pm"

Declare the schema
use DBIx::DataModel;
DBIx::DataModel->Schema(MySchema); # MySchema is now a Perl package

Declare the tables with (Perl name, DB name, primary key column(s)). Each table then becomes a Perl package.

MySchema->Table(qw/Employee Employee emp_id/);
MySchema->Table(qw/Department Department dpt_id/);
MySchema->Table(qw/Activity Activity act_id/);
Declare associations in UML style ( [table1 role1 multiplicity1 join1], [table2...]).
MySchema->Association([qw/Activity activities * emp_id/],
[qw/Employee employee 1 emp_id/]);
MySchema->Association([qw/Activity activities * dpt_id/],
[qw/Department department 1 dpt_id/]);
Declare a n-to-n association, on top of the linking table
MySchema->Association([qw/Department departments * activities department/]);
[qw/Employee employees * activities employee/]);
Declare "column types" with some handlers ..
# date conversion between database (yyyy-mm-dd) and user (dd.mm.yyyy)
MySchema->ColumnType(Date =>
fromDB => sub {$_[0] =~ s/(dddd)-(dd)-(dd)/$3.$2.$1/},
toDB => sub {$_[0] =~ s/(dd).(dd).(dddd)/$3-$2-$1/},
validate => sub {$_[0] =~ m/(dd).(dd).(dddd)/});

# percent conversion between database (0.8) and user (80)
MySchema->ColumnType(Percent =>
fromDB => sub {$_[0] *= 100 if $_[0]},
toDB => sub {$_[0] /= 100 if $_[0]},
validate => sub {$_[0] =~ /1?d?d/});
.. and apply these "column types" to some of our columns
Employee->ColumnType(Date => qw/d_birth/);
Activity->ColumnType(Date => qw/d_begin d_end/);
Activity->ColumnType(Percent => qw/activity_rate/);
Declare a column that will be filled automatically at each update
MySchema->AutoUpdateColumns(last_modif =>
sub{$ENV{REMOTE_USER}.", ".scalar(localtime)});

For details that could not be expressed in a declarative way, just add a new method into the table class (but in that case, Schema and Table declarations should be in a BEGIN block, so that the table class is defined before you start adding methods to it).

package Activity;

sub activePeriod {
my $self = shift;
$self->{d_end} ? "from $self->{d_begin} to $self->{d_end}"
: "since $self->{d_begin}";
}

Declare how to automatically expand objects into data trees
Activity->AutoExpand(qw/employee department/);

DBIx::DataModel 0.21 Screenshot

Advertisements

DBIx::DataModel 0.21 Keywords

Bookmark DBIx::DataModel 0.21

Hyperlink code:
Link for forum:

DBIx::DataModel 0.21 Copyright

WareSeeker periodically updates pricing and software information of DBIx::DataModel 0.21 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of DBIx::DataModel 0.21 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed

Allok Video Splitter 2.2.0 Review:

Name (Required)
Email(Required)
Captcha
Featured Software

Want to place your software product here?
Please contact us for consideration.

Contact WareSeeker.com
Related Software
DBIx:DataLookup 0.03 is designed as a useful tool which can help you easily both cache records pulled by an SQL statement from a database in the memory as well as look them up later at any time during execution of your script. Free Download
DBIx::XML::DataLoader contains a set of modules that are meant to work together. Free Download
DBIx::DBStag is a Perl module for Relational Database to Hierarchical (Stag/XML) Mapping. Free Download
DBIx::CGITables is a Perl module for easy DB access from a CGI. Free Download
DBIx::Wrapper is a Perl module that serves as a wrapper around DBI. Free Download
DBIx::Perlish module provides the ability to work with databases supported by the DBI module. Free Download
DBIx::Log4perl is a Perl extension for DBI to selectively log SQL, parameters, result-sets, etc. Free Download
DBIx::Frame is a Perl module for creating and maintaining DBI frameworks. Free Download