]> git.8kb.co.uk Git - postgresql/jsonb_delete/blob - jsonb_delete_utils.c
Initial commit
[postgresql/jsonb_delete] / jsonb_delete_utils.c
1 /*
2  * jsonb_delete_utils.c
3  *     Test jsonb delete and operator functions for 9.4+
4  *
5  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
6  * Portions Copyright (c) 1994, Regents of the University of California
7  * Author: Glyn Astill <glyn@8kb.co.uk>
8  *
9  */
10
11 #include "postgres.h"
12 #include "utils/jsonb.h"
13 #include "jsonb_delete.h"
14
15 JsonbValue * 
16 pushJsonbBinary(JsonbParseState **pstate, JsonbContainer *in)
17 {
18     JsonbIterator          *it;
19     JsonbValue              v;
20     int32                   r;
21     JsonbValue             *res = NULL;
22
23     it = JsonbIteratorInit((void *)in);
24     while ((r = JsonbIteratorNext(&it, &v, false)) != WJB_DONE)
25     {
26         if (r == WJB_KEY || r == WJB_VALUE || r == WJB_ELEM)
27             res = pushJsonbValue(pstate, r, &v);
28         else
29             res = pushJsonbValue(pstate, r, NULL);
30
31     }
32     return res;
33 }