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

Let Ivan Prenosil test his beloved transaction options.

This commit is contained in:
robocop 2005-11-17 04:22:10 +00:00
parent 5bc24fdd2b
commit 90174410a2
7 changed files with 8014 additions and 9494 deletions

View File

@ -2775,6 +2775,14 @@ void DSQL_pretty(const dsql_nod* node, int column)
verb = "returning";
break;
case nod_tra_misc:
verb = "tra_misc";
break;
case nod_lock_timeout:
verb = "lock_timeout"; // maybe show the timeout value?
break;
default:
sprintf(s, "unknown type %d", node->nod_type);
verb = s;

View File

@ -1,3 +1,10 @@
#ifndef BISON_DSQL_TAB_H
# define BISON_DSQL_TAB_H
# ifndef YYSTYPE
# define YYSTYPE int
# define YYSTYPE_IS_TRIVIAL 1
# endif
# define ACTIVE 257
# define ADD 258
# define AFTER 259
@ -274,3 +281,13 @@
# define TRAILING 530
# define TRIM 531
# define RETURNING 532
# define IGNORE 533
# define LIMBO 534
# define UNDO 535
# define REQUESTS 536
# define TIMEOUT 537
extern YYSTYPE yylval;
#endif /* not BISON_DSQL_TAB_H */

View File

@ -371,7 +371,8 @@ void GEN_expr( dsql_req* request, dsql_nod* node)
{
dsql_nod* child = node->nod_arg[0];
if (child->nod_type == nod_constant &&
DTYPE_IS_NUMERIC(child->nod_desc.dsc_dtype)) {
DTYPE_IS_NUMERIC(child->nod_desc.dsc_dtype))
{
gen_constant(request, &child->nod_desc, NEGATE_VALUE);
return;
}
@ -763,8 +764,8 @@ void GEN_start_transaction( dsql_req* request, const dsql_nod* tran_node)
if (!node)
return;
/* find out isolation level - if specified. This is required for
* specifying the correct lock level in reserving clause. */
// Find out isolation level - if specified. This is required for
// specifying the correct lock level in reserving clause.
USHORT lock_level = isc_tpb_shared;
@ -782,13 +783,15 @@ void GEN_start_transaction( dsql_req* request, const dsql_nod* tran_node)
bool sw_access = false, sw_wait = false, sw_isolation = false,
sw_reserve = false;
sw_reserve = false, sw_lock_timeout = false;
int misc_flags = 0;
// Stuff some version info.
if (count = node->nod_count)
stuff(request, isc_tpb_version1);
while (count--) {
while (count--)
{
const dsql_nod* ptr = node->nod_arg[count];
if (!ptr)
@ -867,6 +870,35 @@ void GEN_start_transaction( dsql_req* request, const dsql_nod* tran_node)
break;
}
case nod_tra_misc:
if (misc_flags & ptr->nod_flags)
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 104,
isc_arg_gds, isc_dsql_dup_option, 0);
misc_flags |= ptr->nod_flags;
if (ptr->nod_flags & NOD_NO_AUTO_UNDO)
stuff(request, isc_tpb_no_auto_undo);
else if (ptr->nod_flags & NOD_IGNORE_LIMBO)
stuff(request, isc_tpb_ignore_limbo);
else if (ptr->nod_flags & NOD_RESTART_REQUESTS)
stuff(request, isc_tpb_restart_requests);
break;
case nod_lock_timeout:
if (sw_lock_timeout)
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 104,
isc_arg_gds, isc_dsql_dup_option, 0);
sw_lock_timeout = true;
if (ptr->nod_count == 1 && ptr->nod_arg[0]->nod_type == nod_constant)
{
const int lck_timeout = (int)(IPTR) ptr->nod_arg[0]->nod_arg[0];
stuff(request, isc_tpb_lock_timeout);
stuff(request, 2);
stuff_word(request, lck_timeout);
}
break;
default:
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 104,
isc_arg_gds, isc_dsql_tran_err, 0);

View File

