<%= form_for gnuplot => begin %>
<%= text_area 'sql', cols => 80, rows => 5 %>
<br>with <%= select_field with => [qw(dots points steps lines)], 'dots' %>
+ timeout <%= text_field 'timeout', value => 5, style => 'width: 2em' %>s
<%= submit_button 'execute' %>
<%= check_box 'include_gnuplot' => 1, title => 'include gnuplot dump' %>
<% end %>
$sql =~ s/\s+(from|where|order|limit|join)/\n$1/gs;
$self->param( sql => $sql );
+ $gearman->timeout( $self->param('timeout') );
my $ret = $gearman->req( 'SUBMIT_JOB', 'Store_sql', '', $sql );
die "no result for $sql" unless $ret;
$ret = Mojo::JSON->new->decode( $ret );
+ $ret->{error} = 'query run longer than ' . $gearman->timeout . ' s timeout' unless ref $ret->{columns} eq 'ARRAY';
+
return $self->render('gnuplot', sql => $sql, img => '', gnuplot => $ret->{error} )
if exists $ret->{error};