liquid_feedback_frontend

annotate env/encode/pg_hstore.lua @ 1071:58f48a8a202a

Imported and merged LDAP patch
author bsw
date Fri Jul 18 21:42:59 2014 +0200 (2014-07-18)
parents
children
rev   line source
bsw@1071 1 -- Encodes a Lua table as PostgreSQL hstore text input
bsw@1071 2 -- TODO This should be implemented in the SQL abstraction layer
bsw@1071 3
bsw@1071 4 function encode.pg_hstore(hstore_values)
bsw@1071 5
bsw@1071 6 local entries = {}
bsw@1071 7
bsw@1071 8 for key, val in pairs(hstore_values) do
bsw@1071 9 local escaped_key = encode.pg_hstore_value(key)
bsw@1071 10 local escaped_val = encode.pg_hstore_value(val)
bsw@1071 11 entries[#entries+1] = escaped_key .. "=>" .. escaped_val
bsw@1071 12 end
bsw@1071 13
bsw@1071 14 return table.concat(entries, ", ")
bsw@1071 15
bsw@1071 16 end

Impressum / About Us