Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions plugins/python/parser/include/pythonparser/pythonparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class PythonParser : public AbstractParser
PythonParser(ParserContext& ctx_);
virtual ~PythonParser();
virtual bool parse() override;
virtual bool cleanupDatabase() override;
private:
struct ParseResultStats {
std::uint32_t partial;
Expand Down
13 changes: 13 additions & 0 deletions plugins/python/parser/src/pythonparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,19 @@ bool PythonParser::parse()
return true;
}

bool PythonParser::cleanupDatabase()
{
LOG(info) << "[pythonparser] Incremental parsing unsupported, cleaning up previous analysis results from database ...";
odb::connection_ptr connection = _ctx.db->connection();
#ifdef DATABASE_PGSQL
connection->execute("TRUNCATE TABLE \"PYName\";");
#else
connection->execute("DELETE FROM \"PYName\";");
#endif
LOG(info) << "[pythonparser] Cleanup finished!";
return true;
}

PythonParser::~PythonParser()
{
}
Expand Down
Loading