Date: Friday, April 7, 2006 @ 19:01:13
  Author: gilles
    Path: /cvsroot/carob/carob

Modified: include/ParameterStatement.hpp (1.14 -> 1.15)
          src/ParameterStatement.cpp (1.27 -> 1.28)
          test/40-Parameter-PreparedStatement/TestParameterStatement.cpp
          (1.12 -> 1.13)

Modified setNull to take sqlType as parameter
Fixes CAROB-92


----------------------------------------------------------------+
 include/ParameterStatement.hpp                                 |    5 ++++-
 src/ParameterStatement.cpp                                     |    4 ++--
 test/40-Parameter-PreparedStatement/TestParameterStatement.cpp |    3 ++-
 3 files changed, 8 insertions(+), 4 deletions(-)


Index: carob/include/ParameterStatement.hpp
diff -u carob/include/ParameterStatement.hpp:1.14 
carob/include/ParameterStatement.hpp:1.15
--- carob/include/ParameterStatement.hpp:1.14   Tue Mar 21 18:30:58 2006
+++ carob/include/ParameterStatement.hpp        Fri Apr  7 19:01:13 2006
@@ -90,8 +90,11 @@
   /**
    * Sets a parameter to SQL NULL.
    * @param parameterIndex the first parameter is 1, etc...
+   * @param sqlType the SQL type code defined in TypeConstants. <b>Note:</b>
+   *          For <b>some</b> databases this sqlType can be a dummy one (eg. 
you
+   *          can always give type "SQLT_SMALLINT")
    */
-  void                    setNull(const int parameterIndex)
+  void                    setNull(const int parameterIndex, const int sqlType)
                               throw (DriverException, UnexpectedException);
 
   /**
Index: carob/src/ParameterStatement.cpp
diff -u carob/src/ParameterStatement.cpp:1.27 
carob/src/ParameterStatement.cpp:1.28
--- carob/src/ParameterStatement.cpp:1.27       Fri Mar 10 18:48:03 2006
+++ carob/src/ParameterStatement.cpp    Fri Apr  7 19:01:13 2006
@@ -419,10 +419,10 @@
   return sbuf.str();
 }
 
-void ParameterStatement::setNull(const int parameterIndex)
+void ParameterStatement::setNull(const int parameterIndex, const int sqlType)
     throw (DriverException, UnexpectedException)
 {
-  set<std::wstring>(parameterIndex, NULL_TAG, emptyString);
+  set<std::wstring>(parameterIndex, NULL_TAG, toWString(sqlType));
 }
 
 
Index: carob/test/40-Parameter-PreparedStatement/TestParameterStatement.cpp
diff -u 
carob/test/40-Parameter-PreparedStatement/TestParameterStatement.cpp:1.12 
carob/test/40-Parameter-PreparedStatement/TestParameterStatement.cpp:1.13
--- carob/test/40-Parameter-PreparedStatement/TestParameterStatement.cpp:1.12   
Fri Apr  7 17:24:31 2006
+++ carob/test/40-Parameter-PreparedStatement/TestParameterStatement.cpp        
Fri Apr  7 19:01:13 2006
@@ -26,6 +26,7 @@
 #include "BigDecimal.hpp"
 #include "ParameterStatement.hpp"
 #include "DriverResultSet.hpp"
+#include "TypeConstants.hpp"
 
 #include "Connection.hpp"
 #include "CarobException.hpp"
@@ -330,7 +331,7 @@
   ParameterStatement* pstmt = connectionPtr->
     createParameterStatement(wstring(L"INSERT into ") + TABLE_NAME + L" values 
(?, ?)");
   pstmt->setInt(1, -125);
-  pstmt->setNull(2);
+  pstmt->setNull(2, SQLT_SMALLINT);
   pstmt->execute();
   Statement* stmt = connectionPtr-> createStatement();
   DriverResultSet* drs = stmt->executeQuery(std::wstring(L"SELECT * from ") + 
TABLE_NAME);

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

Reply via email to