liquid_feedback_frontend
view env/encode/pg_hstore.lua @ 1072:ba51e72830e6
Added OpenLDAP license to LICENSE file
author | bsw |
---|---|
date | Fri Jul 18 23:12:14 2014 +0200 (2014-07-18) |
parents | 58f48a8a202a |
children |
line source
1 -- Encodes a Lua table as PostgreSQL hstore text input
2 -- TODO This should be implemented in the SQL abstraction layer
4 function encode.pg_hstore(hstore_values)
6 local entries = {}
8 for key, val in pairs(hstore_values) do
9 local escaped_key = encode.pg_hstore_value(key)
10 local escaped_val = encode.pg_hstore_value(val)
11 entries[#entries+1] = escaped_key .. "=>" .. escaped_val
12 end
14 return table.concat(entries, ", ")
16 end