commit 9d7a8cc27d0fb5e41b9512731381a2e01fc89ef8
Author: dprunier <dominique.prunier@watch4net.com>
Date:   Mon Jan 16 11:35:47 2012

    fastbit_result_set_get_long added to the C API

diff --git a/src/capi.cpp b/src/capi.cpp
index 88d5e76..befe273 100755
--- a/src/capi.cpp
+++ b/src/capi.cpp
@@ -9,6 +9,12 @@
 #include "bundle.h"	// ibis::query::result
 #include "tafel.h"	// a concrete instance of ibis::tablex
 
+// FIXME: we should not have to do this but C99 limit macros are not
+// defined in C++ unless __STDC_LIMIT_MACROS is defined
+#ifndef INT64_MAX
+#  define INT64_MAX (9223372036854775807LL)
+#endif
+
 extern "C" {
     /// The object underlying the FastBit query handle.
     struct FastBitQuery {
@@ -2152,6 +2158,36 @@ fastbit_result_set_getUnsigned(FastBitResultSetHandle rset,
     return ret;
 } // fastbit_result_set_getUnsigned
 
+extern "C" int64_t
+fastbit_result_set_getLong(FastBitResultSetHandle rset,
+			       unsigned pos) {
+    int64_t ret = INT64_MAX;
+    if (rset == 0)
+	return ret;
+    try {
+	ret = rset->results->getLong(pos);
+    }
+    catch (const std::exception& e) {
+	LOGGER(ibis::gVerbose > 0)
+	    << "Warning -- fastbit_result_set_getLong failed to retrieve "
+	    "value of column " << pos << " due to exception: " << e.what();
+	ret = INT64_MAX;
+    }
+    catch (const char* s) {
+	LOGGER(ibis::gVerbose > 0)
+	    << "Warning -- fastbit_result_set_getLong failed to retrieve "
+	    "value of column " << pos << " due to a string exception: " << s;
+	ret = INT64_MAX;
+    }
+    catch (...) {
+	LOGGER(ibis::gVerbose > 0)
+	    << "Warning -- fastbit_result_set_getLong failed toretrieve "
+	    "value of column " << pos << " due to a unknown exception";
+	ret = INT64_MAX;
+    }
+    return ret;
+} // fastbit_result_set_getLong
+
 extern "C" float
 fastbit_result_set_getFloat(FastBitResultSetHandle rset,
 			    unsigned pos) {
diff --git a/src/capi.h b/src/capi.h
index 9f78a69..b7d7a9c 100644
--- a/src/capi.h
+++ b/src/capi.h
@@ -196,6 +196,10 @@ extern "C" {
     FASTBIT_DLLSPEC unsigned
     fastbit_result_set_get_unsigned(FastBitResultSetHandle rset,
 				    const char *cname);
+    ///@brief Get the value of the named column as a long.
+    FASTBIT_DLLSPEC int64_t
+    fastbit_result_set_get_long(FastBitResultSetHandle rset,
+				    const char *cname);
     ///@brief Get the value of the named column as a single-precision
     /// floating-point number.
     FASTBIT_DLLSPEC float
