local sqlite3 = require("lsqlite3")
local json = require("cjson")

local db = sqlite3.open(ngx.var.document_root..'/sqlite3/tanks.db')

local _M = {}

function _M.oktmo(oktmo)
	local results = {}	
	for row in db:nrows("SELECT * FROM points WHERE oktmo = '"..tostring(oktmo).."'") do table.insert(results,row) end 
	db:close() 
	if not results[1] then return nil end
	return results[1]
end

return _M
