/[SQLSession]/trunk/lib/SQLSession/Action/DoSQL.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

Annotation of /trunk/lib/SQLSession/Action/DoSQL.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5 - (hide annotations)
Sat Dec 2 14:00:51 2006 UTC (17 years, 5 months ago) by dpavlin
File size: 1019 byte(s)
try to add DoSQL action, but it doesn't show available databases yet
1 dpavlin 5 use strict;
2     use warnings;
3    
4     =head1 NAME
5    
6     SQLSession::Action::DoSQL
7    
8     =cut
9    
10     package SQLSession::Action::DoSQL;
11     use base qw/SQLSession::Action Jifty::Action/;
12    
13     use SQLSession::Model::DatabaseCollection;
14     use Data::Dump qw/dump/;
15    
16     use Jifty::Param::Schema;
17     use Jifty::Action schema {
18    
19     param sql_query =>
20     label is 'SQL',
21     is mandatory;
22    
23     param database =>
24     label is 'Database',
25     render as 'Select',
26     # available are qw( test foo bar );
27     available are defer {
28     my $dbs = SQLSession::Model::DatabaseCollection->new;
29     $dbs->unlimit;
30     warn "dbs = ",dump($dbs->items_array_ref);
31     return [{
32     display_from => 'name',
33     value_from => 'name',
34     collection => $dbs,
35     }];
36     };
37    
38     };
39    
40     =head2 take_action
41    
42     =cut
43    
44     sub take_action {
45     my $self = shift;
46    
47     # Custom action code
48    
49     $self->report_success if not $self->result->failure;
50    
51     return 1;
52     }
53    
54     =head2 report_success
55    
56     =cut
57    
58     sub report_success {
59     my $self = shift;
60     # Your success message here
61     $self->result->message('Success');
62     }
63    
64     1;
65    

  ViewVC Help
Powered by ViewVC 1.1.26