Date: Friday, March 10, 2006 @ 18:45:48
Author: gilles
Path: /cvsroot/carob/carob
Modified: include/DriverResultSet.hpp (1.34 -> 1.35)
src/DriverResultSet.cpp (1.47 -> 1.48)
Added getBigDecimal for columns tagged as this
-----------------------------+
include/DriverResultSet.hpp | 16 ++++++++++++++++
src/DriverResultSet.cpp | 20 ++++++++++++++++++++
2 files changed, 36 insertions(+)
Index: carob/include/DriverResultSet.hpp
diff -u carob/include/DriverResultSet.hpp:1.34
carob/include/DriverResultSet.hpp:1.35
--- carob/include/DriverResultSet.hpp:1.34 Thu Mar 9 10:46:43 2006
+++ carob/include/DriverResultSet.hpp Fri Mar 10 18:45:48 2006
@@ -63,6 +63,7 @@
class Connection;
class Field;
class TypeTag;
+class BigDecimal;
/**
* A <code>ResultSet</code> provides access to a table of data generated by
* executing a Statement. The table rows are retrieved in sequence. Within a
row
@@ -346,6 +347,21 @@
{ return getLargeObject(columnIndex); }
/**
+ * Gets the bigdecimal value of a column in the current row only if the
+ * given column is of bigdecimal type, throws an exception otherwise.
+ *
+ * @param columnIndex the first column is 1, the second is 2,...
+ * @return the column value; NULL if SQL NULL
+ * @throw DriverException if the ResultSet is closed or the cursor is out of
+ * bounds
+ * @throw DriverException if the column is not of type string
+ * @throw NullValueException if the retrieved value is NULL
+ */
+ BigDecimal getBigDecimal(int columnIndex) throw
(DriverException,
+ NullValueException, NotImplementedException,
+ UnexpectedException);
+
+ /**
* Closes the remote ResultSet if the ResultSet was streamed else just closes
* the ResultSet locally.
*/
Index: carob/src/DriverResultSet.cpp
diff -u carob/src/DriverResultSet.cpp:1.47 carob/src/DriverResultSet.cpp:1.48
--- carob/src/DriverResultSet.cpp:1.47 Thu Mar 9 10:46:43 2006
+++ carob/src/DriverResultSet.cpp Fri Mar 10 18:45:48 2006
@@ -750,6 +750,26 @@
return *static_cast<LargeData*>((data[currentRow][columnIndex -
1].as_other));
}
+BigDecimal DriverResultSet::getBigDecimal(int columnIndex) throw
(DriverException,
+ NullValueException, NotImplementedException, UnexpectedException)
+{
+ checkRowAndColPosAndSetNullFlag(columnIndex);
+
+ if (wasNullFlag)
+ {
+ throw (NullValueException(L"getBigDecimal: Value at row " +
toWString(currentRow)
+ + L" column " + toWString(columnIndex) + L" is NULL"));
+ }
+
+ if (columnTypeTags[columnIndex - 1] != TT_BIGDECIMAL)
+ {
+ throw (DriverException(L"getBigDecimal: Value at row " +
toWString(currentRow)
+ + L" column " + toWString(columnIndex) + L" is not of type
BigDecimal"));
+ }
+
+ return *static_cast<BigDecimal*>((data[currentRow][columnIndex -
1].as_other));
+}
+
void DriverResultSet::close() throw (SocketIOException, BackendException,
ControllerException, ProtocolException, UnexpectedException)
{
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits