Merge remote-tracking branch 'upstream/master' into misc

This commit is contained in:
Pedro Flemming 2017-04-07 15:48:51 +02:00
commit 9e558c7d22
4 changed files with 15 additions and 6 deletions

View File

@ -27,15 +27,17 @@ library: $(TARGET)
$(TARGET): $(LIBOBJ)
$(CXX) $(LIBFLAGS) -o $(TARGET) $(LIBOBJ)
%.o: %.cpp $(PARSERFILES)
$(CXX) $(CFLAGS) -c -o $@ $<
$(SRCPARSER)/bison_parser.cpp: parser
$(SRCPARSER)/flex_lexer.cpp: parser
$(SRCPARSER)/bison_parser.cpp:
make -C $(SRCPARSER)/ bison_parser.cpp
$(SRCPARSER)/flex_lexer.cpp:
make -C $(SRCPARSER)/ flex_lexer.cpp
parser:
make -C $(SRCPARSER)/
make -C $(SRCPARSER) all
clean:
rm -f $(TARGET)
@ -49,6 +51,8 @@ cleanall: clean cleanparser
install:
cp $(TARGET) $(INSTALL)/lib/$(TARGET)
cp -r src $(INSTALL)/include/hsql
find $(INSTALL)/include/hsql -not -name '*.h' -type f | xargs rm
format:
astyle --options=astyle.options $(ALLLIB)

View File

@ -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:
```
```bash
make parser # builds the bison parser and flex lexer
make library # builds the libsqlparser.so
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:
```
```bash
make cleanall # cleans the parser build and library build
make test # build parser, library and runs the tests
```

View File

@ -19,6 +19,10 @@ int main(int argc, char *argv[]) {
hsql::SQLParserResult* result = hsql::SQLParser::parseSQLString(query);
// check whether the parsing was successful
if (!result) {
return -1;
}
if (result->isValid()) {
printf("Parsed successfully!\n");
printf("Number of statements: %lu\n", result->size());

View File

@ -32,6 +32,7 @@ fi
printf "\n${GREEN}Running memory leak checks...${NC}\n"
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
MEM_LEAK_RET=$?
if [ $MEM_LEAK_RET -ne 200 ]; then
printf "${GREEN}Memory leak check succeeded!${NC}\n"