8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 04:03:03 +01:00

1. Parser cleanup

2. SQL-99 synonyms for generators DDL/DML
3. Implemented REVOKE ADMIN OPTION FROM
This commit is contained in:
dimitr 2004-12-02 22:53:51 +00:00
parent 66214ea340
commit 28ed1df100
5 changed files with 8756 additions and 7042 deletions

View File

@ -4361,9 +4361,9 @@ static void grant_revoke( dsql_req* request)
dsql_nod** uptr;
dsql_nod** uend;
SSHORT option = 0; // no grant/admin option
dsql_nod* ddl_node = request->req_ddl_node;
dsql_nod* privs = ddl_node->nod_arg[e_grant_privs];
USHORT option = 0; // no grant/admin option
dsql_nod* ddl_node = request->req_ddl_node;
dsql_nod* privs = ddl_node->nod_arg[e_grant_privs];
bool process_grant_role = false;
if (privs->nod_arg[0] != NULL) {
@ -4385,12 +4385,8 @@ static void grant_revoke( dsql_req* request)
uend = users->nod_arg + users->nod_count;
for (uptr = users->nod_arg; uptr < uend; ++uptr)
{
modify_privileges( request,
ddl_node->nod_type,
option,
privs,
table,
*uptr);
modify_privileges(request, ddl_node->nod_type, option,
privs, table, *uptr);
}
}
else
@ -4408,11 +4404,8 @@ static void grant_revoke( dsql_req* request)
uend = users->nod_arg + users->nod_count;
for (uptr = users->nod_arg; uptr < uend; ++uptr)
{
process_role_nm_list( request,
option,
*uptr,
*role_ptr,
ddl_node->nod_type);
process_role_nm_list(request, option, *uptr, *role_ptr,
ddl_node->nod_type);
}
}
}

View File

