MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / act_insert

Function act_insert

src/gpre/sql.cpp:3419–3609  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3417//
3418
3419static act* act_insert()
3420{
3421 const TEXT* transaction = NULL;
3422
3423 par_options(&transaction);
3424
3425 if (MSC_match(KW_CURSOR))
3426 return act_insert_blob();
3427
3428 if (!MSC_match(KW_INTO))
3429 CPR_s_error("INTO");
3430
3431 gpre_req* request = MSC_request(REQ_insert);
3432 request->req_trans = transaction;
3433 gpre_ctx* context = SQE_context(request);
3434
3435 int count = 0, count2 = 0;
3436 gpre_lls* fields = NULL;
3437
3438 // Pick up a field list
3439
3440 if (!MSC_match(KW_LEFT_PAREN))
3441 {
3442 gpre_nod* list = MET_fields(context);
3443 count = list->nod_count;
3444 for (int i = 0; i < count; i++)
3445 MSC_push(list->nod_arg[i], &fields);
3446 }
3447 else
3448 {
3449 do {
3450 gpre_nod* node = SQE_field(request, false);
3451 if (node->nod_type == nod_array)
3452 {
3453 node->nod_type = nod_field;
3454
3455 // Make sure no subscripts are specified
3456
3457 if (node->nod_arg[1]) {
3458 PAR_error("Partial insert of arrays not permitted");
3459 }
3460 }
3461
3462 // Dialect 1 program may not insert new datatypes
3463 if ((SQL_DIALECT_V5 == gpreGlob.sw_sql_dialect) && nod_field == node->nod_type)
3464 {
3465 const USHORT field_dtype = ((ref*) (node->nod_arg[0]))->ref_field->fld_dtype;
3466 if (dtype_sql_date == field_dtype || dtype_sql_time == field_dtype ||
3467 dtype_int64 == field_dtype)
3468 {
3469 SQL_dialect1_bad_type(field_dtype);
3470 }
3471 }
3472
3473 MSC_push(node, &fields);
3474 count++;
3475 } while (MSC_match(KW_COMMA));
3476

Callers 1

SQL_actionFunction · 0.85

Calls 15

MSC_matchFunction · 0.85
act_insert_blobFunction · 0.85
CPR_s_errorFunction · 0.85
MSC_requestFunction · 0.85
SQE_contextFunction · 0.85
MET_fieldsFunction · 0.85
MSC_pushFunction · 0.85
SQE_fieldFunction · 0.85
SQL_dialect1_bad_typeFunction · 0.85
EXP_match_parenFunction · 0.85
EXP_left_parenFunction · 0.85
SQE_value_or_nullFunction · 0.85

Tested by

no test coverage detected