From 21d4ac9d94f861ad4f41dc00b13e2e9cfdd4576b Mon Sep 17 00:00:00 2001 From: toppyy <43851547+toppyy@users.noreply.github.com> Date: Sat, 20 Dec 2025 21:26:13 +0200 Subject: [PATCH] do not enforce types when preparing query --- src/PqResultImpl.cpp | 8 ++++---- src/PqResultImpl.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/PqResultImpl.cpp b/src/PqResultImpl.cpp index 3b6f55ade..95607a688 100644 --- a/src/PqResultImpl.cpp +++ b/src/PqResultImpl.cpp @@ -64,7 +64,7 @@ PqResultImpl::_cache::_cache() : { } -void PqResultImpl::_cache::set(PGresult* spec) +void PqResultImpl::_cache::set(PGresult* spec, bool enforce_result) { // always: should be fast if (nparams_ == 0) { @@ -85,7 +85,7 @@ void PqResultImpl::_cache::set(PGresult* spec) return; } - initialized_ = true; + initialized_ = enforce_result; names_ = new_names; oids_ = new_oids; types_ = get_column_types(oids_, names_); @@ -244,7 +244,7 @@ void PqResultImpl::prepare() { } pSpec_ = spec; - cache.set(spec); + cache.set(spec, false); } void PqResultImpl::init(bool params_have_rows) { @@ -516,7 +516,7 @@ bool PqResultImpl::step_run() { } if (need_cache_reset) { - cache.set(pRes_); + cache.set(pRes_, true); } if (status == PGRES_SINGLE_TUPLE) { diff --git a/src/PqResultImpl.h b/src/PqResultImpl.h index aa7a79615..f711614d5 100644 --- a/src/PqResultImpl.h +++ b/src/PqResultImpl.h @@ -34,7 +34,7 @@ class PqResultImpl : boost::noncopyable, public PqResultSource { int nparams_; _cache(); - void set(PGresult* spec); + void set(PGresult* spec, bool enforce_result); static std::vector get_column_names(PGresult* spec); static DATA_TYPE get_column_type_from_oid(const Oid type);