From 2f9bb83dda8c8e56ad3ece73cbe2c82d5ee429c5 Mon Sep 17 00:00:00 2001 From: Rahim Kanji Date: Wed, 30 Apr 2025 13:28:29 +0500 Subject: [PATCH] Added Abort (alias of Rollback) --- include/proxysql_structs.h | 1 + lib/PgSQL_Query_Processor.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/proxysql_structs.h b/include/proxysql_structs.h index 983b121fa..eb6e04c6f 100644 --- a/include/proxysql_structs.h +++ b/include/proxysql_structs.h @@ -627,6 +627,7 @@ enum PGSQL_QUERY_command { PGSQL_QUERY_BEGIN, PGSQL_QUERY_COMMIT, PGSQL_QUERY_ROLLBACK, + PGSQL_QUERY_ABORT, PGSQL_QUERY_DECLARE_CURSOR, PGSQL_QUERY_CLOSE_CURSOR, PGSQL_QUERY_DISCARD, diff --git a/lib/PgSQL_Query_Processor.cpp b/lib/PgSQL_Query_Processor.cpp index 9165a561f..257639f86 100644 --- a/lib/PgSQL_Query_Processor.cpp +++ b/lib/PgSQL_Query_Processor.cpp @@ -102,6 +102,7 @@ static char* commands_counters_desc[PGSQL_QUERY___NONE] = { [PGSQL_QUERY_BEGIN] = (char*)"BEGIN", [PGSQL_QUERY_COMMIT] = (char*)"COMMIT", [PGSQL_QUERY_ROLLBACK] = (char*)"ROLLBACK", + [PGSQL_QUERY_ABORT] = (char*)"ABORT", [PGSQL_QUERY_DECLARE_CURSOR] = (char*)"DECLARE_CURSOR", [PGSQL_QUERY_CLOSE_CURSOR] = (char*)"CLOSE_CURSOR", [PGSQL_QUERY_DISCARD] = (char*)"DISCARD", @@ -664,7 +665,7 @@ enum PGSQL_QUERY_command PgSQL_Query_Processor::query_parser_command_type(SQP_pa char c1; tokenizer_t tok; - tokenizer(&tok, text, " ", TOKENIZER_NO_EMPTIES); + tokenizer(&tok, text, " ;", TOKENIZER_NO_EMPTIES); char* token = NULL; __get_token: token = (char*)tokenize(&tok); @@ -761,6 +762,10 @@ __remove_parenthesis: ret = PGSQL_QUERY_ANALYZE; break; } + if (!strcasecmp("ABORT", token)) { + ret = PGSQL_QUERY_ROLLBACK;; + break; + } break; case 'b': case 'B':