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 tables
40 Gets and set the tables the SELECT mentions. Accepts a string, list or
41 arrayref; returns an array or array reference. Will unique the table
42 names and keep them in order by the first occurrence of a field name.
43
44 $view->tables('foo');
45 $view->tables('foo', 'bar');
46 $view->tables( 'foo, bar' );
47 $view->tables( [ 'foo', 'bar' ] );
48 $view->tables( qw[ foo bar ] );
49
50 my @tables = $view->tables;
51
52 options
53 Gets or appends a list of options on the view.
54
55 $view->options('ALGORITHM=UNDEFINED');
56
57 my @options = $view->options;
58
59 is_valid
60 Determine whether the view is valid or not.
61
62 my $ok = $view->is_valid;
63
64 name
65 Get or set the view's name.
66
67 my $name = $view->name('foo');
68
69 order
70 Get or set the view's order.
71
72 my $order = $view->order(3);
73
74 sql
75 Get or set the view's SQL.
76
77 my $sql = $view->sql('select * from foo');
78
79 schema
80 Get or set the view's schema object.
81
82 $view->schema( $schema );
83 my $schema = $view->schema;
84
85 equals
86 Determines if this view is the same as another
87
88 my $isIdentical = $view1->equals( $view2 );
89
91 Ken Youens-Clark <kclark@cpan.org>.
92
93
94
95perl v5.36.0 2023-02-27 SQL::Translator::Schema::View(3)