From 55361d60346849a4bef6cb98af1b41f6b6b50af6 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Fri, 28 Nov 2014 01:48:26 +0000 Subject: Fix db.listkeycolumns for mysql --- db.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'db.lua') diff --git a/db.lua b/db.lua index badf1f5..626b268 100644 --- a/db.lua +++ b/db.lua @@ -201,7 +201,13 @@ export.listkeycolumns = function(dbobject, table) result[#result+1] = c.name end end - else + elseif dbobject.engine == mymodule.engine.mysql then + local col = dbobject.getselectresponse("SELECT column_name, column_key FROM information_schema.columns WHERE table_name = '"..dbobject.escape(table).."' ORDER BY ordinal_position") + for i,c in ipairs(col) do + if c.column_key == "PRI" then + result[#result+1] = c.column_name + end + end end return result end -- cgit v1.2.3