summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZach LeBar <zach@zachlebar.com>2012-08-20 19:29:15 +0000
committerZach LeBar <zach@zachlebar.com>2012-08-20 19:29:15 +0000
commit781f22c23373bc75c2afedab5daa0fefcb1fc4b1 (patch)
tree0ed5fd16546ecfba1cb51a89b8630452b4cb944d
parent14dc8e248b951add40c6f4715715a7ed0b2c67bc (diff)
downloadacf-kamailio-781f22c23373bc75c2afedab5daa0fefcb1fc4b1.tar.bz2
acf-kamailio-781f22c23373bc75c2afedab5daa0fefcb1fc4b1.tar.xz
Further fixes for merge conflicts in 'kamailio-model.lua'.
-rw-r--r--kamailio-model.lua76
1 files changed, 0 insertions, 76 deletions
diff --git a/kamailio-model.lua b/kamailio-model.lua
index fb31f30..ed05f85 100644
--- a/kamailio-model.lua
+++ b/kamailio-model.lua
@@ -114,7 +114,6 @@ local listtables = function()
return result
end
-<<<<<<< HEAD
local listcolumns = function(table, schema)
local result = {}
if DBENGINE == "PGSQL" then
@@ -125,12 +124,6 @@ local listcolumns = function(table, schema)
col = getselectresponse("SELECT column_name AS field FROM information_schema.columns WHERE table_name='"..table.."' ORDER BY ordinal_position")
end
-=======
-local listcolumns = function(table)
- local result = {}
- if DBENGINE == "PGSQL" then
- local col = getselectresponse("SELECT a.attname AS field FROM pg_class c, pg_attribute a, pg_type t WHERE c.relname = '"..table.."' AND a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid ORDER BY a.attnum")
->>>>>>> e19ee215667692e70cb4788dca4151e23aa73b96
for i,c in ipairs(col) do
result[#result+1] = c.field
end
@@ -326,7 +319,6 @@ function list_tables()
return cfe({ type="list", value=retval, label="List of Database Tables", errtxt=errtxt })
end
-<<<<<<< HEAD
function list_table_entries(req_table)
local retval = {}
-- split up the schema from the table
@@ -337,11 +329,6 @@ function list_table_entries(req_table)
table = req_table
end
retval.table = cfe({ value=req_table or "", label="Table" })
-=======
-function list_table_entries(table)
- local retval = {}
- retval.table = cfe({ value=table or "", label="Table" })
->>>>>>> e19ee215667692e70cb4788dca4151e23aa73b96
retval.fields = cfe({ type="list", value={}, label="List of Table Fields" })
retval.entries = cfe({ type="structure", value={}, label="List of Database Entries" })
local errtxt
@@ -352,7 +339,6 @@ function list_table_entries(table)
retval.table.errtxt = "Table does not exist"
errtxt = "Table does not exist"
for i,t in ipairs(tables) do
-<<<<<<< HEAD
if t.table == table then
retval.table.errtxt = nil
errtxt = nil
@@ -363,13 +349,6 @@ function list_table_entries(table)
retval.entries.value = getselectresponse("SELECT * FROM "..table) or {}
end
retval.fields.value = listcolumns(table, schema) or {}
-=======
- if t == table then
- retval.table.errtxt = nil
- errtxt = nil
- retval.entries.value = getselectresponse("SELECT * FROM "..table.." ORDER BY id ASC") or {}
- retval.fields.value = listcolumns(table) or {}
->>>>>>> e19ee215667692e70cb4788dca4151e23aa73b96
end
end
if connected then databasedisconnect() end
@@ -377,7 +356,6 @@ function list_table_entries(table)
if not res and err then
errtxt = err
end
-<<<<<<< HEAD
return cfe({ type="group", value=retval, label="Database Table Entries", errtxt=errtxt })
end
@@ -393,51 +371,28 @@ function get_table_entry(req_table, id)
retval.table = cfe({ value=req_table or "", label="Table", errtxt="Table does not exist", seq=0 })
local errtxt = "Table does not exist"
if req_table and req_table ~= "" then
-=======
-
- return cfe({ type="group", value=retval, label="Database Table Entries", errtxt=errtxt })
-end
-
-function get_table_entry(table, id)
- local retval = {}
- retval.table = cfe({ value=table or "", label="Table", errtxt="Table does not exist", seq=0 })
- local errtxt = "Table does not exist"
- if table and table ~= "" then
->>>>>>> e19ee215667692e70cb4788dca4151e23aa73b96
local res, err = pcall(function()
local connected = databaseconnect()
local tables = listtables()
for i,t in ipairs(tables) do
-<<<<<<< HEAD
if t.table == table then
-=======
- if t == table then
->>>>>>> e19ee215667692e70cb4788dca4151e23aa73b96
retval.table.errtxt = nil
errtxt = nil
break
end
end
if not errtxt then
-<<<<<<< HEAD
local fields = listcolumns(table, schema)
-=======
- local fields = listcolumns(table)
->>>>>>> e19ee215667692e70cb4788dca4151e23aa73b96
for i,f in ipairs(fields) do
retval[f] = cfe({ label=f, seq=i })
end
if id and id ~= "" then
-<<<<<<< HEAD
local entry
if schema then
entry = getselectresponse("SELECT * FROM "..schema.."."..table.." WHERE id='"..escape(id).."'")
else
entry = getselectresponse("SELECT * FROM "..table.." WHERE id='"..escape(id).."'")
end
-=======
- local entry = getselectresponse("SELECT * FROM "..table.." WHERE id='"..escape(id).."'")
->>>>>>> e19ee215667692e70cb4788dca4151e23aa73b96
if entry and #entry > 0 then
for n,v in pairs(entry[1]) do
if retval[n] then retval[n].value = v end
@@ -480,7 +435,6 @@ function update_table_entry(entry, create)
local res, err = pcall(function()
local connected = databaseconnect()
local tables = listtables()
-<<<<<<< HEAD
local schema, tablename
schema, tablename = string.match(entry.value.table.value, "(.+)%.(.+)")
success = false
@@ -490,12 +444,6 @@ function update_table_entry(entry, create)
entry.value.table.errtxt = "Table does not exist"
for i,t in ipairs(tables) do
if t.table == tablename then
-=======
- success = false
- entry.value.table.errtxt = "Table does not exist"
- for i,t in ipairs(tables) do
- if t == entry.value.table.value then
->>>>>>> e19ee215667692e70cb4788dca4151e23aa73b96
success = true
entry.value.table.errtxt = nil
break
@@ -514,7 +462,6 @@ function update_table_entry(entry, create)
local values = {}
for n,v in pairs(entry.value) do
if n ~= "table" and n ~= "id" then
-<<<<<<< HEAD
--- !!! HACK !!! ---
--- Fix for DISTributary Phone System Tool: ASHP
---
@@ -527,8 +474,6 @@ function update_table_entry(entry, create)
v.value = "0"
end
end
-=======
->>>>>>> e19ee215667692e70cb4788dca4151e23aa73b96
names[#names+1] = n
values[#values+1] = escape(v.value)
end
@@ -557,7 +502,6 @@ function update_table_entry(entry, create)
return entry
end
-<<<<<<< HEAD
function delete_table_entry(req_table, id)
local result = ""
local errtxt
@@ -569,12 +513,6 @@ function delete_table_entry(req_table, id)
table = req_table
end
if not req_table or req_table == "" then
-=======
-function delete_table_entry(table, id)
- local result = ""
- local errtxt
- if not table or table == "" then
->>>>>>> e19ee215667692e70cb4788dca4151e23aa73b96
errtxt = "Invalid table"
elseif not id or id == "" then
errtxt = "Invalid entry"
@@ -584,26 +522,18 @@ function delete_table_entry(table, id)
errtxt = "Invalid table"
local tables = listtables()
for i,t in ipairs(tables) do
-<<<<<<< HEAD
if t.table == table then
-=======
- if t == table then
->>>>>>> e19ee215667692e70cb4788dca4151e23aa73b96
errtxt = nil
break
end
end
if not errtxt then
-<<<<<<< HEAD
local sql
if schema then
sql = "DELETE FROM "..schema.."."..table.." WHERE id='"..escape(id).."'"
else
sql = "DELETE FROM "..table.." WHERE id='"..escape(id).."'"
end
-=======
- local sql = "DELETE FROM "..table.." WHERE id='"..escape(id).."'"
->>>>>>> e19ee215667692e70cb4788dca4151e23aa73b96
runsqlcommand(sql)
result = "Entry Deleted"
end
@@ -634,15 +564,9 @@ function search_database(id, value, comparison)
local connected = databaseconnect()
local tables = listtables() or {}
for i,t in ipairs(tables) do
-<<<<<<< HEAD
local columns = listcolumns(t.table) or {}
for i,c in ipairs(columns) do
retval.id.option[#retval.id.option + 1] = t.table.."."..c
-=======
- local columns = listcolumns(t) or {}
- for i,c in ipairs(columns) do
- retval.id.option[#retval.id.option + 1] = t.."."..c
->>>>>>> e19ee215667692e70cb4788dca4151e23aa73b96
end
end
-- Get the rows from the DB