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

Function gen_t_start

src/gpre/c_cxx.cpp:3329–3382  ·  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 printa(column, "isc_start_transaction (%s, (FB_API_HANDLE*) &%s, (short) %d", vector,
3358 trans->tra_handle ? trans->tra_handle : gpreGlob.transaction_name, trans->tra_db_count);
3359
3360 // Some systems don't like infinitely long lines. Limit them to 256.
3361
3362 int remaining = static_cast<int>(256 - column - strlen(vector) -
3363 strlen(trans->tra_handle ? trans->tra_handle : gpreGlob.transaction_name) - 31);
3364
3365 for (tpb_iterator = trans->tra_tpb; tpb_iterator; tpb_iterator = tpb_iterator->tpb_tra_next)
3366 {
3367 int length = static_cast<int>(strlen(tpb_iterator->tpb_database->dbb_name->sym_string) + 22);
3368 if (length > remaining)
3369 {
3370 align(column + INDENT);
3371 remaining = 256 - column - INDENT;
3372 }
3373 remaining -= length;
3374 fprintf(gpreGlob.out_file, ", &%s, (short) %d, isc_tpb_%d",
3375 tpb_iterator->tpb_database->dbb_name->sym_string,
3376 tpb_iterator->tpb_length, tpb_iterator->tpb_ident);
3377 }
3378
3379 fprintf(gpreGlob.out_file, ");");
3380
3381 set_sqlcode(action, column);
3382}
3383
3384
3385//____________________________________________________________

Callers 1

C_CXX_actionFunction · 0.70

Calls 6

status_vectorFunction · 0.70
t_start_autoFunction · 0.70
printaFunction · 0.70
make_readyFunction · 0.70
alignFunction · 0.70
set_sqlcodeFunction · 0.70

Tested by

no test coverage detected