@ -37,7 +37,8 @@
// I discovered isql was being fooled and put double quotes around those
// special cases unnecessarily.
static const TOK tokens[] = {
static const TOK tokens[] =
{
{NOT_LSS, "!<", 1, false},
{NEQ, "!=", 1, false},
{NOT_GTR, "!>", 1, false},
@ -51,9 +52,9 @@ static const TOK tokens[] = {
{GTR, ">", 1, false},
{GEQ, ">=", 1, false},
#ifdef FB_NEW_INTL_ALLOW_NOT_READY
{ACCENT, "ACCENT", 2, false},
{ACCENT, "ACCENT", 2, true},
#endif
{ACTION, "ACTION", 1, false},
{ACTION, "ACTION", 1, true},
{ACTIVE, "ACTIVE", 1, false},
{ADD, "ADD", 1, false},
{ADMIN, "ADMIN", 1, false},
@ -68,18 +69,18 @@ static const TOK tokens[] = {
{AT, "AT", 1, false},
{AUTO, "AUTO", 1, false},
{AVG, "AVG", 1, false},
{BACKUP, "BACKUP", 2, false},
{BACKUP, "BACKUP", 2, true},
{BEFORE, "BEFORE", 1, false},
{BEGIN, "BEGIN", 1, false},
{BETWEEN, "BETWEEN", 1, false},
{BIGINT, "BIGINT", 2, false},
{BIT_LENGTH, "BIT_LENGTH", 2, false},
{BLOB, "BLOB", 1, false},
{BLOCK, "BLOCK", 2, false},
{BLOCK, "BLOCK", 2, true},
{BOTH, "BOTH", 2, false},
{KW_BREAK, "BREAK", 2, false},
{KW_BREAK, "BREAK", 2, true},
{BY, "BY", 1, false},
{CASCADE, "CASCADE", 1, false},
{CASCADE, "CASCADE", 1, true},
{CASE, "CASE", 2, false},
{CAST, "CAST", 1, false},
{KW_CHAR, "CHAR", 1, false},
@ -88,9 +89,9 @@ static const TOK tokens[] = {
{CHARACTER_LENGTH, "CHARACTER_LENGTH", 2, false},
{CHECK, "CHECK", 1, false},
{CLOSE, "CLOSE", 2, false},
{COALESCE, "COALESCE", 2, false},
{COALESCE, "COALESCE", 2, true},
{COLLATE, "COLLATE", 1, false},
{COLLATION, "COLLATION", 2, false},
{COLLATION, "COLLATION", 2, true},
{COLUMN, "COLUMN", 2, false},
{COMMENT, "COMMENT", 2, true},
{COMMIT, "COMMIT", 1, false},
@ -124,8 +125,8 @@ static const TOK tokens[] = {
{DELETING, "DELETING", 2, true},
{DESC, "DESC", 1, false}, // Alias of DESCENDING
{DESC, "DESCENDING", 1, false},
{KW_DESCRIPTOR, "DESCRIPTOR", 2, false},
{KW_DIFFERENCE, "DIFFERENCE", 2, false},
{KW_DESCRIPTOR, "DESCRIPTOR", 2, true},
{KW_DIFFERENCE, "DIFFERENCE", 2, true},
{DISTINCT, "DISTINCT", 1, false},
{DO, "DO", 1, false},
{DOMAIN, "DOMAIN", 1, false},
@ -148,7 +149,7 @@ static const TOK tokens[] = {
{KW_FLOAT, "FLOAT", 1, false},
{FOR, "FOR", 1, false},
{FOREIGN, "FOREIGN", 1, false},
{FREE_IT, "FREE_IT", 1, false},
{FREE_IT, "FREE_IT", 1, true},
{FROM, "FROM", 1, false},
{FULL, "FULL", 1, false},
{FUNCTION, "FUNCTION", 1, false},
@ -160,7 +161,8 @@ static const TOK tokens[] = {
{HAVING, "HAVING", 1, false},
{HOUR, "HOUR", 2, false},
{IF, "IF", 1, false},
{IIF, "IIF", 2, false},
{IGNORE, "IGNORE", 2, true},
{IIF, "IIF", 2, true},
{KW_IN, "IN", 1, false},
{INACTIVE, "INACTIVE", 1, false},
{INDEX, "INDEX", 1, false},
@ -178,13 +180,15 @@ static const TOK tokens[] = {
{ISOLATION, "ISOLATION", 1, false},
{JOIN, "JOIN", 1, false},
{KEY, "KEY", 1, false},
{LAST, "LAST", 2, false},
{LAST, "LAST", 2, true},
{LEADING, "LEADING", 2, false},
{LEAVE, "LEAVE", 2, false},
{LEAVE, "LEAVE", 2, true},
{LEFT, "LEFT", 1, false},
{LENGTH, "LENGTH", 1, false},
{LEVEL, "LEVEL", 1, false},
{LIKE, "LIKE", 1, false},
{LIMBO, "LIMBO", 2, true},
{LOCK, "LOCK", 2, true},
{KW_LONG, "LONG", 1, false},
{KW_LOWER, "LOWER", 2, false},
{MANUAL, "MANUAL", 1, false},
@ -200,13 +204,12 @@ static const TOK tokens[] = {
{NATIONAL, "NATIONAL", 1, false},
{NATURAL, "NATURAL", 1, false},
{NCHAR, "NCHAR", 1, false},
{NEXT, "NEXT", 2, false},
{NEXT, "NEXT", 2, true},
{NO, "NO", 1, false},
{NOT, "NOT", 1, false},
{NULLIF, "NULLIF", 2, false},
{NULLIF, "NULLIF", 2, true},
{KW_NULL, "NULL", 1, false},
{NULLS, "NULLS", 2, false},
{LOCK, "LOCK", 2, false},
{NULLS, "NULLS", 2, true},
{KW_NUMERIC, "NUMERIC", 1, false},
{OCTET_LENGTH, "OCTET_LENGTH", 2, false},
{OF, "OF", 1, false},
@ -220,7 +223,7 @@ static const TOK tokens[] = {
{OUTPUT_TYPE, "OUTPUT_TYPE", 1, false},
{OVERFLOW, "OVERFLOW", 1, false},
#ifdef FB_NEW_INTL_ALLOW_NOT_READY
{PAD, "PAD", 2, false},
{PAD, "PAD", 2, true},
#endif
{PAGE, "PAGE", 1, false},
{PAGES, "PAGES", 1, false},
@ -242,22 +245,23 @@ static const TOK tokens[] = {
{RECREATE, "RECREATE", 2, false},
{REFERENCES, "REFERENCES", 1, false},
{RELEASE, "RELEASE", 2, false},
{REQUESTS, "REQUESTS", 2, true},
{RESERVING, "RESERV", 1, false}, // Alias of RESERVING
{RESERVING, "RESERVING", 1, false},
{RESTART, "RESTART", 2, false},
{RESTRICT, "RESTRICT", 1, false},
{RESTART, "RESTART", 2, true},
{RESTRICT, "RESTRICT", 1, true},
{RETAIN, "RETAIN", 1, false},
{RETURNING, "RETURNING", 2, false},
{RETURNING, "RETURNING", 2, true},
{RETURNING_VALUES, "RETURNING_VALUES", 1, false},
{RETURNS, "RETURNS", 1, false},
{REVOKE, "REVOKE", 1, false},
{RIGHT, "RIGHT", 1, false},
{ROLE, "ROLE", 1, false},
{ROLE, "ROLE", 1, true},
{ROLLBACK, "ROLLBACK", 1, false},
{ROW_COUNT, "ROW_COUNT", 2, false},
{ROWS, "ROWS", 2, false},
{SAVEPOINT, "SAVEPOINT", 2, false},
{SCALAR_ARRAY, "SCALAR_ARRAY", 2, false},
{SCALAR_ARRAY, "SCALAR_ARRAY", 2, true},
{DATABASE, "SCHEMA", 1, false}, // Alias of DATABASE
{SECOND, "SECOND", 2, false},
{SEGMENT, "SEGMENT", 1, false},
@ -265,7 +269,7 @@ static const TOK tokens[] = {
#ifdef FB_NEW_INTL_ALLOW_NOT_READY
{SENSITIVE, "SENSITIVE", 2, false},
#endif
{SEQUENCE, "SEQUENCE", 2, false},
{SEQUENCE, "SEQUENCE", 2, true},
{SET, "SET", 1, false},
{SHADOW, "SHADOW", 1, false},
{KW_SHARED, "SHARED", 1, false},
@ -277,15 +281,15 @@ static const TOK tokens[] = {
{SOME, "SOME", 1, false},
{SORT, "SORT", 1, false},
#ifdef FB_NEW_INTL_ALLOW_NOT_READY
{SPACE, "SPACE", 2, false},
{SPACE, "SPACE", 2, true},
#endif
{SQLCODE, "SQLCODE", 1, false},
{STABILITY, "STABILITY", 1, false},
{STARTING, "STARTING", 1, false},
{STARTING, "STARTS", 1, false}, // Alias of STARTING
{STATEMENT, "STATEMENT", 2, false},
{STATEMENT, "STATEMENT", 2, true},
{STATISTICS, "STATISTICS", 1, false},
{SUBSTRING, "SUBSTRING", 2, false},
{SUBSTRING, "SUBSTRING", 2, true},
{SUB_TYPE, "SUB_TYPE", 1, false},
{SUM, "SUM", 1, false},
{SUSPEND, "SUSPEND", 1, false},
@ -293,13 +297,15 @@ static const TOK tokens[] = {
{THEN, "THEN", 1, false},
{TIME, "TIME", 2, false},
{TIMESTAMP, "TIMESTAMP", 2, false},
{TIMEOUT, "TIMEOUT", 2, true},
{TO, "TO", 1, false},
{TRAILING, "TRAILING", 2, false},
{TRANSACTION, "TRANSACTION", 1, false},
{TRIGGER, "TRIGGER", 1, false},
{TRIM, "TRIM", 2, false},
{TYPE, "TYPE", 2, false},
{TYPE, "TYPE", 2, true},
{UNCOMMITTED, "UNCOMMITTED", 1, false},
{UNDO, "UNDO", 2, true},
{UNION, "UNION", 1, false},
{UNIQUE, "UNIQUE", 1, false},
{UPDATE, "UPDATE", 1, false},
@ -314,7 +320,7 @@ static const TOK tokens[] = {
{VARYING, "VARYING", 1, false},
{VIEW, "VIEW", 1, false},
{WAIT, "WAIT", 1, false},
{WEEKDAY, "WEEKDAY", 2, false},
{WEEKDAY, "WEEKDAY", 2, true},
{WHEN, "WHEN", 1, false},
{WHERE, "WHERE", 1, false},
{WHILE, "WHILE", 1, false},
@ -322,7 +328,7 @@ static const TOK tokens[] = {
{WORK, "WORK", 1, false},
{WRITE, "WRITE", 1, false},
{YEAR, "YEAR", 2, false},
{YEARDAY, "YEARDAY", 2, false},
{YEARDAY, "YEARDAY", 2, true},
{NOT_LSS, "^<", 1, false}, // Alias of !<
{NEQ, "^=", 1, false}, // Alias of !=
{NOT_GTR, "^>", 1, false}, // Alias of !>

View File

@ -339,7 +339,9 @@ enum nod_t
nod_strlen,
nod_trim,
nod_returning,
nod_redef_trigger
nod_redef_trigger,
nod_tra_misc,
nod_lock_timeout
};
typedef nod_t NOD_TYPE;
@ -363,47 +365,51 @@ public:
// values of flags
enum nod_flags_vals {
NOD_AGG_DISTINCT = 1,
NOD_AGG_DISTINCT = 1, // nod_agg_...
NOD_UNION_ALL = 1,
NOD_UNION_ALL = 1, // nod_list
NOD_READ_ONLY = 1,
NOD_READ_ONLY = 1, // nod_access
NOD_READ_WRITE = 2,
NOD_WAIT = 1,
NOD_WAIT = 1, // nod_wait
NOD_NO_WAIT = 2,
NOD_VERSION = 1,
NOD_VERSION = 1, // nod_version
NOD_NO_VERSION = 2,
NOD_CONCURRENCY = 1,
NOD_CONCURRENCY = 1, // nod_isolation
NOD_CONSISTENCY = 2,
NOD_READ_COMMITTED = 4,
NOD_SHARED = 1,
NOD_SHARED = 1, // nod_lock_mode
NOD_PROTECTED = 2,
NOD_READ = 4,
NOD_WRITE = 8,
NOD_NULLS_FIRST = 1,
NOD_NO_AUTO_UNDO = 1, // nod_tra_misc
NOD_IGNORE_LIMBO = 2,
NOD_RESTART_REQUESTS = 4,
NOD_NULLS_FIRST = 1, // nod_order
NOD_NULLS_LAST = 2,
REF_ACTION_CASCADE = 1,
REF_ACTION_CASCADE = 1, // nod_ref_trig_action
REF_ACTION_SET_DEFAULT = 2,
REF_ACTION_SET_NULL = 4,
REF_ACTION_NONE = 8,
// Node flag indicates that this node has a different type or result
// depending on the SQL dialect.
NOD_COMP_DIALECT = 16,
NOD_COMP_DIALECT = 16, // nod_...2, see MAKE_desc
NOD_SELECT_EXPR_SINGLETON = 1,
NOD_SELECT_EXPR_SINGLETON = 1, // nod_select_expr
NOD_SELECT_EXPR_VALUE = 2,
NOD_CURSOR_EXPLICIT = 1,
NOD_CURSOR_EXPLICIT = 1, // nod_cursor
NOD_CURSOR_FOR = 2,
NOD_CURSOR_ALL = USHORT(-1U),
NOD_DT_IGNORE_COLUMN_CHECK = 1
NOD_DT_IGNORE_COLUMN_CHECK = 1 // nod_cursor, see pass1_cursor_name
};
// Parameters to MAKE_constant

File diff suppressed because it is too large Load Diff

View File

@ -519,6 +519,11 @@ static LexerState lex;
%token TRAILING
%token TRIM
%token RETURNING
%token IGNORE
%token LIMBO
%token UNDO
%token REQUESTS
%token TIMEOUT
/* precedence declarations for expression evaluation */
@ -2766,6 +2771,8 @@ tran_opt_list : tran_opt
tran_opt : access_mode
| lock_wait
| isolation_mode
| tra_misc_options
| tra_timeout
| tbl_reserve_options
;
@ -2810,6 +2817,18 @@ version_mode : VERSION
{ $$ = 0; }
;
tra_misc_options: NO AUTO UNDO
{ $$ = make_flag_node(nod_tra_misc, NOD_NO_AUTO_UNDO, 0, NULL); }
| IGNORE LIMBO
{ $$ = make_flag_node(nod_tra_misc, NOD_IGNORE_LIMBO, 0, NULL); }
| RESTART REQUESTS
{ $$ = make_flag_node(nod_tra_misc, NOD_RESTART_REQUESTS, 0, NULL); }
;
tra_timeout: LOCK TIMEOUT nonneg_short_integer
{ $$ = make_node(nod_lock_timeout, 1, MAKE_constant ((dsql_str*) $3, CONSTANT_SLONG)); }
;
tbl_reserve_options: RESERVING restr_list
{ $$ = make_node (nod_reserve, 1, make_list ($2)); }
;
@ -4318,6 +4337,11 @@ non_reserved_word :
| RESTART
| COLLATION
| RETURNING
| IGNORE
| LIMBO
| UNDO
| REQUESTS
| TIMEOUT
;
%%