1SQL::Translator::SchemaU:s:eVrieCwo(n3t)ributed Perl DocSuQmLe:n:tTartainosnlator::Schema::View(3)
2
3
4
6 SQL::Translator::Schema::View - SQL::Translator view object
7
9 use SQL::Translator::Schema::View;
10 my $view = SQL::Translator::Schema::View->new(
11 name => 'foo', # name, required
12 sql => 'select id, name from foo', # SQL for view
13 fields => 'id, name', # field names in view
14 );
15
17 "SQL::Translator::Schema::View" is the view object.
18
20 new
21 Object constructor.
22
23 my $view = SQL::Translator::Schema::View->new;
24
25 fields
26 Gets and set the fields the constraint is on. Accepts a string, list
27 or arrayref; returns an array or array reference. Will unique the
28 field names and keep them in order by the first occurrence of a field
29 name.
30
31 $view->fields('id');
32 $view->fields('id', 'name');
33 $view->fields( 'id, name' );
34 $view->fields( [ 'id', 'name' ] );
35 $view->fields( qw[ id name ] );
36
37 my @fields = $view->fields;
38
39 is_valid
40 Determine whether the view is valid or not.
41
42 my $ok = $view->is_valid;
43
44 name
45 Get or set the view's name.
46
47 my $name = $view->name('foo');
48
49 order
50 Get or set the view's order.
51
52 my $order = $view->order(3);
53
54 sql
55 Get or set the view's SQL.
56
57 my $sql = $view->sql('select * from foo');
58
59 schema
60 Get or set the view's schema object.
61
62 $view->schema( $schema );
63 my $schema = $view->schema;
64
65 equals
66 Determines if this view is the same as another
67
68 my $isIdentical = $view1->equals( $view2 );
69
71 Ken Youens-Clark <kclark@cpan.org>.
72
73
74
75perl v5.12.0 2009-08-18 SQL::Translator::Schema::View(3)