sqlite question

Posted by Graymane on Sun 13 Jul 2014 05:01 PM — 3 posts, 12,987 views.

USA #0
I have a bit of sql where I query for some room details below. The issue I have is that the name of room 3314 happens to be NULL. In the lua version, the query below fails. If I run the same query in sqlite, I get the single row back correctly with a NULL r.name. How can I get this to work in lua with the NULL value? If I put something in the name column, the lua version starts working.


-- lua mushclient version:

local sql = "SELECT r.name, r.area_id, a.name AS area_name FROM ROOMS r JOIN AREAS a ON a.id = r.area_id WHERE r.id = 3314;"

for name, area_id, area_name in self.db:urows (sql) do
print ("WORKED")
end

--[[
sqlite3 version:
SELECT r.name, r.area_id, a.name AS area_name FROM ROOMS r JOIN AREAS a ON a.id = r.area_id WHERE r.id = 3314;
--]]
Australia Forum Administrator #1
Personally I use db:rows rather than db:urows, then I get a table back and if a column was NULL I get nil in that table entry.
USA #2
Thanks