-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
208 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
TARGET = pg_query | ||
|
||
PG_VERSION = 16.1 | ||
PG_VERSION_MAJOR = 16 | ||
PROTOC_VERSION = 25.1 | ||
|
||
VERSION = 5.0.0 | ||
VERSION_MAJOR = 5 | ||
VERSION_MINOR = 0 | ||
VERSION_PATCH = 0 | ||
|
||
SO_VERSION = 5.0 | ||
|
||
SOLIB = $(TARGET).lib | ||
SONAME = $(SOLIB).$(SO_VERSION) | ||
SOLIBVER = $(SONAME).$(VERSION_PATCH) | ||
SOFLAG = | ||
|
||
SRC_FILES = src/*.c src/postgres/*.c vendor/protobuf-c/protobuf-c.c vendor/xxhash/xxhash.c protobuf/pg_query.pb-c.c | ||
OBJ_FILES = src/*.o src/postgres/*.o vendor/protobuf-c/protobuf-c.o vendor/xxhash/xxhash.o protobuf/pg_query.pb-c.o | ||
|
||
CFLAGS = -I. -I./vendor -I./src/postgres/include -I./src/include -I./src/postgres/include/port/win32 -I./src/postgres/include/port/win32_msvc | ||
|
||
TEST_CFLAGS = -I. -I./vendor -I./src/postgres/include -I./src/include -I./src/postgres/include/port/win32 -I./src/postgres/include/port/win32_msvc | ||
|
||
CLEANLIBS = $(SOLIB) | ||
CLEANOBJS = $(OBJ_FILES) | ||
CLEANFILES = $(PGDIRBZ2) | ||
|
||
INSTALL = install | ||
LN_S = ln -s | ||
RM = rm -f | ||
ECHO = echo | ||
|
||
all: examples test build | ||
|
||
build: $(SOLIB) | ||
|
||
clean: | ||
del *.obj | ||
del pg_query.exp | ||
del pg_query.lib | ||
del pg_query.dll | ||
|
||
.PHONY: all clean build build_shared extract_source examples test install | ||
|
||
.c.o: | ||
@$(ECHO) compiling $(<) | ||
@$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $< | ||
|
||
$(SOLIB): clean $(OBJ_FILES) Makefile | ||
link /dll /DEF:pg_query.def *.obj | ||
|
||
EXAMPLES = examples/simple examples/scan examples/normalize examples/simple_error examples/normalize_error examples/simple_plpgsql | ||
examples: $(EXAMPLES) | ||
.\examples\simple | ||
# .\examples\scan BROKEN | ||
.\examples\normalize | ||
.\examples\simple_error | ||
.\examples\normalize_error | ||
# .\examples\simple_plpgsql BROKEN | ||
|
||
examples/simple: examples/simple.c $(SOLIB) | ||
$(CC) $(TEST_CFLAGS) -o $@ -g examples/simple.c /link $(SOLIB) $(TEST_LDFLAGS) | ||
|
||
examples/scan: examples/scan.c $(SOLIB) | ||
$(CC) $(TEST_CFLAGS) -o $@ -g examples/scan.c /link $(SOLIB) $(TEST_LDFLAGS) | ||
|
||
examples/normalize: examples/normalize.c $(SOLIB) | ||
$(CC) $(TEST_CFLAGS) -o $@ -g examples/normalize.c /link $(SOLIB) $(TEST_LDFLAGS) | ||
|
||
examples/simple_error: examples/simple_error.c $(SOLIB) | ||
$(CC) $(TEST_CFLAGS) -o $@ -g examples/simple_error.c /link $(SOLIB) $(TEST_LDFLAGS) | ||
|
||
examples/normalize_error: examples/normalize_error.c $(SOLIB) | ||
$(CC) $(TEST_CFLAGS) -o $@ -g examples/normalize_error.c /link $(SOLIB) $(TEST_LDFLAGS) | ||
|
||
examples/simple_plpgsql: examples/simple_plpgsql.c $(SOLIB) | ||
$(CC) $(TEST_CFLAGS) -o $@ -g examples/simple_plpgsql.c /link $(SOLIB) $(TEST_LDFLAGS) | ||
|
||
TESTS = test/deparse test/fingerprint test/fingerprint_opts test/normalize test/parse test/parse_opts test/parse_protobuf test/parse_protobuf_opts test/parse_plpgsql test/scan test/split | ||
test: $(TESTS) | ||
.\test\deparse | ||
.\test\fingerprint | ||
.\test\fingerprint_opts | ||
.\test\normalize | ||
.\test\parse | ||
.\test\parse_opts | ||
.\test\parse_protobuf | ||
.\test\parse_protobuf_opts | ||
# .\test\scan | ||
.\test\split | ||
|
||
# Doesn't work because of C2026: string too big, trailing characters truncated | ||
#test/complex: test/complex.c $(SOLIB) | ||
# We have "-Isrc/" because this test uses pg_query_fingerprint_with_opts | ||
# $(CC) $(TEST_CFLAGS) -o $@ -Isrc/ test/complex.c /link $(SOLIB) $(TEST_LDFLAGS) | ||
|
||
# Doesn't work since this requires pthreads | ||
#test/concurrency: test/concurrency.c test/parse_tests.c $(SOLIB) | ||
# $(CC) $(TEST_CFLAGS) -o $@ test/concurrency.c /link $(SOLIB) $(TEST_LDFLAGS) | ||
|
||
test/deparse: test/deparse.c test/deparse_tests.c $(SOLIB) | ||
$(CC) $(TEST_CFLAGS) -o $@ test/deparse.c /link $(SOLIB) $(TEST_LDFLAGS) | ||
|
||
test/fingerprint: test/fingerprint.c test/fingerprint_tests.c $(SOLIB) | ||
# We have "-Isrc/" because this test uses pg_query_fingerprint_with_opts | ||
$(CC) $(TEST_CFLAGS) -o $@ -Isrc/ test/fingerprint.c /link $(SOLIB) $(TEST_LDFLAGS) | ||
|
||
test/fingerprint_opts: test/fingerprint_opts.c test/fingerprint_opts_tests.c $(SOLIB) | ||
# We have "-Isrc/" because this test uses pg_query_fingerprint_with_opts | ||
$(CC) $(TEST_CFLAGS) -o $@ -Isrc/ test/fingerprint_opts.c /link $(SOLIB) $(TEST_LDFLAGS) | ||
|
||
test/normalize: test/normalize.c test/normalize_tests.c $(SOLIB) | ||
$(CC) $(TEST_CFLAGS) -o $@ test/normalize.c /link $(SOLIB) $(TEST_LDFLAGS) | ||
|
||
test/parse: test/parse.c test/parse_tests.c $(SOLIB) | ||
$(CC) $(TEST_CFLAGS) -o $@ test/parse.c /link $(SOLIB) $(TEST_LDFLAGS) | ||
|
||
test/parse_opts: test/parse_opts.c test/parse_opts_tests.c $(SOLIB) | ||
$(CC) $(TEST_CFLAGS) -o $@ test/parse_opts.c /link $(SOLIB) $(TEST_LDFLAGS) | ||
|
||
test/parse_plpgsql: test/parse_plpgsql.c test/parse_tests.c $(SOLIB) | ||
$(CC) $(TEST_CFLAGS) -o $@ test/parse_plpgsql.c /link $(SOLIB) $(TEST_LDFLAGS) | ||
|
||
test/parse_protobuf: test/parse_protobuf.c test/parse_tests.c $(SOLIB) | ||
$(CC) $(TEST_CFLAGS) -o $@ test/parse_protobuf.c /link $(SOLIB) $(TEST_LDFLAGS) | ||
|
||
test/parse_protobuf_opts: test/parse_protobuf_opts.c test/parse_opts_tests.c $(SOLIB) | ||
$(CC) $(TEST_CFLAGS) -o $@ test/parse_protobuf_opts.c /link $(SOLIB) $(TEST_LDFLAGS) | ||
|
||
test/scan: test/scan.c test/scan_tests.c $(SOLIB) | ||
$(CC) $(TEST_CFLAGS) -o $@ test/scan.c /link $(SOLIB) $(TEST_LDFLAGS) | ||
|
||
test/split: test/split.c test/split_tests.c $(SOLIB) | ||
$(CC) $(TEST_CFLAGS) -o $@ test/split.c /link $(SOLIB) $(TEST_LDFLAGS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
LIBRARY pg_query | ||
EXPORTS | ||
pg_query_parse | ||
pg_query_free_parse_result | ||
pg_query_exit | ||
pg_query_scan | ||
pg_query_free_scan_result | ||
protobuf_c_enum_descriptor_get_value | ||
pg_query__scan_result__unpack | ||
pg_query__scan_result__free_unpacked | ||
pg_query__keyword_kind__descriptor | ||
pg_query__token__descriptor | ||
pg_query_normalize | ||
pg_query_free_normalize_result | ||
pg_query_parse_plpgsql | ||
pg_query_free_plpgsql_parse_result | ||
pg_query_parse_protobuf | ||
pg_query_split_with_scanner | ||
pg_query_deparse_protobuf | ||
pg_query_free_split_result | ||
pg_query_free_deparse_result | ||
pg_query_free_protobuf_parse_result | ||
pg_query_fingerprint | ||
pg_query_free_fingerprint_result | ||
pg_query_fingerprint_with_opts | ||
pg_query_fingerprint_opts | ||
pg_query_parse_opts | ||
pg_query_parse_protobuf_opts | ||
pg_query_split_with_parser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/*------------------------------------------------------------------------- | ||
* | ||
* nodes.c | ||
* support code for nodes (now that we have removed the home-brew | ||
* inheritance system, our support code for nodes is much simpler) | ||
* | ||
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group | ||
* Portions Copyright (c) 1994, Regents of the University of California | ||
* | ||
* | ||
* IDENTIFICATION | ||
* src/backend/nodes/nodes.c | ||
* | ||
* HISTORY | ||
* Andrew Yu Oct 20, 1994 file creation | ||
* | ||
*------------------------------------------------------------------------- | ||
*/ | ||
#include "postgres.h" | ||
|
||
#include "nodes/nodes.h" | ||
|
||
/* | ||
* Support for newNode() macro | ||
* | ||
* In a GCC build there is no need for the global variable newNodeMacroHolder. | ||
* However, we create it anyway, to support the case of a non-GCC-built | ||
* loadable module being loaded into a GCC-built backend. | ||
*/ | ||
|
||
Node *newNodeMacroHolder; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters