liquid_feedback_frontend
view 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 | 
 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
