Hello,

 I'll try to do this properly, i.e. add the unit tests exposing the bugs
these commits fix, but this will take me some time and might not happen
before the next week so for now I'd like to ask to either delay SOCI 3.2 a
little bit or commit (or let me commit) the changes below without the
tests as without them current Firebird is simply unusable for us and
anybody else either re-using the same statement more than once or reading
any floating point numbers from the database.

 Thanks,
VZ

>From 8072cd75d757a35c91c81f14a997cad54a96c86f Mon Sep 17 00:00:00 2001
From: Vadim Zeitlin <vz-s...@zeitlins.org>
Date: Fri, 22 Mar 2013 13:30:45 +0100
Subject: [PATCH 1/3] Fix regression with statement re-execution when using
 Firebird backend.

Since the introduction of endOfRowSet_ flag in 4c3cb629, executing the same
statement again stopped working as the flag was never reset after fetching all
the results of the first execution.

Fix this by resetting it in firebird_statement_backend::execute().
---
 src/backends/firebird/statement.cpp |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/backends/firebird/statement.cpp 
b/src/backends/firebird/statement.cpp
index 5eea3e5..a882cc8 100644
--- a/src/backends/firebird/statement.cpp
+++ b/src/backends/firebird/statement.cpp
@@ -438,6 +438,10 @@ void firebird_statement_backend::prepare(std::string const 
& query,
         }
     }

+    // Successfully re-executing the statement must reset the "end of rowset"
+    // flag, we might be able to fetch data again now.
+    endOfRowSet_ = false;
+
     if (sqldap_->sqld)
     {
         // query may return some data
--
1.7.9


>From c259bfa3437e75e7446fddb62a2d6300ed59cf12 Mon Sep 17 00:00:00 2001
From: Vadim Zeitlin <vz-s...@zeitlins.org>
Date: Fri, 22 Mar 2013 13:46:19 +0100
Subject: [PATCH 2/3] Fix reading negative doubles from the database with
 Firebird backend.

Mantissa of type SQL_LONG must be converted to "int", not "unsigned", when
reading from the database.

This corrects the changes of 4c3cb629 which did use int in other places where
SQL_LONG is handled but not here for some reason.
---
 src/backends/firebird/common.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/backends/firebird/common.h b/src/backends/firebird/common.h
index f4c90a4..f0f48ce 100644
--- a/src/backends/firebird/common.h
+++ b/src/backends/firebird/common.h
@@ -201,7 +201,7 @@ T1 from_isc(XSQLVAR * var)
     case SQL_SHORT:
         return static_cast<T1>(*reinterpret_cast<short*>(var->sqldata)/tens);
     case SQL_LONG:
-        return 
static_cast<T1>(*reinterpret_cast<unsigned*>(var->sqldata)/tens);
+        return static_cast<T1>(*reinterpret_cast<int*>(var->sqldata)/tens);
     case SQL_INT64:
         return static_cast<T1>(*reinterpret_cast<long 
long*>(var->sqldata)/tens);
     case SQL_FLOAT:
--
1.7.9

Attachment: pgpo__4uzF9do.pgp
Description: PGP signature

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
soci-users mailing list
soci-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/soci-users

Reply via email to