Date: Thursday, July 27, 2006 @ 17:10:53
Author: gilles
Path: /cvsroot/carob/carob
Modified: include/CarobException.hpp (1.47 -> 1.48)
include/ConnectionParameters.hpp (1.26 -> 1.27)
include/ControllerPool.hpp (1.2 -> 1.3)
include/ResultAndWarnings.hpp (1.1 -> 1.2)
include/StringCodecs.hpp (1.13 -> 1.14)
test/01-Unit/TestStringCodecs.hpp (1.2 -> 1.3)
test/30-ResultSet/TestSimpleUnicode.hpp (1.1 -> 1.2)
test/40-Parameter-PreparedStatement/TestIEEE754.hpp (1.3 -> 1.4)
Javadoc fixes => no more warnings from doxygen!
-----------------------------------------------------+
include/CarobException.hpp | 5 +++-
include/ConnectionParameters.hpp | 6 +++++
include/ControllerPool.hpp | 14 +++++++++++++
include/ResultAndWarnings.hpp | 18 ++++++++++++-----
include/StringCodecs.hpp | 19 ++++++++++++++++--
test/01-Unit/TestStringCodecs.hpp | 4 +++
test/30-ResultSet/TestSimpleUnicode.hpp | 8 +++++--
test/40-Parameter-PreparedStatement/TestIEEE754.hpp | 10 ++++++++-
8 files changed, 73 insertions(+), 11 deletions(-)
Index: carob/include/CarobException.hpp
diff -u carob/include/CarobException.hpp:1.47
carob/include/CarobException.hpp:1.48
--- carob/include/CarobException.hpp:1.47 Wed Jun 21 14:56:22 2006
+++ carob/include/CarobException.hpp Thu Jul 27 17:10:53 2006
@@ -323,7 +323,10 @@
public:
/**
* Constructs a SQLWarning with the given message
- * @param s warning message
+ * @param messagePrm description of the warning
+ * @param SQLStatePrm XOPEN code identifying the warning
+ * @param causePrm exception that caused this one. Can be null
+ * @param vendorPrm database vendor-specific warning code
*/
SQLWarning(const std::wstring& messagePrm,
const std::wstring& SQLStatePrm = DEFAULTSQLSTATE,
Index: carob/include/ConnectionParameters.hpp
diff -u carob/include/ConnectionParameters.hpp:1.26
carob/include/ConnectionParameters.hpp:1.27
--- carob/include/ConnectionParameters.hpp:1.26 Wed Jul 26 16:31:47 2006
+++ carob/include/ConnectionParameters.hpp Thu Jul 27 17:10:53 2006
@@ -91,11 +91,17 @@
class ConnectionParameters
{
public:
+ /** Default username = "user" */
static const std::wstring DEFAULT_USER;
+ /** Default password = "" */
static const std::wstring DEFAULT_PASSWD;
+ /** Default database name = "myDB" */
static const std::wstring DEFAULT_DB;
+ /** Default policy = ROUND_ROBIN */
static const ConnectPolicy DEFAULT_POLICY;
+ /** Default for persistent connections value = false */
static const bool DEFAULT_CONNECTION_PERSISTENCY;
+ /** Default for retrieve SQL warnings = false */
static const bool DEFAULT_RETRIEVE_SQL_WARNINGS;
/**
Index: carob/include/ControllerPool.hpp
diff -u carob/include/ControllerPool.hpp:1.2
carob/include/ControllerPool.hpp:1.3
--- carob/include/ControllerPool.hpp:1.2 Wed Jul 26 17:11:57 2006
+++ carob/include/ControllerPool.hpp Thu Jul 27 17:10:53 2006
@@ -176,12 +176,25 @@
*/
typedef struct
{
+ /** List of controllers (warning: order matters !) */
std::vector<ControllerInfo> controllers;
+ /** Associated Connection policy */
ConnectPolicy policy;
} PoolIndex;
+/**
+ * PoolIndex "Less Than" functor.<br>
+ * First compares policies (just by comparing their enum values)<br>
+ * Then the number of controllers<br>
+ * Finally the controllers themselves using ControllerInfo '<' operator<br>
+ * This functor is used by ControllerPoolManager for sorting values in the pool
+ * map
+ */
struct ltPoolIndex
{
+ /**
+ * Less than operator
+ */
bool operator()(const PoolIndex& pi1, const PoolIndex& pi2) const
{
if (pi1.policy < pi2.policy)
@@ -238,6 +251,7 @@
/**
* Decrements reference counter on the given pool. If no more references are
* made on this pool, removes it from the pool list and deletes it
+ * @param pool the pool to release
*/
static void freePool(AbstractControllerPool* pool);
protected:
Index: carob/include/ResultAndWarnings.hpp
diff -u carob/include/ResultAndWarnings.hpp:1.1
carob/include/ResultAndWarnings.hpp:1.2
--- carob/include/ResultAndWarnings.hpp:1.1 Wed Jun 21 14:56:22 2006
+++ carob/include/ResultAndWarnings.hpp Thu Jul 27 17:10:53 2006
@@ -29,6 +29,11 @@
namespace CarobNS {
+/**
+ * Container that holds XXXexecute() and XXXexecuteUpdate result (update count
+ * or result list) and the eventual associated warnings. Note that
+ * XXXexecuteQuery result and warnings are held by DriverResultSet class
+ */
class ResultAndWarnings
{
public:
@@ -56,7 +61,7 @@
* and the given SQLWarnings.<br>
* This constructor will typically be called by XXXexecute() functions
*
- * @param reslistPtr pointer to a list of results
+ * @param reslist list of results
* @param warnsPtr pointer to the warnings to set, can be null
*/
ResultAndWarnings(std::list<ResultSetOrUpdateCount> reslist, SQLWarning*
warnsPtr)
@@ -75,7 +80,9 @@
}
/**
- * Assignement operator. Deletes
+ * Assignement operator. Deletes the previous warnings and replaces it with
+ * the one from the right value
+ * @param cp the right value
*/
ResultAndWarnings & operator =(const ResultAndWarnings& cp)
{
@@ -127,12 +134,13 @@
std::list<ResultSetOrUpdateCount> getResultList() const { return
result_list; }
private:
- /** warning chain, null means no warning */
+ /** Warning chain, null means no warning */
SQLWarning* warnings_ptr;
- /** true if this object holds an update count, false if it holds a result
List */
+ /** True if this object holds an update count, false if it holds a result
List */
bool is_update_count;
-
+ /** Result of XXXexecuteUpdate */
int update_count;
+ /** Result of XXXexecute */
std::list<ResultSetOrUpdateCount> result_list;
};
Index: carob/include/StringCodecs.hpp
diff -u carob/include/StringCodecs.hpp:1.13 carob/include/StringCodecs.hpp:1.14
--- carob/include/StringCodecs.hpp:1.13 Thu Mar 23 17:10:04 2006
+++ carob/include/StringCodecs.hpp Thu Jul 27 17:10:53 2006
@@ -73,7 +73,9 @@
const mbs_codecvt& codecvt;
public:
+ /** Encodes the given string using the locale set in the constructor */
std::string encode(const std::wstring&) const throw (CodecException);
+ /** Decodes the given string using the locale set in the constructor */
std::wstring decode(const std::string&) const throw (CodecException);
/**
@@ -88,12 +90,20 @@
loc(std::locale("")),
codecvt (std::use_facet<mbs_codecvt>(loc))
{ }
-
+
+ /**
+ * Use locarg locale for conversions
+ * @param locarg locale to be used
+ */
MBSCodec(const std::locale& locarg) :
loc(locarg),
codecvt (std::use_facet<mbs_codecvt>(loc))
{ }
+ /**
+ * Use locale named locname for conversions
+ * @param locname name of the locale to be used
+ */
MBSCodec(const char* locname) throw (CodecException) :
loc(trylocale(locname)),
codecvt (std::use_facet<mbs_codecvt>(loc))
@@ -110,17 +120,22 @@
class StaticCodecs
{
public:
+ /** Converts UTF-8 encoded string to a wide string */
static std::wstring fromUTF8(const std::string& in) throw (CodecException)
{ return utf8_codec.decode(in); }
+ /** Converts a wide string to a UTF-8 encoded string */
static std::string toUTF8(const std::wstring& in) throw (CodecException)
{ return utf8_codec.encode(in); }
+ /** Converts user's locale encoded string to a wide string */
static std::wstring fromString(const std::string& in) throw (CodecException)
{ return user_codec.decode(in); }
+ /** Converts a wide string to a user's locale encoded string */
static std::string toString(const std::wstring& in) throw (CodecException)
{ return user_codec.encode(in); }
private:
+ /** Codec for UTF-8 strings */
static const CarobNS::MBSCodec utf8_codec;
- /** user-defined locale (typically set using LANG, LC_etc) */
+ /** User-defined locale (typically set using LANG, LC_etc) codec */
static const CarobNS::MBSCodec user_codec;
};
Index: carob/test/01-Unit/TestStringCodecs.hpp
diff -u carob/test/01-Unit/TestStringCodecs.hpp:1.2
carob/test/01-Unit/TestStringCodecs.hpp:1.3
--- carob/test/01-Unit/TestStringCodecs.hpp:1.2 Thu Mar 23 17:10:04 2006
+++ carob/test/01-Unit/TestStringCodecs.hpp Thu Jul 27 17:10:53 2006
@@ -33,6 +33,10 @@
/** Suite of tests to be run */
static CppUnit::Test* suite();
+ /**
+ * Encode various strings in different locales and checks that decoding
+ * returns the same string
+ */
void encode_decode();
};
Index: carob/test/30-ResultSet/TestSimpleUnicode.hpp
diff -u carob/test/30-ResultSet/TestSimpleUnicode.hpp:1.1
carob/test/30-ResultSet/TestSimpleUnicode.hpp:1.2
--- carob/test/30-ResultSet/TestSimpleUnicode.hpp:1.1 Fri Dec 16 22:24:28 2005
+++ carob/test/30-ResultSet/TestSimpleUnicode.hpp Thu Jul 27 17:10:53 2006
@@ -25,7 +25,8 @@
#include "../ConnectionSetup.hpp"
/**
- * TODO
+ * Unicode support testing.
+ * TODO: add more tests
*/
class TestSimpleUnicode : public ConnectionSetup
{
@@ -33,7 +34,10 @@
/** Suite of tests to be run */
static CppUnit::Test* suite();
-
+ /**
+ * Writes exotic (greek) unicode characters in a table and checks that when
+ * read back, the data is identical
+ */
void testBasic();
};
Index: carob/test/40-Parameter-PreparedStatement/TestIEEE754.hpp
diff -u carob/test/40-Parameter-PreparedStatement/TestIEEE754.hpp:1.3
carob/test/40-Parameter-PreparedStatement/TestIEEE754.hpp:1.4
--- carob/test/40-Parameter-PreparedStatement/TestIEEE754.hpp:1.3 Mon Feb
27 17:13:36 2006
+++ carob/test/40-Parameter-PreparedStatement/TestIEEE754.hpp Thu Jul 27
17:10:53 2006
@@ -24,7 +24,9 @@
#include "SQLDataSerialization.hpp"
/**
- * Test for IEEE754 double and floats
+ * Test for IEEE754 double and floats.<br>
+ * Creates a table with columns int, float and double, then checks that the
data
+ * read-back is consistent with the data just written
*/
class TestIEEE754 : public ConnectionSetup
{
@@ -32,8 +34,14 @@
/** Suite of tests to be run */
static CppUnit::Test* suite();
+ /**
+ * Write/read basic numbers such as types boundaries
+ */
void testBasic();
+ /**
+ * Write/read with infinity and 'Not A Number' values
+ */
void testInfNaN();
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits