| 3497 | // |
| 3498 | |
| 3499 | static void gen_t_start( const act* action) |
| 3500 | { |
| 3501 | TEXT dbname[80]; |
| 3502 | |
| 3503 | // if this is a purely default transaction, just let it through |
| 3504 | |
| 3505 | const gpre_tra* trans; |
| 3506 | if (!action || !(trans = (gpre_tra*) action->act_object)) |
| 3507 | { |
| 3508 | t_start_auto(0, status_vector(action), action, false); |
| 3509 | return; |
| 3510 | } |
| 3511 | |
| 3512 | // build a complete statement, including tpb's. Ready db's as gpre_req. |
| 3513 | |
| 3514 | const tpb* tpb_iterator; |
| 3515 | if (gpreGlob.sw_auto) |
| 3516 | for (tpb_iterator = trans->tra_tpb; tpb_iterator; tpb_iterator = tpb_iterator->tpb_tra_next) |
| 3517 | { |
| 3518 | const gpre_dbb* db = tpb_iterator->tpb_database; |
| 3519 | const TEXT* filename = db->dbb_runtime; |
| 3520 | if (filename || !(db->dbb_flags & DBB_sqlca)) |
| 3521 | { |
| 3522 | printa(names[COLUMN], false, "IF %s = 0 THEN", db->dbb_name->sym_string); |
| 3523 | const USHORT namelength = static_cast<USHORT>(filename ? strlen(filename) : 0); |
| 3524 | if (filename) |
| 3525 | { |
| 3526 | sprintf(dbname, "%s%ddb", names[isc_b_pos], db->dbb_id); |
| 3527 | filename = dbname; |
| 3528 | } |
| 3529 | make_ready(db, filename, status_vector(action), 0, namelength); |
| 3530 | set_sqlcode(action); |
| 3531 | printa(names[COLUMN], false, "END-IF"); |
| 3532 | } |
| 3533 | } |
| 3534 | |
| 3535 | printa(names[COLUMN], true, "CALL \"%s\" USING %s, %s%s, %s%d%s", |
| 3536 | ISC_START_TRANSACTION, |
| 3537 | status_vector(action), |
| 3538 | BY_REF, trans->tra_handle ? trans->tra_handle : names[isc_trans_pos], |
| 3539 | BY_VALUE, trans->tra_db_count, END_VALUE); |
| 3540 | |
| 3541 | for (tpb_iterator = trans->tra_tpb; tpb_iterator; tpb_iterator = tpb_iterator->tpb_tra_next) |
| 3542 | { |
| 3543 | printa(names[CONTINUE], true, ", %s%s, %s%d%s, %s%s%d", |
| 3544 | BY_REF, tpb_iterator->tpb_database->dbb_name->sym_string, |
| 3545 | BY_VALUE, tpb_iterator->tpb_length, END_VALUE, |
| 3546 | BY_REF, names[isc_tpb_pos], tpb_iterator->tpb_ident); |
| 3547 | } |
| 3548 | |
| 3549 | set_sqlcode(action); |
| 3550 | |
| 3551 | } |
| 3552 | |
| 3553 | |
| 3554 | //____________________________________________________________ |
no test coverage detected