comparison Lib/IMPL/SQL/Schema/Table.pm @ 278:4ddb27ff4a0b

core refactoring
author cin
date Mon, 04 Feb 2013 02:10:37 +0400
parents 56364d0c4b4f
children 77df11605d3a
comparison
equal deleted inserted replaced
277:6585464c4664 278:4ddb27ff4a0b
1 package IMPL::SQL::Schema::Table;
1 use strict; 2 use strict;
2 package IMPL::SQL::Schema::Table; 3
3 4 use IMPL::lang qw(is);
4 use IMPL::lang qw(:declare is); 5 use IMPL::Const qw(:prop);
5 6 use IMPL::declare {
6 use parent qw( 7 base => [
7 IMPL::Object 8 'IMPL::Object' => undef,
8 IMPL::Object::Disposable 9 'IMPL::Object::Disposable' => undef
9 ); 10 ],
11 props => [
12 name => PROP_RO | PROP_DIRECT,
13 schema => PROP_RO | PROP_DIRECT,
14 columns => PROP_RO | PROP_DIRECT,
15 constraints => PROP_RO | PROP_DIRECT,
16 columnsByName => PROP_RO | PROP_DIRECT,
17 primaryKey => PROP_RO | PROP_DIRECT,
18 tag => PROP_RW | PROP_DIRECT,
19 ]
20 };
10 21
11 require IMPL::SQL::Schema::Column; 22 require IMPL::SQL::Schema::Column;
12 require IMPL::SQL::Schema::Constraint; 23 require IMPL::SQL::Schema::Constraint;
13 require IMPL::SQL::Schema::Constraint::PrimaryKey; 24 require IMPL::SQL::Schema::Constraint::PrimaryKey;
14 require IMPL::SQL::Schema::Constraint::ForeignKey; 25 require IMPL::SQL::Schema::Constraint::ForeignKey;
15
16 use IMPL::Class::Property::Direct;
17
18 BEGIN {
19 public _direct property name => PROP_GET;
20 public _direct property schema => PROP_GET;
21 public _direct property columns => PROP_GET;
22 public _direct property constraints => PROP_GET;
23 public _direct property columnsByName => 0;
24 public _direct property primaryKey => PROP_GET;
25 public _direct property tag => PROP_ALL;
26 }
27 26
28 sub CTOR { 27 sub CTOR {
29 my ($this,%args) = @_; 28 my ($this,%args) = @_;
30 29
31 $this->{$name} = $args{'name'} or die new IMPL::InvalidArgumentException('a table name is required'); 30 $this->{$name} = $args{'name'} or die new IMPL::InvalidArgumentException('a table name is required');