# HG changeset patch # User jbe # Date 1406924228 -7200 # Node ID 8d7665e0d4900877b493989c4d1230db0f88cc82 # Parent 20e393d2e6e150d77315c4db23b93fa3b7c3145d Load JSON library in WebMCP and automatically convert JSON documents in mondelefant-atom-connector diff -r 20e393d2e6e1 -r 8d7665e0d490 framework/cgi-bin/webmcp.lua --- a/framework/cgi-bin/webmcp.lua Fri Aug 01 21:54:45 2014 +0200 +++ b/framework/cgi-bin/webmcp.lua Fri Aug 01 22:17:08 2014 +0200 @@ -74,6 +74,9 @@ -- load type system "atom" atom = require 'atom' +-- load JSON library +json = require 'json' + -- load mondelefant atom connector require 'mondelefant_atom_connector' diff -r 20e393d2e6e1 -r 8d7665e0d490 libraries/mondelefant/mondelefant_atom_connector.lua --- a/libraries/mondelefant/mondelefant_atom_connector.lua Fri Aug 01 21:54:45 2014 +0200 +++ b/libraries/mondelefant/mondelefant_atom_connector.lua Fri Aug 01 22:17:08 2014 +0200 @@ -129,6 +129,9 @@ output_converters.time = time_loader_func output_converters.timetz = time_loader_func +output_converters.json = json.import +output_converters.jsonb = json.import + mondelefant.postgresql_connection_prototype.type_mappings = { int8 = atom.integer, int4 = atom.integer, @@ -139,6 +142,8 @@ time = atom.time, text = atom.string, varchar = atom.string, + json = json, + jsonb = json, } diff -r 20e393d2e6e1 -r 8d7665e0d490 libraries/mondelefant/mondelefant_native.c --- a/libraries/mondelefant/mondelefant_native.c Fri Aug 01 21:54:45 2014 +0200 +++ b/libraries/mondelefant/mondelefant_native.c Fri Aug 01 22:17:08 2014 +0200 @@ -63,6 +63,7 @@ case 27: return "tid"; case 28: return "xid"; case 29: return "cid"; + case 114: return "json"; case 600: return "point"; case 601: return "lseg"; case 602: return "path"; @@ -88,6 +89,7 @@ case 1560: return "bit"; case 1562: return "varbit"; case 1700: return "numeric"; + case 3802: return "jsonb"; default: return NULL; } }