From 4156a471d30ed8528ab6c6ec687e31ebdd2c4685 Mon Sep 17 00:00:00 2001 From: hvlad Date: Fri, 6 Aug 2010 15:11:16 +0000 Subject: [PATCH] Fixed bug CORE-3089 : Attempt of execute statement on external datasource failed when datasource is interbase 4.1 --- src/jrd/extds/IscDS.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/jrd/extds/IscDS.cpp b/src/jrd/extds/IscDS.cpp index acba269ea5..d19b1a88c8 100644 --- a/src/jrd/extds/IscDS.cpp +++ b/src/jrd/extds/IscDS.cpp @@ -127,7 +127,7 @@ void IscConnection::attach(thread_db* tdbb, const string& dbName, const string& raise(status, tdbb, "attach"); } - char buff[8]; + char buff[16]; { EngineCallbackGuard guard(tdbb, *this); @@ -151,8 +151,21 @@ void IscConnection::attach(thread_db* tdbb, const string& dbName, const string& m_sqlDialect = m_iscProvider.isc_vax_integer(p, len); break; - case isc_info_truncated: case isc_info_error: + if (*p == isc_info_db_sql_dialect) + { + const ULONG err = m_iscProvider.isc_vax_integer(p + 1, len - 1); + if (err == isc_infunk) + { + // Remote server don't understand isc_info_db_sql_dialect. + // Consider it as pre-IB6 server and use SQL dialect 1 to work with it. + m_sqlDialect = 1; + break; + } + } + // fall thru + + case isc_info_truncated: ERR_post(Arg::Gds(isc_random) << Arg::Str("Unexpected error in isc_database_info")); case isc_info_end: