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

Function gen_t_start

src/gpre/obj_cxx.cpp:3329–3385  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3327//
3328
3329static void gen_t_start( const act* action, int column)
3330{
3331 const TEXT* vector = status_vector(action);
3332
3333 // if this is a purely default transaction, just let it through
3334
3335 const gpre_tra* trans;
3336 if (!action || !(trans = (gpre_tra*) action->act_object))
3337 {
3338 t_start_auto(action, 0, vector, column, false);
3339 return;
3340 }
3341
3342 // build a complete statement, including tpb's. Ready db's
3343 const tpb* tpb_iterator;
3344
3345 if (gpreGlob.sw_auto)
3346 for (tpb_iterator = trans->tra_tpb; tpb_iterator; tpb_iterator = tpb_iterator->tpb_tra_next)
3347 {
3348 const gpre_dbb* db = tpb_iterator->tpb_database;
3349 const TEXT* filename = db->dbb_runtime;
3350 if (filename || !(db->dbb_flags & DBB_sqlca))
3351 {
3352 printa(column, "if (!%s)", db->dbb_name->sym_string);
3353 make_ready(db, filename, vector, (USHORT) (column + INDENT), 0);
3354 }
3355 }
3356
3357 if (trans->tra_db_count == 1)
3358 {
3359 printa(column, "%s = %s->startTransaction(%s, %d, fb_tpb_%d);",
3360 trans->tra_handle ? trans->tra_handle : gpreGlob.transaction_name,
3361 trans->tra_tpb->tpb_database->dbb_name->sym_string, vector,
3362 trans->tra_tpb->tpb_length, trans->tra_tpb->tpb_ident);
3363 }
3364 else
3365 {
3366 printa(column, "{\t\t// fbComponents scope\n");
3367 printa(column + INDENT, "DtcStart fbComponents[%d] = {", trans->tra_db_count);
3368
3369 for (tpb_iterator = trans->tra_tpb; tpb_iterator; tpb_iterator = tpb_iterator->tpb_tra_next)
3370 {
3371 printa(column + INDENT * 2, "{%s, fb_tpb_%d, %d}%s\n",
3372 tpb_iterator->tpb_database->dbb_name->sym_string,
3373 tpb_iterator->tpb_ident, tpb_iterator->tpb_length,
3374 tpb_iterator->tpb_tra_next ? "," : "");
3375 }
3376
3377 printa(column + INDENT, " };\n\n");
3378
3379 printa(column + INDENT, "%s = fbMaster->getDtc()->start(%s, %d, fbComponents);\n",
3380 trans->tra_handle ? trans->tra_handle : gpreGlob.transaction_name,
3381 vector, trans->tra_db_count);
3382
3383 printa(column, "}\t\t// end fbComponents scope\n");
3384 }
3385}
3386

Callers 1

OBJ_CXX_actionFunction · 0.70

Calls 4

status_vectorFunction · 0.70
t_start_autoFunction · 0.70
printaFunction · 0.70
make_readyFunction · 0.70

Tested by

no test coverage detected