/[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

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

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

revision 11 by dpavlin, Sun Dec 3 00:10:31 2006 UTC revision 13 by dpavlin, Sun Dec 3 13:28:48 2006 UTC
# Line 22  use Jifty::Action schema { Line 22  use Jifty::Action schema {
22                  label is 'SQL',                  label is 'SQL',
23                  render as 'textarea',                  render as 'textarea',
24                  is mandatory,                  is mandatory,
25                  ajax validates;                  ajax validates,
26                    ajax canonicalizes;
27                    
28          param database =>          param database =>
29                  label is 'Database',                  label is 'Database',
# Line 60  sub validate_sql_query { Line 61  sub validate_sql_query {
61          }          }
62  }  }
63    
64    use SQL::ReservedWords;
65    
66    sub canonicalize_sql_query {
67            my $self = shift;
68            my $sql = shift;
69    
70            my @words = SQL::ReservedWords->words;
71    
72            my $w = join('|', @words);
73    
74            warn "canonicalize SQL: $sql";
75    
76            $sql =~ s/\b($w)\b/uc($1)/egis;
77    
78            return $sql;
79    }
80    
81  =head2 take_action  =head2 take_action
82    
83  Execute SQL query on database  Execute SQL query on database

Legend:
Removed from v.11  
changed lines
  Added in v.13

  ViewVC Help
Powered by ViewVC 1.1.26