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

Function t_start_auto

src/gpre/c_cxx.cpp:3950–4026  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3948//
3949
3950static void t_start_auto(const act* action,
3951 const gpre_req* request,
3952 const TEXT* vector,
3953 int column,
3954 bool test)
3955{
3956 const TEXT* trname = request_trans(action, request);
3957
3958 // find out whether we're using a status vector or not
3959
3960 const int stat = !strcmp(vector, global_status_name);
3961
3962 // this is a default transaction, make sure all databases are ready
3963
3964 begin(column);
3965
3966 const gpre_dbb* db;
3967 int count;
3968
3969 if (gpreGlob.sw_auto)
3970 {
3971 TEXT buffer[256];
3972 buffer[0] = 0;
3973 for (count = 0, db = gpreGlob.isc_databases; db; db = db->dbb_next, count++)
3974 {
3975 const TEXT* filename = db->dbb_runtime;
3976 if (filename || !(db->dbb_flags & DBB_sqlca))
3977 {
3978 align(column);
3979 fprintf(gpreGlob.out_file, "if (!%s", db->dbb_name->sym_string);
3980 if (stat && buffer[0])
3981 fprintf(gpreGlob.out_file, " && !%s [1]", vector);
3982 fprintf(gpreGlob.out_file, ")");
3983 make_ready(db, filename, vector, (USHORT) (column + INDENT), 0);
3984 if (buffer[0])
3985 strcat(buffer, " && ");
3986 strcat(buffer, db->dbb_name->sym_string);
3987 }
3988 }
3989 if (!buffer[0])
3990 strcpy(buffer, "1");
3991 if (test)
3992 printa(column, "if (%s && !%s)", buffer, trname);
3993 else
3994 printa(column, "if (%s)", buffer);
3995 column += INDENT;
3996 }
3997 else
3998 for (count = 0, db = gpreGlob.isc_databases; db; db = db->dbb_next, count++)
3999 ; // empty loop body
4000
4001 printa(column, "isc_start_transaction (%s, (FB_API_HANDLE*) &%s, (short) %d",
4002 vector, trname, count);
4003
4004 // Some systems don't like infinitely long lines. Limit them to 256.
4005
4006 int remaining = static_cast<int>(256 - column - strlen(vector) - strlen(trname) - 31);
4007

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 6

request_transFunction · 0.70
beginFunction · 0.70
alignFunction · 0.70
make_readyFunction · 0.70
printaFunction · 0.70
endpFunction · 0.70

Tested by

no test coverage detected