pg_query 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/ext/pg_query/pg_query.c +16 -20
- data/lib/pg_query/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZDNiOTIxMTliNzI0NmUzMjU2ZjYzNTcwZDI2ZDE0NzE1MzY5ZWIxMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NzQxMTg0YWNkZWJjZTQ1NTQyMThjZGRhN2JhY2ZlZmEwMmQyNzAyMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODc0N2Q4ZmE0ZmJjZjJkYzRiZmVmMjg0MGJiOTA4NDNiODg5Zjc4M2Q3YThh
|
10
|
+
NmM2Zjk5ZDViMzk1ZjJlZTM4ZDE5NTlkN2NlNGJhYTM3ODA1YzQ0NTE2ZDll
|
11
|
+
OTIzMjc2OWE3ZGIyMDAzMWRlNjE1NDdkYzQ0YjYxZjgyNjcyN2I=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Zjg0NDA0MjI4NTc4OWJkNTg4OGY3MWJhY2EyMDZkOGVkMWI2YzkwOTUwYjFl
|
14
|
+
YmZkZTI5YmRhZjU1YmViN2JiNDFhMjc3YzE0YjQyYjA2YWQyMDU0NjQwYWVi
|
15
|
+
MDZhYTZmZWU1YWE5NzdiZjFmNGMzMGEzZjBjNDgyMGM0NzBlYzI=
|
data/ext/pg_query/pg_query.c
CHANGED
@@ -13,10 +13,10 @@
|
|
13
13
|
|
14
14
|
const char* progname = "pg_query";
|
15
15
|
|
16
|
-
static
|
16
|
+
static VALUE new_parse_error(ErrorData* error)
|
17
17
|
{
|
18
18
|
VALUE cPgQuery, cParseError;
|
19
|
-
VALUE
|
19
|
+
VALUE args[2];
|
20
20
|
|
21
21
|
cPgQuery = rb_const_get(rb_cObject, rb_intern("PgQuery"));
|
22
22
|
cParseError = rb_const_get_at(cPgQuery, rb_intern("ParseError"));
|
@@ -24,9 +24,7 @@ static void raise_parse_error(ErrorData* error)
|
|
24
24
|
args[0] = rb_tainted_str_new_cstr(error->message);
|
25
25
|
args[1] = INT2NUM(error->cursorpos);
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
rb_exc_raise(exc);
|
27
|
+
return rb_class_new_instance(2, args, cParseError);
|
30
28
|
}
|
31
29
|
|
32
30
|
#define STDERR_BUFFER_LEN 4096
|
@@ -36,8 +34,8 @@ static VALUE pg_query_raw_parse(VALUE self, VALUE input)
|
|
36
34
|
Check_Type(input, T_STRING);
|
37
35
|
|
38
36
|
MemoryContext ctx = NULL;
|
39
|
-
VALUE result;
|
40
|
-
|
37
|
+
VALUE result = Qnil;
|
38
|
+
VALUE error = Qnil;
|
41
39
|
char stderr_buffer[STDERR_BUFFER_LEN + 1] = {0};
|
42
40
|
int stderr_global;
|
43
41
|
int stderr_pipe[2];
|
@@ -82,7 +80,8 @@ static VALUE pg_query_raw_parse(VALUE self, VALUE input)
|
|
82
80
|
}
|
83
81
|
PG_CATCH();
|
84
82
|
{
|
85
|
-
|
83
|
+
ErrorData* error_data = CopyErrorData();
|
84
|
+
error = new_parse_error(error_data);
|
86
85
|
FlushErrorState();
|
87
86
|
}
|
88
87
|
PG_END_TRY();
|
@@ -93,8 +92,8 @@ static VALUE pg_query_raw_parse(VALUE self, VALUE input)
|
|
93
92
|
MemoryContextSwitchTo(TopMemoryContext);
|
94
93
|
MemoryContextDelete(ctx);
|
95
94
|
|
96
|
-
// If we got an error, throw
|
97
|
-
if (error)
|
95
|
+
// If we got an error, throw it
|
96
|
+
if (!NIL_P(error)) rb_exc_raise(error);
|
98
97
|
|
99
98
|
return result;
|
100
99
|
}
|
@@ -351,10 +350,6 @@ bool const_record_walker(Node *node, pgssConstLocations *jstate)
|
|
351
350
|
jstate->clocations[jstate->clocations_count].length = -1;
|
352
351
|
jstate->clocations_count++;
|
353
352
|
}
|
354
|
-
//else if (isA(node, Query))
|
355
|
-
//{
|
356
|
-
// return query_tree_walker(node, const_record_walker, jstate, 0);
|
357
|
-
//}
|
358
353
|
|
359
354
|
PG_TRY();
|
360
355
|
{
|
@@ -372,8 +367,8 @@ static VALUE pg_query_normalize(VALUE self, VALUE input)
|
|
372
367
|
Check_Type(input, T_STRING);
|
373
368
|
|
374
369
|
MemoryContext ctx = NULL;
|
375
|
-
VALUE result;
|
376
|
-
|
370
|
+
VALUE result = Qnil;
|
371
|
+
VALUE error = Qnil;
|
377
372
|
|
378
373
|
ctx = AllocSetContextCreate(TopMemoryContext,
|
379
374
|
"pg_query_normalize",
|
@@ -412,16 +407,17 @@ static VALUE pg_query_normalize(VALUE self, VALUE input)
|
|
412
407
|
}
|
413
408
|
PG_CATCH();
|
414
409
|
{
|
415
|
-
|
410
|
+
ErrorData* error_data = CopyErrorData();
|
411
|
+
error = new_parse_error(error_data);
|
416
412
|
FlushErrorState();
|
417
413
|
}
|
418
414
|
PG_END_TRY();
|
419
|
-
|
415
|
+
|
420
416
|
MemoryContextSwitchTo(TopMemoryContext);
|
421
417
|
MemoryContextDelete(ctx);
|
422
418
|
|
423
|
-
// If we got an error, throw
|
424
|
-
if (error)
|
419
|
+
// If we got an error, throw it
|
420
|
+
if (!NIL_P(error)) rb_exc_raise(error);
|
425
421
|
|
426
422
|
return result;
|
427
423
|
}
|
data/lib/pg_query/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pg_query
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lukas Fittl
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|