1
1
/*-------------------------------------------------------------------------
2
2
*
3
- * jsquery_manipulation .c
4
- * Functions and operations to manipulate jsquery
3
+ * jsquery_constr .c
4
+ * Functions and operations to manipulate jsquery
5
5
*
6
6
* Copyright (c) 2014, PostgreSQL Global Development Group
7
7
* Author: Teodor Sigaev <[email protected] >
8
8
*
9
9
* IDENTIFICATION
10
- * contrib/jsquery/jsquery_manipulation .c
10
+ * contrib/jsquery/jsquery_constr .c
11
11
*
12
12
*-------------------------------------------------------------------------
13
13
*/
@@ -23,8 +23,8 @@ static int32
23
23
copyJsQuery (StringInfo buf , JsQueryItem * jsq )
24
24
{
25
25
JsQueryItem elem ;
26
- int32 next , chld ;
27
- int32 resPos = buf -> len - VARHDRSZ ; /* position from begining of jsquery data */
26
+ int32 next , chld ;
27
+ int32 resPos = buf -> len - VARHDRSZ ; /* position from begining of jsquery data */
28
28
29
29
check_stack_depth ();
30
30
@@ -42,7 +42,7 @@ copyJsQuery(StringInfo buf, JsQueryItem *jsq)
42
42
case jqiKey :
43
43
case jqiString :
44
44
{
45
- int32 len ;
45
+ int32 len ;
46
46
char * s ;
47
47
48
48
s = jsqGetString (jsq , & len );
@@ -124,6 +124,10 @@ copyJsQuery(StringInfo buf, JsQueryItem *jsq)
124
124
* (int32 * )(buf -> data + argOut ) = chld ;
125
125
}
126
126
break ;
127
+ case jqiIndexArray :
128
+ appendBinaryStringInfo (buf , (char * )& jsq -> arrayIndex ,
129
+ sizeof (jsq -> arrayIndex ));
130
+ break ;
127
131
case jqiNull :
128
132
case jqiCurrent :
129
133
case jqiLength :
@@ -150,7 +154,7 @@ joinJsQuery(JsQueryItemType type, JsQuery *jq1, JsQuery *jq2)
150
154
JsQuery * out ;
151
155
StringInfoData buf ;
152
156
int32 left , right , chld ;
153
- JsQueryItem v ;
157
+ JsQueryItem v ;
154
158
155
159
initStringInfo (& buf );
156
160
enlargeStringInfo (& buf , VARSIZE_ANY (jq1 ) + VARSIZE_ANY (jq2 ) + 4 * sizeof (int32 ) + VARHDRSZ );
@@ -188,9 +192,9 @@ PG_FUNCTION_INFO_V1(jsquery_join_and);
188
192
Datum
189
193
jsquery_join_and (PG_FUNCTION_ARGS )
190
194
{
191
- JsQuery * jq1 = PG_GETARG_JSQUERY (0 );
192
- JsQuery * jq2 = PG_GETARG_JSQUERY (1 );
193
- JsQuery * out ;
195
+ JsQuery * jq1 = PG_GETARG_JSQUERY (0 );
196
+ JsQuery * jq2 = PG_GETARG_JSQUERY (1 );
197
+ JsQuery * out ;
194
198
195
199
out = joinJsQuery (jqiAnd , jq1 , jq2 );
196
200
@@ -204,9 +208,9 @@ PG_FUNCTION_INFO_V1(jsquery_join_or);
204
208
Datum
205
209
jsquery_join_or (PG_FUNCTION_ARGS )
206
210
{
207
- JsQuery * jq1 = PG_GETARG_JSQUERY (0 );
208
- JsQuery * jq2 = PG_GETARG_JSQUERY (1 );
209
- JsQuery * out ;
211
+ JsQuery * jq1 = PG_GETARG_JSQUERY (0 );
212
+ JsQuery * jq2 = PG_GETARG_JSQUERY (1 );
213
+ JsQuery * out ;
210
214
211
215
out = joinJsQuery (jqiOr , jq1 , jq2 );
212
216
0 commit comments