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 (19 files): msg#00051

db.carob.cvs

Subject: CVS update of carob (19 files)

Date: Tuesday, February 14, 2006 @ 18:35:48
Author: gilles
Path: /cvsroot/carob/carob

Modified: Makefile (1.32 -> 1.33) include/Common.hpp (1.31 -> 1.32)
src/Common.cpp (1.24 -> 1.25) src/Connection.cpp (1.63 -> 1.64)
src/ControllerConnectPolicy.cpp (1.7 -> 1.8)
src/DriverSocket.cpp (1.14 -> 1.15) src/JavaSocket.cpp (1.39 ->
1.40) test/10-Connection/TestConnect.cpp (1.3 -> 1.4)
test/10-Connection/TestControllerConnectPolicy.cpp (1.1 -> 1.2)
test/30-ResultSet/TestSimpleUnicode.cpp (1.5 -> 1.6)
test/40-Parameter-PreparedStatement/TestParameterStatement.cpp
(1.6 -> 1.7)
test/40-Parameter-PreparedStatement/TestPreparedStatement.cpp
(1.4 -> 1.5) test/CarobTestLauncher.cpp (1.21 -> 1.22)
test/GNUmakefile (1.19 -> 1.20) test/TestBeginCommitRollback.cpp
(1.12 -> 1.13) test/TestDriverResultSet.cpp (1.4 -> 1.5)
test/TestExecReadRequest.cpp (1.17 -> 1.18)
test/TestExecWriteRequest.cpp (1.16 -> 1.17)
test/TestStatement.cpp (1.20 -> 1.21)

Reworked logging:
- changed log levels to comply to log4xxx (ie. removed verbose, inverted
info/debug, added fatal)
- removed useless connection logging
- put tests logging as info
- added ability to use log4cxx instead of the internal logger (disabled by
default)


----------------------------------------------------------------+
Makefile | 3
include/Common.hpp | 56 ++--
src/Common.cpp | 122
+++++++---
src/Connection.cpp | 14 -
src/ControllerConnectPolicy.cpp | 4
src/DriverSocket.cpp | 31 --
src/JavaSocket.cpp | 24 -
test/10-Connection/TestConnect.cpp | 28 +-
test/10-Connection/TestControllerConnectPolicy.cpp | 4
test/30-ResultSet/TestSimpleUnicode.cpp | 4
test/40-Parameter-PreparedStatement/TestParameterStatement.cpp | 52 ++--
test/40-Parameter-PreparedStatement/TestPreparedStatement.cpp | 40 +--
test/CarobTestLauncher.cpp | 12
test/GNUmakefile | 5
test/TestBeginCommitRollback.cpp | 16 -
test/TestDriverResultSet.cpp | 16 -
test/TestExecReadRequest.cpp | 20 -
test/TestExecWriteRequest.cpp | 24 -
test/TestStatement.cpp | 88 +++----
19 files changed, 302 insertions(+), 261 deletions(-)


Index: carob/Makefile
diff -u carob/Makefile:1.32 carob/Makefile:1.33
--- carob/Makefile:1.32 Wed Jan 18 20:06:21 2006
+++ carob/Makefile Tue Feb 14 18:35:47 2006
@@ -62,6 +62,9 @@
LIB_CAROB_LIB_SHORT = lib${LIB_CAROB}.so
LIB_CAROB_LIB = ${LIB_CAROB_LIB_SHORT}.${LIB_MAJOR_VERSION}
LIB_CAROB_STATIC = lib${LIB_CAROB}.a
+# Uncomment these 2 lines to use log4cxx instead of internal logger
+#CXXFLAGS += -DCAROB_USE_LOG4CXX
+#LDFLAGS += -llog4cxx

#Doc
# DOC_DIR is duplicated in Doxyfile
Index: carob/include/Common.hpp
diff -u carob/include/Common.hpp:1.31 carob/include/Common.hpp:1.32
--- carob/include/Common.hpp:1.31 Thu Jan 26 12:27:02 2006
+++ carob/include/Common.hpp Tue Feb 14 18:35:48 2006
@@ -31,12 +31,11 @@
// or you can try this one:
// #include <cstdint>

-#define VERBOSE_PRE L"VERBOSE:\t"
-#define INFO_PRE L"INFO:\t"
#define DEBUG_PRE L"DEBUG:\t"
-#define WARNING_PRE L"WARNING:\t"
+#define INFO_PRE L"INFO:\t"
+#define WARN_PRE L"WARN:\t"
#define ERROR_PRE L"ERROR:\t"
-
+#define FATAL_PRE L"FATAL:\t"

