Check in between query statements to see if the query was interrupted

This allows a long series of uninterruptible statements to still be
interrupted for a long running query that might do something like create
or drop many databases.
pull/7010/head
Jonathan A. Sternberg 2016-08-10 15:36:00 -05:00
parent f58a50c231
commit 32d10de94f
1 changed files with 15 additions and 0 deletions

View File

@ -260,6 +260,21 @@ func (e *QueryExecutor) executeQuery(query *Query, opt ExecutionOptions, closing
// Stop after the first error.
break
}
// Check if the query was interrupted during an uninterruptible statement.
interrupted := false
if ctx.InterruptCh != nil {
select {
case <-ctx.InterruptCh:
interrupted = true
default:
// Query has not been interrupted.
}
}
if interrupted {
break
}
}
// Send error results for any statements which were not executed.