"_engine" => 'InnoDB',
});
+=cut
+
+sub is_virtual { 0 }
+
+=pod
+
+=head2 is_virtual
+
+Returns true if the resultsource is a virtual result source. This stub
+method returns false by default, see L<DBIx::Class::ResultSource::View>
+for more information.
+
=head2 add_columns
$table->add_columns(qw/col1 col2 col3/);
use base qw/DBIx::Class/;
__PACKAGE__->load_components(qw/ResultSource/);
+__PACKAGE__->mk_group_accessors('simple' => ' is_virtual');
=head1 NAME
=head1 METHODS
+=head2 is_virtual
+
+Attribute to declare a view as virtual.
+
=head2 from
Returns the FROM entry for the table (i.e. the view name)
+or the definition if this is a virtual view.
=cut
-sub from { shift->name; }
+sub from {
+ my $self = shift;
+ return \"(${\$self->view_definition})" if $self->is_virtual;
+ return $self->name;
+}
1;
my(@table_monikers, @view_monikers);
for my $moniker (@monikers){
my $source = $dbicschema->source($moniker);
+ next if $source->is_virtual;
if ( $source->isa('DBIx::Class::ResultSource::Table') ||
$source->isa('DBIx::Class::ResultSourceProxy::Table') ) {
push(@table_monikers, $moniker);