diff options
author | Ted Trask <ttrask01@yahoo.com> | 2014-11-28 01:48:26 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2014-11-28 01:48:26 +0000 |
commit | 55361d60346849a4bef6cb98af1b41f6b6b50af6 (patch) | |
tree | 4cf144aabe292a11a958f38c0df1c01a721481a6 | |
parent | a08d2d05987e3893f8f1e749579b04f9258150bb (diff) | |
download | acf-lib-55361d60346849a4bef6cb98af1b41f6b6b50af6.tar.bz2 acf-lib-55361d60346849a4bef6cb98af1b41f6b6b50af6.tar.xz |
Fix db.listkeycolumns for mysql
-rw-r--r-- | db.lua | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -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 |