This the code:
but it no work...
require "tprint"
DatabaseOpen ("db", GetInfo (66) .. ":memory:", 6)
rc = DatabaseExec ("db", [[
DROP TABLE IF EXISTS weapons;
CREATE TABLE weapons(
weapon_id INTEGER NOT NULL PRIMARY KEY autoincrement,
name TEXT NOT NULL,
damage INT default 10,
weight REAL
);
]])
-- put some data into the database
DatabaseExec ("db",
[[
INSERT INTO weapons (name, damage) VALUES ('sword', 42);
INSERT INTO weapons (name, damage) VALUES ('mace', 55);
INSERT INTO weapons (name, damage) VALUES ('staff', 35);
]])
-- prepare a query
DatabasePrepare ("db", "SELECT * from weapons ORDER BY name")
-- find the column names
names = DatabaseColumnNames ("db")
tprint (names)
-- execute to get the first row
rc = DatabaseStep ("db") -- read first row
-- now loop, displaying each row, and getting the next one
while rc == 100 do
print ("")
values = DatabaseColumnValues ("db")
tprint (values)
rc = DatabaseStep ("db") -- read next row
end -- while loop
-- finished with the statement
DatabaseFinalize ("db")
DatabaseClose ("db") -- close it
but it no work...