lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Rick,

 

On Fri, Sep 9, 2016 at 2:03 PM, Leinen, Rick <RLeinen@leviton.com> wrote:

Also, I don’t see sqlite3.ROW listed at http://lua.sqlite.org/index.cgi/doc/tip/doc/lsqlite3.wiki.  Should I be looking elsewhere?

 

 

where the results of step are listed.

 

that shows ROW. It is sqlite3.ROW because you typically do

 

   sqlite3 = require 'lsqlite3'

 

so all the constants are in the sqlite3 table.

 

 

Thanks Doug,

 

I think I’m getting it.  In the code snippet:

 

local insert_stmt = db:prepare('SELECT * FROM numbers') -- WHERE num1=1')

x = insert_stmt:get_names()

print(x[3])

if sqlite3.ROW == insert_stmt:step() then

    x = insert_stmt:get_values()

end

 

:get_names() works because the first iteration returns the column names.  :step() then iterates to the first row of values so now :get_values works.  Correct?