All pastes #213465 Raw Edit

Untitled

public text v1 · immutable
#213465 ·published 2006-10-21 12:51 UTC
rendered paste body
function HexSQL:GetData(target,id,columnnames,value)
	local query = "SELECT * FROM " .. target .. " WHERE " .. id .. "='" .. value .. "'"
	local cur = assert (con:execute(query))
		local row = cur:fetch ({}, "a")
		if row == nil then
			_Msg("HexSQL: No matching rows found.\n")
		else
		local results = {}
		local i = 0
		while row do
			i = i + 1
			for k, v in ipairs(row) do
				_Msg(i .. "\n")
				local row.columnnames[i] = results[i]
			end
			row = cur:fetch (row, "a")
		end
		return results
	end
end