I have just discovered a strange behavior in one of my programs. So I tried the example of “Database.exec(sql)”. It seems that all fields of the returned table are of type “string”.

local sqlite = require "sqlite"

-- Create an in-:memory: database
local db = sqlite.Database(":memory:")

-- Create a new table "users"
db:exec([[CREATE TABLE users (
            id integer PRIMARY KEY,
            name text NOT NULL,
            age  integer)]])

-- Insert a new row
db:exec("INSERT INTO users (name, age) VALUES('John', true)")

-- Get a row from the SELECT statement
local row = db:exec("SELECT * FROM users WHERE(name == 'John')")
print(row.name, type(row.age))

When I run the example I get back “John string”. This means that the age is returned as a “string” and not as a “number”. It still worked with LuaRT 1.8. Can you check this please.

Thank you for the report I will check this

It was due to the debug print bug, it will be fixed in next LuaRT release

a month later

It's now fixed in LuaRT 1.9.5

12 days later

Powered by: FreeFlarum.
(remove this footer)