Mercurial > pub > Impl
comparison _test/Test/SQL/Traits.pm @ 168:6148f89bb7bf
IMPL::SQL::Schema::Traits::Diff alfa version
IMPL::lang added hash traits
author | sourcer |
---|---|
date | Mon, 16 May 2011 04:30:38 +0400 |
parents | 1f7a6d762394 |
children | d1676be8afcc |
comparison
equal
deleted
inserted
replaced
167:1f7a6d762394 | 168:6148f89bb7bf |
---|---|
43 new IMPL::SQL::Schema::Traits::Column( | 43 new IMPL::SQL::Schema::Traits::Column( |
44 id => Integer, tag => { auto_increment => 1 } | 44 id => Integer, tag => { auto_increment => 1 } |
45 ) | 45 ) |
46 ); | 46 ); |
47 | 47 |
48 my $column = $table->Column('id') or failed "Column not found"; | 48 my $column = $table->GetColumn('id') or failed "Column not found"; |
49 | 49 |
50 assert( $column->name eq 'id'); | 50 assert( $column->name eq 'id'); |
51 assert( $column->type->SameValue(Integer()) ); | 51 assert( $column->type->SameValue(Integer()) ); |
52 assert( not $column->isNullable ); | 52 assert( not $column->isNullable ); |
53 assert( $column->tag->{auto_increment} ); | 53 assert( $column->tag->{auto_increment} ); |
56 new IMPL::SQL::Schema::Traits::Column( | 56 new IMPL::SQL::Schema::Traits::Column( |
57 name => Varchar(255), isNullable => 1 | 57 name => Varchar(255), isNullable => 1 |
58 ) | 58 ) |
59 ); | 59 ); |
60 | 60 |
61 $column = $table->Column('name'); | 61 $column = $table->GetColumn('name'); |
62 | 62 |
63 assert($column); | 63 assert($column); |
64 assert($column->name eq 'name'); | 64 assert($column->name eq 'name'); |
65 assert($column->type->SameValue(Varchar(255))); | 65 assert($column->type->SameValue(Varchar(255))); |
66 assert($column->isNullable); | 66 assert($column->isNullable); |
79 ) | 79 ) |
80 ) or failed "Failed to create table"; | 80 ) or failed "Failed to create table"; |
81 | 81 |
82 assert( $table->ColumnsCount == 3 ); | 82 assert( $table->ColumnsCount == 3 ); |
83 | 83 |
84 assert( my $column = $table->Column('id') ); | 84 assert( my $column = $table->GetColumn('id') ); |
85 assert($column->type->SameValue(Varchar(64))); | 85 assert($column->type->SameValue(Varchar(64))); |
86 assert(not $column->isNullable); | 86 assert(not $column->isNullable); |
87 | 87 |
88 assert( $column = $table->Column('role') ); | 88 assert( $column = $table->GetColumn('role') ); |
89 assert( $column->defaultValue eq 'user' ); | 89 assert( $column->defaultValue eq 'user' ); |
90 }; | 90 }; |
91 | 91 |
92 sub FinishUnit { | 92 sub FinishUnit { |
93 my ($self,$session) = @_; | 93 my ($self,$session) = @_; |