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

SQL schema in progress
author sourcer
date Thu, 12 May 2011 08:57:19 +0400
parents 76515373dac0
children d1676be8afcc
comparison
equal deleted inserted replaced
166:4267a2ac3d46 167:1f7a6d762394
1 use strict; 1 use strict;
2 package IMPL::SQL::Schema; 2 package IMPL::SQL::Schema;
3 3
4 use IMPL::_core::version; 4 use IMPL::_core::version;
5 use IMPL::lang; 5
6 use IMPL::lang qw(is :declare :constants);
7
6 use parent qw( 8 use parent qw(
7 IMPL::Object 9 IMPL::Object
8 IMPL::Object::Disposable 10 IMPL::Object::Disposable
9 IMPL::Object::Autofill 11 IMPL::Object::Autofill
10 IMPL::Object::Clonable 12 IMPL::Object::Clonable
11 ); 13 );
12 14
13 use IMPL::Class::Property;
14 use IMPL::Class::Property::Direct; 15 use IMPL::Class::Property::Direct;
15 16
16 require IMPL::SQL::Schema::Table; 17 require IMPL::SQL::Schema::Table;
17 18
18 __PACKAGE__->PassThroughArgs; 19 __PACKAGE__->PassThroughArgs;
19 20
20 BEGIN { 21 BEGIN {
21 public _direct property version => prop_get; 22 public _direct property version => PROP_GET;
22 public _direct property name => prop_get; 23 public _direct property name => PROP_GET;
23 private _direct property tables => prop_get; 24 private _direct property tables => PROP_GET;
24 } 25 }
25 26
26 sub AddTable { 27 sub AddTable {
27 my ($this,$table) = @_; 28 my ($this,$table) = @_;
28 29
62 63
63 sub ResolveTable { 64 sub ResolveTable {
64 my ($this,$table) = @_; 65 my ($this,$table) = @_;
65 66
66 UNIVERSAL::isa($table,'IMPL::SQL::Schema::Table') ? $table : $this->{$tables}{$table}; 67 UNIVERSAL::isa($table,'IMPL::SQL::Schema::Table') ? $table : $this->{$tables}{$table};
67 }
68
69 sub Table {
70 goto &GetTable;
71 } 68 }
72 69
73 sub GetTable { 70 sub GetTable {
74 my ($this,$tableName) = @_; 71 my ($this,$tableName) = @_;
75 return $this->{$tables}{$tableName}; 72 return $this->{$tables}{$tableName};