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

Function t_start_auto

src/gpre/languages/pas.cpp:3433–3491  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3431//
3432
3433static void t_start_auto( const act* action, const gpre_req* request,
3434 const TEXT* vector, int column)
3435{
3436 TEXT buffer[256];
3437
3438 buffer[0] = 0;
3439
3440 // find out whether we're using a status vector or not
3441
3442 const bool stat = !strcmp(vector, "gds__status");
3443
3444 // this is a default transaction, make sure all databases are ready
3445
3446 begin(column);
3447
3448 int count, and_count;
3449 const gpre_dbb* db;
3450 for (db = gpreGlob.isc_databases, count = and_count = 0; db; db = db->dbb_next)
3451 {
3452 if (gpreGlob.sw_auto)
3453 {
3454 const TEXT* filename = db->dbb_runtime;
3455 if (filename || !(db->dbb_flags & DBB_sqlca))
3456 {
3457 align(column);
3458 fprintf(gpreGlob.out_file, "if (%s = nil", db->dbb_name->sym_string);
3459 if (stat && buffer[0])
3460 fprintf(gpreGlob.out_file, ") and (%s[2] = 0", vector);
3461 fprintf(gpreGlob.out_file, ") then");
3462 make_ready(db, filename, vector, column + INDENT, 0);
3463 if (buffer[0])
3464 if (and_count % 4)
3465 strcat(buffer, ") and (");
3466 else
3467 strcat(buffer, ") and\n\t(");
3468 and_count++;
3469 TEXT temp[40];
3470 sprintf(temp, "%s <> nil", db->dbb_name->sym_string);
3471 strcat(buffer, temp);
3472 printa(column, "if (%s) then", buffer);
3473 align(column + INDENT);
3474 }
3475 }
3476
3477 count++;
3478 printa(column, "gds__teb[%d].tpb_len:= 0;", count);
3479 printa(column, "gds__teb[%d].tpb_ptr := ADDR(gds__null);", count);
3480 printa(column, "gds__teb[%d].dbb_ptr := ADDR(%s);", count, db->dbb_name->sym_string);
3481 }
3482
3483 printa(column, "GDS__START_MULTIPLE (%s, %s, %d, gds__teb);",
3484 vector, request_trans(action, request), count);
3485
3486 if (gpreGlob.sw_auto && request)
3487 column -= INDENT;
3488
3489 set_sqlcode(action, column);
3490 ends(column);

Callers 9

gen_blob_openFunction · 0.70
gen_compileFunction · 0.70
gen_ddlFunction · 0.70
gen_dyn_executeFunction · 0.70
gen_dyn_immediateFunction · 0.70
gen_dyn_openFunction · 0.70
gen_dyn_prepareFunction · 0.70
gen_procedureFunction · 0.70
gen_t_startFunction · 0.70

Calls 7

endsFunction · 0.85
beginFunction · 0.70
alignFunction · 0.70
make_readyFunction · 0.70
printaFunction · 0.70
request_transFunction · 0.70
set_sqlcodeFunction · 0.70

Tested by

no test coverage detected