Merge remote-tracking branch 'upstream/master' into misc
This commit is contained in:
commit
9e558c7d22
12
Makefile
12
Makefile
|
@ -27,15 +27,17 @@ library: $(TARGET)
|
||||||
$(TARGET): $(LIBOBJ)
|
$(TARGET): $(LIBOBJ)
|
||||||
$(CXX) $(LIBFLAGS) -o $(TARGET) $(LIBOBJ)
|
$(CXX) $(LIBFLAGS) -o $(TARGET) $(LIBOBJ)
|
||||||
|
|
||||||
|
|
||||||
%.o: %.cpp $(PARSERFILES)
|
%.o: %.cpp $(PARSERFILES)
|
||||||
$(CXX) $(CFLAGS) -c -o $@ $<
|
$(CXX) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
$(SRCPARSER)/bison_parser.cpp: parser
|
$(SRCPARSER)/bison_parser.cpp:
|
||||||
$(SRCPARSER)/flex_lexer.cpp: parser
|
make -C $(SRCPARSER)/ bison_parser.cpp
|
||||||
|
|
||||||
|
$(SRCPARSER)/flex_lexer.cpp:
|
||||||
|
make -C $(SRCPARSER)/ flex_lexer.cpp
|
||||||
|
|
||||||
parser:
|
parser:
|
||||||
make -C $(SRCPARSER)/
|
make -C $(SRCPARSER) all
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(TARGET)
|
rm -f $(TARGET)
|
||||||
|
@ -49,6 +51,8 @@ cleanall: clean cleanparser
|
||||||
|
|
||||||
install:
|
install:
|
||||||
cp $(TARGET) $(INSTALL)/lib/$(TARGET)
|
cp $(TARGET) $(INSTALL)/lib/$(TARGET)
|
||||||
|
cp -r src $(INSTALL)/include/hsql
|
||||||
|
find $(INSTALL)/include/hsql -not -name '*.h' -type f | xargs rm
|
||||||
|
|
||||||
format:
|
format:
|
||||||
astyle --options=astyle.options $(ALLLIB)
|
astyle --options=astyle.options $(ALLLIB)
|
||||||
|
|
|
@ -36,7 +36,7 @@ To use the SQL parser in your own projects you simply have to follow these few s
|
||||||
|
|
||||||
First step to extending this parser is cloning the repository `git clone git@github.com:hyrise/sql-parser.git` and making sure everything works by running the following steps:
|
First step to extending this parser is cloning the repository `git clone git@github.com:hyrise/sql-parser.git` and making sure everything works by running the following steps:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
make parser # builds the bison parser and flex lexer
|
make parser # builds the bison parser and flex lexer
|
||||||
make library # builds the libsqlparser.so
|
make library # builds the libsqlparser.so
|
||||||
make test # runs the tests with the library
|
make test # runs the tests with the library
|
||||||
|
@ -44,7 +44,7 @@ make test # runs the tests with the library
|
||||||
|
|
||||||
Rerun these steps whenever you change part of the parse. To execute the entire pipeline automatically you can run:
|
Rerun these steps whenever you change part of the parse. To execute the entire pipeline automatically you can run:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
make cleanall # cleans the parser build and library build
|
make cleanall # cleans the parser build and library build
|
||||||
make test # build parser, library and runs the tests
|
make test # build parser, library and runs the tests
|
||||||
```
|
```
|
||||||
|
|
|
@ -19,6 +19,10 @@ int main(int argc, char *argv[]) {
|
||||||
hsql::SQLParserResult* result = hsql::SQLParser::parseSQLString(query);
|
hsql::SQLParserResult* result = hsql::SQLParser::parseSQLString(query);
|
||||||
|
|
||||||
// check whether the parsing was successful
|
// check whether the parsing was successful
|
||||||
|
if (!result) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (result->isValid()) {
|
if (result->isValid()) {
|
||||||
printf("Parsed successfully!\n");
|
printf("Parsed successfully!\n");
|
||||||
printf("Number of statements: %lu\n", result->size());
|
printf("Number of statements: %lu\n", result->size());
|
||||||
|
|
|
@ -32,6 +32,7 @@ fi
|
||||||
printf "\n${GREEN}Running memory leak checks...${NC}\n"
|
printf "\n${GREEN}Running memory leak checks...${NC}\n"
|
||||||
valgrind --leak-check=full --error-exitcode=200 --log-fd=3 \
|
valgrind --leak-check=full --error-exitcode=200 --log-fd=3 \
|
||||||
./bin/sql_tests -f "test/valid_queries.sql" 3>&1 >/dev/null 2>/dev/null
|
./bin/sql_tests -f "test/valid_queries.sql" 3>&1 >/dev/null 2>/dev/null
|
||||||
|
MEM_LEAK_RET=$?
|
||||||
|
|
||||||
if [ $MEM_LEAK_RET -ne 200 ]; then
|
if [ $MEM_LEAK_RET -ne 200 ]; then
|
||||||
printf "${GREEN}Memory leak check succeeded!${NC}\n"
|
printf "${GREEN}Memory leak check succeeded!${NC}\n"
|
||||||
|
|
Loading…
Reference in New Issue