/[Frey]/trunk/lib/Frey/SQL.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/Frey/SQL.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 371 by dpavlin, Mon Nov 17 15:24:24 2008 UTC revision 414 by dpavlin, Tue Nov 18 14:15:45 2008 UTC
# Line 1  Line 1 
1  package Frey::SQL;  package Frey::SQL;
2  use Moose;  use Moose;
3    extends 'Frey';
4    
5  use MooseX::Types::Moose qw(Str Int ArrayRef);  use MooseX::Types::Moose qw(Str Int ArrayRef);
6  use MooseX::Types::Structured qw/Dict/;  use MooseX::Types::Structured qw/Dict/;
# Line 12  has 'query' => ( Line 13  has 'query' => (
13          isa => 'Str',          isa => 'Str',
14          required => 1,          required => 1,
15          default => 'select * from sponge',          default => 'select * from sponge',
16            documentation => 'SQL query to filter data',
17  );  );
18    
19  has table => (  has table => (
# Line 19  has table => ( Line 21  has table => (
21          isa => 'Str',          isa => 'Str',
22          required => 1,          required => 1,
23          default => 'sponge',          default => 'sponge',
24            documentation => 'Name of table to create from sponge data',
25  );  );
26    
27  has 'sponge' => (  has 'sponge' => (
# Line 35  sub data { Line 38  sub data {
38    
39          my $dbh=DBI->connect('dbi:AnyData(RaiseError=>1):');          my $dbh=DBI->connect('dbi:AnyData(RaiseError=>1):');
40    
   
   
41          my $data = $self->sponge->{rows};          my $data = $self->sponge->{rows};
42          unshift @$data, $self->sponge->{NAME};          unshift @$data, $self->sponge->{NAME};
43    
44          warn "# data = ",dump( $data );          warn "# data = ",dump( $data ) if $self->debug;
45    
46          $dbh->func( $self->table, 'ARRAY', $data, 'ad_import' );          $dbh->func( $self->table, 'ARRAY', $data, 'ad_import' );
47    

Legend:
Removed from v.371  
changed lines
  Added in v.414

  ViewVC Help
Powered by ViewVC 1.1.26