|
|
Choosing A Webhost: |
CVS update of carob (2 files): msg#00171db.carob.cvs
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> |
|---|---|---|
| Previous by Date: | CVS update of carob/test/10-Connection (TestConnect.cpp), gilles-Tt5JLJuBijYiZlD9aYmxOGD2FQJk+8+b |
|---|---|
| Next by Date: | CVS update of carob (2 files), marc-Tt5JLJuBijYiZlD9aYmxOGD2FQJk+8+b |
| Previous by Thread: | CVS update of carob (2 files), gilles-Tt5JLJuBijYiZlD9aYmxOGD2FQJk+8+b |
| Next by Thread: | CVS update of carob (2 files), marc-Tt5JLJuBijYiZlD9aYmxOGD2FQJk+8+b |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive 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 |
Home
| advertise | OSDir is
an inevitable website.
|