From fbdfe6ef89304ec5558c0161a8410e5220dafc80 Mon Sep 17 00:00:00 2001 From: irodushka Date: Sun, 17 Nov 2024 21:09:22 +0300 Subject: [PATCH] Issue #233: Fix erratic prepared execute --- ChangeLog_v3.0 | 3 +++ IscDbc/Sqlda.cpp | 13 ++++++++----- IscDbc/Sqlda.h | 1 - WriteBuildNo.h | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/ChangeLog_v3.0 b/ChangeLog_v3.0 index 80f160bd..17f2a681 100644 --- a/ChangeLog_v3.0 +++ b/ChangeLog_v3.0 @@ -1,3 +1,6 @@ + * EXECUTE STATEMENT changed for the worse in ODBC 3.0 + #233 opened by Fabio-LV + * Abnormal termination in SQLFetch() #229 by fdcastel diff --git a/IscDbc/Sqlda.cpp b/IscDbc/Sqlda.cpp index d724d0b5..020f129b 100644 --- a/IscDbc/Sqlda.cpp +++ b/IscDbc/Sqlda.cpp @@ -326,7 +326,6 @@ Sqlda::~Sqlda() void Sqlda::init() { meta = nullptr; - metaBackup = meta; sqlvar.clear(); dataStaticCursor = nullptr; columnsCount = 0; @@ -456,10 +455,14 @@ Sqlda::ExecBuilder::ExecBuilder(Sqlda& sqlda) : _sqlda{sqlda}, _localMeta { null Sqlda::ExecBuilder::~ExecBuilder() { - //release meta - if (_localMeta) _localMeta->release(); - //restore original sql vars - for (auto& var : _sqlda.sqlvar) *static_cast(&var) = var.orgSqlProperties; + //save new meta + if (_localMeta) + { + for (auto& var : _sqlda.sqlvar) var.orgSqlProperties = *static_cast(&var); + if(_sqlda.meta) _sqlda.meta->release(); + _sqlda.meta = _localMeta; + _sqlda.buffer = _localBuffer; + } } void Sqlda::mapSqlAttributes( IscStatement *stmt ) diff --git a/IscDbc/Sqlda.h b/IscDbc/Sqlda.h index b815441d..512b3b4e 100644 --- a/IscDbc/Sqlda.h +++ b/IscDbc/Sqlda.h @@ -220,7 +220,6 @@ class Sqlda IscConnection* connection; Firebird::IMessageMetadata* meta; - Firebird::IMessageMetadata* metaBackup; buffer_t buffer; diff --git a/WriteBuildNo.h b/WriteBuildNo.h index c2860e77..fc50b82c 100644 --- a/WriteBuildNo.h +++ b/WriteBuildNo.h @@ -4,4 +4,4 @@ // Note - there must be two tabs between BUILDNUM_VERSION and // the actual number, otherwise the makefile for linux will not // pick up the value. -#define BUILDNUM_VERSION 13 +#define BUILDNUM_VERSION 14