function cctvDB(action, id, data)
if action == "create" then
local checkT = executeSQLSelect("cctvterminals", "name, loc, interior, restricted, access, options")
if not checkT then
local alter = executeSQLSelect("cctvterminals", "name", "", 1)
if not alter then
executeSQLCreateTable("cctvterminals", "name TEXT, loc TEXT, interior INTEGER, restricted INTEGER, access TEXT, options TEXT")
outputChatBox("CCTV: DB: Created terminal table", root, 0, 222, 222, true)
else
executeSQLQuery("ALTER TABLE cctvterminals ADD COLUMN options TEXT DEFAULT '0'")
outputChatBox("CCTV: DB: Updated terminal table structure", root, 0, 222, 222, true)
end
end
local checkC = executeSQLSelect("cctvcameras", "name, type, terminal, loc, interior, target, color, scan, zoom, motor, options")
if not checkC then
local alter = executeSQLSelect("cctvcameras", "name", "", 1)
if not alter then
executeSQLCreateTable("cctvcameras", "name TEXT, type INTEGER, terminal TEXT, loc TEXT, interior INTEGER, target TEXT, color TEXT, scan TEXT, zoom BOOL, motor BOOL, options TEXT")
outputChatBox("CCTV: DB: Created camera table", root, 0, 222, 222, true)
else
executeSQLQuery("ALTER TABLE cctvcameras ADD COLUMN options TEXT DEFAULT '0'")
outputChatBox("CCTV: DB: Updated camera table structure", root, 0, 222, 222, true)
end
end
elseif action == "load" then
cctvT = nil
cctvC = nil
cctvT = {}
cctvC = {}
local term = executeSQLSelect("cctvterminals", "name, loc, interior, restricted, access, options")
if #term > 0 then
for id,terminal in ipairs(term) do
I have problem with CCTV! Here is pic of errors