webmcp

changeset 176:8d7665e0d490

Load JSON library in WebMCP and automatically convert JSON documents in mondelefant-atom-connector
author jbe
date Fri Aug 01 22:17:08 2014 +0200 (2014-08-01)
parents 20e393d2e6e1
children c16292cbcc1e
files framework/cgi-bin/webmcp.lua libraries/mondelefant/mondelefant_atom_connector.lua libraries/mondelefant/mondelefant_native.c
line diff
     1.1 --- a/framework/cgi-bin/webmcp.lua	Fri Aug 01 21:54:45 2014 +0200
     1.2 +++ b/framework/cgi-bin/webmcp.lua	Fri Aug 01 22:17:08 2014 +0200
     1.3 @@ -74,6 +74,9 @@
     1.4  -- load type system "atom"
     1.5  atom = require 'atom'
     1.6  
     1.7 +-- load JSON library
     1.8 +json = require 'json'
     1.9 +
    1.10  -- load mondelefant atom connector
    1.11  require 'mondelefant_atom_connector'
    1.12  
     2.1 --- a/libraries/mondelefant/mondelefant_atom_connector.lua	Fri Aug 01 21:54:45 2014 +0200
     2.2 +++ b/libraries/mondelefant/mondelefant_atom_connector.lua	Fri Aug 01 22:17:08 2014 +0200
     2.3 @@ -129,6 +129,9 @@
     2.4  output_converters.time = time_loader_func
     2.5  output_converters.timetz = time_loader_func
     2.6  
     2.7 +output_converters.json = json.import
     2.8 +output_converters.jsonb = json.import
     2.9 +
    2.10  mondelefant.postgresql_connection_prototype.type_mappings = {
    2.11    int8 = atom.integer,
    2.12    int4 = atom.integer,
    2.13 @@ -139,6 +142,8 @@
    2.14    time = atom.time,
    2.15    text = atom.string,
    2.16    varchar = atom.string,
    2.17 +  json = json,
    2.18 +  jsonb = json,
    2.19  }
    2.20  
    2.21  
     3.1 --- a/libraries/mondelefant/mondelefant_native.c	Fri Aug 01 21:54:45 2014 +0200
     3.2 +++ b/libraries/mondelefant/mondelefant_native.c	Fri Aug 01 22:17:08 2014 +0200
     3.3 @@ -63,6 +63,7 @@
     3.4      case 27: return "tid";
     3.5      case 28: return "xid";
     3.6      case 29: return "cid";
     3.7 +    case 114: return "json";
     3.8      case 600: return "point";
     3.9      case 601: return "lseg";
    3.10      case 602: return "path";
    3.11 @@ -88,6 +89,7 @@
    3.12      case 1560: return "bit";
    3.13      case 1562: return "varbit";
    3.14      case 1700: return "numeric";
    3.15 +    case 3802: return "jsonb";
    3.16      default: return NULL;
    3.17    }
    3.18  }

Impressum / About Us