1 package DBIx::Class::ResultSourceProxy::Table;
6 use base qw/DBIx::Class::ResultSourceProxy/;
8 use DBIx::Class::ResultSource::Table;
10 __PACKAGE__->mk_classdata(table_class => 'DBIx::Class::ResultSource::Table');
12 __PACKAGE__->mk_classdata('table_alias'); # FIXME: Doesn't actually do
15 sub _init_result_source_instance {
18 $class->mk_classdata('result_source_instance')
19 unless $class->can('result_source_instance');
21 my $table = $class->result_source_instance;
22 my $class_has_table_instance = ($table and $table->result_class eq $class);
23 return $table if $class_has_table_instance;
26 $table = $class->table_class->new({
28 result_class => $class,
34 $table = $class->table_class->new({
36 result_class => $class,
41 $class->result_source_instance($table);
48 DBIx::Class::ResultSourceProxy::Table - provides a classdata table
49 object and method proxies
53 __PACKAGE__->table('cd');
54 __PACKAGE__->add_columns(qw/cdid artist title year/);
55 __PACKAGE__->set_primary_key('cdid');
61 __PACKAGE__->add_columns(qw/cdid artist title year/);
63 Adds columns to the current class and creates accessors for them.
69 __PACKAGE__->table('tbl_name');
71 Gets or sets the table name.
76 my ($class, $table) = @_;
77 return $class->result_source_instance->name unless $table;
79 $table = $class->table_class->new({
80 $class->can('result_source_instance') ?
81 %{$class->result_source_instance||{}} : (),
83 result_class => $class,
88 $class->mk_classdata('result_source_instance')
89 unless $class->can('result_source_instance');
91 $class->result_source_instance($table);
93 return $class->result_source_instance->name;
98 if ($obj->has_column($col)) { ... }
100 Returns 1 if the class has a column of this name, 0 otherwise.
106 my $info = $obj->column_info($col);
108 Returns the column metadata hashref for a column. For a description of
109 the various types of column data in this hashref, see
110 L<DBIx::Class::ResultSource/add_column>
116 my @column_names = $obj->columns;
124 Matt S. Trout <mst@shadowcatsystems.co.uk>
128 You may distribute this code under the same terms as Perl itself.