From 5a558932f61473ffe34998fb4671b5ec0dcccd6b Mon Sep 17 00:00:00 2001 From: hellozrh <455741807@qq.com> Date: Thu, 20 Jul 2023 20:13:49 +0800 Subject: [PATCH] informix-sql: add support of set auto free. --- sql/informix-sql/InformixSQLLexer.g4 | 3 +++ sql/informix-sql/InformixSQLParser.g4 | 9 +++++++++ sql/informix-sql/examples/setautoFree.sql | 6 ++++++ 3 files changed, 18 insertions(+) create mode 100644 sql/informix-sql/examples/setautoFree.sql diff --git a/sql/informix-sql/InformixSQLLexer.g4 b/sql/informix-sql/InformixSQLLexer.g4 index dfe4252731..6f53d150b7 100644 --- a/sql/informix-sql/InformixSQLLexer.g4 +++ b/sql/informix-sql/InformixSQLLexer.g4 @@ -66,6 +66,7 @@ AND: 'AND'; AS: 'AS'; ASC: 'ASC'; ATTACH: 'ATTACH'; +AUTOFREE: 'AUTOFREE'; AUTOINCREMENT: 'AUTOINCREMENT'; BEFORE: 'BEFORE'; BEGIN: 'BEGIN'; @@ -95,10 +96,12 @@ DEFERRED: 'DEFERRED'; DELETE: 'DELETE'; DESC: 'DESC'; DETACH: 'DETACH'; +DISABLED: 'DISABLED'; DISTINCT: 'DISTINCT'; DROP: 'DROP'; EACH: 'EACH'; ELSE: 'ELSE'; +ENABLED: 'ENABLED'; END: 'END'; ESCAPE: 'ESCAPE'; EXCEPT: 'EXCEPT'; diff --git a/sql/informix-sql/InformixSQLParser.g4 b/sql/informix-sql/InformixSQLParser.g4 index 9b541d3427..ec7aa717fd 100644 --- a/sql/informix-sql/InformixSQLParser.g4 +++ b/sql/informix-sql/InformixSQLParser.g4 @@ -64,6 +64,7 @@ unitStatement | renameUser | rollbackWork | savepointStmt + | setAutofree ) SCOL ; @@ -221,6 +222,11 @@ savepointStmt : SAVEPOINT savepoint=identifier UNIQUE? ; +//https://www.ibm.com/docs/en/informix-servers/14.10?topic=statements-set-autofree-statement +setAutofree + : SET AUTOFREE (ENABLED | DISABLED)? (FOR (cursorId=identifier | cursorIdVar=anyName))? + ; + anyName : IDENTIFIER | keyword @@ -246,6 +252,7 @@ keyword | AS | ASC | ATTACH + | AUTOFREE | AUTOINCREMENT | BEFORE | BEGIN @@ -275,10 +282,12 @@ keyword | DELETE | DESC | DETACH + | DISABLED | DISTINCT | DROP | EACH | ELSE + | ENABLED | END | ESCAPE | EXCEPT diff --git a/sql/informix-sql/examples/setautoFree.sql b/sql/informix-sql/examples/setautoFree.sql new file mode 100644 index 0000000000..e09f137e90 --- /dev/null +++ b/sql/informix-sql/examples/setautoFree.sql @@ -0,0 +1,6 @@ +SET AUTOFREE ; +SET AUTOFREE ENABLED; +SET AUTOFREE DISABLED; +SET AUTOFREE DISABLED FOR idd; + +