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

Function reconnect

src/alice/tdr.cpp:778–833  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

776//
777
778static bool reconnect(FB_API_HANDLE handle, TraNumber number, const TEXT* name, SINT64 switches)
779{
780 ISC_STATUS_ARRAY status_vector;
781
782 UCHAR numbuf[sizeof(TraNumber)];
783 USHORT numlen;
784
785 if (number > TraNumber(MAX_SLONG))
786 {
787 put_vax_int64(numbuf, number);
788 numlen = sizeof(SINT64);
789 }
790 else
791 {
792 put_vax_long(numbuf, (SLONG) number);
793 numlen = sizeof(SLONG);
794 }
795
796 FB_API_HANDLE transaction = 0;
797 if (isc_reconnect_transaction(status_vector, &handle, &transaction,
798 numlen, reinterpret_cast<const char*>(numbuf)))
799 {
800 ALICE_print(90, SafeArg() << name);
801 // msg 90: failed to reconnect to a transaction in database %s
802 ALICE_print_status(true, status_vector);
803 return true;
804 }
805
806 if (!(switches & (sw_commit | sw_rollback)))
807 {
808 ALICE_print(91, SafeArg() << number);
809 // msg 91: Transaction %ld:
810 switches = ask();
811 if (switches == ~SINT64(0))
812 {
813 ALICE_print(84);
814 // msg 84: unexpected end of input
815 return true;
816 }
817 }
818
819 if (switches & sw_commit)
820 isc_commit_transaction(status_vector, &transaction);
821 else if (switches & sw_rollback)
822 isc_rollback_transaction(status_vector, &transaction);
823 else
824 return false;
825
826 if (status_vector[1])
827 {
828 ALICE_print_status(true, status_vector);
829 return true;
830 }
831
832 return false;
833}

Callers 1

TDR_reconnect_multipleFunction · 0.85

Calls 6

put_vax_int64Function · 0.85
put_vax_longFunction · 0.85
ALICE_printFunction · 0.85
ALICE_print_statusFunction · 0.85
askFunction · 0.85
SafeArgClass · 0.50

Tested by

no test coverage detected