         (catch SQLException e
           (log/error (format-sql-exception e)))))))
 
-(defn- check-interrupt [curr-query-no]
+(defn- check-interrupt
+  "Throw an exception if an interrupt (signal) has occured or if queries are out
+  of order."
+  [curr-query-no]
   (let [ieq @interrupt-execute-query]
     (log/debugf "check interrupt: ieq=%s, query no: (%s == %s)"
                 ieq curr-query-no @query-no)

       (display-result-set rs meta)
       (reset! last-frame-label (format "table: %s" table))))))

(defn- interrupt [signal]
  (log/debugf "interrupting with signal: %s" signal)
  (let [ieq @interrupt-execute-query]
    (println)

    (let [cols (.getColumnCount meta)]
      (take-while identity (repeatedly #(next-row cols))))))

(defn result-set-to-array
  "Return result set `rs` as an array of rows and column names.

Parameters:
  * **header**: the column header data
  * **rows**: a lazy list of maps each representing a row from the result set."
  [rs]
  (let [meta (.getMetaData rs)
        col-count (.getColumnCount meta)
        ;; must for SQLite: get headers before the result set is used up