namespace CarobNS {

@@ -48,12 +47,12 @@
*/
enum LogLevel
{
- LOG_LEVEL_VERBOSE,
- LOG_LEVEL_INFO,
LOG_LEVEL_DEBUG,
- LOG_LEVEL_WARNING,
+ LOG_LEVEL_INFO,
+ LOG_LEVEL_WARN,
LOG_LEVEL_ERROR,
- LOG_LEVEL_NONE
+ LOG_LEVEL_FATAL,
+ LOG_LEVEL_OFF
};

// Line separator (EOL)
@@ -66,50 +65,47 @@
#endif
;

-
-
/** The current log level (set by setLogLevel) */
extern LogLevel currentLogLevel;

/** Sets the log level to l */
void setLogLevel(const LogLevel l);
/**
- * Writes a log message with 'Verbose' level.
- * Use isVerboseEnabled() to determine if the message should
- * be printed
+ * Writes a log message with 'Debug' level.
+ * Use isDebugEnabled() to determine if the message should be printed
*/
-void logVerbose(const std::wstring, const std::wstring);
+void logDebug(const std::wstring&, const std::wstring&);
/**
* Writes a log message with 'Info' level.
* Use isInfoEnabled() to determine if the message should be printed
*/
-void logInfo(const std::wstring, const std::wstring);
+void logInfo(const std::wstring&, const std::wstring&);
/**
- * Writes a log message with 'Debug' level.
- * Use isDebugEnabled() to determine if the message should be printed
- */
-void logDebug(const std::wstring, const std::wstring);
-/**
- * Writes a log message with 'Warning' level.
- * Use isWarningEnabled() to determine if the message should be printed
+ * Writes a log message with 'Warn' level.
+ * Use isWarnEnabled() to determine if the message should be printed
*/
-void logWarning(const std::wstring, const std::wstring);
+void logWarn(const std::wstring&, const std::wstring&);
/**
* Writes a log message with 'Error' level.
* Use isErrorEnabled() to determine if the message should be printed
*/
-void logError(const std::wstring, const std::wstring);
+void logError(const std::wstring&, const std::wstring&);
+/**
+ * Writes a log message with 'Fatal' level.
+ * Use isFatalEnabled() to determine if the message should be printed
+ */
+void logFatal(const std::wstring&, const std::wstring&);

-/** Returns true if the verbose level or higher is enabled */
-bool isVerboseEnabled();
-/** Returns true if the info level or higher is enabled */
-bool isInfoEnabled();
/** Returns true if the debug level or higher is enabled */
bool isDebugEnabled();
-/** Returns true if the warning level or higher is enabled */
-bool isWarningEnabled();
+/** Returns true if the info level or higher is enabled */
+bool isInfoEnabled();
+/** Returns true if the warn level or higher is enabled */
+bool isWarnEnabled();
/** Returns true if the error level or higher is enabled */
bool isErrorEnabled();
+/** Returns true if the fatal level or higher is enabled */
+bool isFatalEnabled();

/**
* Removes given whitespaces from the begining and end of the given string
Index: carob/src/Common.cpp
diff -u carob/src/Common.cpp:1.24 carob/src/Common.cpp:1.25
--- carob/src/Common.cpp:1.24 Mon Jan 30 22:36:08 2006
+++ carob/src/Common.cpp Tue Feb 14 18:35:47 2006
@@ -23,18 +23,33 @@

#include "StringCodecs.hpp"

+//LOG4CXX includes
+#ifdef CAROB_USE_LOG4CXX
+#include "StringCodecs.hpp" //for toString
+#include <log4cxx/logger.h>
+#endif
+
#include <iostream>
#include <sstream> //for wostringstream

#include <stdlib.h>

-CarobNS::LogLevel CarobNS::currentLogLevel = LOG_LEVEL_WARNING;
+CarobNS::LogLevel CarobNS::currentLogLevel = LOG_LEVEL_WARN;

using std::wstring;
using std::string;
using std::wcerr;
using std::endl;

+//LOG4CXX
+#ifdef CAROB_USE_LOG4CXX
+using namespace log4cxx;
+namespace
+{
+ LoggerPtr logger(Logger::getLogger("Carob"));
+}
+#endif
+

// On linux or MACOSX>10.4 try "locale -a" to get the list of all available
locales.
// TODO: it would be nice to be able to get this at runtime
@@ -51,66 +66,115 @@

namespace {
inline void
- carobLog(const wstring& prefix, const wstring& fctName, const wstring& msg)
+ carobLog(const CarobNS::LogLevel& level, const wstring& fctName, const
wstring& msg)
{
- wcerr << prefix << L'(' << fctName << L") " << msg << endl;
+#ifdef CAROB_USE_LOG4CXX
+ // Log4cxx <= 0.9.7 doesn't accept wstrings - we have to convert the string
+ std::string tmp = CarobNS::StaticCodecs::toString(fctName + L": " + msg);
+#endif
+ if (level == CarobNS::LOG_LEVEL_DEBUG)
+ {
+#ifdef CAROB_USE_LOG4CXX
+ LOG4CXX_DEBUG(logger, tmp);
+#else
+ wcerr << DEBUG_PRE << L'(' << fctName << L") " << msg << endl;
+#endif
+ }
+ else if (level == CarobNS::LOG_LEVEL_INFO)
+ {
+#ifdef CAROB_USE_LOG4CXX
+ LOG4CXX_INFO(logger, tmp);
+#else
+ wcerr << INFO_PRE << L'(' << fctName << L") " << msg << endl;
+#endif
+ }
+ else if (level == CarobNS::LOG_LEVEL_WARN)
+ {
+#ifdef CAROB_USE_LOG4CXX
+ LOG4CXX_WARN(logger, tmp);
+#else
+ wcerr << WARN_PRE << L'(' << fctName << L") " << msg << endl;
+#endif
+ }
+ else if (level == CarobNS::LOG_LEVEL_ERROR)
+ {
+#ifdef CAROB_USE_LOG4CXX
+ LOG4CXX_ERROR(logger, tmp);
+#else
+ wcerr << ERROR_PRE << L'(' << fctName << L") " << msg << endl;
+#endif
+ }
+ else //if (level == CarobNS::LOG_LEVEL_FATAL)
+ {
+#ifdef CAROB_USE_LOG4CXX
+ LOG4CXX_FATAL(logger, tmp);
+#else
+ wcerr << FATAL_PRE << L'(' << fctName << L") " << msg << endl;
+#endif
+ }
}
}

void CarobNS::setLogLevel(const LogLevel l)
{
+#ifdef CAROB_USE_LOG4CXX
+ if (l == LOG_LEVEL_DEBUG)
+ logger->setLevel(log4cxx::Level::DEBUG);
+ else if (l == LOG_LEVEL_INFO)
+ logger->setLevel(log4cxx::Level::INFO);
+ else if (l == LOG_LEVEL_WARN)
+ logger->setLevel(log4cxx::Level::WARN);
+ else if (l == LOG_LEVEL_ERROR)
+ logger->setLevel(log4cxx::Level::ERROR);
+ else if (l == LOG_LEVEL_FATAL)
+ logger->setLevel(log4cxx::Level::FATAL);
+ else if (l == LOG_LEVEL_OFF)
+ logger->setLevel(log4cxx::Level::OFF);
+#endif
CarobNS::currentLogLevel = l;
}

-void CarobNS::logVerbose(const wstring fctName, const wstring s)
+void CarobNS::logDebug(const wstring& fctName, const wstring& s)
{
- carobLog(VERBOSE_PRE, fctName, s);
+ carobLog(LOG_LEVEL_DEBUG, fctName, s);
}
-
-void CarobNS::logInfo(const wstring fctName, const wstring s)
+void CarobNS::logInfo(const wstring& fctName, const wstring& s)
{
- carobLog(INFO_PRE, fctName, s);
+ carobLog(LOG_LEVEL_INFO, fctName, s);
}
-
-void CarobNS::logDebug(const wstring fctName, const wstring s)
+void CarobNS::logWarn(const wstring& fctName, const wstring& s)
{
- carobLog(DEBUG_PRE, fctName, s);
+ carobLog(LOG_LEVEL_WARN, fctName, s);
}
-
-void CarobNS::logWarning(const wstring fctName, const wstring s)
+void CarobNS::logError(const wstring& fctName, const wstring& s)
{
- carobLog(WARNING_PRE, fctName, s);
+ carobLog(LOG_LEVEL_ERROR, fctName, s);
}
-
-void CarobNS::logError(const wstring fctName, const wstring s)
+void CarobNS::logFatal(const wstring& fctName, const wstring& s)
{
- carobLog(ERROR_PRE, fctName, s);
+ carobLog(LOG_LEVEL_FATAL, fctName, s);
}

-bool CarobNS::isVerboseEnabled()
+bool CarobNS::isDebugEnabled()
{
- return CarobNS::currentLogLevel <= LOG_LEVEL_VERBOSE;
+ return CarobNS::currentLogLevel <= LOG_LEVEL_DEBUG;
}
-
bool CarobNS::isInfoEnabled()
{
return CarobNS::currentLogLevel <= LOG_LEVEL_INFO;
}
-
-bool CarobNS::isDebugEnabled()
-{
- return CarobNS::currentLogLevel <= LOG_LEVEL_DEBUG;
-}
-
-bool CarobNS::isWarningEnabled()
+bool CarobNS::isWarnEnabled()
{
- return CarobNS::currentLogLevel <= LOG_LEVEL_WARNING;
+ return CarobNS::currentLogLevel <= LOG_LEVEL_WARN;
}
-
bool CarobNS::isErrorEnabled()
{
return CarobNS::currentLogLevel <= LOG_LEVEL_ERROR;
}
+bool CarobNS::isFatalEnabled()
+{
+ return CarobNS::currentLogLevel <= LOG_LEVEL_FATAL;
+}

wstring CarobNS::trim(const wstring& source,
const wchar_t* delims)
Index: carob/src/Connection.cpp
diff -u carob/src/Connection.cpp:1.63 carob/src/Connection.cpp:1.64
--- carob/src/Connection.cpp:1.63 Mon Feb 13 15:42:09 2006
+++ carob/src/Connection.cpp Tue Feb 14 18:35:47 2006
@@ -90,8 +90,6 @@
//Do the authentication stuff, then receive ack and other params
if (initConnection() && finalizeConnect())
{
- if (isInfoEnabled())
- logInfo(fctName, L"Connection succeded");
isClosed = false;
}
}
@@ -721,9 +719,9 @@
sendCommand(*driverSocketPtr, FetchNextResultSetRows);
*driverSocketPtr<<cursorName;
*driverSocketPtr<<fetchSize;
- if (isVerboseEnabled())
+ if (isDebugEnabled())
{
- logVerbose(fctName, L"Fetching next " + toWString(fetchSize) + L" from "
+ logDebug(fctName, L"Fetching next " + toWString(fetchSize) + L" from "
+ cursorName);
}
TypeTag tag(*driverSocketPtr);
@@ -1000,8 +998,8 @@
// Should not happen, this probably mean an inconsistency in controller
// configuration but safely ignore (see below)
wstring msg = L"Warning! Authentication exception received on connection
retry, controller configuration might be inconsistent";
- if (isWarningEnabled())
- logWarning(fctName, msg);
+ if (isWarnEnabled())
+ logWarn(fctName, msg);
throw DriverException(msg+ae.description());
}
catch (ConnectionException ce)
@@ -1009,8 +1007,8 @@
// Should not happen, this probably mean an inconsistency in controller
// configuration but safely ignore (see below)
wstring msg = L"Warning! Connection exception received on connection
retry, controller configuration might be inconsistent";
- if (isWarningEnabled())
- logWarning(fctName, msg);
+ if (isWarnEnabled())
+ logWarn(fctName, msg);
throw DriverException(msg+ce.description());
}
}
Index: carob/src/ControllerConnectPolicy.cpp
diff -u carob/src/ControllerConnectPolicy.cpp:1.7
carob/src/ControllerConnectPolicy.cpp:1.8
--- carob/src/ControllerConnectPolicy.cpp:1.7 Thu Feb 2 18:19:18 2006
+++ carob/src/ControllerConnectPolicy.cpp Tue Feb 14 18:35:47 2006
@@ -219,9 +219,9 @@
return;
}
}
- if (isWarningEnabled())
+ if (isWarnEnabled())
{
- logWarning(fctName, L"Controller " + (wstring)controllerInfo
+ logWarn(fctName, L"Controller " + (wstring)controllerInfo
+ L" is not (anymore?) in the suspect list");
}
}
Index: carob/src/DriverSocket.cpp
diff -u carob/src/DriverSocket.cpp:1.14 carob/src/DriverSocket.cpp:1.15
--- carob/src/DriverSocket.cpp:1.14 Wed Jan 25 17:02:00 2006
+++ carob/src/DriverSocket.cpp Tue Feb 14 18:35:47 2006
@@ -32,19 +32,13 @@
throw (ConnectionException, UnexpectedException) : JavaSocket()
{
wstring fctName(L"DriverSocket::DriverSocket");
- if (JavaSocket::create() && JavaSocket::connectTo(host, port))
- {
- if (isInfoEnabled())
- logInfo(fctName, L"Socket ready");
- }
+ if (JavaSocket::create())
+ JavaSocket::connectTo(host, port);
}

const DriverSocket& DriverSocket::operator <<(const wstring & s) const
throw (SocketIOException, UnexpectedException)
{
- wstring fctName(L"DriverSocket::operator<<(wstring)");
- if (isVerboseEnabled())
- logVerbose(fctName, L"");
// First write "true" (for "non null string"), then the size of the upcoming
// string, then the string itself
*this<<true;
@@ -69,9 +63,6 @@
const DriverSocket & DriverSocket::operator >>(wstring & s) const
throw (SocketIOException, UnexpectedException)
{
- wstring fctName(L"DriverSocket::operator >>(wstring)");
- if (isVerboseEnabled())
- logVerbose(fctName, L"");
bool ack = false;
*this>>ack;
if (ack)
@@ -100,9 +91,6 @@
const DriverSocket & DriverSocket::operator <<(const int32_t &i) const
throw (SocketIOException, UnexpectedException)
{
- wstring fctName(L"DriverSocket::operator<<(int32)");
- if (isVerboseEnabled())
- logVerbose(fctName, L"");
writeJavaInt(i);
return *this;
}
@@ -110,9 +98,6 @@
const DriverSocket & DriverSocket::operator >>(int32_t &i) const
throw (SocketIOException, UnexpectedException)
{
- wstring fctName(L"DriverSocket::operator>>(int32_t)");
- if (isVerboseEnabled())
- logVerbose(fctName, L"");
readJavaInt(i);
return *this;
}
@@ -120,9 +105,6 @@
const DriverSocket & DriverSocket::operator <<(const int64_t &i) const
throw (SocketIOException, UnexpectedException)
{
- wstring fctName(L"DriverSocket::operator<<(int64_t)");
- if (isVerboseEnabled())
- logVerbose(fctName, L"");
writeJavaLong(i);
return *this;
}
@@ -130,9 +112,6 @@
const DriverSocket & DriverSocket::operator >>(int64_t &i) const
throw (SocketIOException, UnexpectedException)
{
- wstring fctName(L"DriverSocket::operator>>(int64)");
- if (isVerboseEnabled())
- logVerbose(fctName, L"");
readJavaLong(i);
return *this;
}
@@ -140,9 +119,6 @@
const DriverSocket & DriverSocket::operator <<(const bool &b) const
throw (SocketIOException, UnexpectedException)
{
- wstring fctName(L"DriverSocket::operator<<(bool)");
- if (isVerboseEnabled())
- logVerbose(fctName, L"");
writeJavaBool(b);
return *this;
}
@@ -150,9 +126,6 @@
const DriverSocket & DriverSocket::operator >>(bool &b) const
throw (SocketIOException, UnexpectedException)
{
- wstring fctName(L"DriverSocket::operator>>(bool)");
- if (isVerboseEnabled())
- logVerbose(fctName, L"");
readJavaBool(b);
return *this;
}
Index: carob/src/JavaSocket.cpp
diff -u carob/src/JavaSocket.cpp:1.39 carob/src/JavaSocket.cpp:1.40
--- carob/src/JavaSocket.cpp:1.39 Tue Feb 14 12:05:05 2006
+++ carob/src/JavaSocket.cpp Tue Feb 14 18:35:47 2006
@@ -51,8 +51,8 @@
throw (ConnectionException, UnexpectedException)
{
wstring fctName(L"JavaSocket::Create");
- if (isVerboseEnabled())
- logVerbose(fctName, L"Creating socket...");
+ if (isDebugEnabled())
+ logDebug(fctName, L"Creating socket...");
socketFd = socket(SOCKET_CREATION_DOMAIN,
SOCK_STREAM,
0);
@@ -99,8 +99,8 @@
throw ConnectionException(L"Set option failed on socket");
return false;
}
- if (isVerboseEnabled())
- logVerbose(fctName, L"Socket created.");
+ if (isDebugEnabled())
+ logDebug(fctName, L"Socket created.");
return true;
}

@@ -108,8 +108,8 @@
throw (ConnectionException, UnexpectedException)
{
wstring fctName(L"JavaSocket::Connect");
- if (isVerboseEnabled())
- logVerbose(fctName, L"Connecting...");
+ if (isDebugEnabled())
+ logDebug(fctName, L"Connecting...");
if (!isValid())
{
if (isErrorEnabled())
@@ -173,8 +173,8 @@
}
else
{
- if (isWarningEnabled())
- logWarning(fctName, L"Could not connect trying next address if
any...");
+ if (isWarnEnabled())
+ logWarn(fctName, L"Could not connect trying next address if any...");
}
addressInfoPtr = addressInfoPtr->ai_next;
}
@@ -213,8 +213,6 @@
throw (SocketIOException, CodecException, UnexpectedException)
{
wstring fctName(L"JavaSocket::writeJavaUTF");
- if (isVerboseEnabled())
- logVerbose(fctName, L"Converting string...");

std::string utf8str(toUTF8(str));

@@ -223,8 +221,6 @@
//First write number of bytes to follow as
if (sendToSocket(fctName, L"UTF string", &netlen, sizeof(netlen),
SOCKET_SEND_FLAGS))
{
- if (isVerboseEnabled())
- logVerbose(fctName, L"Ok. Sending string");
sendToSocket(fctName, L"UTF string", utf8str.data(), utf8str.length(),
SOCKET_SEND_FLAGS);
}

@@ -354,8 +350,6 @@
const void* buf, int len, int flags) const
throw (SocketIOException, UnexpectedException)
{
- if (isVerboseEnabled())
- logVerbose(fctName, L"Sending to socket...");
int ret = send(socketFd, buf, len, flags);
if ( ret == -1 )
{
@@ -370,8 +364,6 @@
const wstring& objName, void *buf, int len, int flags) const
throw (SocketIOException, UnexpectedException)
{
- if (isVerboseEnabled())
- logVerbose(fctName, L"Receiving from socket...");
int status = recvFully(buf, len, flags);
if (status == -1)
{
Index: carob/test/10-Connection/TestConnect.cpp
diff -u carob/test/10-Connection/TestConnect.cpp:1.3
carob/test/10-Connection/TestConnect.cpp:1.4
--- carob/test/10-Connection/TestConnect.cpp:1.3 Wed Jan 25 23:13:50 2006
+++ carob/test/10-Connection/TestConnect.cpp Tue Feb 14 18:35:48 2006
@@ -51,9 +51,9 @@
DEBUG_LEVEL_DEBUG);
try
{
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Connecting to controller - should fail");
+ logInfo(fctName, L"Connecting to controller - should fail");
}
connectionPtr = new Connection(connectionPrms);
// We should receive an exception instead of coming here
@@ -79,9 +79,9 @@
DEBUG_LEVEL_DEBUG);
try
{
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Connecting to controller - sould fail");
+ logInfo(fctName, L"Connecting to controller - sould fail");
}
connectionPtr = new Connection(connectionPrms);
// We should receive an exception instead of coming here
@@ -107,9 +107,9 @@
try
{
connectionPtr = new Connection(connectionPrms);
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Connecting to controller - sould fail");
+ logInfo(fctName, L"Connecting to controller - sould fail");
}

// We should receive an exception instead of coming here
@@ -136,9 +136,9 @@
try
{
connectionPtr = new Connection(connectionPrms);
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Connecting to controller - sould fail");
+ logInfo(fctName, L"Connecting to controller - sould fail");
}

// We should receive an exception instead of coming here
@@ -165,9 +165,9 @@
try
{
connectionPtr = new Connection(connectionPrms);
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Connecting to controller - sould fail");
+ logInfo(fctName, L"Connecting to controller - sould fail");
}

// We should receive an exception instead of coming here
@@ -191,14 +191,14 @@
L"user",
L"",
DEBUG_LEVEL_DEBUG);
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Connecting to controller - this should succeed");
+ logInfo(fctName, L"Connecting to controller - this should succeed");
}
connectionPtr = new Connection(connectionPrms);
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Connection succeeded");
+ logInfo(fctName, L"Connection succeeded");
}
}

Index: carob/test/10-Connection/TestControllerConnectPolicy.cpp
diff -u carob/test/10-Connection/TestControllerConnectPolicy.cpp:1.1
carob/test/10-Connection/TestControllerConnectPolicy.cpp:1.2
--- carob/test/10-Connection/TestControllerConnectPolicy.cpp:1.1 Thu Feb
2 18:20:56 2006
+++ carob/test/10-Connection/TestControllerConnectPolicy.cpp Tue Feb 14
18:35:48 2006
@@ -90,8 +90,8 @@

try
{
- if (isDebugEnabled())
- logDebug(fctName, L"Trying to get controller - should fail");
+ if (isInfoEnabled())
+ logInfo(fctName, L"Trying to get controller - should fail");
cp.getController();
CPPUNIT_ASSERT(false); //should have thrown an exception
}
Index: carob/test/30-ResultSet/TestSimpleUnicode.cpp
diff -u carob/test/30-ResultSet/TestSimpleUnicode.cpp:1.5
carob/test/30-ResultSet/TestSimpleUnicode.cpp:1.6
--- carob/test/30-ResultSet/TestSimpleUnicode.cpp:1.5 Fri Jan 20 23:50:53 2006
+++ carob/test/30-ResultSet/TestSimpleUnicode.cpp Tue Feb 14 18:35:48 2006
@@ -57,9 +57,9 @@
{
std::wstring fctName(L"TestSimpleUnicode::testBasic");

- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing replace table " TABLE_NAME L" "
TABLE_TYPE);
+ logInfo(fctName, L"Executing replace table " TABLE_NAME L" "
TABLE_TYPE);
}

createOrReplaceTable(connectionPtr, TABLE_NAME, TABLE_TYPE);
Index: carob/test/40-Parameter-PreparedStatement/TestParameterStatement.cpp
diff -u
carob/test/40-Parameter-PreparedStatement/TestParameterStatement.cpp:1.6
carob/test/40-Parameter-PreparedStatement/TestParameterStatement.cpp:1.7
--- carob/test/40-Parameter-PreparedStatement/TestParameterStatement.cpp:1.6
Mon Jan 30 22:58:43 2006
+++ carob/test/40-Parameter-PreparedStatement/TestParameterStatement.cpp
Tue Feb 14 18:35:47 2006
@@ -42,9 +42,9 @@
try
{
statementPtr = connectionPtr->createParameterStatement(L"select * from
address where id = ?");
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing query without setting it's parameters -
should fail");
+ logInfo(fctName, L"Executing query without setting it's parameters -
should fail");
}
statementPtr->executeQuery();
// We should receive an exception instead of coming here
@@ -65,16 +65,16 @@
wstring fctName(L"TestParameterStatement::testExecuteQueryGood");
ParameterStatement* statementPtr = NULL;
statementPtr = connectionPtr->createParameterStatement(L"select * from
address where id < ?");
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing read - should succeed");
+ logInfo(fctName, L"Executing read - should succeed");
}
statementPtr->setInt(1,10);
statementPtr->setFetchSize(1);
DriverResultSet* drsPtr = statementPtr->executeQuery();
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Read succeeded. Displaying rows which has id < 10");
+ logInfo(fctName, L"Read succeeded. Displaying rows which has id < 10");
}
ResultSetMetaData rsmd(drsPtr);
std::wostringstream buffer;
@@ -86,8 +86,8 @@
buffer<<drsPtr->getAsString(j+1)<<L"\t";
buffer<<endl;
}
- if (isDebugEnabled())
- logDebug(fctName, buffer.str());
+ if (isInfoEnabled())
+ logInfo(fctName, buffer.str());

}

@@ -100,9 +100,9 @@
try
{
statementPtr = connectionPtr->createParameterStatement(L"update address
set name=? where id=?");
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing update with bad params - this should
fail");
+ logInfo(fctName, L"Executing update with bad params - this should fail");
}
statementPtr->setInt(10,10);
statementPtr->executeUpdate();
@@ -124,16 +124,16 @@
wstring fctName(L"TestParameterStatement::testExecuteUpdateGood");
ParameterStatement* statementPtr = NULL;
statementPtr = connectionPtr->createParameterStatement(L"update product set
name=? where id=?");
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing update - should succeed");
+ logInfo(fctName, L"Executing update - should succeed");
}
statementPtr->setString(1, std::wstring(L"changed by
testExecuteUpdateGood"));
statementPtr->setInt(2,0);
int nbRowsAffected = statementPtr->executeUpdate();
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Update succeeded. Number of affected rows = "
+ logInfo(fctName, L"Update succeeded. Number of affected rows = "
+ toWString(nbRowsAffected));
}
CPPUNIT_ASSERT(nbRowsAffected == 1);
@@ -144,18 +144,18 @@
wstring fctName(L"TestParameterStatement::testExecuteWithSelect");
ParameterStatement* statementPtr = NULL;
statementPtr = connectionPtr->createParameterStatement(L"select * from
address where id < ?");
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing execute(SELECT * FROM address where id < 10)
- should succeed");
+ logInfo(fctName, L"Executing execute(SELECT * FROM address where id < 10)
- should succeed");
}
statementPtr->setInt(1,10);
bool isRS = statementPtr->execute();
CPPUNIT_ASSERT(isRS);

DriverResultSet* drsPtr = statementPtr->getResultSet();
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Read succeeded. Displaying rows:");
+ logInfo(fctName, L"Read succeeded. Displaying rows:");
}
ResultSetMetaData rsmd(drsPtr);
std::wostringstream buffer;
@@ -167,9 +167,9 @@
buffer<<drsPtr->getAsString(j+1)<<L"\t";
buffer<<endl;
}
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, buffer.str());
+ logInfo(fctName, buffer.str());
}
}

@@ -178,17 +178,17 @@
wstring fctName(L"TestParameterStatement::testExecuteWithUpdate");
ParameterStatement* statementPtr = NULL;
statementPtr = connectionPtr->createParameterStatement(L"UPDATE product SET
name=? WHERE id=?");
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing execute(UPDATE FROM address...) - should
succeed");
+ logInfo(fctName, L"Executing execute(UPDATE FROM address...) - should
succeed");
}
statementPtr->setString<const wchar_t *>(1, L"changed by
testExecuteWithUpdate");
statementPtr->setInt(2, 0);
bool isRS = statementPtr->execute();
CPPUNIT_ASSERT(!isRS);
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Update with execute succeeded. Number of affected rows
= "
+ logInfo(fctName, L"Update with execute succeeded. Number of affected rows
= "
+ toWString(statementPtr->getUpdateCount()));
}
CPPUNIT_ASSERT(statementPtr->getUpdateCount() == 1);
@@ -196,9 +196,9 @@
statementPtr->setInt(2, 1);
isRS = statementPtr->execute();
CPPUNIT_ASSERT(!isRS);
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Update with execute succeeded. Number of affected rows
= "
+ logInfo(fctName, L"Update with execute succeeded. Number of affected rows
= "
+ toWString(statementPtr->getUpdateCount()));
}
CPPUNIT_ASSERT(statementPtr->getUpdateCount() == 1);
Index: carob/test/40-Parameter-PreparedStatement/TestPreparedStatement.cpp
diff -u carob/test/40-Parameter-PreparedStatement/TestPreparedStatement.cpp:1.4
carob/test/40-Parameter-PreparedStatement/TestPreparedStatement.cpp:1.5
--- carob/test/40-Parameter-PreparedStatement/TestPreparedStatement.cpp:1.4
Tue Jan 24 18:54:51 2006
+++ carob/test/40-Parameter-PreparedStatement/TestPreparedStatement.cpp Tue Feb
14 18:35:47 2006
@@ -38,9 +38,9 @@
try
{
statementPtr = connectionPtr->createStatement();
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing getMetaData() on empty statement - should
fail");
+ logInfo(fctName, L"Executing getMetaData() on empty statement - should
fail");
}
ResultSetMetaData* rsmdPtr = statementPtr->getMetaData();
CPPUNIT_ASSERT(rsmdPtr == NULL); //just to avoid warning on unsused var
@@ -61,9 +61,9 @@
try
{
psPtr = connectionPtr->createParameterStatement(L"");
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing getMetaData() on empty parameter statement
- should fail");
+ logInfo(fctName, L"Executing getMetaData() on empty parameter statement
- should fail");
}
ResultSetMetaData* rsmdPtr = psPtr->getMetaData();
CPPUNIT_ASSERT(rsmdPtr == NULL);
@@ -87,9 +87,9 @@
statementPtr = connectionPtr->createStatement();
int nbRowsAffected = statementPtr->executeUpdate(
L"update product set name='changed by testPrepareUpdate' where id=0");
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing getMetaData() on update statement - should
fail");
+ logInfo(fctName, L"Executing getMetaData() on update statement - should
fail");
}
ResultSetMetaData* rsmdPtr = statementPtr->getMetaData();
CPPUNIT_ASSERT(nbRowsAffected == 0 && rsmdPtr == NULL); //just to avoid
warning on unsused var
@@ -110,9 +110,9 @@
ParameterStatement* psPtr = connectionPtr->createParameterStatement(L"update
address set name='changed by testPrepareUpdateParameterStatement' where id=?");
psPtr->setInt(1,0);
psPtr->executeUpdate();
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing getMetaData() on update parameter statement
- should return null");
+ logInfo(fctName, L"Executing getMetaData() on update parameter statement -
should return null");
}
ResultSetMetaData* rsmdPtr = psPtr->getMetaData();
CPPUNIT_ASSERT(rsmdPtr == NULL);
@@ -123,9 +123,9 @@
wstring fctName(L"testPrepareExecuteQueryStatement");
Statement* statementPtr = connectionPtr->createStatement();
statementPtr->executeQuery(L"SELECT * FROM address");
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing getMetaData() on query statement");
+ logInfo(fctName, L"Executing getMetaData() on query statement");
}
ResultSetMetaData* rsmdPtr = statementPtr->getMetaData();
CPPUNIT_ASSERT(rsmdPtr != NULL); //just to avoid warning on unsused var
@@ -138,9 +138,9 @@
ParameterStatement* psPtr = connectionPtr->createParameterStatement(L"SELECT
* FROM address where id=?");
psPtr->setInt(1,0);
psPtr->executeQuery();
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing getMetaData() on query parameter statement");
+ logInfo(fctName, L"Executing getMetaData() on query parameter statement");
}
ResultSetMetaData* rsmdPtr = psPtr->getMetaData();
CPPUNIT_ASSERT(rsmdPtr != NULL);
@@ -152,9 +152,9 @@
wstring fctName(L"testPrepareExecuteStatement");
Statement* statementPtr = connectionPtr->createStatement();
statementPtr->execute(L"SELECT * FROM address");
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing getMetaData() on execute statement");
+ logInfo(fctName, L"Executing getMetaData() on execute statement");
}
ResultSetMetaData* rsmdPtr = statementPtr->getMetaData();
CPPUNIT_ASSERT(rsmdPtr != NULL); //just to avoid warning on unsused var
@@ -167,9 +167,9 @@
ParameterStatement* psPtr = connectionPtr->createParameterStatement(L"SELECT
* FROM address where id=?");
psPtr->setInt(1,0);
psPtr->execute();
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing getMetaData() on execute parameter
statement");
+ logInfo(fctName, L"Executing getMetaData() on execute parameter
statement");
}
ResultSetMetaData* rsmdPtr = psPtr->getMetaData();
CPPUNIT_ASSERT(rsmdPtr != NULL);
@@ -181,9 +181,9 @@
wstring fctName(L"testPrepareStatement");
Statement* statementPtr = connectionPtr->createStatement();
statementPtr->setRequest(L"SELECT * FROM address");
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing getMetaData() on statement");
+ logInfo(fctName, L"Executing getMetaData() on statement");
}
ResultSetMetaData* rsmdPtr = statementPtr->getMetaData();
CPPUNIT_ASSERT(rsmdPtr != NULL); //just to avoid warning on unsused var
@@ -195,9 +195,9 @@
wstring fctName(L"testPrepareParameterStatement");
ParameterStatement* psPtr = connectionPtr->createParameterStatement(L"SELECT
* FROM address where id=?");
psPtr->setInt(1,0);
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing getMetaData() on parameter statement");
+ logInfo(fctName, L"Executing getMetaData() on parameter statement");
}
ResultSetMetaData* rsmdPtr = psPtr->getMetaData();
CPPUNIT_ASSERT(rsmdPtr != NULL);
Index: carob/test/CarobTestLauncher.cpp
diff -u carob/test/CarobTestLauncher.cpp:1.21
carob/test/CarobTestLauncher.cpp:1.22
--- carob/test/CarobTestLauncher.cpp:1.21 Thu Feb 2 18:20:56 2006
+++ carob/test/CarobTestLauncher.cpp Tue Feb 14 18:35:47 2006
@@ -29,6 +29,11 @@
#include "CarobException.hpp"
#include "StringCodecs.hpp"
#include "Common.hpp"
+#ifdef CAROB_USE_LOG4CXX
+#include <log4cxx/logger.h>
+#include <log4cxx/basicconfigurator.h>
+#include <log4cxx/propertyconfigurator.h>
+#endif

#include "CarobProtector.hpp"

@@ -49,8 +54,13 @@

int main (int argc, char **argv)
{
+#ifdef CAROB_USE_LOG4CXX
+ // Set up a simple configuration that logs on the console.
+ log4cxx::BasicConfigurator::configure();
+#endif
+
//setLogLevel(LOG_LEVEL_INFO);
- setLogLevel(LOG_LEVEL_NONE);
+ setLogLevel(LOG_LEVEL_OFF);
std::locale::global(std::locale(""));

std::set_unexpected(UnexpectedException::convertUnexpected);
Index: carob/test/GNUmakefile
diff -u carob/test/GNUmakefile:1.19 carob/test/GNUmakefile:1.20
--- carob/test/GNUmakefile:1.19 Thu Jan 26 11:37:24 2006
+++ carob/test/GNUmakefile Tue Feb 14 18:35:47 2006
@@ -48,6 +48,11 @@
EXE = carobTestLauncher


+# Uncomment these 2 lines to use log4cxx instead of internal logger
+#CXXFLAGS += -DCAROB_USE_LOG4CXX
+#LDFLAGS += -llog4cxx
+
+
${EXE}: ${TESTOBJS} CarobTestLauncher.o ${LIB_CAROB_FILE}
${CXX} ${LDFLAGS} -o $@ $^

Index: carob/test/TestBeginCommitRollback.cpp
diff -u carob/test/TestBeginCommitRollback.cpp:1.12
carob/test/TestBeginCommitRollback.cpp:1.13
--- carob/test/TestBeginCommitRollback.cpp:1.12 Tue Jan 24 18:54:51 2006
+++ carob/test/TestBeginCommitRollback.cpp Tue Feb 14 18:35:47 2006
@@ -39,9 +39,9 @@
readReq.setEscapeProcessing(false).setTimeoutInSeconds(2);
DriverResultSet* drsPtr = connectionPtr->statementExecuteQuery(readReq);
connectionPtr->commit();
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Read and commit succeeded");
+ logInfo(fctName, L"Read and commit succeeded");
}
delete drsPtr;
}
@@ -54,9 +54,9 @@
readReq.setEscapeProcessing(false).setTimeoutInSeconds(2);
DriverResultSet* drsPtr = connectionPtr->statementExecuteQuery(readReq);
connectionPtr->rollback();
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Read and rollback succeeded");
+ logInfo(fctName, L"Read and rollback succeeded");
}
delete drsPtr;
}
@@ -69,9 +69,9 @@
updtReq.setEscapeProcessing(false).setTimeoutInSeconds(2);
connectionPtr->statementExecuteUpdate(updtReq);
connectionPtr->commit();
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Write and commit succeeded");
+ logInfo(fctName, L"Write and commit succeeded");
}
}

@@ -83,9 +83,9 @@
updtReq.setEscapeProcessing(false).setTimeoutInSeconds(2);
connectionPtr->statementExecuteUpdate(updtReq);
connectionPtr->rollback();
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Write and rollback succeeded");
+ logInfo(fctName, L"Write and rollback succeeded");
}
}

Index: carob/test/TestDriverResultSet.cpp
diff -u carob/test/TestDriverResultSet.cpp:1.4
carob/test/TestDriverResultSet.cpp:1.5
--- carob/test/TestDriverResultSet.cpp:1.4 Thu Jan 12 17:33:46 2006
+++ carob/test/TestDriverResultSet.cpp Tue Feb 14 18:35:47 2006
@@ -41,9 +41,9 @@
Statement* statementPtr = NULL;
//1. Update table: set a value to null
statementPtr = connectionPtr->createStatement();
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Creating a NULL value");
+ logInfo(fctName, L"Creating a NULL value");
}
statementPtr->executeUpdate(L"UPDATE address SET firstname=NULL WHERE id=0");

@@ -87,9 +87,9 @@
Statement* statementPtr = NULL;
//1. Set a string to an int an read it
statementPtr = connectionPtr->createStatement();
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Writing an int in a string");
+ logInfo(fctName, L"Writing an int in a string");
}
statementPtr->executeUpdate(L"UPDATE address SET firstname='1234' WHERE
id=0");
//read
@@ -99,9 +99,9 @@

//2. Negative numbers
statementPtr = connectionPtr->createStatement();
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Writing a negative int in a string");
+ logInfo(fctName, L"Writing a negative int in a string");
}
statementPtr->executeUpdate(L"UPDATE address SET firstname='-1' WHERE id=1");
//Read it
@@ -111,9 +111,9 @@

//3. Not a number
statementPtr = connectionPtr->createStatement();
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Writing a non-number in a string");
+ logInfo(fctName, L"Writing a non-number in a string");
}
statementPtr->executeUpdate(L"UPDATE address SET firstname='hello' WHERE
id=1");
//Read it
Index: carob/test/TestExecReadRequest.cpp
diff -u carob/test/TestExecReadRequest.cpp:1.17
carob/test/TestExecReadRequest.cpp:1.18
--- carob/test/TestExecReadRequest.cpp:1.17 Thu Dec 15 17:43:53 2005
+++ carob/test/TestExecReadRequest.cpp Tue Feb 14 18:35:47 2006
@@ -40,9 +40,9 @@
{
RequestWithResultSetParameters readReq(L"dummy request");
readReq.setEscapeProcessing(false).setTimeoutInSeconds(2);
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing read - this should fail");
+ logInfo(fctName, L"Executing read - this should fail");
}
connectionPtr->statementExecuteQuery(readReq);
// We should receive an exception instead of coming here
@@ -65,9 +65,9 @@
RequestWithResultSetParameters readReq(L"select * from dummy");
readReq.setEscapeProcessing(false).setTimeoutInSeconds(2);

- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing read - this should fail");
+ logInfo(fctName, L"Executing read - this should fail");
}
connectionPtr->statementExecuteQuery(readReq);
// We should receive an exception instead of coming here
@@ -88,14 +88,14 @@
wstring fctName(L"TestExecReadRequest::testReadGood");
RequestWithResultSetParameters readReq(L"select * from address");
readReq.setEscapeProcessing(false).setTimeoutInSeconds(2);
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing read - this should succeed");
+ logInfo(fctName, L"Executing read - this should succeed");
}
DriverResultSet* drsPtr = connectionPtr->statementExecuteQuery(readReq);
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Read succeeded. Displaying 50 rows:");
+ logInfo(fctName, L"Read succeeded. Displaying 50 rows:");
}
//Display 50 rows for debugging...

@@ -109,9 +109,9 @@
<<L"\t"<<drsPtr->getString(2)
<<L"\t\t"<<drsPtr->getString(3)<<endl;
}
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, buffer.str());
+ logInfo(fctName, buffer.str());
}
//We have to free the allocated result...
delete drsPtr;
Index: carob/test/TestExecWriteRequest.cpp
diff -u carob/test/TestExecWriteRequest.cpp:1.16
carob/test/TestExecWriteRequest.cpp:1.17
--- carob/test/TestExecWriteRequest.cpp:1.16 Thu Dec 22 17:02:51 2005
+++ carob/test/TestExecWriteRequest.cpp Tue Feb 14 18:35:47 2006
@@ -37,9 +37,9 @@
{
Request updtReq(L"dummy request");
updtReq.setEscapeProcessing(false).setTimeoutInSeconds(2);
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing write - should fail");
+ logInfo(fctName, L"Executing write - should fail");
}
connectionPtr->statementExecuteUpdate(updtReq);
// We should receive an exception instead of coming here
@@ -63,9 +63,9 @@
{
Request updtReq(L"update dummy set name='gotit' where id=0");
updtReq.setEscapeProcessing(false).setTimeoutInSeconds(2);
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing write - should fail");
+ logInfo(fctName, L"Executing write - should fail");
}
connectionPtr->statementExecuteUpdate(updtReq);
// We should receive an exception instead of coming here
@@ -86,14 +86,14 @@
wstring fctName(L"TestExecWriteRequest::testWriteGood");
Request updtReq(L"update product set name='changed' where id=0");
updtReq.setEscapeProcessing(false).setTimeoutInSeconds(2);
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing write - should succeed");
+ logInfo(fctName, L"Executing write - should succeed");
}
int nbRowsAffected = connectionPtr->statementExecuteUpdate(updtReq);
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Write succeed. Number of rows updated:"
+ logInfo(fctName, L"Write succeed. Number of rows updated:"
+ toWString(nbRowsAffected));
}
CPPUNIT_ASSERT(nbRowsAffected == 1);
@@ -107,9 +107,9 @@

Request updtReq(L"");
updtReq.setEscapeProcessing(false).setTimeoutInSeconds(2);
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing 1000 writes");
+ logInfo(fctName, L"Executing 1000 writes");
}
for (int i=0; i<1000; i++)
{
@@ -118,9 +118,9 @@
int nbRowsAffected = connectionPtr->statementExecuteUpdate(updtReq);
CPPUNIT_ASSERT(nbRowsAffected == 1);
}
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"1000 writes succeeded");
+ logInfo(fctName, L"1000 writes succeeded");
}
}

Index: carob/test/TestStatement.cpp
diff -u carob/test/TestStatement.cpp:1.20 carob/test/TestStatement.cpp:1.21
--- carob/test/TestStatement.cpp:1.20 Thu Jan 12 17:33:46 2006
+++ carob/test/TestStatement.cpp Tue Feb 14 18:35:47 2006
@@ -43,9 +43,9 @@
try
{
statementPtr = connectionPtr->createStatement();
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing dummy read - should fail");
+ logInfo(fctName, L"Executing dummy read - should fail");
}
statementPtr->executeQuery(L"dummy request");
// We should receive an exception instead of coming here
@@ -68,9 +68,9 @@
try
{
statementPtr = connectionPtr->createStatement();
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing bad table read - should fail");
+ logInfo(fctName, L"Executing bad table read - should fail");
}
statementPtr->executeQuery(L"select * from dummy");
// We should receive an exception instead of coming here
@@ -91,16 +91,16 @@
wstring fctName(L"TestStatement::testExecuteQueryGood");
Statement* statementPtr = NULL;
statementPtr = connectionPtr->createStatement();
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing read - should succeed");
+ logInfo(fctName, L"Executing read - should succeed");
}
statementPtr->setFetchSize(1);
DriverResultSet* drsPtr = statementPtr->executeQuery(
L"select * from address");
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Read succeeded. Displaying 50 rows:");
+ logInfo(fctName, L"Read succeeded. Displaying 50 rows:");
}
//Display 50 rows using metadata and toString
ResultSetMetaData rsmd(drsPtr);
@@ -113,8 +113,8 @@
buffer<<drsPtr->getAsString(j+1)<<L"\t";
buffer<<endl;
}
- if (isDebugEnabled())
- logDebug(fctName, buffer.str());
+ if (isInfoEnabled())
+ logInfo(fctName, buffer.str());

}

@@ -128,9 +128,9 @@
try
{
statementPtr = connectionPtr->createStatement();
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing dummy update - should fail");
+ logInfo(fctName, L"Executing dummy update - should fail");
}
statementPtr->executeUpdate(L"dummy request");
// We should receive an exception instead of coming here
@@ -153,9 +153,9 @@
try
{
statementPtr = connectionPtr->createStatement();
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing bad table update - this should fail");
+ logInfo(fctName, L"Executing bad table update - this should fail");
}
statementPtr->executeUpdate(L"update dummy set name='gotit' where id=0");
// We should receive an exception instead of coming here
@@ -176,15 +176,15 @@
wstring fctName(L"TestStatement::testExecuteUpdateGood");
Statement* statementPtr = NULL;
statementPtr = connectionPtr->createStatement();
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing update - should succeed");
+ logInfo(fctName, L"Executing update - should succeed");
}
int nbRowsAffected = statementPtr->executeUpdate(
L"update product set name='changed by testExecuteUpdateGood' where
id=0");
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Update succeeded. Number of affected rows = "
+ logInfo(fctName, L"Update succeeded. Number of affected rows = "
+ toWString(nbRowsAffected));
}
CPPUNIT_ASSERT(nbRowsAffected == 1);
@@ -195,16 +195,16 @@
wstring fctName(L"TestStatement::testExecuteQueryWithMaxRows");
Statement* statementPtr = NULL;
statementPtr = connectionPtr->createStatement();
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing read with max rows = 1");
+ logInfo(fctName, L"Executing read with max rows = 1");
}
statementPtr->setMaxRows(1);
DriverResultSet* drsPtr = statementPtr->executeQuery(
L"select * from address");
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"executeQuery succeeded. Displaying first row.");
+ logInfo(fctName, L"executeQuery succeeded. Displaying first row.");
}
//wcerr<<L"Row\tId\tName\t\tCost"<<endl;
std::wostringstream buffer;
@@ -213,9 +213,9 @@
buffer<<drsPtr->getInt32(1)
<<L"\t"<<drsPtr->getString(2)
<<L"\t\t"<<drsPtr->getString(3)<<endl;
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, buffer.str());
+ logInfo(fctName, buffer.str());
}
//This next() should return false because we asked just 1 row
CPPUNIT_ASSERT(drsPtr->next() == false);
@@ -225,9 +225,9 @@
{
wstring fctName(L"TestStatement::testExecuteBadRequests");
Statement* statementPtr = NULL;
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Testing execute with bad query \"dummy\" (should
fail)");
+ logInfo(fctName, L"Testing execute with bad query \"dummy\" (should
fail)");
}
try
{
@@ -244,9 +244,9 @@
+ be.description());
}
}
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Testing execute with bad query \"SELECT * FROM dummy\"
(should fail)");
+ logInfo(fctName, L"Testing execute with bad query \"SELECT * FROM dummy\"
(should fail)");
}
try
{
@@ -269,17 +269,17 @@
wstring fctName(L"TestStatement::testExecuteWithSelect");
Statement* statementPtr = NULL;
statementPtr = connectionPtr->createStatement();
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing execute(SELECT * FROM address) - should
succeed");
+ logInfo(fctName, L"Executing execute(SELECT * FROM address) - should
succeed");
}
bool isRS = statementPtr->execute(L"SELECT * FROM address");
CPPUNIT_ASSERT(isRS);

DriverResultSet* drsPtr = statementPtr->getResultSet();
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Read succeeded. Displaying 50 rows:");
+ logInfo(fctName, L"Read succeeded. Displaying 50 rows:");
}
//Display 50 rows using metadata and toString
ResultSetMetaData rsmd(drsPtr);
@@ -292,9 +292,9 @@
buffer<<drsPtr->getAsString(j+1)<<L"\t";
buffer<<endl;
}
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, buffer.str());
+ logInfo(fctName, buffer.str());
}
}
void TestStatement::testExecuteWithUpdate()
@@ -302,15 +302,15 @@
wstring fctName(L"TestStatement::testExecuteWithUpdate");
Statement* statementPtr = NULL;
statementPtr = connectionPtr->createStatement();
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing execute(UPDATE FROM address...) - should
succeed");
+ logInfo(fctName, L"Executing execute(UPDATE FROM address...) - should
succeed");
}
bool isRS = statementPtr->execute(L"UPDATE product SET name='changed by
testExecuteWithUpdate' WHERE id=0");
CPPUNIT_ASSERT(!isRS);
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Update with execute succeeded. Number of affected rows
= "
+ logInfo(fctName, L"Update with execute succeeded. Number of affected rows
= "
+ toWString(statementPtr->getUpdateCount()));
}
CPPUNIT_ASSERT(statementPtr->getUpdateCount() == 1);
@@ -321,9 +321,9 @@
wstring fctName(L"TestStatement::testExecuteWithSelectStreamed");
Statement* statementPtr = NULL;
statementPtr = connectionPtr->createStatement();
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Executing streamed execute(SELECT * FROM address) -
should succeed");
+ logInfo(fctName, L"Executing streamed execute(SELECT * FROM address) -
should succeed");
}
statementPtr->setFetchSize(1);
bool isRS = statementPtr->execute(L"SELECT * FROM address");
@@ -331,9 +331,9 @@

DriverResultSet* drsPtr = statementPtr->getResultSet();
ResultSetMetaData rsmd(drsPtr);
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, L"Read succeeded. Displaying 50 rows:");
+ logInfo(fctName, L"Read succeeded. Displaying 50 rows:");
}
//Display rows using metadata and toString
std::wostringstream buffer;
@@ -344,9 +344,9 @@
buffer<<drsPtr->getAsString(j+1)<<L"\t";
buffer<<endl;
}
- if (isDebugEnabled())
+ if (isInfoEnabled())
{
- logDebug(fctName, buffer.str());
+ logInfo(fctName, buffer.str());
}
}


<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