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

Add checks to allow explicit pessimistic locks only in cases when we really support them

This commit is contained in:
skidder 2003-06-29 20:36:52 +00:00
parent 13d6ff35cc
commit c4727d695b
3 changed files with 20 additions and 3 deletions

View File

@ -199,6 +199,7 @@ typedef dsql_rel* DSQL_REL;
#define REL_new_relation 1 //!< relation is newly defined, not committed yet
#define REL_dropped 2 //!< relation has been dropped
#define REL_view 4 //!< relation is a view
#define REL_external 8 //!< relation is an external table
class dsql_fld : public pool_alloc_rpt<SCHAR, dsql_type_fld>

View File

@ -1449,7 +1449,9 @@ DSQL_REL METD_get_relation(DSQL_REQ request, STR name)
if (!X.RDB$VIEW_BLR.NULL) {
relation->rel_flags |= REL_view;
}
if (!X.RDB$EXTERNAL_FILE.NULL) {
relation->rel_flags |= REL_external;
}
}
THREAD_EXIT;

View File

@ -4225,6 +4225,7 @@ static DSQL_NOD pass1_rse( DSQL_REQ request, DSQL_NOD input, DSQL_NOD order, DSQ
TSQL tdsql;
ULONG position;
BOOLEAN field;
DSQL_REL relation;
DEV_BLKCHK(request, dsql_type_req);
DEV_BLKCHK(input, dsql_type_nod);
@ -4239,8 +4240,13 @@ static DSQL_NOD pass1_rse( DSQL_REQ request, DSQL_NOD input, DSQL_NOD order, DSQ
if (input->nod_type == nod_list) {
if (input->nod_count == 1)
return PASS1_rse(request, input->nod_arg[0], order, update_lock);
else
else {
if (update_lock)
ERRD_post(gds_sqlerr, gds_arg_number, (SLONG) - 104, gds_arg_gds,
gds_token_err, /* Token unknown */
gds_arg_gds, gds_random, gds_arg_string, "WITH LOCK", 0);
return pass1_union(request, input, order);
}
}
/* Save the original base of the context stack and process relations */
@ -4249,8 +4255,16 @@ static DSQL_NOD pass1_rse( DSQL_REQ request, DSQL_NOD input, DSQL_NOD order, DSQ
parent_rse = NULL;
rse = target_rse = MAKE_node(nod_rse, e_rse_count);
rse->nod_arg[e_rse_lock] = update_lock;
rse->nod_arg[e_rse_streams] = PASS1_node(request, input->nod_arg[e_sel_from], 0);
list = rse->nod_arg[e_rse_streams] = PASS1_node(request, input->nod_arg[e_sel_from], 0);
if (update_lock && (list->nod_count != 1 || list->nod_arg[0]->nod_type != nod_relation ||
!(relation=((DSQL_CTX)list->nod_arg[0]->nod_arg[e_rel_context])->ctx_relation) ||
(relation->rel_flags & REL_view) || (relation->rel_flags & REL_external) ))
{
ERRD_post(gds_sqlerr, gds_arg_number, (SLONG) - 104, gds_arg_gds, gds_token_err, /* Token unknown */
gds_arg_gds, gds_random, gds_arg_string, "WITH LOCK", 0);
}
/* Process LIMIT, if any */
if (node = input->nod_arg[e_sel_limit]) {