Caution: I used Visual Studio 2017 to run the simpleest-build.bat file.
From the evidence below, you can see that branching or other compilation occurs between the 32-bit and 64-bit versions of the Firebird service, which causes this problem.
Decision. The EngineCode () member function does not exist in the 64-bit version. You should use the function () function exception as shown in the commented line inside the catch3 () block of catch. If you want to use EngineCode information, you will have to parse it from the what () line, since it contains all the information that was originally provided as separate data elements in the IBPP :: SQLExceptionImpl class for the 32-bit version.
try { #if defined(IBPP_WINDOWS) && defined(_DEBUG) OutputDebugString(_("An exception will now get logged in the debugger: this is expected.\n")); #endif st1->ExecuteImmediate( "CREATE SYNTAX ERROR(X, Y) AS " "SELECT ERRONEOUS FROM MUSTFAIL M" ); } catch(IBPP::SQLException& e) {
Call result ().
*** IBPP::SQLException *** Context: Statement::ExecuteImmediate( CREATE SYNTAX ERROR(X, Y) AS SELECT ERRONEOUS FROM MUSTFAIL M ) Message: isc_dsql_execute_immediate failed SQL Message : -104 can't format message 13:896 -- message file C:\WINDOWS\SYSTEM32\firebird.msg not found Engine Code : 335544569 Engine Message : Dynamic SQL Error SQL error code = -104 Token unknown - line 1, column 8 SYNTAX
Puzzle: statement.cpp shows using IBPP :: SQLExceptionImpl and more ... using ExceptionImpl, so I should assume that this source code is a 32-bit branch. If it is assumed that this is a common branch for 32 and 64 bits, then I do not see how it can work.
There are two header files that define exception classes. I believe that _ibbp.h was used to compile a 32-bit client, and ibbp.h was used for a 64-bit client. I came to these conclusions by modifying the catch clause in Test3 () to find out what possible exceptions might occur .... ExceptionImpl classes will only compile with 32-bit client dlls and they won't compile with 64-bit dlls.
From _ibpp.h (32-bit fbclient dlls recognize these classes. 64-bit fbclient dlls do not.)
/////////////////////////////////////////////////////////////////////////////// // // Implementation of the "hidden" classes associated with their public // counterparts. Their private data and methods can freely change without // breaking the compatibility of the DLL. If they receive new public methods, // and those methods are reflected in the public class, then the compatibility // is broken. // /////////////////////////////////////////////////////////////////////////////// // // Hidden implementation of Exception classes. // /* std::exception | IBPP::Exception / \ / \ IBPP::LogicException ExceptionBase IBPP::SQLException | \ / | \ / | LogicExceptionImpl | SQLExceptionImpl | | IBPP::WrongType | \ | IBPP::WrongTypeImpl */
From ibpp.h (both sets of fbclient dll recognize these classes)
/* IBPP never return any error codes. It throws exceptions. * On database engine reported errors, an IBPP::SQLException is thrown. * In all other cases, IBPP throws IBPP::LogicException. * Also note that the runtime and the language might also throw exceptions * while executing some IBPP methods. A failing new operator will throw * std::bad_alloc, IBPP does nothing to alter the standard behaviour. * * std::exception * | * IBPP::Exception * / \ * IBPP::LogicException IBPP::SQLException * | * IBPP::WrongType */
In all tests, test.cpp, the only attribute for IBPP :: SQLException is in Test3 (). Every other catch uses IBPP :: Exception.
Thus, this problem would only appear in Test3 () when compiling for 64 bits, but I think that it would occur whenever IBPP :: SQLException is used in a 64-bit implementation.