lua-users home
lua-l archive

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


So luapsql also has the build issue I posted about earlier, and also
fails without giving any error message!


#!/usr/bin/env lua5.1
local sql = require('psql')

if not arg[1] then
	print("Usage: " .. arg[0] .. " database-name")
	os.exit(1)
end

local name = arg[1]
os.execute("createdb '" .. name .. "'")
local db = assert(sql.connect(("host=localhost dbname='%s'"):
	format(name, name)))

local function exec(query, ...)
	return assert(db:exec(query, ...))
end

exec [[
CREATE TABLE channels (
	id INTEGER PRIMARY KEY,
	path VARCHAR(16384) NOT NULL
); ]]


lua5.1: ./create-database.lua:26: assertion failed!
stack traceback:
	[C]: in function 'assert'
	./create-database.lua:26: in function 'exec'
	./create-database.lua:33: in main chunk
	[C]: ?

sure enough db:exec() returns absolutely nothing. Oi.

-- 
Sent from my Game Boy.