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', |
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 |