- (let ((stmt (sqlite3:sqlite3-prepare (sqlite3-db database)
- query-expression))
- (rows '())
- (col-names '()))
- (declare (type sqlite3:sqlite3-stmt-type stmt))
- (unwind-protect
- (when (sqlite3:sqlite3-step stmt)
- (let ((n-col (sqlite3:sqlite3-column-count stmt)))
- (flet ((extract-row-data ()
- (loop for i from 0 below n-col
- for types = (get-result-types stmt n-col result-types) then (rest types)
- collect (if (eq (first types) :blob)
- (clsql-uffi:convert-raw-field
- (sqlite3:sqlite3-column-blob stmt i)
- types 0
- (sqlite3:sqlite3-column-bytes stmt i))
- (clsql-uffi:convert-raw-field
- (sqlite3:sqlite3-column-text stmt i)
- types 0)))))
- (when field-names
- (setf col-names (loop for n from 0 below n-col
- collect (sqlite3:sqlite3-column-name stmt n))))
- (push (extract-row-data) rows)
- (do* () (nil)
- (if (sqlite3:sqlite3-step stmt)
- (push (extract-row-data) rows)
- (return))))))
- (sqlite3:sqlite3-finalize stmt))
- (values (nreverse rows) col-names))
+ (let ((stmt (sqlite3:sqlite3-prepare (sqlite3-db database)
+ query-expression))
+ (rows '())
+ (col-names '()))
+ (declare (type sqlite3:sqlite3-stmt-type stmt))
+ (unwind-protect
+ (when (sqlite3:sqlite3-step stmt)
+ (let ((n-col (sqlite3:sqlite3-column-count stmt)))
+ (flet ((extract-row-data ()
+ (loop for i from 0 below n-col
+ for types = (get-result-types stmt n-col result-types) then (rest types)
+ collect (if (eq (first types) :blob)
+ (clsql-uffi:convert-raw-field
+ (sqlite3:sqlite3-column-blob stmt i)
+ types 0
+ (sqlite3:sqlite3-column-bytes stmt i))
+ (clsql-uffi:convert-raw-field
+ (sqlite3:sqlite3-column-text stmt i)
+ types 0)))))
+ (when field-names
+ (setf col-names (loop for n from 0 below n-col
+ collect (sqlite3:sqlite3-column-name stmt n))))
+ (push (extract-row-data) rows)
+ (do* () (nil)
+ (if (sqlite3:sqlite3-step stmt)
+ (push (extract-row-data) rows)
+ (return))))))
+ (sqlite3:sqlite3-finalize stmt))
+ (values (nreverse rows) col-names))