Date: Thursday, March 23, 2006 @ 15:38:10
  Author: gilles
    Path: /cvsroot/carob/carob

Modified: include/DriverResultSet.hpp (1.38 -> 1.39)
          src/DriverResultSet.cpp (1.50 -> 1.51)

Fixed memory leak for BigDecimals in result set (were not destroyed)
getBigDecimal now returns a const ref


-----------------------------+
 include/DriverResultSet.hpp |    2 +-
 src/DriverResultSet.cpp     |   11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)


Index: carob/include/DriverResultSet.hpp
diff -u carob/include/DriverResultSet.hpp:1.38 
carob/include/DriverResultSet.hpp:1.39
--- carob/include/DriverResultSet.hpp:1.38      Fri Mar 17 12:46:49 2006
+++ carob/include/DriverResultSet.hpp   Thu Mar 23 15:38:10 2006
@@ -388,7 +388,7 @@
    * @throw DriverException if the column is not of type string
    * @throw NullValueException if the retrieved value is NULL
    */
-  BigDecimal                  getBigDecimal(int columnIndex) throw 
(DriverException,
+  const BigDecimal&           getBigDecimal(int columnIndex) throw 
(DriverException,
                                   NullValueException, NotImplementedException,
                                   UnexpectedException);
 
Index: carob/src/DriverResultSet.cpp
diff -u carob/src/DriverResultSet.cpp:1.50 carob/src/DriverResultSet.cpp:1.51
--- carob/src/DriverResultSet.cpp:1.50  Mon Mar 13 20:31:04 2006
+++ carob/src/DriverResultSet.cpp       Thu Mar 23 15:38:10 2006
@@ -77,6 +77,15 @@
             }
           }
         break;
+        case TT_BIGDECIMAL:
+          for (cnt=0; cnt<data.size(); cnt++)
+          {
+            if (!nulls[cnt][col])
+            {
+              delete (static_cast<BigDecimal*>((data[cnt][col]).as_other));
+            }
+          }
+        break;
         case TT_SQL_TIMESTAMP:
           for (cnt=0; cnt<data.size(); cnt++)
           {
@@ -834,7 +843,7 @@
   return *static_cast<LargeData*>((data[currentRow][columnIndex - 
1].as_other));
 }
 
-BigDecimal DriverResultSet::getBigDecimal(int columnIndex) throw 
(DriverException,
+const BigDecimal& DriverResultSet::getBigDecimal(int columnIndex) throw 
(DriverException,
     NullValueException, NotImplementedException, UnexpectedException)
 {
   checkRowAndColPosAndSetNullFlag(columnIndex);

_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits

Reply via email to