@ -1,267 +1,264 @@
#ifndef YYSTYPE
#define YYSTYPE int
#endif
#define ACTIVE 257
#define ADD 258
#define AFTER 259
#define ALL 260
#define ALTER 261
#define AND 262
#define ANY 263
#define AS 264
#define ASC 265
#define AT 266
#define AVG 267
#define AUTO 268
#define BEFORE 269
#define BEGIN 270
#define BETWEEN 271
#define BLOB 272
#define BY 273
#define CAST 274
#define CHARACTER 275
#define CHECK 276
#define COLLATE 277
#define COMMA 278
#define COMMIT 279
#define COMMITTED 280
#define COMPUTED 281
#define CONCATENATE 282
#define CONDITIONAL 283
#define CONSTRAINT 284
#define CONTAINING 285
#define COUNT 286
#define CREATE 287
#define CSTRING 288
#define CURRENT 289
#define CURSOR 290
#define DATABASE 291
#define DATE 292
#define DB_KEY 293
#define KW_DEBUG 294
#define DECIMAL 295
#define DECLARE 296
#define DEFAULT 297
#define KW_DELETE 298
#define DESC 299
#define DISTINCT 300
#define DO 301
#define DOMAIN 302
#define DROP 303
#define ELSE 304
#define END 305
#define ENTRY_POINT 306
#define EQL 307
#define ESCAPE 308
#define EXCEPTION 309
#define EXECUTE 310
#define EXISTS 311
#define EXIT 312
#define EXTERNAL 313
#define FILTER 314
#define FOR 315
#define FOREIGN 316
#define FROM 317
#define FULL 318
#define FUNCTION 319
#define GDSCODE 320
#define GEQ 321
#define GENERATOR 322
#define GEN_ID 323
#define GRANT 324
#define GROUP 325
#define GTR 326
#define HAVING 327
#define IF 328
#define KW_IN 329
#define INACTIVE 330
#define INNER 331
#define INPUT_TYPE 332
#define INDEX 333
#define INSERT 334
#define INTEGER 335
#define INTO 336
#define IS 337
#define ISOLATION 338
#define JOIN 339
#define KEY 340
#define KW_CHAR 341
#define KW_DEC 342
#define KW_DOUBLE 343
#define KW_FILE 344
#define KW_FLOAT 345
#define KW_INT 346
#define KW_LONG 347
#define KW_NULL 348
#define KW_NUMERIC 349
#define KW_UPPER 350
#define KW_VALUE 351
#define LENGTH 352
#define LPAREN 353
#define LEFT 354
#define LEQ 355
#define LEVEL 356
#define LIKE 357
#define LSS 358
#define MANUAL 359
#define MAXIMUM 360
#define MAX_SEGMENT 361
#define MERGE 362
#define MESSAGE 363
#define MINIMUM 364
#define MODULE_NAME 365
#define NAMES 366
#define NATIONAL 367
#define NATURAL 368
#define NCHAR 369
#define NEQ 370
#define NO 371
#define NOT 372
#define NOT_GTR 373
#define NOT_LSS 374
#define OF 375
#define ON 376
#define ONLY 377
#define OPTION 378
#define OR 379
#define ORDER 380
#define OUTER 381
#define OUTPUT_TYPE 382
#define OVERFLOW 383
#define PAGE 384
#define PAGES 385
#define KW_PAGE_SIZE 386
#define PARAMETER 387
#define PASSWORD 388
#define PLAN 389
#define POSITION 390
#define POST_EVENT 391
#define PRECISION 392
#define PRIMARY 393
#define PRIVILEGES 394
#define PROCEDURE 395
#define PROTECTED 396
#define READ 397
#define REAL 398
#define REFERENCES 399
#define RESERVING 400
#define RETAIN 401
#define RETURNING_VALUES 402
#define RETURNS 403
#define REVOKE 404
#define RIGHT 405
#define RPAREN 406
#define ROLLBACK 407
#define SEGMENT 408
#define SELECT 409
#define SET 410
#define SHADOW 411
#define KW_SHARED 412
#define SINGULAR 413
#define KW_SIZE 414
#define SMALLINT 415
#define SNAPSHOT 416
#define SOME 417
#define SORT 418
#define SQLCODE 419
#define STABILITY 420
#define STARTING 421
#define STATISTICS 422
#define SUB_TYPE 423
#define SUSPEND 424
#define SUM 425
#define TABLE 426
#define THEN 427
#define TO 428
#define TRANSACTION 429
#define TRIGGER 430
#define UNCOMMITTED 431
#define UNION 432
#define UNIQUE 433
#define UPDATE 434
#define USER 435
#define VALUES 436
#define VARCHAR 437
#define VARIABLE 438
#define VARYING 439
#define VERSION 440
#define VIEW 441
#define WAIT 442
#define WHEN 443
#define WHERE 444
#define WHILE 445
#define WITH 446
#define WORK 447
#define WRITE 448
#define FLOAT_NUMBER 449
#define NUMBER 450
#define NUMERIC 451
#define SYMBOL 452
#define STRING 453
#define INTRODUCER 454
#define ACTION 455
#define ADMIN 456
#define CASCADE 457
#define FREE_IT 458
#define RESTRICT 459
#define ROLE 460
#define COLUMN 461
#define TYPE 462
#define EXTRACT 463
#define YEAR 464
#define MONTH 465
#define DAY 466
#define HOUR 467
#define MINUTE 468
#define SECOND 469
#define WEEKDAY 470
#define YEARDAY 471
#define TIME 472
#define TIMESTAMP 473
#define CURRENT_DATE 474
#define CURRENT_TIME 475
#define CURRENT_TIMESTAMP 476
#define NUMBER64BIT 477
#define SCALEDINT 478
#define CURRENT_USER 479
#define CURRENT_ROLE 480
#define KW_BREAK 481
#define SUBSTRING 482
#define RECREATE 483
#define KW_DESCRIPTOR 484
#define FIRST 485
#define SKIP 486
#define CURRENT_CONNECTION 487
#define CURRENT_TRANSACTION 488
#define BIGINT 489
#define CASE 490
#define NULLIF 491
#define COALESCE 492
#define USING 493
#define NULLS 494
#define LAST 495
#define ROW_COUNT 496
#define LOCK 497
#define SAVEPOINT 498
#define RELEASE 499
#define STATEMENT 500
#define LEAVE 501
#define INSERTING 502
#define UPDATING 503
#define DELETING 504
#define KW_INSERTING 505
#define KW_UPDATING 506
#define KW_DELETING 507
#define BACKUP 508
#define KW_DIFFERENCE 509
#define OPEN 510
#define CLOSE 511
#define FETCH 512
#define ROWS 513
#define BLOCK 514
#define IIF 515
#define SCALAR_ARRAY 516
#define CROSS 517
extern YYSTYPE yylval;
#define ACTIVE 257
#define ADD 258
#define AFTER 259
#define ALL 260
#define ALTER 261
#define AND 262
#define ANY 263
#define AS 264
#define ASC 265
#define AT 266
#define AVG 267
#define AUTO 268
#define BEFORE 269
#define BEGIN 270
#define BETWEEN 271
#define BLOB 272
#define BY 273
#define CAST 274
#define CHARACTER 275
#define CHECK 276
#define COLLATE 277
#define COMMA 278
#define COMMIT 279
#define COMMITTED 280
#define COMPUTED 281
#define CONCATENATE 282
#define CONDITIONAL 283
#define CONSTRAINT 284
#define CONTAINING 285
#define COUNT 286
#define CREATE 287
#define CSTRING 288
#define CURRENT 289
#define CURSOR 290
#define DATABASE 291
#define DATE 292
#define DB_KEY 293
#define KW_DEBUG 294
#define DECIMAL 295
#define DECLARE 296
#define DEFAULT 297
#define KW_DELETE 298
#define DESC 299
#define DISTINCT 300
#define DO 301
#define DOMAIN 302
#define DROP 303
#define ELSE 304
#define END 305
#define ENTRY_POINT 306
#define EQL 307
#define ESCAPE 308
#define EXCEPTION 309
#define EXECUTE 310
#define EXISTS 311
#define EXIT 312
#define EXTERNAL 313
#define FILTER 314
#define FOR 315
#define FOREIGN 316
#define FROM 317
#define FULL 318
#define FUNCTION 319
#define GDSCODE 320
#define GEQ 321
#define GENERATOR 322
#define GEN_ID 323
#define GRANT 324
#define GROUP 325
#define GTR 326
#define HAVING 327
#define IF 328
#define KW_IN 329
#define INACTIVE 330
#define INNER 331
#define INPUT_TYPE 332
#define INDEX 333
#define INSERT 334
#define INTEGER 335
#define INTO 336
#define IS 337
#define ISOLATION 338
#define JOIN 339
#define KEY 340
#define KW_CHAR 341
#define KW_DEC 342
#define KW_DOUBLE 343
#define KW_FILE 344
#define KW_FLOAT 345
#define KW_INT 346
#define KW_LONG 347
#define KW_NULL 348
#define KW_NUMERIC 349
#define KW_UPPER 350
#define KW_VALUE 351
#define LENGTH 352
#define LPAREN 353
#define LEFT 354
#define LEQ 355
#define LEVEL 356
#define LIKE 357
#define LSS 358
#define MANUAL 359
#define MAXIMUM 360
#define MAX_SEGMENT 361
#define MERGE 362
#define MESSAGE 363
#define MINIMUM 364
#define MODULE_NAME 365
#define NAMES 366
#define NATIONAL 367
#define NATURAL 368
#define NCHAR 369
#define NEQ 370
#define NO 371
#define NOT 372
#define NOT_GTR 373
#define NOT_LSS 374
#define OF 375
#define ON 376
#define ONLY 377
#define OPTION 378
#define OR 379
#define ORDER 380
#define OUTER 381
#define OUTPUT_TYPE 382
#define OVERFLOW 383
#define PAGE 384
#define PAGES 385
#define KW_PAGE_SIZE 386
#define PARAMETER 387
#define PASSWORD 388
#define PLAN 389
#define POSITION 390
#define POST_EVENT 391
#define PRECISION 392
#define PRIMARY 393
#define PRIVILEGES 394
#define PROCEDURE 395
#define PROTECTED 396
#define READ 397
#define REAL 398
#define REFERENCES 399
#define RESERVING 400
#define RETAIN 401
#define RETURNING_VALUES 402
#define RETURNS 403
#define REVOKE 404
#define RIGHT 405
#define RPAREN 406
#define ROLLBACK 407
#define SEGMENT 408
#define SELECT 409
#define SET 410
#define SHADOW 411
#define KW_SHARED 412
#define SINGULAR 413
#define KW_SIZE 414
#define SMALLINT 415
#define SNAPSHOT 416
#define SOME 417
#define SORT 418
#define SQLCODE 419
#define STABILITY 420
#define STARTING 421
#define STATISTICS 422
#define SUB_TYPE 423
#define SUSPEND 424
#define SUM 425
#define TABLE 426
#define THEN 427
#define TO 428
#define TRANSACTION 429
#define TRIGGER 430
#define UNCOMMITTED 431
#define UNION 432
#define UNIQUE 433
#define UPDATE 434
#define USER 435
#define VALUES 436
#define VARCHAR 437
#define VARIABLE 438
#define VARYING 439
#define VERSION 440
#define VIEW 441
#define WAIT 442
#define WHEN 443
#define WHERE 444
#define WHILE 445
#define WITH 446
#define WORK 447
#define WRITE 448
#define FLOAT_NUMBER 449
#define NUMBER 450
#define NUMERIC 451
#define SYMBOL 452
#define STRING 453
#define INTRODUCER 454
#define ACTION 455
#define ADMIN 456
#define CASCADE 457
#define FREE_IT 458
#define RESTRICT 459
#define ROLE 460
#define COLUMN 461
#define TYPE 462
#define EXTRACT 463
#define YEAR 464
#define MONTH 465
#define DAY 466
#define HOUR 467
#define MINUTE 468
#define SECOND 469
#define WEEKDAY 470
#define YEARDAY 471
#define TIME 472
#define TIMESTAMP 473
#define CURRENT_DATE 474
#define CURRENT_TIME 475
#define CURRENT_TIMESTAMP 476
#define NUMBER64BIT 477
#define SCALEDINT 478
#define CURRENT_USER 479
#define CURRENT_ROLE 480
#define KW_BREAK 481
#define SUBSTRING 482
#define RECREATE 483
#define KW_DESCRIPTOR 484
#define FIRST 485
#define SKIP 486
#define CURRENT_CONNECTION 487
#define CURRENT_TRANSACTION 488
#define BIGINT 489
#define CASE 490
#define NULLIF 491
#define COALESCE 492
#define USING 493
#define NULLS 494
#define LAST 495
#define ROW_COUNT 496
#define LOCK 497
#define SAVEPOINT 498
#define RELEASE 499
#define STATEMENT 500
#define LEAVE 501
#define INSERTING 502
#define UPDATING 503
#define DELETING 504
#define KW_INSERTING 505
#define KW_UPDATING 506
#define KW_DELETING 507
#define BACKUP 508
#define KW_DIFFERENCE 509
#define OPEN 510
#define CLOSE 511
#define FETCH 512
#define ROWS 513
#define BLOCK 514
#define IIF 515
#define SCALAR_ARRAY 516
#define CROSS 517
#define NEXT 518
#define SEQUENCE 519
#define RESTART 520

