Let's see what kind of performance is available spooling off results.
1. Get a temporary file using GetTempPath and GetTempFileName api's.
2. Write one row per sqlite3.step. For each column in the row
a. Total Column size = Long
b. Column Type = SQLite value type
c. Column Data Length = Long
d. Column Data =

3. Close temporary file
4. Return full name of temporary file to caller along with the row and column count.
This can be accomplished without creating a duplicate copy of the column data value for BLOBs or TEXT
1. Get the data value length using sqlite3_column_bytes
1. sqlite3_column_type returns SQLITE_INTEGER, SQLITE_FLOAT, SQLITE_TEXT, SQLITE_BLOB, or SQLITE_NULL
2. If SQLITE_INTEGER or SQLITE_FLOAT get the value using sqlite3_column_double or sqlite3_column_int64 or sqlite3_column_int
3. If SQLITE_BLOB get the BLOB pointer
4. If SQLITE_NULL, nothing is spooled out
5. If SQLITE_TEXT get the ZString ptr
6. Calculate the column total size 4+4+data value length
7. Spool out everything