Atsushi Kobayashi > DBIx-Class-ProxyTable-0.02 > DBIx::Class::ProxyTable

Download:
DBIx-Class-ProxyTable-0.02.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.02   Source  

NAME ^

DBIx::Class::ProxyTable - without generating a schema

SYNOPSIS ^

    package Your::Schema;
    use base 'DBIx::Class::Schema';
    __PACKAGE__->load_classes(qw//);
     
    package Your::Schema::Log;
    use base 'DBIx::Class';
     
    __PACKAGE__->load_components(qw/ProxyTable Core/);
    __PACKAGE__->table('log');
    __PACKAGE__->add_columns(qw/ id body /);
    __PACKAGE__->set_primary_key('id');
     
    1;
     
    # in your script:
    my $rs = $schema->resultset('Log');
    $rs->proxy('log2')->create({id => 1, body => 'hoge'});
    # insert data for log2 table
    my $log2 = $rs->proxy('log2')->single({id => 1});

DESCRIPTION ^

The cause can treat a table becoming the base in DBIC without generating a schema. and auto create target table.

METHOD ^

proxy

    # get Log's resultset
    my $rs = $schema->resultset('Log');
    # insert data to log2 table
    $rs->proxy('log2')->create({id => 1, body => 'bar'});

__auto_create_table

FIXME ^

now: $schema->resultset('Log')->proxy('log2')->create({id => 1, body => 'hoge'});

but 'log2' does not do proxy. Is this place better?

$schema->proxy('Log','log2')->create({id => 1, body => 'hoge'});

or

$schema->proxy('Log')->table('log2')->create({id => 1, body => 'hoge'});

or

$schema->resultset('Log')->proxy_to('log2')->create({id => 1, body => 'hoge'});

any more idea?

BUGS AND LIMITATIONS ^

No bugs have been reported.

AUTHOR ^

Atsushi Kobayashi <nekokak __at__ gmail.com>

LICENCE AND COPYRIGHT ^

Copyright (c) 2007, Atsushi Kobayashi <nekokak __at__ gmail.com>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

syntax highlighting: