#include "common/protobuf/utility.h" #include "include/sqlparser/SQLParser.h" namespace Envoy { namespace Extensions { namespace Common { namespace SQLUtils { class SQLUtils { public: using DecoderAttributes = std::map; /** * Method parses SQL query string and writes output to metadata. * @param query supplies SQL statement. * @param attr supplies attributes which cannot be extracted from SQL query but are * required to create proper metadata. For example database name may be sent * by a client when it initially connects to the server, not along each SQL query. * @param metadata supplies placeholder where metadata should be written. * @return True if parsing was successful and False if parsing failed. * If True was returned the metadata contains result of parsing. The results are * stored in metadata.mutable_fields. **/ static bool setMetadata(const std::string& query, const DecoderAttributes& attr, ProtobufWkt::Struct& metadata); }; } // namespace SQLUtils } // namespace Common } // namespace Extensions } // namespace Envoy