Commit c972d267 authored by Ted Trask's avatar Ted Trask

Check with database and only display default and null options if applicable

parent d0ce28f1
......@@ -58,7 +58,6 @@ for x,name in ipairs(order) do
htmlviewfunctions.displayitemmiddle(myitem, nil, header_level2)
htmlviewfunctions.displayformitem(myitem, name, -1, "fields")
if not myitem.readonly and form.value.defaults and form.value.defaults.value[name] then
form.value.defaults.value[name].descr = "Default"
form.value.defaults.value[name].class = "defaults"
htmlviewfunctions.displayformitem(form.value.defaults.value[name], name, -1, "defaults")
end
......
......@@ -153,11 +153,15 @@ function mymodule.get_new_table_entry(dbase, self, clientdata)
retval.value.fields = cfe({ type="group", value={}, label="Table Fields", seq=2 })
retval.value.nulls = cfe({ type="group", value={}, label="Null Value Table Fields", seq=3 })
retval.value.defaults = cfe({ type="group", value={}, label="Default Value Table Fields", seq=4 })
local fields = db.listcolumns(retval.value.table.value)
local fields, defaults, nullable = db.listcolumns(retval.value.table.value)
for i,f in ipairs(fields) do
retval.value.fields.value[f] = cfe({ label=f, seq=i })
retval.value.nulls.value[f] = cfe({ type="boolean", value=false, label=f, seq=i })
retval.value.defaults.value[f] = cfe({ type="boolean", value=false, label=f, seq=i })
if nullable[f] then
retval.value.nulls.value[f] = cfe({ type="boolean", value=false, label=f, seq=i })
end
if defaults[f] then
retval.value.defaults.value[f] = cfe({ type="boolean", value=false, label=f, default=defaults[f], seq=i })
end
end
end
if connected then db.databasedisconnect() end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment