comparison Lib/IMPL/SQL/Schema/Traits.pm @ 167:1f7a6d762394

SQL schema in progress
author sourcer
date Thu, 12 May 2011 08:57:19 +0400
parents 76515373dac0
children 6148f89bb7bf
comparison
equal deleted inserted replaced
166:4267a2ac3d46 167:1f7a6d762394
56 56
57 ################################################## 57 ##################################################
58 58
59 package IMPL::SQL::Schema::Traits::Constraint; 59 package IMPL::SQL::Schema::Traits::Constraint;
60 use base qw(IMPL::Object::Fields); 60 use base qw(IMPL::Object::Fields);
61 61
62 use fields qw( 62 use fields qw(
63 name 63 name
64 tableName
65 columns 64 columns
66 ); 65 );
67 66
68 sub CTOR { 67 sub CTOR {
69 my ($this, $name, $tableName, $columns) = @_; 68 my ($this, $name, $columns) = @_;
70 69
71 $this->{name} = $name; 70 $this->{name} = $name;
72 $this->{tableName} = $tableName; 71 $$this->{columns} = $columns; # list of columnNames
73 $$this->{columns} = $columns;
74 } 72 }
75 73
76 ################################################## 74 ##################################################
77 75
78 package IMPL::SQL::Schema::Traits::PrimaryKey; 76 package IMPL::SQL::Schema::Traits::PrimaryKey;
106 foreignTable 104 foreignTable
107 foreignColumns 105 foreignColumns
108 ); 106 );
109 107
110 our %CTOR = ( 108 our %CTOR = (
111 'IMPL::SQL::Schema::Traits::Constraint' => sub { @_[0..2] } 109 'IMPL::SQL::Schema::Traits::Constraint' => sub { @_[0..1] }
112 ); 110 );
113 111
114 sub CTOR { 112 sub CTOR {
115 my ($this,$foreignTable,$foreignColumns) = @_[0,4,5]; 113 my ($this,$foreignTable,$foreignColumns) = @_[0,3,4];
116 114
117 $this->{foreignTable} = $foreignTable; 115 $this->{foreignTable} = $foreignTable;
118 $this->{foreignColunms} = $foreignColumns; 116 $this->{foreignColunms} = $foreignColumns;
119 } 117 }
120 118