8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-02-02 10:00:38 +01:00

Changed UPDATE OR INSERT to check existence of records with IS NOT DISTINCT

This commit is contained in:
asfernandes 2007-05-13 14:06:41 +00:00
parent 293ebb3c4c
commit 1a427efe19
2 changed files with 7 additions and 2 deletions

View File

@ -3,7 +3,7 @@ UPDATE OR INSERT statement
-----------------
Function:
Allow to update or insert a record based on the existence or not of it.
Allow to update or insert a record based on the existence (checked with IS NOT DISTINCT) or not of it.
Author:
Adriano dos Santos Fernandes <adrianosf@uol.com.br>

View File

@ -8999,9 +8999,12 @@ static dsql_nod* pass1_update_or_insert(dsql_req* request, dsql_nod* input, bool
}
dsql_nod* matching = input->nod_arg[e_upi_matching];
nod_t equality_type;
if (matching)
{
equality_type = nod_equiv;
request->req_context->push(context);
request->req_scope_level++;
@ -9014,6 +9017,8 @@ static dsql_nod* pass1_update_or_insert(dsql_req* request, dsql_nod* input, bool
}
else
{
equality_type = nod_eql;
matching = METD_get_primary_key(request, base_name);
if (!matching)
@ -9079,7 +9084,7 @@ static dsql_nod* pass1_update_or_insert(dsql_req* request, dsql_nod* input, bool
{
++match_count;
dsql_nod* eql = MAKE_node(nod_eql, 2);
dsql_nod* eql = MAKE_node(equality_type, 2);
eql->nod_arg[0] = *field_ptr;
eql->nod_arg[1] = *value_ptr;