View File

@ -28,7 +28,7 @@
* Contributor(s):
*
*
* $Id: keywords.cpp,v 1.38 2004-11-22 20:49:57 skidder Exp $
* $Id: keywords.cpp,v 1.39 2004-12-02 22:51:40 dimitr Exp $
*
*/
@ -197,6 +197,7 @@ static const TOK tokens[] = {
{NATIONAL, "NATIONAL", 1},
{NATURAL, "NATURAL", 1},
{NCHAR, "NCHAR", 1},
{NEXT, "NEXT", 2},
{NO, "NO", 1},
{NOT, "NOT", 1},
{NULLIF, "NULLIF", 2},
@ -238,6 +239,7 @@ static const TOK tokens[] = {
{RELEASE, "RELEASE", 2},
{RESERVING, "RESERV", 1}, // Alias of RESERVING
{RESERVING, "RESERVING", 1},
{RESTART, "RESTART", 2},
{RESTRICT, "RESTRICT", 1},
{RETAIN, "RETAIN", 1},
{RETURNING_VALUES, "RETURNING_VALUES", 1},
@ -254,6 +256,7 @@ static const TOK tokens[] = {
{SECOND, "SECOND", 2},
{SEGMENT, "SEGMENT", 1},
{SELECT, "SELECT", 1},
{SEQUENCE, "SEQUENCE", 2},
{SET, "SET", 1},
{SHADOW, "SHADOW", 1},
{KW_SHARED, "SHARED", 1},

File diff suppressed because it is too large Load Diff

View File

@ -507,6 +507,9 @@ static LexerState lex;
%token IIF
%token SCALAR_ARRAY
%token CROSS
%token NEXT
%token SEQUENCE
%token RESTART
/* precedence declarations for expression evaluation */
@ -569,30 +572,21 @@ statement : alter
/* GRANT statement */
grant : GRANT privileges ON prot_table_name
TO user_grantee_list grant_option
{ $$ = make_node (nod_grant, (int) e_grant_count,
$2, $4, make_list($6), $7); }
| GRANT proc_privileges ON PROCEDURE simple_proc_name
TO user_grantee_list grant_option
grant : GRANT privileges ON table_noise simple_table_name
TO non_role_grantee_list grant_option
{ $$ = make_node (nod_grant, (int) e_grant_count,
$2, $5, make_list($7), $8); }
| GRANT privileges ON prot_table_name
TO grantee_list
{ $$ = make_node (nod_grant, (int) e_grant_count,
$2, $4, make_list($6), NULL); }
| GRANT proc_privileges ON PROCEDURE simple_proc_name
TO grantee_list
TO non_role_grantee_list grant_option
{ $$ = make_node (nod_grant, (int) e_grant_count,
$2, $5, make_list($7), NULL); }
$2, $5, make_list($7), $8); }
| GRANT role_name_list TO role_grantee_list role_admin_option
{ $$ = make_node (nod_grant, (int) e_grant_count,
make_list($2), make_list($4), NULL, $5); }
;
;
prot_table_name : simple_table_name
| TABLE simple_table_name
{ $$ = $2; }
table_noise : TABLE
|
;
privileges : ALL
@ -627,13 +621,13 @@ privilege : SELECT
grant_option : WITH GRANT OPTION
{ $$ = make_node (nod_grant, (int) 0, NULL); }
|
{ $$ = 0; }
{ $$ = NULL; }
;
role_admin_option : WITH ADMIN OPTION
{ $$ = make_node (nod_grant_admin, (int) 0, NULL); }
|
{ $$ = 0; }
{ $$ = NULL; }
;
simple_proc_name: symbol_procedure_name
@ -643,44 +637,33 @@ simple_proc_name: symbol_procedure_name
/* REVOKE statement */
revoke : REVOKE rev_grant_option privileges ON prot_table_name
FROM user_grantee_list
{ $$ = make_node (nod_revoke,
(int) e_grant_count, $3, $5,
make_list($7), $2); }
| REVOKE rev_grant_option proc_privileges ON
PROCEDURE simple_proc_name FROM user_grantee_list
{ $$ = make_node (nod_revoke,
(int) e_grant_count, $3, $6,
make_list($8), $2); }
| REVOKE privileges ON prot_table_name
FROM user_grantee_list
{ $$ = make_node (nod_revoke,
(int) e_grant_count, $2, $4,
make_list($6), NULL); }
| REVOKE proc_privileges ON
PROCEDURE simple_proc_name FROM user_grantee_list
{ $$ = make_node (nod_revoke,
(int) e_grant_count, $2, $5,
make_list($7), NULL); }
| REVOKE privileges ON prot_table_name
FROM grantee_list
{ $$ = make_node (nod_revoke,
(int) e_grant_count, $2, $4,
make_list($6), NULL); }
| REVOKE proc_privileges ON
PROCEDURE simple_proc_name FROM grantee_list
{ $$ = make_node (nod_revoke,
(int) e_grant_count, $2, $5,
make_list($7), NULL); }
| REVOKE role_name_list FROM role_grantee_list
{ $$ = make_node (nod_revoke,
(int) e_grant_count, make_list($2), make_list($4),
NULL, NULL); }
;
revoke : REVOKE rev_grant_option privileges ON table_noise simple_table_name
FROM non_role_grantee_list
{ $$ = make_node (nod_revoke, (int) e_grant_count,
$3, $6, make_list($8), $2); }
| REVOKE rev_grant_option proc_privileges ON PROCEDURE simple_proc_name
FROM non_role_grantee_list
{ $$ = make_node (nod_revoke, (int) e_grant_count,
$3, $6, make_list($8), $2); }
| REVOKE rev_admin_option role_name_list FROM role_grantee_list
{ $$ = make_node (nod_revoke, (int) e_grant_count,
make_list($3), make_list($5), NULL, $2); }
;
rev_grant_option : GRANT OPTION FOR
{ $$ = make_node (nod_grant, (int) 0, NULL); }
|
{ $$ = NULL; }
;
rev_admin_option : ADMIN OPTION FOR
{ $$ = make_node (nod_grant_admin, (int) 0, NULL); }
|
{ $$ = NULL; }
;
non_role_grantee_list : grantee_list
| user_grantee_list
;
grantee_list : grantee
@ -858,6 +841,8 @@ create_clause : EXCEPTION symbol_exception_name sql_string
{ $$ = $2; }
| GENERATOR generator_clause
{ $$ = $2; }
| SEQUENCE generator_clause
{ $$ = $2; }
| DATABASE db_clause
{ $$ = $2; }
| DOMAIN domain_clause
@ -1017,19 +1002,17 @@ domain_check_constraint : begin_trigger CHECK '(' search_condition ')' end_trig
;
/* CREATE GENERATOR */
/* CREATE SEQUENCE/GENERATOR */
generator_clause : symbol_generator_name
{ $$ = make_node (nod_def_generator,
(int) e_gen_count, $1); }
{ $$ = make_node (nod_def_generator, (int) e_gen_count, $1); }
;
/* CREATE ROLE */
role_clause : symbol_role_name
{ $$ = make_node (nod_def_role,
(int) 1, $1); }
{ $$ = make_node (nod_def_role, (int) 1, $1); }
;
@ -2019,6 +2002,8 @@ alter_clause : EXCEPTION symbol_exception_name sql_string
| INDEX alter_index_clause
{ $$ = make_node (nod_mod_index,
(int) e_mod_idx_count, $2); }
| SEQUENCE alter_sequence_clause
{ $$ = $2; }
;
domain_default_opt2 : DEFAULT begin_trigger default_value
@ -2157,6 +2142,14 @@ alter_index_clause : symbol_index_name ACTIVE
{ $$ = make_node (nod_idx_inactive, 1, $1); }
;
alter_sequence_clause : symbol_generator_name RESTART WITH signed_long_integer
{ $$ = make_node (nod_set_generator2, e_gen_id_count, $1,
MAKE_constant ((dsql_str*) $4, CONSTANT_SLONG)); }
| symbol_generator_name RESTART WITH signed_64bit_integer
{ $$ = make_node (nod_set_generator2, e_gen_id_count, $1,
MAKE_constant((dsql_str*) $4, CONSTANT_SINT64)); }
;
/* ALTER DATABASE */
@ -2255,6 +2248,8 @@ drop_clause : EXCEPTION symbol_exception_name
{ $$ = make_node (nod_del_role, (int) 1, $2); }
| GENERATOR symbol_generator_name
{ $$ = make_node (nod_del_generator, (int) 1, $2); }
| SEQUENCE symbol_generator_name
{ $$ = make_node (nod_del_generator, (int) 1, $2); }
;
@ -2690,21 +2685,11 @@ set : set_transaction
set_generator : SET GENERATOR symbol_generator_name TO signed_long_integer
{
$$ = make_node (nod_set_generator2, e_gen_id_count, $3,
MAKE_constant ((dsql_str*) $5, CONSTANT_SLONG));
}
| SET GENERATOR symbol_generator_name TO NUMBER64BIT
{
$$ = make_node (nod_set_generator2, e_gen_id_count, $3,
MAKE_constant((dsql_str*)$5, CONSTANT_SINT64));
}
| SET GENERATOR symbol_generator_name TO '-' NUMBER64BIT
{
$$ = make_node (nod_set_generator2, (int) e_gen_id_count, $3,
make_node(nod_negate, 1,
MAKE_constant((dsql_str*)$6, CONSTANT_SINT64)));
}
{ $$ = make_node (nod_set_generator2, e_gen_id_count, $3,
MAKE_constant ((dsql_str*) $5, CONSTANT_SLONG)); }
| SET GENERATOR symbol_generator_name TO signed_64bit_integer
{ $$ = make_node (nod_set_generator2, e_gen_id_count, $3,
MAKE_constant((dsql_str*)$5, CONSTANT_SINT64)); }
;
@ -3635,6 +3620,7 @@ value : column_name
| variable
| cast_specification
| case_expression
| next_value_expression
| udf
| '-' value
{ $$ = make_node (nod_negate, 1, $2); }
@ -3871,11 +3857,16 @@ signed_long_integer : long_integer
long_integer : NUMBER
{ $$ = $1;}
;
signed_64bit_integer : NUMBER64BIT
| '-' NUMBER64BIT
{ $$ = (dsql_nod*) - (IPTR) $2; }
;
/* functions */
function : aggregate_function
| generate_value_function
| numeric_value_function
| string_value_function
;
@ -3929,17 +3920,6 @@ aggregate_function : COUNT '(' '*' ')'
{ $$ = make_node (nod_agg_max, 1, $4); }
;
/* Firebird specific functions into 'generate_value_function' */
generate_value_function : GEN_ID '(' symbol_generator_name ',' value ')'
{
if (client_dialect >= SQL_DIALECT_V6_TRANSITION)
$$ = make_node (nod_gen_id2, 2, $3, $5);
else
$$ = make_node (nod_gen_id, 2, $3, $5);
}
;
numeric_value_function : extract_expression
;
@ -4031,6 +4011,21 @@ case_operand : value
case_result : value
;
/* next value expression */
next_value_expression : NEXT KW_VALUE FOR symbol_generator_name
{ $$ = make_node (nod_gen_id, 2, $4,
MAKE_constant((dsql_str*) 1, CONSTANT_SLONG)); }
| GEN_ID '(' symbol_generator_name ',' value ')'
{
if (client_dialect >= SQL_DIALECT_V6_TRANSITION)
$$ = make_node (nod_gen_id2, 2, $3, $5);
else
$$ = make_node (nod_gen_id, 2, $3, $5);
}
;
timestamp_part : YEAR
{ $$ = MAKE_constant ((dsql_str*)blr_extract_year, CONSTANT_SLONG); }
| MONTH
@ -4167,6 +4162,9 @@ non_reserved_word :
| SCALAR_ARRAY
| WEEKDAY
| YEARDAY
| SEQUENCE
| NEXT
| RESTART
;
%%