@@ -299,10 +299,16 @@ export interface drop_index_stmt_node {
299299
300300export type drop_stmt = AstStatement < drop_stmt_node > | AstStatement < drop_index_stmt_node > ;
301301
302+ export type truncate_table_name = table_name & { suffix ?: string } ;
303+
304+ export type truncate_table_name_list = truncate_table_name [ ] ;
305+
302306export interface truncate_stmt_node {
303307 type : 'trucate' ;
304308 keyword : 'table' ;
309+ prefix ?: string ;
305310 name : table_ref_list ;
311+ suffix : string [ ] ;
306312 }
307313
308314export type truncate_stmt = AstStatement < truncate_stmt_node > ;
@@ -559,7 +565,7 @@ export type table_option = {
559565 keyword : 'auto_increment' | 'avg_row_length' | 'key_block_size' | 'max_rows' | 'min_rows' | 'stats_sample_pages' ;
560566 symbol : '=' ;
561567 value : number ; // <== literal_numeric['value']
562- } | create_option_character_set | { keyword : 'connection' | 'comment' ; symbol : '=' ; value : string ; } | { keyword : 'compression' ; symbol : '=' ; value : "'ZLIB'" | "'LZ4'" | "'NONE'" } | { keyword : 'engine' ; symbol : '=' ; value : string ; } ;
568+ } | create_option_character_set | { keyword : 'connection' | 'comment' ; symbol : '=' ; value : string ; } | { keyword : 'compression' ; symbol ? : '=' ; value : "'ZLIB'" | "'LZ4'" | "'NONE'" } | { keyword : 'engine' ; symbol ? : '=' ; value : string ; } | { keyword : 'partition by' ; value : expr ; } ;
563569
564570export type ALTER_ADD_FULLETXT_SPARITAL_INDEX = create_fulltext_spatial_index_definition & { action : 'add' ; type : 'alter' } ;
565571
@@ -770,6 +776,8 @@ export type column_clause = 'ALL' | '*' | column_list_item[] | column_list_item[
770776
771777export type array_index = { brackets : boolean , number : number } ;
772778
779+ export type array_index_list = array_index [ ] ;
780+
773781export type expr_item = binary_expr & { array_index : array_index } ;
774782
775783export type cast_data_type = data_type & { quoted ?: string } ;
@@ -881,7 +889,7 @@ export type window_frame_value = literal_string | literal_numeric;
881889
882890
883891
884- export type partition_by_clause = column_clause ;
892+ export type partition_by_clause = { type : 'expr' ; expr : column_ref_list } [ ] ;
885893
886894
887895
@@ -1103,32 +1111,38 @@ export type column_ref = string_constants_escape | {
11031111 property ?: ( literal_string | literal_numeric ) [ ] ;
11041112 } ;
11051113
1114+ export type column_ref_quoted = IGNORE ;
1115+
11061116export type column_list = column [ ] ;
11071117
1118+ export type ident_without_kw_type = { type : 'default' , value : string } | quoted_ident_type ;
1119+
1120+ export type ident_type = ident_name | quoted_ident_type ;
1121+
11081122export type ident = string ;
11091123
11101124export type ident_list = ident [ ] ;
11111125
11121126export type alias_ident = string ;
11131127
1114- export type quoted_ident = double_quoted_ident | single_quoted_ident | backticks_quoted_ident ;
1115-
1116-
1128+ export type quoted_ident_type = double_quoted_ident | single_quoted_ident | backticks_quoted_ident ;
11171129
1118- export type double_quoted_ident = string ;
1130+ export type quoted_ident = string ;
11191131
1132+ export type double_quoted_ident = { type : 'double_quote_string' ; value : string ; } ;
11201133
1134+ export type single_quoted_ident = { type : 'single_quote_string' ; value : string ; } ;
11211135
1122- export type single_quoted_ident = string ;
1123-
1124-
1125-
1126- export type backticks_quoted_ident = string ;
1136+ export type backticks_quoted_ident = { type : 'backticks_quote_string' ; value : string ; } ;
11271137
11281138export type ident_without_kw = ident_name | quoted_ident ;
11291139
11301140export type column_without_kw = column_name | quoted_ident ;
11311141
1142+ export type column_without_kw_type = { type : 'default' , value : string } | quoted_ident_type ;
1143+
1144+ export type column_type = { type : 'default' , value : string } | quoted_ident_type ;
1145+
11321146
11331147
11341148export type column = string | quoted_ident ;
@@ -1199,11 +1213,11 @@ export type trim_position = "BOTH" | "LEADING" | "TRAILING";
11991213
12001214export type trim_rem = expr_list ;
12011215
1202- export type trim_func_clause = { type : 'function' ; name : string ; args : expr_list ; } ;
1216+ export type trim_func_clause = { type : 'function' ; name : proc_func_name ; args : expr_list ; } ;
12031217
1204- export type tablefunc_clause = { type : 'tablefunc' ; name : crosstab ; args : expr_list ; as : func_call } ;
1218+ export type tablefunc_clause = { type : 'tablefunc' ; name : proc_func_name ; args : expr_list ; as : func_call } ;
12051219
1206- export type func_call = trim_func_clause | tablefunc_clause | { type : 'function' ; name : string ; args : expr_list ; suffix : literal_string ; } | { type : 'function' ; name : string ; args : expr_list ; over ?: over_partition ; } | extract_func | { type : 'function' ; name : string ; over ?: on_update_current_timestamp ; } | { type : 'function' ; name : string ; args : expr_list ; } ;
1220+ export type func_call = trim_func_clause | tablefunc_clause | { type : 'function' ; name : proc_func_name ; args : expr_list ; suffix : literal_string ; } | { type : 'function' ; name : proc_func_name ; args : expr_list ; over ?: over_partition ; } | extract_func | { type : 'function' ; name : proc_func_name ; over ?: on_update_current_timestamp ; } | { type : 'function' ; name : proc_func_name ; args : expr_list ; } ;
12071221
12081222export type extract_filed = 'string' ;
12091223
@@ -1262,7 +1276,9 @@ export type literal_not_null = { type: 'not null'; value: 'not null' };
12621276
12631277export type literal_bool = { type : 'bool' , value : true } | { type : 'bool' , value : false } ;
12641278
1265- export type literal_string = { type : 'single_quote_string' ; value : string ; } | { type : 'string' ; value : string ; } ;
1279+ export type literal_string = { type : 'single_quote_string' ; value : string ; } | literal_double_quoted_string ;
1280+
1281+ export type literal_double_quoted_string = { type : 'string' ; value : string ; } ;
12661282
12671283export type literal_datetime = { type : 'TIME' | 'DATE' | 'TIMESTAMP' | 'DATETIME' , value : string } ;
12681284
@@ -1730,7 +1746,7 @@ export type proc_join = { type: 'join'; ltable: var_decl; rtable: var_decl; op:
17301746
17311747export type proc_primary = literal | var_decl | proc_func_call | param | proc_additive_expr & { parentheses : true ; } | { type : 'var' ; prefix : null ; name : number ; members : [ ] ; quoted : null } | column_ref ;
17321748
1733- export type proc_func_name = string ;
1749+ export type proc_func_name = { schema ?: ident_without_kw_type , name : ident_without_kw_type } ;
17341750
17351751export type proc_func_call = { type : 'function' ; name : string ; args : null | { type : expr_list ; value : proc_primary_list ; } } ;
17361752
@@ -1831,4 +1847,6 @@ export type uuid_type = data_type;
18311847
18321848
18331849
1834- export type record_type = data_type ;
1850+ export type record_type = data_type ;
1851+
1852+ export type custom_types = data_type ;
0 commit comments