Stevan Little > FeyX-Active-0.03 > FeyX::Active::Table

Download:
FeyX-Active-0.03.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.03   Source  

NAME ^

FeyX::Active::Table - An active Fey Table

SYNOPSIS ^

  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;

DESCRIPTION ^

This is a subclass of Fey::Table that adds a couple methods for creating FeyX::Active::SQL objects.

METHODS ^

All these methods will pass the default_source database handle from the associated FeyX::Active::Schema to the FeyX::Active::SQL object it creates.

select ( ?@columns )

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.

delete

This will create a FeyX::Active::SQL::Delete object which that will execute against the table associated.

insert ( ?@values )

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.

update ( ?@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.

BUGS ^

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.

AUTHOR ^

Stevan Little <stevan.little@iinteractive.com>

COPYRIGHT AND LICENSE ^

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.

syntax highlighting: