revert to rebuilding the sql
This commit is contained in:
parent
136bb030c9
commit
765a239408
15
server.js
15
server.js
@ -52,13 +52,22 @@ server.get("/source", function (inReq, inRes)
|
|||||||
Postgres.FirstRow(sql,[], inRes);
|
Postgres.FirstRow(sql,[], inRes);
|
||||||
});
|
});
|
||||||
//returns message about status and error description
|
//returns message about status and error description
|
||||||
|
server.post("/sourc_single", bodyParser.json(), function (inReq, inRes)// remove body parsing, just pass post body to the sql string build
|
||||||
|
{
|
||||||
|
for (var i =0; i < x.length; i++) {
|
||||||
|
var sql = "SELECT x.message FROM tps.srce_set($1::jsonb) as x(message)";
|
||||||
|
}
|
||||||
|
Postgres.FirstRow(sql,inReq.body, inRes);
|
||||||
|
});
|
||||||
server.post("/source", bodyParser.json(), function (inReq, inRes)// remove body parsing, just pass post body to the sql string build
|
server.post("/source", bodyParser.json(), function (inReq, inRes)// remove body parsing, just pass post body to the sql string build
|
||||||
{
|
{
|
||||||
x = inReq.body;
|
x = inReq.body;
|
||||||
for (var i =0; i < x.length; i++) {
|
var sql = "SELECT\
|
||||||
var sql = "SELECT x.message FROM tps.srce_set($1::jsonb) as x(message)";
|
jsonb_agg(x.message) message\
|
||||||
|
FROM\
|
||||||
|
jsonb_array_elements($1::jsonb) d(def)\
|
||||||
|
JOIN LATERAL tps.srce_set(d.def) x(message) ON TRUE";
|
||||||
Postgres.FirstRow(sql,[JSON.stringify(x[i])], inRes);
|
Postgres.FirstRow(sql,[JSON.stringify(x[i])], inRes);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//----------------------------------------------------------regex instrUctions-------------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------regex instrUctions-------------------------------------------------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user