Date: Thursday, July 27, 2006 @ 17:10:42
Author: gilles
Path: /cvsroot/carob/carob
Modified: include/BigDecimal.hpp (1.25 -> 1.26) include/Common.hpp (1.44
-> 1.45) include/DriverResultSet.hpp (1.44 -> 1.45)
src/BigDecimal.cpp (1.28 -> 1.29) src/Common.cpp (1.42 -> 1.43)
src/Connection.cpp (1.82 -> 1.83) src/ConnectionParameters.cpp
(1.21 -> 1.22) src/ControllerPool.cpp (1.1 -> 1.2)
src/DriverResultSet.cpp (1.58 -> 1.59) src/JavaSocket.cpp (1.49
-> 1.50) src/ParameterStatement.cpp (1.30 -> 1.31)
src/ResultSetMetaData.cpp (1.9 -> 1.10) src/Statement.cpp (1.30
-> 1.31) test/20-Write/TestExecWriteRequest.cpp (1.2 -> 1.3)
test/30-ResultSet/TestBigDecimal.cpp (1.10 -> 1.11)
test/30-ResultSet/TestBigDecimal.hpp (1.3 -> 1.4)
test/35-ResultList/TestExec.cpp (1.2 -> 1.3)
test/40-Parameter-PreparedStatement/TestParameterStatement.cpp
(1.13 -> 1.14) test/CarobTestLauncher.cpp (1.32 -> 1.33)
Introduced toUserString() utility function - to be used for user output (old
toWString function remains for internal use, ie. data exchange with controller)
Changed (again!) BigDecimal::toString to take a locale as parameter and to
format strings according to the given locale (with eventual thousand separators)
Fixed/enhanced BigDecimal test to test with different locales (btw, correctly
tests BigDecimal::toString function)
----------------------------------------------------------------+
include/BigDecimal.hpp | 17 +
include/Common.hpp | 23 ++
include/DriverResultSet.hpp | 4
src/BigDecimal.cpp | 30 ++
src/Common.cpp | 22 ++
src/Connection.cpp | 30 +-
src/ConnectionParameters.cpp | 2
src/ControllerPool.cpp | 16 -
src/DriverResultSet.cpp | 100 ++++-----
src/JavaSocket.cpp | 12 -
src/ParameterStatement.cpp | 2
src/ResultSetMetaData.cpp | 4
src/Statement.cpp | 8
test/20-Write/TestExecWriteRequest.cpp | 2
test/30-ResultSet/TestBigDecimal.cpp | 110
++++++----
test/30-ResultSet/TestBigDecimal.hpp | 22 +-
test/35-ResultList/TestExec.cpp | 2
test/40-Parameter-PreparedStatement/TestParameterStatement.cpp | 6
test/CarobTestLauncher.cpp | 1
19 files changed, 267 insertions(+), 146 deletions(-)
Index: carob/include/BigDecimal.hpp
diff -u carob/include/BigDecimal.hpp:1.25 carob/include/BigDecimal.hpp:1.26
--- carob/include/BigDecimal.hpp:1.25 Wed Jul 26 17:11:57 2006
+++ carob/include/BigDecimal.hpp Thu Jul 27 17:10:42 2006
@@ -121,7 +121,7 @@
* @param bd value to be serialized
*/
friend std::basic_ostream<wchar_t>& operator <<
(std::basic_ostream<wchar_t>& os,
- const BigDecimal &bd) { return os<<bd.toString(controllerDecimalPoint);
}
+ const BigDecimal &bd) { return os<<bd.toString(std::locale::classic());
}
/**
* Constructor to deserialize a BigDecimal from a stream.
* @param input socket from which to deserializer Big Decimal
@@ -141,11 +141,18 @@
*/
operator std::wstring() const;
/**
- * Conversion to string with the given decimal point
- * A leading minus sign is used to indicate sign, and the number of digits to
- * the right of the decimal point is used to indicate scale.
+ * Conversion to string with the given locale.<br>
+ * Adds optionnal leading minus sign, decimal point and thousand separator.
+ * Decimal and thousand separators are taken from the given locale.<br>
+ * Note that the locale's grouping property is only used to determine if a
+ * grouping must be done. If so, grouping is assumed to be "\003" whatever
+ * the locale is (eg. 12345 will always be "12<sep>345").<br>
+ * <i>This function is mandatory due to the internal representation that we
use
+ * (full number + scale), which doesn't allow to use gmp's or stl's
+ * functions.</i>
+ * @param loc the locale to be used for string conversion
*/
- std::wstring toString(const wchar_t) const;
+ std::wstring toString(const std::locale& loc) const;
/**
* Conversion to int.
* Any fractional part of this BigDecimal will be discarded, and if the
Index: carob/include/Common.hpp
diff -u carob/include/Common.hpp:1.44 carob/include/Common.hpp:1.45
--- carob/include/Common.hpp:1.44 Fri May 5 19:00:56 2006
+++ carob/include/Common.hpp Thu Jul 27 17:10:42 2006
@@ -177,7 +177,8 @@
/**
- * Converts any type to wstring
+ * Converts any type to wstring using C locale (locale independant). To be used
+ * for internal conversions
* Implemented so far:
* char
* wchar_t
@@ -195,6 +196,26 @@
template <class T> std::wstring toWString(const T& t);
/**
+ * Converts any type to wstring using user current locale (ie. std::locale()).
+ * To be used for user-oriented info (logs, exception)
+ * Implemented so far:
+ * char
+ * wchar_t
+ * uint16_t
+ * int16_t
+ * uint32_t
+ * int64_t
+ * uint64_t
+ * int
+ * long
+ * float
+ * double
+ * @see toWString(const T&)
+ * @return a wstring representation of the given argument
+ */
+template <class T> std::wstring toUserString(const T& t);
+
+/**
* Converts the given wstring to any given type.
* Uses wistringstream >> operator.
* Ignores whitespaces and eventual characters following the number.
Index: carob/include/DriverResultSet.hpp
diff -u carob/include/DriverResultSet.hpp:1.44
carob/include/DriverResultSet.hpp:1.45
--- carob/include/DriverResultSet.hpp:1.44 Wed Jul 26 17:11:57 2006
+++ carob/include/DriverResultSet.hpp Thu Jul 27 17:10:42 2006
@@ -154,7 +154,7 @@
/**
* Gets the string value of a column in the current row only if the given
* column is of string type. Throws an exception otherwise. To get the value
- * as a string anyway, use #getAsString(int)
+ * as a string anyway, use #getAsString(int, const std::locale&)
*
* @param columnIndex the first column is 1, the second is 2...
* @return the column value, null for SQL NULL
@@ -179,7 +179,7 @@
* out of bounds
* @throw NullValueException if the retrieved value is NULL
*/
- std::wstring getAsString(int columnIndex, std::locale loc =
std::locale(""))
+ std::wstring getAsString(int columnIndex, const std::locale&
loc = std::locale())
throw (DriverException, NullValueException,
NotImplementedException,
UnexpectedException);
/**
Index: carob/src/BigDecimal.cpp
diff -u carob/src/BigDecimal.cpp:1.28 carob/src/BigDecimal.cpp:1.29
--- carob/src/BigDecimal.cpp:1.28 Fri May 5 19:00:56 2006
+++ carob/src/BigDecimal.cpp Thu Jul 27 17:10:42 2006
@@ -85,7 +85,7 @@
{
//double decimal point => exception
throw ConversionException(L"Detected more than one decimal point [" +
- toWString(userDecimalPoint) + L"] in BigDecimal string ["+
fromString(str) + L"]", CONV_NUM_RANGE);
+ toUserString(userDecimalPoint) + L"] in BigDecimal string ["+
fromString(str) + L"]", CONV_NUM_RANGE);
}
// remove the decimal point (actually replace it by a space)
unscaledStr.replace(i, 1, " ");
@@ -327,12 +327,15 @@
BigDecimal::operator wstring() const
{
- return toString(userDecimalPoint); //use user-defined locale
+ return toString(std::locale::classic()); //use user-defined locale
}
// FIXME: this function can be optimized: lots of front-inserts can be avoided
-std::wstring BigDecimal::toString(const wchar_t decimal_point) const
+std::wstring BigDecimal::toString(const std::locale& loc) const
{
+ wchar_t decimalPoint = std::use_facet< std::numpunct<wchar_t>
>(loc).decimal_point();
+ wchar_t thousandsSep = std::use_facet< std::numpunct<wchar_t>
>(loc).thousands_sep();
+ bool groupIt = std::use_facet< std::numpunct<wchar_t> >(loc).grouping() !=
"";
//convert to string, then to wstring (no direct mpz->wstring converter)
// First compute space needed by the resulting string
// number of digits in the unscaled value
@@ -349,6 +352,10 @@
// space for the heading '-' (minus) sign
if (signum < 0)
size_needed++;
+ // and room for the possible thousand separators
+ int nbDec = nbDigits-scale;
+ if (nbDec > 0 && groupIt)
+ size_needed += nbDec/3 - (nbDec%3 == 0 ? 1 : 0);
char* as_string = new char[size_needed+1]; // +1 for the \0
gmp_snprintf(as_string, nbDigits+1, "%Zd", unscaled_value);
@@ -365,7 +372,22 @@
static_cast<size_t>(scale - sRetLength + 1), L'0');
}
// insert the decimal point
- sRet.insert(sRet.length()-scale, 1, decimal_point);
+ sRet.insert(sRet.length()-scale, 1, decimalPoint);
+ }
+ //insert thousand separators if needed
+ if (nbDec > 0 && groupIt)
+ {
+ int tCount = 0; // counts the number of digits starting from the least
significant decimal
+ int idx = sRet.length();
+ if (scale > 0)
+ idx = idx - scale-1; // don't count fractional part and separator
+ while (idx > 0)
+ {
+ if (tCount>0 && tCount%3 == 0)
+ sRet.insert(idx, 1, thousandsSep);
+ tCount++;
+ idx--;
+ }
}
// and the optional sign
if (signum < 0)
Index: carob/src/Common.cpp
diff -u carob/src/Common.cpp:1.42 carob/src/Common.cpp:1.43
--- carob/src/Common.cpp:1.42 Wed Jul 26 17:11:57 2006
+++ carob/src/Common.cpp Thu Jul 27 17:10:42 2006
@@ -337,6 +337,28 @@
template wstring CarobNS::toWString<float>(const float&);
template wstring CarobNS::toWString<double>(const double&);
+// locale dependant conversions
+template <class T> wstring CarobNS::toUserString(const T& t)
+{
+ std::wostringstream buffer;
+ // imbue with user's locale
+ buffer.imbue(std::locale());
+ buffer << t;
+ return buffer.str();
+}
+
+template wstring CarobNS::toUserString<char>(const char&);
+template wstring CarobNS::toUserString<wchar_t>(const wchar_t&);
+template wstring CarobNS::toUserString<uint16_t>(const uint16_t&);
+template wstring CarobNS::toUserString<int16_t>(const int16_t&);
+template wstring CarobNS::toUserString<uint32_t>(const uint32_t&);
+template wstring CarobNS::toUserString<int64_t>(const int64_t&);
+template wstring CarobNS::toUserString<uint64_t>(const uint64_t&);
+template wstring CarobNS::toUserString<int>(const int&);
+template wstring CarobNS::toUserString<long>(const long&);
+template wstring CarobNS::toUserString<float>(const float&);
+template wstring CarobNS::toUserString<double>(const double&);
+
template <class T> bool CarobNS::wstringTo(T& t, const std::wstring& s)
{
std::wistringstream iss(s);
Index: carob/src/Connection.cpp
diff -u carob/src/Connection.cpp:1.82 carob/src/Connection.cpp:1.83
--- carob/src/Connection.cpp:1.82 Wed Jul 26 16:31:47 2006
+++ carob/src/Connection.cpp Thu Jul 27 17:10:42 2006
@@ -146,7 +146,7 @@
if (ack != ControllerPrompt)
throw ProtocolException(
L"Protocol corruption while trying to send command: "
- + toWString(command) + L". Check the previous command");
+ + toUserString(command) + L". Check the previous command");
socket<<CommandPrefix;
socket<<static_cast<int32_t>(command);
}
@@ -163,7 +163,7 @@
if (isInfoEnabled())
logInfo(fctName, L"Authenticating with controller "
+ connected_controller.getHostName() + L":"
- +
toWString(static_cast<int>(connected_controller.getHostPort())));
+ +
toUserString(static_cast<int>(connected_controller.getHostPort())));
try
{
//Here is the connection protocol...
@@ -186,7 +186,7 @@
{
wstring msg = L"Unable to connect to controller on "
+ connected_controller.getHostName()
- + L":" +
toWString(static_cast<int>(connected_controller.getHostPort()))
+ + L":" +
toUserString(static_cast<int>(connected_controller.getHostPort()))
+ L" (" + connExcpt.description() + L").";
if (isErrorEnabled())
logError(fctName, msg);
@@ -195,7 +195,7 @@
catch (SocketIOException sockIOExcpt)
{
wstring msg = L"Could not authentify to " +
connected_controller.getHostName()
- + L":" +
toWString(static_cast<int>(connected_controller.getHostPort()));
+ + L":" +
toUserString(static_cast<int>(connected_controller.getHostPort()));
if (!protocolVersionSend)
{
msg+=L". Error while sending protocol version ("
@@ -446,7 +446,7 @@
autoCommit = false;
if (isDebugEnabled())
- logDebug(fctName, L"Transaction" + toWString(transactionId)
+ logDebug(fctName, L"Transaction" + toUserString(transactionId)
+ L" has been started");
}
}
@@ -500,9 +500,9 @@
{
throw (ProtocolException(
L"Protocol error during commit (acknowledge transaction ID = "
- + toWString(acknowledgedTransactionId)
+ + toUserString(acknowledgedTransactionId)
+ L", expected transaction ID = "
- + toWString(transactionId) + L")"));
+ + toUserString(transactionId) + L")"));
}
// Commit must be followed by a BEGIN
mustBeginTransaction = true;
@@ -515,8 +515,8 @@
{
throw (DriverException(
L"Error during commit failover (acknowledge transaction ID = "
- + toWString(acknowledgedTransactionId)
- + L", expected transaction ID = " + toWString(transactionId) +
L")"));
+ + toUserString(acknowledgedTransactionId)
+ + L", expected transaction ID = " + toUserString(transactionId) +
L")"));
}
// The controller will automatically redo the commit if it was not done
@@ -551,9 +551,9 @@
{
throw (ProtocolException(
L"Protocol error during rollback (acknowledge transaction ID = "
- + toWString(acknowledgedTransactionId)
+ + toUserString(acknowledgedTransactionId)
+ L", expected transaction ID = "
- + toWString(transactionId) + L")"));
+ + toUserString(transactionId) + L")"));
}
// Rollback is followed by a BEGIN
mustBeginTransaction = true;
@@ -566,8 +566,8 @@
{
throw (DriverException(
L"Error during rollback failover (acknowledge transaction ID = "
- + toWString(acknowledgedTransactionId)
- + L", expected transaction ID = " + toWString(transactionId) +
L")"));
+ + toUserString(acknowledgedTransactionId)
+ + L", expected transaction ID = " + toUserString(transactionId) +
L")"));
}
// The controller will automatically redo the rollback if it was not
// done earlier so we can safely return here, this is a success.
@@ -880,7 +880,7 @@
*driverSocketPtr<<cursorName;
*driverSocketPtr<<fetchSize;
if (isDebugEnabled())
- logDebug(fctName, L"Fetching next " + toWString(fetchSize) + L" rows.");
+ logDebug(fctName, L"Fetching next " + toUserString(fetchSize) + L" rows.");
TypeTag tag(*driverSocketPtr);
if (tag == TT_EXCEPTION)
@@ -1094,7 +1094,7 @@
receiveException();
throw ProtocolException(L"Expected a resultset, received unexpected tag: "
- + toWString(static_cast<int>(tag)));
+ + toUserString(static_cast<int>(tag)));
//just to avoid compiler warnings
return NULL;
}
Index: carob/src/ConnectionParameters.cpp
diff -u carob/src/ConnectionParameters.cpp:1.21
carob/src/ConnectionParameters.cpp:1.22
--- carob/src/ConnectionParameters.cpp:1.21 Wed Jul 26 16:31:47 2006
+++ carob/src/ConnectionParameters.cpp Thu Jul 27 17:10:42 2006
@@ -87,7 +87,7 @@
{
std::wostringstream buffer;
buffer<<host_name<<L":"<<host_port;
- return host_name+L":"+toWString(static_cast<int>(host_port));
+ return host_name+L":"+toUserString(static_cast<int>(host_port));
}
////////////////////////////////////////////////////////////////////////////////
Index: carob/src/ControllerPool.cpp
diff -u carob/src/ControllerPool.cpp:1.1 carob/src/ControllerPool.cpp:1.2
--- carob/src/ControllerPool.cpp:1.1 Wed Jul 26 16:31:47 2006
+++ carob/src/ControllerPool.cpp Thu Jul 27 17:10:42 2006
@@ -114,7 +114,7 @@
{
if (isErrorEnabled())
{
- logError(fctName, L"Select returned error #"+toWString(errno));
+ logError(fctName, L"Select returned error #"+toUserString(errno));
}
return;
}
@@ -139,7 +139,7 @@
logDebug(fctName, L"Controller "
+ static_cast<wstring>((*iter).controllerInfo)
+ L" is up again. Removing it from the list of suspects (list
size="
- + toWString(suspected_controllers.size())+L")");
+ + toUserString(suspected_controllers.size())+L")");
}
//send ping and close socket
(*iter).pingSocketPtr->writeJavaInt(Ping);
@@ -203,7 +203,7 @@
if (isDebugEnabled())
logDebug(fctName, L"Controller " + static_cast<wstring>(controllerInfo)
+ L" is now suspected of failure (list size="
- + toWString(suspected_controllers.size())+L")");
+ + toUserString(suspected_controllers.size())+L")");
return;
}
}
@@ -228,7 +228,7 @@
{
logDebug(fctName, L"Controller " + static_cast<wstring>(controllerInfo)
+ L" has been removed from suspect list (list size="
- + toWString(suspected_controllers.size())+L")");
+ + toUserString(suspected_controllers.size())+L")");
}
return;
}
@@ -253,7 +253,7 @@
{
sRet += L"[" + static_cast<wstring>(controller_list[i]) + L"]";
}
- sRet += L" - Ref counter=" + toWString(ref_counter);
+ sRet += L" - Ref counter=" + toUserString(ref_counter);
return sRet;
}
@@ -291,12 +291,12 @@
if (lastTestedControllerWasSuspect)
{
throw NoMoreControllerException(L"All "
- + toWString(suspected_controllers.size())
+ +
toUserString(suspected_controllers.size())
+ L" controllers down");
}
}
if (isDebugEnabled())
- logDebug(fctName, L"Selected controller[" + toWString(index) + L"]:"
+ logDebug(fctName, L"Selected controller[" + toUserString(index) + L"]:"
+ static_cast<wstring>(controller_list[index]));
return controller_list[index];
}
@@ -332,7 +332,7 @@
new_pool = new RoundRobinControllerPool(ctrls);
break;
default:
- throw DriverException(L"Unsupported connection policy #" +
toWString(static_cast<int>(cp)));
+ throw DriverException(L"Unsupported connection policy #" +
toUserString(static_cast<int>(cp)));
}
new_pool->addRef();
pool_map[idx] = static_cast<AbstractControllerPool*>(new_pool);
Index: carob/src/DriverResultSet.cpp
diff -u carob/src/DriverResultSet.cpp:1.58 carob/src/DriverResultSet.cpp:1.59
--- carob/src/DriverResultSet.cpp:1.58 Wed Jul 26 17:11:57 2006
+++ carob/src/DriverResultSet.cpp Thu Jul 27 17:10:42 2006
@@ -190,9 +190,9 @@
DriverResultSet::operator wstring()
{
wstring sRet;
- sRet+=toWString(nbOfRows)+L" rows - ";
- sRet+=toWString(nbOfColumns)+L" columns - ";
- sRet+=L"current row:" +toWString(currentRow)+L" - ";
+ sRet+=toUserString(nbOfRows)+L" rows - ";
+ sRet+=toUserString(nbOfColumns)+L" columns - ";
+ sRet+=L"current row:" +toUserString(currentRow)+L" - ";
sRet+=hasMoreData?L"[has more data/":L"[no more data/";
sRet+=isClosed?L"closed]":L"not closed]";
return sRet;
@@ -254,26 +254,26 @@
checkRowAndColPosAndSetNullFlag(columnIndex);
if (wasNullFlag)
{
- throw (NullValueException(L"getString: value at row " +
toWString(currentRow)
- + L" column " + toWString(columnIndex) + L" is NULL"));
+ throw (NullValueException(L"getString: value at row " +
toUserString(currentRow)
+ + L" column " + toUserString(columnIndex) + L" is NULL"));
}
if (columnTypeTags[columnIndex - 1] != TT_STRING)
{
- throw (DriverException(L"getString: value at row " + toWString(currentRow)
- + L" column " + toWString(columnIndex) + L" is not of type string"));
+ throw (DriverException(L"getString: value at row " +
toUserString(currentRow)
+ + L" column " + toUserString(columnIndex) + L" is not of type
string"));
}
return (*(static_cast<wstring*>((data[currentRow][columnIndex -
1].as_other))));
}
-wstring DriverResultSet::getAsString(int columnIndex, std::locale
loc/*=std::locale("")*/)
+wstring DriverResultSet::getAsString(int columnIndex, const std::locale&
loc/*=std::locale()*/)
throw (DriverException, NullValueException, NotImplementedException,
UnexpectedException)
{
checkRowAndColPosAndSetNullFlag(columnIndex);
if (wasNullFlag)
{
- throw (NullValueException(L"getString: value at row " +
toWString(currentRow)
- + L" column " + toWString(columnIndex) + L" is NULL"));
+ throw (NullValueException(L"getString: value at row " +
toUserString(currentRow)
+ + L" column " + toUserString(columnIndex) + L" is NULL"));
}
std::wostringstream buffer;
@@ -288,7 +288,7 @@
case TT_BIGDECIMAL:
{
BigDecimal* bd = (static_cast<BigDecimal*>((data[currentRow][columnIndex
- 1].as_other)));
- buffer << bd->toString(std::use_facet< std::numpunct<wchar_t>
>(loc).decimal_point());
+ buffer << bd->toString(loc);
break;
}
case TT_BOOLEAN:
@@ -337,14 +337,14 @@
if (wasNullFlag)
{
- throw (NullValueException(L"getInt: Value at row " + toWString(currentRow)
- + L" column " + toWString(columnIndex) + L" is NULL"));
+ throw (NullValueException(L"getInt: Value at row " +
toUserString(currentRow)
+ + L" column " + toUserString(columnIndex) + L" is NULL"));
}
if (columnTypeTags[columnIndex - 1] != TT_INTEGER)
{
- throw (DriverException(L"getInt: Value at row " + toWString(currentRow)
- + L" column " + toWString(columnIndex) + L" is not of type integer"));
+ throw (DriverException(L"getInt: Value at row " + toUserString(currentRow)
+ + L" column " + toUserString(columnIndex) + L" is not of type
integer"));
}
return ((data[currentRow])[columnIndex - 1]).as_int;
@@ -358,8 +358,8 @@
if (wasNullFlag)
{
- throw (NullValueException(L"getInt: Value at row " + toWString(currentRow)
- + L" column " + toWString(columnIndex) + L" is NULL"));
+ throw (NullValueException(L"getInt: Value at row " +
toUserString(currentRow)
+ + L" column " + toUserString(columnIndex) + L" is NULL"));
}
int ret = -1;
@@ -441,14 +441,14 @@
if (wasNullFlag)
{
- throw (NullValueException(L"getInt64: Value at row " +
toWString(currentRow)
- + L" column " + toWString(columnIndex) + L" is NULL"));
+ throw (NullValueException(L"getInt64: Value at row " +
toUserString(currentRow)
+ + L" column " + toUserString(columnIndex) + L" is NULL"));
}
if (columnTypeTags[columnIndex - 1] != TT_LONG)
{
- throw (DriverException(L"getInt64: Value at row " + toWString(currentRow)
- + L" column " + toWString(columnIndex) + L" is not of type integer"));
+ throw (DriverException(L"getInt64: Value at row " +
toUserString(currentRow)
+ + L" column " + toUserString(columnIndex) + L" is not of type
integer"));
}
return ((data[currentRow])[columnIndex - 1]).as_long;
@@ -462,8 +462,8 @@
if (wasNullFlag)
{
- throw (NullValueException(L"getAsInt64: Value at row " +
toWString(currentRow)
- + L" column " + toWString(columnIndex) + L" is NULL"));
+ throw (NullValueException(L"getAsInt64: Value at row " +
toUserString(currentRow)
+ + L" column " + toUserString(columnIndex) + L" is NULL"));
}
int64_t ret = -1;
@@ -546,8 +546,8 @@
if (wasNullFlag)
{
- throw (NullValueException(L"getAsUInt64: Value at row " +
toWString(currentRow)
- + L" column " + toWString(columnIndex) + L" is NULL"));
+ throw (NullValueException(L"getAsUInt64: Value at row " +
toUserString(currentRow)
+ + L" column " + toUserString(columnIndex) + L" is NULL"));
}
uint64_t ret = 0;
@@ -631,14 +631,14 @@
if (wasNullFlag)
{
- throw (NullValueException(L"getFloat: Value at row " +
toWString(currentRow)
- + L" column " + toWString(columnIndex) + L" is NULL"));
+ throw (NullValueException(L"getFloat: Value at row " +
toUserString(currentRow)
+ + L" column " + toUserString(columnIndex) + L" is NULL"));
}
if (columnTypeTags[columnIndex - 1] != TT_FLOAT)
{
- throw (DriverException(L"getFloat: Value at row " + toWString(currentRow)
- + L" column " + toWString(columnIndex) + L" is not of type float"));
+ throw (DriverException(L"getFloat: Value at row " +
toUserString(currentRow)
+ + L" column " + toUserString(columnIndex) + L" is not of type float"));
}
return ((data[currentRow])[columnIndex - 1]).as_float;
@@ -652,8 +652,8 @@
if (wasNullFlag)
{
- throw (NullValueException(L"getAsFloat: Value at row " +
toWString(currentRow)
- + L" column " + toWString(columnIndex) + L" is NULL"));
+ throw (NullValueException(L"getAsFloat: Value at row " +
toUserString(currentRow)
+ + L" column " + toUserString(columnIndex) + L" is NULL"));
}
float ret = -1;
@@ -735,14 +735,14 @@
if (wasNullFlag)
{
- throw (NullValueException(L"getDouble: Value at row " +
toWString(currentRow)
- + L" column " + toWString(columnIndex) + L" is NULL"));
+ throw (NullValueException(L"getDouble: Value at row " +
toUserString(currentRow)
+ + L" column " + toUserString(columnIndex) + L" is NULL"));
}
if (columnTypeTags[columnIndex - 1] != TT_DOUBLE)
{
- throw (DriverException(L"getDouble: Value at row " + toWString(currentRow)
- + L" column " + toWString(columnIndex) + L" is not of type double"));
+ throw (DriverException(L"getDouble: Value at row " +
toUserString(currentRow)
+ + L" column " + toUserString(columnIndex) + L" is not of type
double"));
}
return ((data[currentRow])[columnIndex - 1]).as_double;
@@ -756,8 +756,8 @@
if (wasNullFlag)
{
- throw (NullValueException(L"getAsDouble: Value at row " +
toWString(currentRow)
- + L" column " + toWString(columnIndex) + L" is NULL"));
+ throw (NullValueException(L"getAsDouble: Value at row " +
toUserString(currentRow)
+ + L" column " + toUserString(columnIndex) + L" is NULL"));
}
double ret = -1;
@@ -839,14 +839,14 @@
if (wasNullFlag)
{
- throw (NullValueException(L"getTimeStamp: Value at row " +
toWString(currentRow)
- + L" column " + toWString(columnIndex) + L" is NULL"));
+ throw (NullValueException(L"getTimeStamp: Value at row " +
toUserString(currentRow)
+ + L" column " + toUserString(columnIndex) + L" is NULL"));
}
if (columnTypeTags[columnIndex - 1] != TT_SQL_TIMESTAMP)
{
- throw (DriverException(L"getTimeStamp: Value at row " +
toWString(currentRow)
- + L" column " + toWString(columnIndex) + L" is not of type
timestamp"));
+ throw (DriverException(L"getTimeStamp: Value at row " +
toUserString(currentRow)
+ + L" column " + toUserString(columnIndex) + L" is not of type
timestamp"));
}
return *static_cast<SQLTimeStamp*>((data[currentRow][columnIndex -
1].as_other));
@@ -859,15 +859,15 @@
if (wasNullFlag)
{
- throw (NullValueException(L"getLargeData: Value at row " +
toWString(currentRow)
- + L" column " + toWString(columnIndex) + L" is NULL"));
+ throw (NullValueException(L"getLargeData: Value at row " +
toUserString(currentRow)
+ + L" column " + toUserString(columnIndex) + L" is NULL"));
}
if (!(columnTypeTags[columnIndex - 1] == TT_BLOB ||
columnTypeTags[columnIndex - 1] == TT_CLOB ||
columnTypeTags[columnIndex - 1] == TT_BYTE_ARRAY))
{
- throw (DriverException(L"getLargeData: Value at row " +
toWString(currentRow)
- + L" column " + toWString(columnIndex) + L" is not of type blob, clob
or byte array"));
+ throw (DriverException(L"getLargeData: Value at row " +
toUserString(currentRow)
+ + L" column " + toUserString(columnIndex) + L" is not of type blob,
clob or byte array"));
}
return *static_cast<LargeData*>((data[currentRow][columnIndex -
1].as_other));
@@ -880,14 +880,14 @@
if (wasNullFlag)
{
- throw (NullValueException(L"getBigDecimal: Value at row " +
toWString(currentRow)
- + L" column " + toWString(columnIndex) + L" is NULL"));
+ throw (NullValueException(L"getBigDecimal: Value at row " +
toUserString(currentRow)
+ + L" column " + toUserString(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"));
+ throw (DriverException(L"getBigDecimal: Value at row " +
toUserString(currentRow)
+ + L" column " + toUserString(columnIndex) + L" is not of type
BigDecimal"));
}
return *static_cast<BigDecimal*>((data[currentRow][columnIndex -
1].as_other));
@@ -985,7 +985,7 @@
if (columnIndex < 1 || columnIndex > nbOfColumns)
throw DriverException(L"Column Index out of range ( "
- + toWString(columnIndex) + L" > " + toWString(nbOfColumns) + L").");
+ + toUserString(columnIndex) + L" > " + toUserString(nbOfColumns) +
L").");
if (static_cast<int>(data[currentRow].size())<columnIndex-1)
answer = true;
Index: carob/src/JavaSocket.cpp
diff -u carob/src/JavaSocket.cpp:1.49 carob/src/JavaSocket.cpp:1.50
--- carob/src/JavaSocket.cpp:1.49 Wed Jul 19 18:54:30 2006
+++ carob/src/JavaSocket.cpp Thu Jul 27 17:10:42 2006
@@ -172,7 +172,7 @@
if (resp==0)
{
if (isInfoEnabled())
- logInfo(fctName, L"Connection to "+host+L":"+toWString(port)+L"
succeeded");
+ logInfo(fctName, L"Connection to "+host+L":"+toUserString(port)+L"
succeeded");
freeaddrinfo(addressInfoList);
connected = true;
return true;
@@ -187,7 +187,7 @@
}
//if we get here, it means we could'nt connect to any of the addresses
found...
freeaddrinfo(addressInfoList);
- throw ConnectionException(L"Unable to connect. Last error code was
"+toWString(errno));
+ throw ConnectionException(L"Unable to connect. Last error code was
"+toUserString(errno));
connected = false;
return false;
}
@@ -205,9 +205,9 @@
{
wstring msg(L"Could not close socket. Error code is ");
#ifdef __WIN32__
- msg += toWString(WSAGetLastError());
+ msg += toUserString(WSAGetLastError());
#else
- msg += toWString(errno);
+ msg += toUserString(errno);
#endif
throw SocketIOException(msg);
return false;
@@ -381,8 +381,8 @@
if (ret != len)
{
// should never happen
- throw SocketIOException(L'(' + fctName + L"): only " + toWString(ret)
- + L"/" + toWString(len) + L" bytes send while sending " + objName
+ throw SocketIOException(L'(' + fctName + L"): only " + toUserString(ret)
+ + L"/" + toUserString(len) + L" bytes send while sending " + objName
+ L" to socket");
}
}
Index: carob/src/ParameterStatement.cpp
diff -u carob/src/ParameterStatement.cpp:1.30
carob/src/ParameterStatement.cpp:1.31
--- carob/src/ParameterStatement.cpp:1.30 Thu May 11 15:42:51 2006
+++ carob/src/ParameterStatement.cpp Thu Jul 27 17:10:42 2006
@@ -415,7 +415,7 @@
if (iparam->empty())
{
if (throwException)
- throw DriverException(L"Parameter " + toWString(i) + L" is incorrect");
+ throw DriverException(L"Parameter " + toUserString(i) + L" is
incorrect");
else
sbuf << L"?";
}
Index: carob/src/ResultSetMetaData.cpp
diff -u carob/src/ResultSetMetaData.cpp:1.9 carob/src/ResultSetMetaData.cpp:1.10
--- carob/src/ResultSetMetaData.cpp:1.9 Tue Jan 24 19:37:27 2006
+++ carob/src/ResultSetMetaData.cpp Thu Jul 27 17:10:42 2006
@@ -45,8 +45,8 @@
UnexpectedException)
{
if ((column < 1) || (column > resultSetPtr->nbOfColumns))
- throw DriverException(L"Invalid column index " + toWString(column)
- + L" is not between 1 and " + toWString(resultSetPtr->nbOfColumns));
+ throw DriverException(L"Invalid column index " + toUserString(column)
+ + L" is not between 1 and " + toUserString(resultSetPtr->nbOfColumns));
}
bool ResultSetMetaData::isAutoIncrement(int column) throw (DriverException,
UnexpectedException)
Index: carob/src/Statement.cpp
diff -u carob/src/Statement.cpp:1.30 carob/src/Statement.cpp:1.31
--- carob/src/Statement.cpp:1.30 Wed Jul 5 09:26:05 2006
+++ carob/src/Statement.cpp Thu Jul 27 17:10:42 2006
@@ -233,7 +233,7 @@
{
if (seconds < 0)
{
- throw DriverException(L"Invalid query timeout value: " +
toWString(seconds));
+ throw DriverException(L"Invalid query timeout value: " +
toUserString(seconds));
}
timeout = seconds;
}
@@ -244,7 +244,7 @@
// The spec forgets the case maxRows = 0.
|| 0 < maxRows && maxRows < rows)
{
- throw DriverException(L"Invalid fetch size value: " + toWString(rows));
+ throw DriverException(L"Invalid fetch size value: " + toUserString(rows));
}
fetchSize = rows;
}
@@ -260,7 +260,7 @@
break;
default :
throw DriverException(L"Invalid ResultSet concurrency mode: "
- + toWString(value));
+ + toUserString(value));
}
}
@@ -268,7 +268,7 @@
{
if (max < 0)
{
- throw DriverException(L"Invalid max rows limit: " + toWString(max));
+ throw DriverException(L"Invalid max rows limit: " + toUserString(max));
}
// this may break fetchSize <= maxRows
maxRows = max;
Index: carob/test/20-Write/TestExecWriteRequest.cpp
diff -u carob/test/20-Write/TestExecWriteRequest.cpp:1.2
carob/test/20-Write/TestExecWriteRequest.cpp:1.3
--- carob/test/20-Write/TestExecWriteRequest.cpp:1.2 Fri Mar 3 16:54:13 2006
+++ carob/test/20-Write/TestExecWriteRequest.cpp Thu Jul 27 17:10:42 2006
@@ -93,7 +93,7 @@
if (isInfoEnabled())
{
logInfo(fctName, L"Update succeeded. Number of affected rows = "
- + toWString(nbRowsAffected));
+ + toUserString(nbRowsAffected));
}
CPPUNIT_ASSERT(nbRowsAffected == 1);
}
Index: carob/test/30-ResultSet/TestBigDecimal.cpp
diff -u carob/test/30-ResultSet/TestBigDecimal.cpp:1.10
carob/test/30-ResultSet/TestBigDecimal.cpp:1.11
--- carob/test/30-ResultSet/TestBigDecimal.cpp:1.10 Wed Jul 26 17:11:57 2006
+++ carob/test/30-ResultSet/TestBigDecimal.cpp Thu Jul 27 17:10:42 2006
@@ -104,67 +104,92 @@
statementPtr->executeUpdate(
L"UPDATE product SET cost = -9223372036854775807 WHERE id= " +
toWString(id++));
}
+void TestBigDecimal::testGetAsStringUsingCLocale()
+{
+ testGetAsString(std::locale::classic());
+}
+
+void TestBigDecimal::testGetAsStringUsingUserLocale()
+{
+ testGetAsString(std::locale(""));
+}
+
+void TestBigDecimal::testGetAsStringUsingFrLocale()
+{
+ testGetAsString(std::locale("fr_FR.UTF-8"));
+}
+
+void TestBigDecimal::testGetAsStringUsingUSLocale()
+{
+ testGetAsString(std::locale("en_US.utf8"));
+}
-void TestBigDecimal::testGetAsString()
+void TestBigDecimal::testGetAsString(const std::locale& loc)
{
+ std::locale::global(loc);
+ bool groupIt = std::use_facet< std::numpunct<wchar_t> >(loc).grouping() !=
"";
+ wstring thousandsSep(L"");
+ if (groupIt)
+ thousandsSep += std::use_facet< std::numpunct<wchar_t>
>(loc).thousands_sep();
+ wchar_t decimalSep = std::use_facet<std::numpunct<wchar_t>
>(loc).decimal_point();
wstring fctName(L"TestBigDecimal::testGetAsString");
Statement* statementPtr = NULL;
statementPtr = connectionPtr->createStatement();
DriverResultSet* drsPtr = statementPtr->executeQuery(L"SELECT * FROM
product");
drsPtr->next();
- logInfo(fctName, L"0 - getAsString=" + drsPtr->getAsString(3,
std::locale::classic()));
- CPPUNIT_ASSERT(drsPtr->getAsString(3, std::locale::classic()) == L"0");
+ logInfo(fctName, L"0 - getAsString=" + drsPtr->getAsString(3, loc));
+ CPPUNIT_ASSERT(drsPtr->getAsString(3, loc) == L"0");
drsPtr->next();
- logInfo(fctName, L"-0.5 - getAsString=" + drsPtr->getAsString(3,
std::locale::classic()));
- CPPUNIT_ASSERT(drsPtr->getAsString(3, std::locale::classic()) ==
toWString(-0.5));
+ logInfo(fctName, toUserString(-0.5) + L" - getAsString=" +
drsPtr->getAsString(3, loc));
+ CPPUNIT_ASSERT(drsPtr->getAsString(3, loc) == toUserString(-0.5));
drsPtr->next();
- logInfo(fctName, L"0.5 - getAsString=" + drsPtr->getAsString(3,
std::locale::classic()));
- CPPUNIT_ASSERT(drsPtr->getAsString(3, std::locale::classic()) ==
toWString(0.5));
+ logInfo(fctName, toUserString(0.5) + L" - getAsString=" +
drsPtr->getAsString(3, loc));
+ CPPUNIT_ASSERT(drsPtr->getAsString(3, loc) == toUserString(0.5));
drsPtr->next();
- logInfo(fctName, L"-1 - getAsString=" + drsPtr->getAsString(3,
std::locale::classic()));
- CPPUNIT_ASSERT(drsPtr->getAsString(3, std::locale::classic()) == L"-1");
+ logInfo(fctName, L"-1 - getAsString=" + drsPtr->getAsString(3, loc));
+ CPPUNIT_ASSERT(drsPtr->getAsString(3, loc) == L"-1");
drsPtr->next();
- logInfo(fctName, L"1 - getAsString=" + drsPtr->getAsString(3,
std::locale::classic()));
- CPPUNIT_ASSERT(drsPtr->getAsString(3, std::locale::classic()) == L"1");
+ logInfo(fctName, L"1 - getAsString=" + drsPtr->getAsString(3, loc));
+ CPPUNIT_ASSERT(drsPtr->getAsString(3, loc) == L"1");
drsPtr->next();
- logInfo(fctName, toWString(-12.34) + L" - getAsString=" +
drsPtr->getAsString(3, std::locale::classic()));
- CPPUNIT_ASSERT(drsPtr->getAsString(3, std::locale::classic()) ==
toWString(-12.34));
+ logInfo(fctName, toUserString(-12.34) + L" - getAsString=" +
drsPtr->getAsString(3, loc));
+ CPPUNIT_ASSERT(drsPtr->getAsString(3, loc) == toUserString(-12.34));
drsPtr->next();
- logInfo(fctName, toWString(12.34) + L" - getAsString=" +
drsPtr->getAsString(3, std::locale::classic()));
- CPPUNIT_ASSERT(drsPtr->getAsString(3, std::locale::classic()) ==
toWString(12.34));
+ logInfo(fctName, toUserString(12.34) + L" - getAsString=" +
drsPtr->getAsString(3, loc));
+ CPPUNIT_ASSERT(drsPtr->getAsString(3, loc) == toUserString(12.34));
drsPtr->next();
- logInfo(fctName, toWString(numeric_limits<int>::min()) + L" - getAsString="
+ drsPtr->getAsString(3, std::locale::classic()));
- CPPUNIT_ASSERT(drsPtr->getAsString(3, std::locale::classic()) ==
toWString(numeric_limits<int>::min()));
+ logInfo(fctName, toUserString(numeric_limits<int>::min()) + L" -
getAsString=" + drsPtr->getAsString(3, loc));
+ CPPUNIT_ASSERT(drsPtr->getAsString(3, loc) ==
toUserString(numeric_limits<int>::min()));
drsPtr->next();
- logInfo(fctName, toWString(numeric_limits<int>::max()) + L" - getAsString="
+ drsPtr->getAsString(3, std::locale::classic()));
- CPPUNIT_ASSERT(drsPtr->getAsString(3, std::locale::classic()) ==
toWString(numeric_limits<int>::max()));
+ logInfo(fctName, toUserString(numeric_limits<int>::max()) + L" -
getAsString=" + drsPtr->getAsString(3, loc));
+ CPPUNIT_ASSERT(drsPtr->getAsString(3, loc) ==
toUserString(numeric_limits<int>::max()));
drsPtr->next();
- logInfo(fctName, toWString(numeric_limits<long long>::min()) + L" -
getAsString=" + drsPtr->getAsString(3, std::locale::classic()));
- CPPUNIT_ASSERT(drsPtr->getAsString(3, std::locale::classic()) ==
toWString(numeric_limits<long long>::min()));
+ logInfo(fctName, toUserString(numeric_limits<long long>::min()) + L" -
getAsString=" + drsPtr->getAsString(3, loc));
+ CPPUNIT_ASSERT(drsPtr->getAsString(3, loc) ==
toUserString(numeric_limits<long long>::min()));
drsPtr->next();
- logInfo(fctName, toWString(numeric_limits<long long>::max()) + L" -
getAsString=" + drsPtr->getAsString(3, std::locale::classic()));
- CPPUNIT_ASSERT(drsPtr->getAsString(3, std::locale::classic()) ==
toWString(numeric_limits<long long>::max()));
+ logInfo(fctName, toUserString(numeric_limits<long long>::max()) + L" -
getAsString=" + drsPtr->getAsString(3, loc));
+ CPPUNIT_ASSERT(drsPtr->getAsString(3, loc) ==
toUserString(numeric_limits<long long>::max()));
drsPtr->next();
-// logInfo(fctName, toWString(numeric_limits<float>::min()) + L" -
getAsString=" + drsPtr->getAsString(3, std::locale::classic()));
-// CPPUNIT_ASSERT(drsPtr->getAsString(3, std::locale::classic()) ==
toWString(numeric_limits<float>::min()));
+// logInfo(fctName, toUserString(numeric_limits<float>::min()) + L" -
getAsString=" + drsPtr->getAsString(3, loc));
+// CPPUNIT_ASSERT(drsPtr->getAsString(3, loc) ==
toUserString(numeric_limits<float>::min()));
drsPtr->next();
-// logInfo(fctName, toWString(numeric_limits<float>::max()) + L" -
getAsString=" + drsPtr->getAsString(3, std::locale::classic()));
-// CPPUNIT_ASSERT(drsPtr->getAsString(3, std::locale::classic()) ==
toWString(numeric_limits<float>::max()));
+// logInfo(fctName, toUserString(numeric_limits<float>::max()) + L" -
getAsString=" + drsPtr->getAsString(3, loc));
+// CPPUNIT_ASSERT(drsPtr->getAsString(3, loc) ==
toUserString(numeric_limits<float>::max()));
drsPtr->next();
-// logInfo(fctName, toWString(numeric_limits<double>::min()) + L" -
getAsString=" + drsPtr->getAsString(3, std::locale::classic()));
-// CPPUNIT_ASSERT(drsPtr->getAsString(3, std::locale::classic()) ==
toWString(numeric_limits<double>::min()));
+// logInfo(fctName, toUserString(numeric_limits<double>::min()) + L" -
getAsString=" + drsPtr->getAsString(3, loc));
+// CPPUNIT_ASSERT(drsPtr->getAsString(3, loc) ==
toUserString(numeric_limits<double>::min()));
drsPtr->next();
-// logInfo(fctName, toWString(numeric_limits<double>::max()) + L" -
getAsString=" + drsPtr->getAsString(3, std::locale::classic()));
-// CPPUNIT_ASSERT(drsPtr->getAsString(3, std::locale::classic()) ==
toWString(numeric_limits<double>::max()));
+// logInfo(fctName, toUserString(numeric_limits<double>::max()) + L" -
getAsString=" + drsPtr->getAsString(3, loc));
+// CPPUNIT_ASSERT(drsPtr->getAsString(3, loc) ==
toUserString(numeric_limits<double>::max()));
drsPtr->next();
- logInfo(fctName,
wstring(L"-123456789012345678901234567890.123456789012345678901234567890 -
getAsString=") + drsPtr->getAsString(3, std::locale::classic()));
- CPPUNIT_ASSERT(drsPtr->getAsString(3, std::locale::classic()) ==
wstring(L"-123456789012345678901234567890.123456789012345678901234567890"));
+
+ logInfo(fctName, toUserString(-123456789012LL) + thousandsSep +
toUserString(345678901) + thousandsSep + toUserString(234567890) + decimalSep +
L"123456789012345678901234567890 - getAsString=" + drsPtr->getAsString(3, loc));
+ CPPUNIT_ASSERT(drsPtr->getAsString(3, loc) == toUserString(-123456789012LL)
+ thousandsSep + toUserString(345678901) + thousandsSep +
toUserString(234567890) + decimalSep + L"123456789012345678901234567890");
drsPtr->next();
- logInfo(fctName,
wstring(L"123456789012345678901234567890.123456789012345678901234567890 -
getAsString=") + drsPtr->getAsString(3, std::locale::classic()));
- CPPUNIT_ASSERT(drsPtr->getAsString(3, std::locale::classic()) ==
wstring(L"123456789012345678901234567890.123456789012345678901234567890"));
+ logInfo(fctName, toUserString(123456789012LL) + thousandsSep +
toUserString(345678901) + thousandsSep + toUserString(234567890) + decimalSep +
L"123456789012345678901234567890 - getAsString=" + drsPtr->getAsString(3, loc));
+ CPPUNIT_ASSERT(drsPtr->getAsString(3, loc) == toUserString(123456789012LL) +
thousandsSep + toUserString(345678901) + thousandsSep + toUserString(234567890)
+ decimalSep + L"123456789012345678901234567890");
}
-//TODO: display as strings (when logging) in order to see where the test
crashes
//TODO: improve log msgs
void TestBigDecimal::testGetAsInt()
@@ -480,8 +505,17 @@
{
CppUnit::TestSuite *suiteOfTests = new CppUnit::TestSuite( "TestBigDecimal"
);
suiteOfTests->addTest(new CppUnit::TestCaller<TestBigDecimal>(
- "TestBigDecimal::testGetAsString",
- &TestBigDecimal::testGetAsString));
+
"TestBigDecimal::testGetAsStringUsingCLocale",
+
&TestBigDecimal::testGetAsStringUsingCLocale));
+ suiteOfTests->addTest(new CppUnit::TestCaller<TestBigDecimal>(
+
"TestBigDecimal::testGetAsStringUsingUserLocale",
+
&TestBigDecimal::testGetAsStringUsingCLocale));
+ suiteOfTests->addTest(new CppUnit::TestCaller<TestBigDecimal>(
+
"TestBigDecimal::testGetAsStringUsingFrLocale",
+
&TestBigDecimal::testGetAsStringUsingCLocale));
+ suiteOfTests->addTest(new CppUnit::TestCaller<TestBigDecimal>(
+
"TestBigDecimal::testGetAsStringUsingUSLocale",
+
&TestBigDecimal::testGetAsStringUsingCLocale));
suiteOfTests->addTest(new CppUnit::TestCaller<TestBigDecimal>(
"TestBigDecimal::testGetAsInt",
&TestBigDecimal::testGetAsInt));
Index: carob/test/30-ResultSet/TestBigDecimal.hpp
diff -u carob/test/30-ResultSet/TestBigDecimal.hpp:1.3
carob/test/30-ResultSet/TestBigDecimal.hpp:1.4
--- carob/test/30-ResultSet/TestBigDecimal.hpp:1.3 Fri Mar 10 22:21:41 2006
+++ carob/test/30-ResultSet/TestBigDecimal.hpp Thu Jul 27 17:10:42 2006
@@ -42,10 +42,26 @@
virtual void setUp();
/**
- * Read big decimal values using getAsString(), then checks the read and
- * written values are consistent
+ * Read big decimal values using getAsString() and given locale, then checks
+ * the read and written values are consistent
*/
- void testGetAsString();
+ void testGetAsString(const std::locale& loc);
+ /**
+ * @see #testGetAsString(const std::locale& loc)
+ */
+ void testGetAsStringUsingCLocale();
+ /**
+ * @see #testGetAsString(const std::locale& loc)
+ */
+ void testGetAsStringUsingUserLocale();
+ /**
+ * @see #testGetAsString(const std::locale& loc)
+ */
+ void testGetAsStringUsingFrLocale();
+ /**
+ * @see #testGetAsString(const std::locale& loc)
+ */
+ void testGetAsStringUsingUSLocale();
/**
* Read big decimal values using getAsInt() and checks that the integer read
* is the expected one
Index: carob/test/35-ResultList/TestExec.cpp
diff -u carob/test/35-ResultList/TestExec.cpp:1.2
carob/test/35-ResultList/TestExec.cpp:1.3
--- carob/test/35-ResultList/TestExec.cpp:1.2 Fri Mar 3 16:54:13 2006
+++ carob/test/35-ResultList/TestExec.cpp Thu Jul 27 17:10:42 2006
@@ -125,7 +125,7 @@
if (isInfoEnabled())
{
logInfo(fctName, L"Update with execute succeeded. Number of affected rows
= "
- + toWString(statementPtr->getUpdateCount()));
+ + toUserString(statementPtr->getUpdateCount()));
}
CPPUNIT_ASSERT(statementPtr->getUpdateCount() == 1);
}
Index: carob/test/40-Parameter-PreparedStatement/TestParameterStatement.cpp
diff -u
carob/test/40-Parameter-PreparedStatement/TestParameterStatement.cpp:1.13
carob/test/40-Parameter-PreparedStatement/TestParameterStatement.cpp:1.14
--- carob/test/40-Parameter-PreparedStatement/TestParameterStatement.cpp:1.13
Fri Apr 7 19:01:13 2006
+++ carob/test/40-Parameter-PreparedStatement/TestParameterStatement.cpp
Thu Jul 27 17:10:42 2006
@@ -140,7 +140,7 @@
if (isInfoEnabled())
{
logInfo(fctName, L"Update succeeded. Number of affected rows = "
- + toWString(nbRowsAffected));
+ + toUserString(nbRowsAffected));
}
CPPUNIT_ASSERT(nbRowsAffected == 1);
}
@@ -195,7 +195,7 @@
if (isInfoEnabled())
{
logInfo(fctName, L"Update with execute succeeded. Number of affected rows
= "
- + toWString(statementPtr->getUpdateCount()));
+ + toUserString(statementPtr->getUpdateCount()));
}
CPPUNIT_ASSERT(statementPtr->getUpdateCount() == 1);
//execute again the statement with different parameters
@@ -205,7 +205,7 @@
if (isInfoEnabled())
{
logInfo(fctName, L"Update with execute succeeded. Number of affected rows
= "
- + toWString(statementPtr->getUpdateCount()));
+ + toUserString(statementPtr->getUpdateCount()));
}
CPPUNIT_ASSERT(statementPtr->getUpdateCount() == 1);
}
Index: carob/test/CarobTestLauncher.cpp
diff -u carob/test/CarobTestLauncher.cpp:1.32
carob/test/CarobTestLauncher.cpp:1.33
--- carob/test/CarobTestLauncher.cpp:1.32 Wed Jul 26 16:31:47 2006
+++ carob/test/CarobTestLauncher.cpp Thu Jul 27 17:10:42 2006
@@ -66,7 +66,6 @@
// or in file include/Common.hpp
//setLogLevel(LOG_LEVEL_DEBUG);
setLogLevel(LOG_LEVEL_OFF);
- std::locale::global(std::locale(""));
std::set_unexpected(UnexpectedException::convertUnexpected);
CppUnit::TextUi::TestRunner runner;
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits