File tree 3 files changed +42
-1
lines changed
3 files changed +42
-1
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " oracle-sql-parser" ,
3
- "version" : " 0.0.7 " ,
3
+ "version" : " 0.1.0 " ,
4
4
"description" : " spec compliant parser for oracle sql" ,
5
5
"main" : " index.js" ,
6
6
"scripts" : {
Original file line number Diff line number Diff line change @@ -149,6 +149,26 @@ stmt
149
149
/ alter_table_stmt
150
150
/ create_domain_stmt
151
151
/ drop_domain_stmt
152
+ / commit_stmt
153
+
154
+ commit_stmt
155
+ = operation :KW_COMMIT _
156
+ work :KW_WORK ? _
157
+ settings :(
158
+ op :KW_FORCE _ string :string _ integer :(COMMA _ x :integer { return x; })? {
159
+ return { operation: op, string, integer };
160
+ } /
161
+ comment :(KW_COMMENT _ c :string { return c; }) _
162
+ write :(wait :(KW_WAIT / KW_NOWAIT )? _ mode :(KW_BATCH / KW_IMMEDIATE )? { return { wait, mode }; })? {
163
+ return { comment, write };
164
+ }
165
+ )? _ SEMI_COLON {
166
+ return {
167
+ work,
168
+ settings,
169
+ operation,
170
+ };
171
+ }
152
172
153
173
drop_domain_stmt
154
174
= operation :KW_DROP _
@@ -2878,6 +2898,11 @@ KW_DOMAIN = 'domain'i !ident_start { return '
2878
2898
KW_EXISTS = 'exists'i !ident_start { return 'exists'; }
2879
2899
KW_IF = 'if'i !ident_start { return 'if'; }
2880
2900
KW_ENUM = 'enum'i !ident_start { return 'enum'; }
2901
+ KW_WORK = 'work'i !ident_start { return 'work'; }
2902
+ KW_COMMENT = 'comment'i !ident_start { return 'comment'; }
2903
+ KW_WAIT = 'wait'i !ident_start { return 'wait'; }
2904
+ KW_NOWAIT = 'nowait'i !ident_start { return 'nowait'; }
2905
+ KW_BATCH = 'batch'i !ident_start { return 'batch'; }
2881
2906
2882
2907
KW_VARYING = 'varying'i !ident_start { return 'varying'; }
2883
2908
KW_VARCHAR = 'varchar'i !ident_start { return 'varchar'; }
Original file line number Diff line number Diff line change
1
+ const { Parser } = require ( "../../" ) ;
2
+
3
+ const parser = new Parser ( ) ;
4
+
5
+ describe ( "commit statement" , ( ) => {
6
+ it ( "commit;" , ( ) => {
7
+ const sql = "commit;" ;
8
+ const ast = parser . parse ( sql ) ;
9
+ const expected = {
10
+ operation : "commit" ,
11
+ work : null ,
12
+ settings : null ,
13
+ } ;
14
+ expect ( ast [ 0 ] ) . toMatchObject ( expected ) ;
15
+ } ) ;
16
+ } ) ;
You can’t perform that action at this time.
0 commit comments