85 |
|
|
86 |
}; |
}; |
87 |
|
|
88 |
|
=head2 sql |
89 |
|
|
90 |
|
Execute SQL query on site |
91 |
|
|
92 |
|
=cut |
93 |
|
|
94 |
|
template 'sql' => page { |
95 |
|
|
96 |
|
title is _('Execute SQL'); |
97 |
|
|
98 |
|
my $action = new_action( |
99 |
|
class => 'StrixSQL', |
100 |
|
moniker => 'strix-sql', |
101 |
|
sticky_on_success => 1, |
102 |
|
sticky_on_failure => 1, |
103 |
|
); |
104 |
|
|
105 |
|
form { |
106 |
|
render_action( $action => [ 'strix', 'sql' ] ); |
107 |
|
form_submit( label => _('Execute SQL') ); |
108 |
|
}; |
109 |
|
|
110 |
|
if ( my $sql = $action->result->content('sql') ) { |
111 |
|
div { _('Found %1 results', $sql->count ) } |
112 |
|
table { |
113 |
|
row { map { th { $_ } } $sql->_column_names }; |
114 |
|
while (my $row = $sql->next) { |
115 |
|
row { |
116 |
|
foreach my $col ( $sql->_column_names ) { |
117 |
|
warn "++ $col\n"; |
118 |
|
cell { $row->$col } |
119 |
|
} |
120 |
|
} |
121 |
|
} |
122 |
|
} |
123 |
|
} |
124 |
|
}; |
125 |
|
|
126 |
=head1 REGIONS |
=head1 REGIONS |
127 |
|
|
128 |
=head2 search_sites |
=head2 search_sites |