| 4412 | // |
| 4413 | |
| 4414 | static void t_start_auto(const gpre_req* request, |
| 4415 | const TEXT* vector, |
| 4416 | const act* action, |
| 4417 | bool test) |
| 4418 | { |
| 4419 | TEXT dbname[80], buffer[256], temp[MAX_CURSOR_SIZE + 10]; |
| 4420 | |
| 4421 | const TEXT* trname = request_trans(action, request); |
| 4422 | |
| 4423 | // find out whether we're using a status vector or not |
| 4424 | |
| 4425 | const bool stat = !strcmp(vector, names[isc_status_vector_pos]); |
| 4426 | |
| 4427 | // this is a default transaction, make sure all databases are ready |
| 4428 | |
| 4429 | const gpre_dbb* db; |
| 4430 | int count; |
| 4431 | |
| 4432 | if (gpreGlob.sw_auto) |
| 4433 | { |
| 4434 | buffer[0] = 0; |
| 4435 | for (count = 0, db = gpreGlob.isc_databases; db; db = db->dbb_next, count++) |
| 4436 | { |
| 4437 | const TEXT* filename = db->dbb_runtime; |
| 4438 | if (filename || !(db->dbb_flags & DBB_sqlca)) |
| 4439 | { |
| 4440 | fprintf(gpreGlob.out_file, "%sIF %s = 0", names[COLUMN], db->dbb_name->sym_string); |
| 4441 | if (stat && buffer[0]) |
| 4442 | fprintf(gpreGlob.out_file, " AND %s(2) = 0", names[isc_status_pos]); |
| 4443 | fprintf(gpreGlob.out_file, " THEN\n"); |
| 4444 | const USHORT namelength = static_cast<USHORT>(filename ? strlen(filename) : 0); |
| 4445 | if (filename) |
| 4446 | { |
| 4447 | sprintf(dbname, "%s%ddb", names[isc_b_pos], db->dbb_id); |
| 4448 | filename = dbname; |
| 4449 | } |
| 4450 | make_ready(db, filename, vector, 0, namelength); |
| 4451 | printa(names[COLUMN], false, "END-IF"); |
| 4452 | if (buffer[0]) |
| 4453 | strcat(buffer, ") AND ("); |
| 4454 | fb_utils::snprintf(temp, sizeof(temp), "%s NOT = 0", db->dbb_name->sym_string); |
| 4455 | strcat(buffer, temp); |
| 4456 | } |
| 4457 | } |
| 4458 | fb_assert(strlen(buffer) < sizeof(buffer)); |
| 4459 | if (test) |
| 4460 | if (buffer[0]) |
| 4461 | printa(names[COLUMN], false, "IF (%s) AND %s = 0 THEN", buffer, trname); |
| 4462 | |
| 4463 | else |
| 4464 | printa(names[COLUMN], false, "IF %s = 0 THEN", trname); |
| 4465 | else if (buffer[0]) |
| 4466 | printa(names[COLUMN], false, "IF (%s) THEN", buffer); |
| 4467 | } |
| 4468 | else |
| 4469 | for (count = 0, db = gpreGlob.isc_databases; db; db = db->dbb_next, count++) |
| 4470 | ; |
| 4471 |
no test coverage detected