1 package DBIx::Class::ResultSourceProxy::Table;
6 use base qw/DBIx::Class::ResultSourceProxy/;
7 __PACKAGE__->load_components(qw/AccessorGroup/);
9 __PACKAGE__->mk_group_accessors('component_class' => 'table_class');
10 __PACKAGE__->table_class('DBIx::Class::ResultSource::Table');
12 __PACKAGE__->mk_classdata('table_alias'); # FIXME: Doesn't actually do anything yet!
16 DBIx::Class::ResultSourceProxy::Table - provides a classdata table object and method proxies
20 __PACKAGE__->table('foo');
21 __PACKAGE__->add_columns(qw/id bar baz/);
22 __PACKAGE__->set_primary_key('id');
28 __PACKAGE__->add_columns(qw/col1 col2 col3/);
30 Adds columns to the current class and creates accessors for them.
36 __PACKAGE__->table('tbl_name');
38 Gets or sets the table name.
43 my ($class, $table) = @_;
44 return $class->result_source_instance->name unless $table;
46 $table = $class->table_class->new({
47 $class->can('result_source_instance') ? %{$class->result_source_instance} : (),
49 result_class => $class,
52 $class->mk_classdata('result_source_instance' => $table);
53 if ($class->can('schema_instance')) {
54 $class =~ m/([^:]+)$/;
55 $class->schema_instance->register_class($class, $class);
61 if ($obj->has_column($col)) { ... }
63 Returns 1 if the class has a column of this name, 0 otherwise.
69 my $info = $obj->column_info($col);
71 Returns the column metadata hashref for a column. For a description of
72 the various types of column data in this hashref, see
73 L<DBIx::Class::ResultSource/add_column>
79 my @column_names = $obj->columns;
87 Matt S. Trout <mst@shadowcatsystems.co.uk>
91 You may distribute this code under the same terms as Perl itself.