Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

CVS update of carob (2 files): msg#00171

db.carob.cvs

Subject: CVS update of carob (2 files)

Date: Wednesday, January 25, 2006 @ 23:41:15
Author: marc
Path: /cvsroot/carob/carob

Modified: include/DriverResultSet.hpp (1.28 -> 1.29)
src/DriverResultSet.cpp (1.34 -> 1.35)

quick partial implementation of getAsFloat() (needed for HSQL testing)


-----------------------------+
include/DriverResultSet.hpp | 14 ++++++++++++++
src/DriverResultSet.cpp | 22 ++++++++++++++++++++++
2 files changed, 36 insertions(+)


Index: carob/include/DriverResultSet.hpp
diff -u carob/include/DriverResultSet.hpp:1.28
carob/include/DriverResultSet.hpp:1.29
--- carob/include/DriverResultSet.hpp:1.28 Tue Jan 24 19:37:27 2006
+++ carob/include/DriverResultSet.hpp Wed Jan 25 23:41:15 2006
@@ -235,6 +235,20 @@
NullValueException, NotImplementedException,
UnexpectedException);
/**
+ * Tries to get the value of a column in the current row as a
+ * float. If the value at the given row/col is not of type float or
+ * double, miserably fails TODO.
+ *
+ * @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 NullValueException if the retrieved value is NULL
+ */
+ float getAsFloat(int columnIndex) throw
(DriverException,
+ NullValueException, NotImplementedException,
+ UnexpectedException);
+ /**
* Gets the double value of a column in the current row only if the
* given column is of double type, throws an exception otherwise.
*
Index: carob/src/DriverResultSet.cpp
diff -u carob/src/DriverResultSet.cpp:1.34 carob/src/DriverResultSet.cpp:1.35
--- carob/src/DriverResultSet.cpp:1.34 Tue Jan 24 18:54:51 2006
+++ carob/src/DriverResultSet.cpp Wed Jan 25 23:41:15 2006
@@ -497,6 +497,28 @@
return ((data[currentRow])[columnIndex - 1]).as_float;
}

+float DriverResultSet::getAsFloat(int columnIndex) throw (DriverException,
+ NullValueException, NotImplementedException, UnexpectedException)
+{
+ checkRowAndColPosAndSetNullFlag(columnIndex);
+
+ if (wasNullFlag)
+ {
+ throw (NullValueException(L"getAsFloat: Value at row " +
toWString(currentRow)
+ + L" column " + toWString(columnIndex) + L" is NULL"));
+ }
+
+ switch (columnTypeTags[columnIndex - 1])
+ {
+ case TT_FLOAT:
+ return ((data[currentRow])[columnIndex - 1]).as_float;
+ case TT_DOUBLE:
+ return static_cast<float>(data[currentRow][columnIndex - 1].as_double);
+ default: // TODO
+ throw NotImplementedException(L"float conversion not implemented for
this type yet.");
+ }
+}
+
double DriverResultSet::getDouble(int columnIndex) throw (DriverException,
NullValueException, NotImplementedException, UnexpectedException)
{


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation

Home | advertise | OSDir is an inevitable website. super tiny logo