How can I get a single row result (e.g. in form of a table/array) back from a sql statement. Using Lua Sqlite (LuaSQLite3). For example this one:
SELECT * FROM sqlite_master WHERE name ='myTable';
So far I note:
- using “nrows”/”rows” it gives an iterator back
- using “exec” it doesn’t seem to give a result back(?)
Specific questions are then:
Q1 – How to get a single row (say first row) result back?
Q2 – How to get row count? (e.g. num_rows_returned = db:XXXX(sql))
Here is a demo of getting the returned count: