FeyX::Active::Table - An active Fey Table
use FeyX::Active::Table; my $Person = FeyX::Active::Table->new(name => 'Person'); $Person->add_column( Fey::Column->new( name => 'first_name', type => 'varchar' ) ); $Person->add_column( Fey::Column->new( name => 'last_name', type => 'varchar' ) ); $schema->add_table( $Person ); my @people = ( { first_name => 'Homer', last_name => 'Simpson' }, { first_name => 'Marge', last_name => 'Simpson' }, { first_name => 'Bart', last_name => 'Simpson' }, ); foreach my $person (@people) { $Person->insert( %$person )->execute; } my ($first_name, $last_name) = $Person->select ->where( $Person->column('first_name'), '==', 'Homer' ) ->execute ->fetchrow;
This is a subclass of Fey::Table that adds a couple methods for creating FeyX::Active::SQL objects.
All these methods will pass the default_source database handle from the associated FeyX::Active::Schema to the FeyX::Active::SQL object it creates.
default_source
This will create a FeyX::Active::SQL::Select object which that will execute against the table associated. You can either pass in a list of Fey::Column objects to be passed to the select method, or pass in nothing which will be interpreted as selecting all the columns.
This will create a FeyX::Active::SQL::Delete object which that will execute against the table associated.
This will create a FeyX::Active::SQL::Insert object which that will execute against the table associated. You can optionally pass in the set of values you wish to insert and they will be passed to the values method.
values
This will create a FeyX::Active::SQL::Update object which that will execute against the table associated. You can optionally pass in the set of values you wish to update and they will be passed to the set method.
set
All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to cpan-RT.
Stevan Little <stevan.little@iinteractive.com>
Copyright 2009-2010 Infinity Interactive, Inc.
http://www.iinteractive.com
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install FeyX::Active, copy and paste the appropriate command in to your terminal.
cpanm
cpanm FeyX::Active
CPAN shell
perl -MCPAN -e shell install FeyX::Active
For more information on module installation, please visit the detailed CPAN module installation guide.