| 3431 | // |
| 3432 | |
| 3433 | static 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); |
no test coverage detected