You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/01/17 14:04:53 UTC
[17/50] [abbrv] ignite git commit: IGNITE-4470 Added support for log
file configuration via environmental variable IGNITE_ODBC_LOG_PATH
IGNITE-4470 Added support for log file configuration via environmental variable IGNITE_ODBC_LOG_PATH
This closes #1384
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/825fe9cd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/825fe9cd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/825fe9cd
Branch: refs/heads/ignite-gg-11810-1
Commit: 825fe9cd64ded64068c573d7e3c3901efae6283f
Parents: 9e8e979
Author: Sergey Kalashnikov <sk...@gridgain.com>
Authored: Tue Jan 10 15:57:05 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Tue Jan 10 15:57:05 2017 +0300
----------------------------------------------------------------------
modules/platforms/cpp/odbc/Makefile.am | 3 +-
modules/platforms/cpp/odbc/include/Makefile.am | 3 +-
.../ignite/odbc/config/connection_info.h | 2 -
.../cpp/odbc/include/ignite/odbc/log.h | 123 ++++++++++++++
.../odbc/include/ignite/odbc/meta/column_meta.h | 2 -
.../cpp/odbc/include/ignite/odbc/utility.h | 19 +--
.../odbc/os/linux/src/system/socket_client.cpp | 9 +-
.../odbc/os/win/src/system/socket_client.cpp | 9 +-
.../src/system/ui/dsn_configuration_window.cpp | 18 +-
.../cpp/odbc/os/win/src/system_dsn.cpp | 17 +-
.../platforms/cpp/odbc/project/vs/odbc.vcxproj | 2 +
.../cpp/odbc/project/vs/odbc.vcxproj.filters | 6 +
.../cpp/odbc/src/config/connection_info.cpp | 3 -
modules/platforms/cpp/odbc/src/connection.cpp | 19 ++-
.../odbc/src/diagnostic/diagnosable_adapter.cpp | 3 +-
modules/platforms/cpp/odbc/src/entry_points.cpp | 52 +++---
modules/platforms/cpp/odbc/src/log.cpp | 83 +++++++++
.../platforms/cpp/odbc/src/meta/column_meta.cpp | 4 -
modules/platforms/cpp/odbc/src/odbc.cpp | 167 ++++++++++---------
.../odbc/src/query/column_metadata_query.cpp | 13 +-
.../platforms/cpp/odbc/src/query/data_query.cpp | 23 ++-
.../cpp/odbc/src/query/table_metadata_query.cpp | 12 +-
modules/platforms/cpp/odbc/src/statement.cpp | 11 +-
modules/platforms/cpp/odbc/src/utility.cpp | 18 +-
24 files changed, 412 insertions(+), 209 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/825fe9cd/modules/platforms/cpp/odbc/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/Makefile.am b/modules/platforms/cpp/odbc/Makefile.am
index 1eb42d1..de6f75a 100644
--- a/modules/platforms/cpp/odbc/Makefile.am
+++ b/modules/platforms/cpp/odbc/Makefile.am
@@ -79,7 +79,8 @@ libignite_odbc_la_SOURCES = \
src/column.cpp \
src/statement.cpp \
src/type_traits.cpp \
- src/utility.cpp
+ src/utility.cpp \
+ src/log.cpp
clean-local:
$(RM) *.gcno *.gcda
http://git-wip-us.apache.org/repos/asf/ignite/blob/825fe9cd/modules/platforms/cpp/odbc/include/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/include/Makefile.am b/modules/platforms/cpp/odbc/include/Makefile.am
index 073dcaa..36d8e25 100644
--- a/modules/platforms/cpp/odbc/include/Makefile.am
+++ b/modules/platforms/cpp/odbc/include/Makefile.am
@@ -53,7 +53,8 @@ noinst_HEADERS = \
ignite/odbc/cursor.h \
ignite/odbc/common_types.h \
ignite/odbc/result_page.h \
- ignite/odbc/type_traits.h
+ ignite/odbc/type_traits.h \
+ ignite/odbc/log.h
uninstall-hook:
if [ -d ${includedir}/ignite ]; then find ${includedir}/ignite -type d -empty -delete; fi
http://git-wip-us.apache.org/repos/asf/ignite/blob/825fe9cd/modules/platforms/cpp/odbc/include/ignite/odbc/config/connection_info.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/config/connection_info.h b/modules/platforms/cpp/odbc/include/ignite/odbc/config/connection_info.h
index e0ed152..d421952 100644
--- a/modules/platforms/cpp/odbc/include/ignite/odbc/config/connection_info.h
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc/config/connection_info.h
@@ -40,7 +40,6 @@ namespace ignite
/** Info type. */
typedef unsigned short InfoType;
-#ifdef ODBC_DEBUG
/**
* Convert type to string containing its name.
* Debug function.
@@ -48,7 +47,6 @@ namespace ignite
* @return Null-terminated string containing types name.
*/
static const char* InfoTypeToString(InfoType type);
-#endif
/**
* Constructor.
http://git-wip-us.apache.org/repos/asf/ignite/blob/825fe9cd/modules/platforms/cpp/odbc/include/ignite/odbc/log.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/log.h b/modules/platforms/cpp/odbc/include/ignite/odbc/log.h
new file mode 100644
index 0000000..5a6dafc
--- /dev/null
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc/log.h
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _IGNITE_ODBC_LOG
+#define _IGNITE_ODBC_LOG
+
+#include <string>
+#include <sstream>
+#include <fstream>
+
+#include "ignite/common/common.h"
+#include "ignite/common/concurrent.h"
+
+# define LOG_MSG(param) \
+ if (ignite::odbc::Logger* p = ignite::odbc::Logger::Get()) \
+ { \
+ ignite::odbc::LogStream lstream(p); \
+ lstream << __FUNCTION__ << ": " << param; \
+ }
+
+namespace ignite
+{
+ namespace odbc
+ {
+ /* Forward declaration */
+ class Logger;
+
+ /**
+ * Helper object providing stream operations for single log line.
+ * Writes resulting string to Logger object upon destruction.
+ */
+ class LogStream: public std::basic_ostream<char>
+ {
+ public:
+ /**
+ * Constructor.
+ * @param parent pointer to Logger.
+ */
+ LogStream(Logger* parent);
+
+ /**
+ * Conversion operator helpful to determine if log is enabled
+ * @return True if logger is enabled
+ */
+ bool operator()();
+
+ /**
+ * Destructor.
+ */
+ virtual ~LogStream();
+
+ private:
+ IGNITE_NO_COPY_ASSIGNMENT(LogStream);
+
+ /** String buffer. */
+ std::basic_stringbuf<char> strbuf;
+
+ /** Parent logger object */
+ Logger* logger;
+ };
+
+ /**
+ * Logging facility.
+ */
+ class Logger
+ {
+ public:
+ /**
+ * Get instance of Logger, if enabled.
+ * @return Logger instance if logging is enabled. Null otherwise.
+ */
+ static Logger* Get();
+
+ /**
+ * Checks if logging is enabled.
+ * @return True, if logging is enabled.
+ */
+ bool IsEnabled() const;
+
+ /**
+ * Outputs the message to log file
+ * @param message The message to write
+ */
+ void WriteMessage(std::string const& message);
+
+ private:
+ /**
+ * Constructor.
+ * @param path to log file.
+ */
+ Logger(const char* path);
+
+ /**
+ * Destructor.
+ */
+ ~Logger();
+
+ IGNITE_NO_COPY_ASSIGNMENT(Logger);
+
+ /** Mutex for writes synchronization. */
+ ignite::common::concurrent::CriticalSection mutex;
+
+ /** File stream. */
+ std::ofstream stream;
+ };
+ }
+}
+
+#endif //_IGNITE_ODBC_LOG
http://git-wip-us.apache.org/repos/asf/ignite/blob/825fe9cd/modules/platforms/cpp/odbc/include/ignite/odbc/meta/column_meta.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/meta/column_meta.h b/modules/platforms/cpp/odbc/include/ignite/odbc/meta/column_meta.h
index 5ffff03..6a94b04 100644
--- a/modules/platforms/cpp/odbc/include/ignite/odbc/meta/column_meta.h
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc/meta/column_meta.h
@@ -38,7 +38,6 @@ namespace ignite
class ColumnMeta
{
public:
-#ifdef ODBC_DEBUG
/**
* Convert attribute ID to string containing its name.
* Debug function.
@@ -46,7 +45,6 @@ namespace ignite
* @return Null-terminated string containing attribute name.
*/
static const char* AttrIdToString(uint16_t id);
-#endif
/**
* Default constructor.
http://git-wip-us.apache.org/repos/asf/ignite/blob/825fe9cd/modules/platforms/cpp/odbc/include/ignite/odbc/utility.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/utility.h b/modules/platforms/cpp/odbc/include/ignite/odbc/utility.h
index 590e97c..7ff5b23 100644
--- a/modules/platforms/cpp/odbc/include/ignite/odbc/utility.h
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc/utility.h
@@ -27,6 +27,7 @@
#include <string>
#include <algorithm>
+#include <sstream>
#include <ignite/common/utils.h>
#include <ignite/common/decimal.h>
@@ -34,22 +35,6 @@
#include "ignite/impl/binary/binary_reader_impl.h"
#include "ignite/impl/binary/binary_writer_impl.h"
-
-#ifdef ODBC_DEBUG
-
-extern FILE* log_file;
-void logInit(const char*);
-
-# define LOG_MSG(fmt, ...) \
- do { \
- logInit(ODBC_LOG_PATH); \
- fprintf(log_file, "%s: " fmt, __FUNCTION__, ##__VA_ARGS__); \
- fflush(log_file); \
- } while (false)
-#else
-# define LOG_MSG(...)
-#endif
-
namespace ignite
{
namespace utility
@@ -187,7 +172,7 @@ namespace ignite
* @param count data length
* @return standard string containing the formated hex dump
*/
- std::string HexDump(const char* data, size_t count);
+ std::string HexDump(const void* data, size_t count);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/825fe9cd/modules/platforms/cpp/odbc/os/linux/src/system/socket_client.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/os/linux/src/system/socket_client.cpp b/modules/platforms/cpp/odbc/os/linux/src/system/socket_client.cpp
index a355625..9bdf1d7 100644
--- a/modules/platforms/cpp/odbc/os/linux/src/system/socket_client.cpp
+++ b/modules/platforms/cpp/odbc/os/linux/src/system/socket_client.cpp
@@ -27,6 +27,7 @@
#include "ignite/odbc/system/socket_client.h"
#include "ignite/odbc/utility.h"
+#include "ignite/odbc/log.h"
#define SOCKET_ERROR (-1)
@@ -49,7 +50,7 @@ namespace ignite
bool SocketClient::Connect(const char* hostname, uint16_t port)
{
- LOG_MSG("Host: %s, port: %d\n", hostname, port);
+ LOG_MSG("Host: " << hostname << ", port: " << port);
addrinfo hints;
memset(&hints, 0, sizeof(hints));
@@ -70,8 +71,10 @@ namespace ignite
// Attempt to connect to an address until one succeeds
for (addrinfo *it = result; it != NULL; it = it->ai_next)
{
- LOG_MSG("Addr: %u.%u.%u.%u\n", it->ai_addr->sa_data[2], it->ai_addr->sa_data[3],
- it->ai_addr->sa_data[4], it->ai_addr->sa_data[5]);
+ LOG_MSG("Addr: " << it->ai_addr->sa_data[2] << "."
+ << it->ai_addr->sa_data[3] << "."
+ << it->ai_addr->sa_data[4] << "."
+ << it->ai_addr->sa_data[5]);
// Create a SOCKET for connecting to server
socketHandle = socket(it->ai_family, it->ai_socktype, it->ai_protocol);
http://git-wip-us.apache.org/repos/asf/ignite/blob/825fe9cd/modules/platforms/cpp/odbc/os/win/src/system/socket_client.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/os/win/src/system/socket_client.cpp b/modules/platforms/cpp/odbc/os/win/src/system/socket_client.cpp
index e248323..4c440e2 100644
--- a/modules/platforms/cpp/odbc/os/win/src/system/socket_client.cpp
+++ b/modules/platforms/cpp/odbc/os/win/src/system/socket_client.cpp
@@ -28,6 +28,7 @@
#include "ignite/odbc/system/socket_client.h"
#include "ignite/odbc/utility.h"
+#include "ignite/odbc/log.h"
namespace ignite
{
@@ -64,7 +65,7 @@ namespace ignite
addrinfo *result = NULL;
addrinfo hints;
- LOG_MSG("Host: %s, port: %d\n", hostname, port);
+ LOG_MSG("Host: " << hostname << " port: " << port);
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
@@ -83,8 +84,10 @@ namespace ignite
// Attempt to connect to an address until one succeeds
for (addrinfo *it = result; it != NULL; it = it->ai_next)
{
- LOG_MSG("Addr: %u.%u.%u.%u\n", it->ai_addr->sa_data[2] & 0xFF, it->ai_addr->sa_data[3] & 0xFF,
- it->ai_addr->sa_data[4] & 0xFF, it->ai_addr->sa_data[5] & 0xFF);
+ LOG_MSG("Addr: " << (it->ai_addr->sa_data[2] & 0xFF) << "."
+ << (it->ai_addr->sa_data[3] & 0xFF) << "."
+ << (it->ai_addr->sa_data[4] & 0xFF) << "."
+ << (it->ai_addr->sa_data[5] & 0xFF));
// Create a SOCKET for connecting to server
socketHandle = socket(it->ai_family, it->ai_socktype, it->ai_protocol);
http://git-wip-us.apache.org/repos/asf/ignite/blob/825fe9cd/modules/platforms/cpp/odbc/os/win/src/system/ui/dsn_configuration_window.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/os/win/src/system/ui/dsn_configuration_window.cpp b/modules/platforms/cpp/odbc/os/win/src/system/ui/dsn_configuration_window.cpp
index a758bd9..864ca85 100644
--- a/modules/platforms/cpp/odbc/os/win/src/system/ui/dsn_configuration_window.cpp
+++ b/modules/platforms/cpp/odbc/os/win/src/system/ui/dsn_configuration_window.cpp
@@ -17,6 +17,8 @@
#include <Windowsx.h>
+#include "ignite/odbc/log.h"
+
#include "ignite/odbc/system/ui/dsn_configuration_window.h"
namespace ignite
@@ -300,14 +302,14 @@ namespace ignite
distributedJoins = distributedJoinsCheckBox->IsEnabled() && distributedJoinsCheckBox->IsChecked();
enforceJoinOrder = enforceJoinOrderCheckBox->IsEnabled() && enforceJoinOrderCheckBox->IsChecked();
- LOG_MSG("Retriving arguments:\n");
- LOG_MSG("DSN: %s\n", dsn.c_str());
- LOG_MSG("Address: %s\n", address.c_str());
- LOG_MSG("Cache: %s\n", cache.c_str());
- LOG_MSG("Page size: %d\n", pageSize);
- LOG_MSG("Protocol version: %s\n", version.c_str());
- LOG_MSG("Distributed Joins: %s\n", distributedJoins ? "true" : "false");
- LOG_MSG("Enforce Join Order: %s\n", enforceJoinOrder ? "true" : "false");
+ LOG_MSG("Retriving arguments:");
+ LOG_MSG("DSN: " << dsn);
+ LOG_MSG("Address: " << address);
+ LOG_MSG("Cache: " << cache);
+ LOG_MSG("Page size: " << pageSize);
+ LOG_MSG("Protocol version: " << version);
+ LOG_MSG("Distributed Joins: " << (distributedJoins ? "true" : "false"));
+ LOG_MSG("Enforce Join Order: " << (enforceJoinOrder ? "true" : "false"));
if (dsn.empty())
throw IgniteError(IgniteError::IGNITE_ERR_GENERIC, "DSN name can not be empty.");
http://git-wip-us.apache.org/repos/asf/ignite/blob/825fe9cd/modules/platforms/cpp/odbc/os/win/src/system_dsn.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/os/win/src/system_dsn.cpp b/modules/platforms/cpp/odbc/os/win/src/system_dsn.cpp
index f432a40..3d41e3e 100644
--- a/modules/platforms/cpp/odbc/os/win/src/system_dsn.cpp
+++ b/modules/platforms/cpp/odbc/os/win/src/system_dsn.cpp
@@ -16,6 +16,7 @@
*/
#include "ignite/odbc/utility.h"
+#include "ignite/odbc/log.h"
#include "ignite/odbc/system/odbc_constants.h"
#include "ignite/odbc/dsn_config.h"
@@ -147,27 +148,27 @@ BOOL INSTAPI ConfigDSN(HWND hwndParent, WORD req, LPCSTR driver, LPCSTR attribut
{
using namespace ignite::odbc;
- LOG_MSG("ConfigDSN called\n");
+ LOG_MSG("ConfigDSN called");
Configuration config;
- LOG_MSG("Attributes: %s\n", attributes);
+ LOG_MSG("Attributes: " << attributes);
config.FillFromConfigAttributes(attributes);
if (!SQLValidDSN(config.GetDsn().c_str()))
return FALSE;
- LOG_MSG("Driver: %s\n", driver);
- LOG_MSG("Attributes: %s\n", attributes);
+ LOG_MSG("Driver: " << driver);
+ LOG_MSG("Attributes: " << attributes);
- LOG_MSG("DSN: %s\n", config.GetDsn().c_str());
+ LOG_MSG("DSN: " << config.GetDsn());
switch (req)
{
case ODBC_ADD_DSN:
{
- LOG_MSG("ODBC_ADD_DSN\n");
+ LOG_MSG("ODBC_ADD_DSN");
if (!DisplayConfigureDsnWindow(hwndParent, config))
return FALSE;
@@ -180,7 +181,7 @@ BOOL INSTAPI ConfigDSN(HWND hwndParent, WORD req, LPCSTR driver, LPCSTR attribut
case ODBC_CONFIG_DSN:
{
- LOG_MSG("ODBC_CONFIG_DSN\n");
+ LOG_MSG("ODBC_CONFIG_DSN");
std::string dsn = config.GetDsn();
@@ -202,7 +203,7 @@ BOOL INSTAPI ConfigDSN(HWND hwndParent, WORD req, LPCSTR driver, LPCSTR attribut
case ODBC_REMOVE_DSN:
{
- LOG_MSG("ODBC_REMOVE_DSN\n");
+ LOG_MSG("ODBC_REMOVE_DSN");
if (!UnregisterDsn(config.GetDsn().c_str()))
return FALSE;
http://git-wip-us.apache.org/repos/asf/ignite/blob/825fe9cd/modules/platforms/cpp/odbc/project/vs/odbc.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/project/vs/odbc.vcxproj b/modules/platforms/cpp/odbc/project/vs/odbc.vcxproj
index 56358c5..b00e432 100644
--- a/modules/platforms/cpp/odbc/project/vs/odbc.vcxproj
+++ b/modules/platforms/cpp/odbc/project/vs/odbc.vcxproj
@@ -188,6 +188,7 @@
<ClCompile Include="..\..\src\statement.cpp" />
<ClCompile Include="..\..\src\type_traits.cpp" />
<ClCompile Include="..\..\src\utility.cpp" />
+ <ClCompile Include="..\..\src\log.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="module.def" />
@@ -230,6 +231,7 @@
<ClInclude Include="..\..\include\ignite\odbc\system\ui\dsn_configuration_window.h" />
<ClInclude Include="..\..\include\ignite\odbc\type_traits.h" />
<ClInclude Include="..\..\include\ignite\odbc\utility.h" />
+ <ClInclude Include="..\..\include\ignite\odbc\log.h" />
<ClInclude Include="..\..\os\win\include\ignite\odbc\system\ui\custom_window.h" />
<ClInclude Include="..\..\os\win\include\ignite\odbc\system\ui\window.h" />
</ItemGroup>
http://git-wip-us.apache.org/repos/asf/ignite/blob/825fe9cd/modules/platforms/cpp/odbc/project/vs/odbc.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/project/vs/odbc.vcxproj.filters b/modules/platforms/cpp/odbc/project/vs/odbc.vcxproj.filters
index 58764e4..1828be1 100644
--- a/modules/platforms/cpp/odbc/project/vs/odbc.vcxproj.filters
+++ b/modules/platforms/cpp/odbc/project/vs/odbc.vcxproj.filters
@@ -52,6 +52,9 @@
<ClCompile Include="..\..\src\utility.cpp">
<Filter>Code</Filter>
</ClCompile>
+ <ClCompile Include="..\..\src\log.cpp">
+ <Filter>Code</Filter>
+ </ClCompile>
<ClCompile Include="..\..\src\cursor.cpp">
<Filter>Code</Filter>
</ClCompile>
@@ -176,6 +179,9 @@
<ClInclude Include="..\..\include\ignite\odbc\utility.h">
<Filter>Code</Filter>
</ClInclude>
+ <ClInclude Include="..\..\include\ignite\odbc\log.h">
+ <Filter>Code</Filter>
+ </ClInclude>
<ClInclude Include="..\..\include\ignite\odbc\query\query.h">
<Filter>Code\query</Filter>
</ClInclude>
http://git-wip-us.apache.org/repos/asf/ignite/blob/825fe9cd/modules/platforms/cpp/odbc/src/config/connection_info.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/config/connection_info.cpp b/modules/platforms/cpp/odbc/src/config/connection_info.cpp
index 7c612bc..ed76aab 100644
--- a/modules/platforms/cpp/odbc/src/config/connection_info.cpp
+++ b/modules/platforms/cpp/odbc/src/config/connection_info.cpp
@@ -42,8 +42,6 @@ namespace ignite
namespace config
{
-#ifdef ODBC_DEBUG
-
#define DBG_STR_CASE(x) case x: return #x
const char * ConnectionInfo::InfoTypeToString(InfoType type)
@@ -102,7 +100,6 @@ namespace ignite
}
#undef DBG_STR_CASE
-#endif
ConnectionInfo::ConnectionInfo() : strParams(), intParams(),
shortParams()
http://git-wip-us.apache.org/repos/asf/ignite/blob/825fe9cd/modules/platforms/cpp/odbc/src/connection.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/connection.cpp b/modules/platforms/cpp/odbc/src/connection.cpp
index 4a6de5e..960a507 100644
--- a/modules/platforms/cpp/odbc/src/connection.cpp
+++ b/modules/platforms/cpp/odbc/src/connection.cpp
@@ -21,6 +21,7 @@
#include <ignite/common/fixed_size_array.h>
+#include "ignite/odbc/log.h"
#include "ignite/odbc/utility.h"
#include "ignite/odbc/statement.h"
#include "ignite/odbc/connection.h"
@@ -65,6 +66,13 @@ namespace ignite
void Connection::GetInfo(config::ConnectionInfo::InfoType type, void* buf, short buflen, short* reslen)
{
+ LOG_MSG("SQLGetInfo called: "
+ << type << " ("
+ << config::ConnectionInfo::InfoTypeToString(type) << "), "
+ << std::hex << reinterpret_cast<size_t>(buf) << ", "
+ << buflen << ", "
+ << std::hex << reinterpret_cast<size_t>(reslen));
+
IGNITE_ODBC_API_CALL(InternalGetInfo(type, buf, buflen, reslen));
}
@@ -195,7 +203,7 @@ namespace ignite
if (sent != len + sizeof(OdbcProtocolHeader))
IGNITE_ERROR_1(IgniteError::IGNITE_ERR_GENERIC, "Can not send message");
- LOG_MSG("message sent: (%d bytes)%s\n", msg.GetSize(), utility::HexDump((char*)msg.GetData(), msg.GetSize()).c_str());
+ LOG_MSG("message sent: (" << msg.GetSize() << " bytes)" << utility::HexDump(msg.GetData(), msg.GetSize()));
}
size_t Connection::SendAll(const int8_t* data, size_t len)
@@ -206,7 +214,7 @@ namespace ignite
{
int res = socket.Send(data + sent, len - sent);
- LOG_MSG("Sent: %d\n", res);
+ LOG_MSG("Sent: " << res);
if (res <= 0)
return sent;
@@ -259,8 +267,7 @@ namespace ignite
size_t received = len - remain;
int res = socket.Receive(buffer + received, remain);
- LOG_MSG("Receive res: %d\n", res);
- LOG_MSG("remain: %d\n", remain);
+ LOG_MSG("Receive res: " << res << " remain: " << remain);
if (res <= 0)
return received;
@@ -345,7 +352,7 @@ namespace ignite
if (rsp.GetStatus() != RESPONSE_STATUS_SUCCESS)
{
- LOG_MSG("Error: %s\n", rsp.GetError().c_str());
+ LOG_MSG("Error: " << rsp.GetError().c_str());
AddStatusRecord(SQL_STATE_08001_CANNOT_CONNECT, rsp.GetError());
@@ -356,7 +363,7 @@ namespace ignite
if (!rsp.IsAccepted())
{
- LOG_MSG("Hanshake message has been rejected.\n");
+ LOG_MSG("Hanshake message has been rejected.");
std::stringstream constructor;
http://git-wip-us.apache.org/repos/asf/ignite/blob/825fe9cd/modules/platforms/cpp/odbc/src/diagnostic/diagnosable_adapter.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/diagnostic/diagnosable_adapter.cpp b/modules/platforms/cpp/odbc/src/diagnostic/diagnosable_adapter.cpp
index 260e3e4..94ea53e 100644
--- a/modules/platforms/cpp/odbc/src/diagnostic/diagnosable_adapter.cpp
+++ b/modules/platforms/cpp/odbc/src/diagnostic/diagnosable_adapter.cpp
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+#include "ignite/odbc/log.h"
#include "ignite/odbc/connection.h"
#include "ignite/odbc/diagnostic/diagnosable_adapter.h"
@@ -41,7 +42,7 @@ namespace ignite
void DiagnosableAdapter::AddStatusRecord(SqlState sqlState, const std::string& message)
{
- LOG_MSG("Adding new record: %s\n", message.c_str());
+ LOG_MSG("Adding new record: " << message);
AddStatusRecord(sqlState, message, 0, 0);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/825fe9cd/modules/platforms/cpp/odbc/src/entry_points.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/entry_points.cpp b/modules/platforms/cpp/odbc/src/entry_points.cpp
index 850fa10..e241a9f 100644
--- a/modules/platforms/cpp/odbc/src/entry_points.cpp
+++ b/modules/platforms/cpp/odbc/src/entry_points.cpp
@@ -17,6 +17,8 @@
#include "ignite/odbc.h"
+#include "ignite/odbc/log.h"
+
#include "ignite/odbc/utility.h"
SQLRETURN SQL_API SQLGetInfo(SQLHDBC conn,
@@ -440,7 +442,7 @@ SQLRETURN SQL_API SQLError(SQLHENV env,
SQLRETURN SQL_API SQLCancel(SQLHSTMT stmt)
{
- LOG_MSG("SQLCancel called\n");
+ LOG_MSG("SQLCancel called");
return SQL_SUCCESS;
}
@@ -452,7 +454,7 @@ SQLRETURN SQL_API SQLColAttributes(SQLHSTMT stmt,
SQLSMALLINT* strAttrResLen,
SQLLEN* numAttrBuf)
{
- LOG_MSG("SQLColAttributes called\n");
+ LOG_MSG("SQLColAttributes called");
return SQL_SUCCESS;
}
@@ -461,7 +463,7 @@ SQLRETURN SQL_API SQLGetCursorName(SQLHSTMT stmt,
SQLSMALLINT nameBufLen,
SQLSMALLINT* nameResLen)
{
- LOG_MSG("SQLGetCursorName called\n");
+ LOG_MSG("SQLGetCursorName called");
return SQL_SUCCESS;
}
@@ -469,7 +471,7 @@ SQLRETURN SQL_API SQLSetCursorName(SQLHSTMT stmt,
SQLCHAR* name,
SQLSMALLINT nameLen)
{
- LOG_MSG("SQLSetCursorName called\n");
+ LOG_MSG("SQLSetCursorName called");
return SQL_SUCCESS;
}
@@ -477,7 +479,7 @@ SQLRETURN SQL_API SQLGetConnectOption(SQLHDBC conn,
SQLUSMALLINT option,
SQLPOINTER value)
{
- LOG_MSG("SQLGetConnectOption called\n");
+ LOG_MSG("SQLGetConnectOption called");
return SQL_SUCCESS;
}
@@ -485,7 +487,7 @@ SQLRETURN SQL_API SQLGetStmtOption(SQLHSTMT stmt,
SQLUSMALLINT option,
SQLPOINTER value)
{
- LOG_MSG("SQLGetStmtOption called\n");
+ LOG_MSG("SQLGetStmtOption called");
return SQL_SUCCESS;
}
@@ -493,7 +495,7 @@ SQLRETURN SQL_API SQLSetConnectOption(SQLHDBC conn,
SQLUSMALLINT option,
SQLULEN value)
{
- LOG_MSG("SQLSetConnectOption called\n");
+ LOG_MSG("SQLSetConnectOption called");
return SQL_SUCCESS;
}
@@ -501,7 +503,7 @@ SQLRETURN SQL_API SQLSetStmtOption(SQLHSTMT stmt,
SQLUSMALLINT option,
SQLULEN value)
{
- LOG_MSG("SQLSetStmtOption called\n");
+ LOG_MSG("SQLSetStmtOption called");
return SQL_SUCCESS;
}
@@ -515,7 +517,7 @@ SQLRETURN SQL_API SQLStatistics(SQLHSTMT stmt,
SQLUSMALLINT unique,
SQLUSMALLINT reserved)
{
- LOG_MSG("SQLStatistics called\n");
+ LOG_MSG("SQLStatistics called");
return SQL_SUCCESS;
}
@@ -526,7 +528,7 @@ SQLRETURN SQL_API SQLBrowseConnect(SQLHDBC conn,
SQLSMALLINT outConnectionStrBufLen,
SQLSMALLINT* outConnectionStrResLen)
{
- LOG_MSG("SQLBrowseConnect called\n");
+ LOG_MSG("SQLBrowseConnect called");
return SQL_SUCCESS;
}
@@ -540,7 +542,7 @@ SQLRETURN SQL_API SQLProcedureColumns(SQLHSTMT stmt,
SQLCHAR * columnName,
SQLSMALLINT columnNameLen)
{
- LOG_MSG("SQLProcedureColumns called\n");
+ LOG_MSG("SQLProcedureColumns called");
return SQL_SUCCESS;
}
@@ -549,7 +551,7 @@ SQLRETURN SQL_API SQLSetPos(SQLHSTMT stmt,
SQLUSMALLINT operation,
SQLUSMALLINT lockType)
{
- LOG_MSG("SQLSetPos called\n");
+ LOG_MSG("SQLSetPos called");
return SQL_SUCCESS;
}
@@ -558,7 +560,7 @@ SQLRETURN SQL_API SQLSetScrollOptions(SQLHSTMT stmt,
SQLLEN crowKeyset,
SQLUSMALLINT crowRowset)
{
- LOG_MSG("SQLSetScrollOptions called\n");
+ LOG_MSG("SQLSetScrollOptions called");
return SQL_SUCCESS;
}
@@ -568,7 +570,7 @@ SQLRETURN SQL_API SQLGetConnectAttr(SQLHDBC conn,
SQLINTEGER valueBufLen,
SQLINTEGER* valueResLen)
{
- LOG_MSG("SQLGetConnectAttr called\n");
+ LOG_MSG("SQLGetConnectAttr called");
return SQL_SUCCESS;
}
@@ -577,14 +579,14 @@ SQLRETURN SQL_API SQLSetConnectAttr(SQLHDBC conn,
SQLPOINTER value,
SQLINTEGER valueLen)
{
- LOG_MSG("SQLSetConnectAttr called\n");
+ LOG_MSG("SQLSetConnectAttr called");
return SQL_SUCCESS;
}
SQLRETURN SQL_API SQLBulkOperations(SQLHSTMT stmt,
SQLUSMALLINT operation)
{
- LOG_MSG("SQLBulkOperations called\n");
+ LOG_MSG("SQLBulkOperations called");
return SQL_SUCCESS;
}
@@ -596,13 +598,13 @@ SQLRETURN SQL_API SQLTablePrivileges(SQLHSTMT stmt,
SQLCHAR* tableName,
SQLSMALLINT tableNameLen)
{
- LOG_MSG("SQLTablePrivileges called\n");
+ LOG_MSG("SQLTablePrivileges called");
return SQL_SUCCESS;
}
SQLRETURN SQL_API SQLCopyDesc(SQLHDESC src, SQLHDESC dst)
{
- LOG_MSG("SQLCopyDesc called\n");
+ LOG_MSG("SQLCopyDesc called");
return SQL_SUCCESS;
}
@@ -613,7 +615,7 @@ SQLRETURN SQL_API SQLGetDescField(SQLHDESC descr,
SQLINTEGER bufferLen,
SQLINTEGER* resLen)
{
- LOG_MSG("SQLGetDescField called\n");
+ LOG_MSG("SQLGetDescField called");
return SQL_SUCCESS;
}
@@ -629,7 +631,7 @@ SQLRETURN SQL_API SQLGetDescRec(SQLHDESC DescriptorHandle,
SQLSMALLINT* scale,
SQLSMALLINT* nullable)
{
- LOG_MSG("SQLGetDescRec called\n");
+ LOG_MSG("SQLGetDescRec called");
return SQL_SUCCESS;
}
@@ -639,7 +641,7 @@ SQLRETURN SQL_API SQLSetDescField(SQLHDESC descr,
SQLPOINTER buffer,
SQLINTEGER bufferLen)
{
- LOG_MSG("SQLSetDescField called\n");
+ LOG_MSG("SQLSetDescField called");
return SQL_SUCCESS;
}
@@ -654,7 +656,7 @@ SQLRETURN SQL_API SQLSetDescRec(SQLHDESC descr,
SQLLEN* resLen,
SQLLEN* id)
{
- LOG_MSG("SQLSetDescRec called\n");
+ LOG_MSG("SQLSetDescRec called");
return SQL_SUCCESS;
}
@@ -668,7 +670,7 @@ SQLRETURN SQL_API SQLColumnPrivileges(SQLHSTMT stmt,
SQLCHAR* columnName,
SQLSMALLINT columnNameLen)
{
- LOG_MSG("SQLColumnPrivileges called\n");
+ LOG_MSG("SQLColumnPrivileges called");
return SQL_SUCCESS;
}
@@ -676,7 +678,7 @@ SQLRETURN SQL_API SQLParamOptions(SQLHSTMT stmt,
SQLULEN paramSetSize,
SQLULEN* paramsProcessed)
{
- LOG_MSG("SQLParamOptions called\n");
+ LOG_MSG("SQLParamOptions called");
return SQL_SUCCESS;
}
@@ -688,6 +690,6 @@ SQLRETURN SQL_API SQLProcedures(SQLHSTMT stmt,
SQLCHAR* tableName,
SQLSMALLINT tableNameLen)
{
- LOG_MSG("SQLProcedures called\n");
+ LOG_MSG("SQLProcedures called");
return SQL_SUCCESS;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/825fe9cd/modules/platforms/cpp/odbc/src/log.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/log.cpp b/modules/platforms/cpp/odbc/src/log.cpp
new file mode 100644
index 0000000..755798f
--- /dev/null
+++ b/modules/platforms/cpp/odbc/src/log.cpp
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <cstdlib>
+
+#include "ignite/odbc/log.h"
+
+namespace ignite
+{
+ namespace odbc
+ {
+ LogStream::LogStream(Logger* parent) :
+ std::basic_ostream<char>(0),
+ strbuf(),
+ logger(parent)
+ {
+ init(&strbuf);
+ }
+
+ bool LogStream::operator()()
+ {
+ return logger != 0;
+ }
+
+ LogStream::~LogStream()
+ {
+ if (logger)
+ {
+ logger->WriteMessage(strbuf.str());
+ }
+ }
+
+ Logger::Logger(const char* path) :
+ mutex(),
+ stream()
+ {
+ if (path)
+ {
+ stream.open(path);
+ }
+ }
+
+ Logger::~Logger()
+ {
+ }
+
+ bool Logger::IsEnabled() const
+ {
+ return stream.is_open();
+ }
+
+ void Logger::WriteMessage(std::string const& message)
+ {
+ if (IsEnabled())
+ {
+ ignite::common::concurrent::CsLockGuard guard(mutex);
+ stream << message << std::endl;
+ }
+ }
+
+ Logger* Logger::Get()
+ {
+ const char* envVarName = "IGNITE_ODBC_LOG_PATH";
+ static Logger logger(getenv(envVarName));
+ return logger.IsEnabled() ? &logger : 0;
+ }
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/ignite/blob/825fe9cd/modules/platforms/cpp/odbc/src/meta/column_meta.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/meta/column_meta.cpp b/modules/platforms/cpp/odbc/src/meta/column_meta.cpp
index d397618..12dbfc1 100644
--- a/modules/platforms/cpp/odbc/src/meta/column_meta.cpp
+++ b/modules/platforms/cpp/odbc/src/meta/column_meta.cpp
@@ -27,8 +27,6 @@ namespace ignite
namespace meta
{
-#ifdef ODBC_DEBUG
-
#define DBG_STR_CASE(x) case x: return #x
const char* ColumnMeta::AttrIdToString(uint16_t id)
@@ -70,8 +68,6 @@ namespace ignite
#undef DBG_STR_CASE
-#endif
-
void ColumnMeta::Read(ignite::impl::binary::BinaryReaderImpl& reader)
{
utility::ReadString(reader, schemaName);
http://git-wip-us.apache.org/repos/asf/ignite/blob/825fe9cd/modules/platforms/cpp/odbc/src/odbc.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/odbc.cpp b/modules/platforms/cpp/odbc/src/odbc.cpp
index fd69c0d..542e64c 100644
--- a/modules/platforms/cpp/odbc/src/odbc.cpp
+++ b/modules/platforms/cpp/odbc/src/odbc.cpp
@@ -20,6 +20,7 @@
#include <cstring>
#include <algorithm>
+#include "ignite/odbc/log.h"
#include "ignite/odbc/utility.h"
#include "ignite/odbc/system/odbc_constants.h"
@@ -43,9 +44,10 @@ namespace ignite
using odbc::Connection;
using odbc::config::ConnectionInfo;
- LOG_MSG("SQLGetInfo called: %d (%s), %p, %d, %p\n",
- infoType, ConnectionInfo::InfoTypeToString(infoType),
- infoValue, infoValueMax, length);
+ LOG_MSG("SQLGetInfo called: "
+ << infoType << " (" << ConnectionInfo::InfoTypeToString(infoType) << "), "
+ << std::hex << reinterpret_cast<size_t>(infoValue) << ", " << infoValueMax << ", "
+ << std::hex << reinterpret_cast<size_t>(length));
Connection *connection = reinterpret_cast<Connection*>(conn);
@@ -59,7 +61,7 @@ namespace ignite
SQLRETURN SQLAllocHandle(SQLSMALLINT type, SQLHANDLE parent, SQLHANDLE* result)
{
- //LOG_MSG("SQLAllocHandle called\n");
+ //LOG_MSG("SQLAllocHandle called");
switch (type)
{
case SQL_HANDLE_ENV:
@@ -101,7 +103,7 @@ namespace ignite
{
using odbc::Environment;
- LOG_MSG("SQLAllocEnv called\n");
+ LOG_MSG("SQLAllocEnv called");
*env = reinterpret_cast<SQLHENV>(new Environment());
@@ -113,7 +115,7 @@ namespace ignite
using odbc::Environment;
using odbc::Connection;
- LOG_MSG("SQLAllocConnect called\n");
+ LOG_MSG("SQLAllocConnect called");
*conn = SQL_NULL_HDBC;
@@ -137,7 +139,7 @@ namespace ignite
using odbc::Connection;
using odbc::Statement;
- LOG_MSG("SQLAllocStmt called\n");
+ LOG_MSG("SQLAllocStmt called");
*stmt = SQL_NULL_HDBC;
@@ -178,7 +180,7 @@ namespace ignite
{
using odbc::Environment;
- LOG_MSG("SQLFreeEnv called\n");
+ LOG_MSG("SQLFreeEnv called");
Environment *environment = reinterpret_cast<Environment*>(env);
@@ -194,7 +196,7 @@ namespace ignite
{
using odbc::Connection;
- LOG_MSG("SQLFreeConnect called\n");
+ LOG_MSG("SQLFreeConnect called");
Connection *connection = reinterpret_cast<Connection*>(conn);
@@ -210,7 +212,7 @@ namespace ignite
{
using odbc::Statement;
- LOG_MSG("SQLFreeStmt called\n");
+ LOG_MSG("SQLFreeStmt called");
Statement *statement = reinterpret_cast<Statement*>(stmt);
@@ -232,7 +234,7 @@ namespace ignite
{
using odbc::Statement;
- LOG_MSG("SQLCloseCursor called\n");
+ LOG_MSG("SQLCloseCursor called");
Statement *statement = reinterpret_cast<Statement*>(stmt);
@@ -257,8 +259,9 @@ namespace ignite
UNREFERENCED_PARAMETER(windowHandle);
- LOG_MSG("SQLDriverConnect called\n");
- LOG_MSG("Connection String: [%s]\n", inConnectionString);
+ LOG_MSG("SQLDriverConnect called");
+ if (inConnectionString)
+ LOG_MSG("Connection String: [" << inConnectionString << "]");
Connection *connection = reinterpret_cast<Connection*>(conn);
@@ -290,7 +293,8 @@ namespace ignite
if (outConnectionStringLen)
*outConnectionStringLen = static_cast<SQLSMALLINT>(reslen);
- LOG_MSG("%s\n", outConnectionString);
+ if (outConnectionString)
+ LOG_MSG(outConnectionString);
return diag.GetReturnCode();
}
@@ -318,7 +322,7 @@ namespace ignite
std::string dsn = SqlStringToString(serverName, serverNameLen);
- LOG_MSG("DSN: %s\n", dsn.c_str());
+ LOG_MSG("DSN: " << dsn);
odbc::ReadDsnConfiguration(dsn.c_str(), config);
@@ -331,7 +335,7 @@ namespace ignite
{
using odbc::Connection;
- LOG_MSG("SQLDisconnect called\n");
+ LOG_MSG("SQLDisconnect called");
Connection *connection = reinterpret_cast<Connection*>(conn);
@@ -348,7 +352,7 @@ namespace ignite
using odbc::Statement;
using utility::SqlStringToString;
- LOG_MSG("SQLPrepare called\n");
+ LOG_MSG("SQLPrepare called");
Statement *statement = reinterpret_cast<Statement*>(stmt);
@@ -357,7 +361,7 @@ namespace ignite
std::string sql = SqlStringToString(query, queryLen);
- LOG_MSG("SQL: %s\n", sql.c_str());
+ LOG_MSG("SQL: " << sql);
statement->PrepareSqlQuery(sql);
@@ -368,7 +372,7 @@ namespace ignite
{
using odbc::Statement;
- LOG_MSG("SQLExecute called\n");
+ LOG_MSG("SQLExecute called");
Statement *statement = reinterpret_cast<Statement*>(stmt);
@@ -385,7 +389,7 @@ namespace ignite
using odbc::Statement;
using utility::SqlStringToString;
- LOG_MSG("SQLExecDirect called\n");
+ LOG_MSG("SQLExecDirect called");
Statement *statement = reinterpret_cast<Statement*>(stmt);
@@ -394,7 +398,7 @@ namespace ignite
std::string sql = SqlStringToString(query, queryLen);
- LOG_MSG("SQL: %s\n", sql.c_str());
+ LOG_MSG("SQL: " << sql);
statement->ExecuteSqlQuery(sql);
@@ -413,7 +417,10 @@ namespace ignite
using odbc::Statement;
using odbc::app::ApplicationDataBuffer;
- LOG_MSG("SQLBindCol called: index=%d, type=%d targetValue=%p bufferLength=%d\n", colNum, targetType, targetValue, bufferLength);
+ LOG_MSG("SQLBindCol called: index=" << colNum << ", type=" << targetType <<
+ ", targetValue=" << reinterpret_cast<size_t>(targetValue) <<
+ ", bufferLength=" << bufferLength <<
+ ", lengthInd=" << reinterpret_cast<size_t>(strLengthOrIndicator));
Statement *statement = reinterpret_cast<Statement*>(stmt);
@@ -429,7 +436,7 @@ namespace ignite
{
using odbc::Statement;
- LOG_MSG("SQLFetch called\n");
+ LOG_MSG("SQLFetch called");
Statement *statement = reinterpret_cast<Statement*>(stmt);
@@ -445,8 +452,8 @@ namespace ignite
{
using odbc::Statement;
- LOG_MSG("SQLFetchScroll called\n");
- LOG_MSG("Orientation: %d, Offset: %d\n", orientation, offset);
+ LOG_MSG("SQLFetchScroll called");
+ LOG_MSG("Orientation: " << orientation << " Offset: " << offset);
Statement *statement = reinterpret_cast<Statement*>(stmt);
@@ -464,7 +471,7 @@ namespace ignite
SQLULEN* rowCount,
SQLUSMALLINT* rowStatusArray)
{
- LOG_MSG("SQLExtendedFetch called\n");
+ LOG_MSG("SQLExtendedFetch called");
SQLRETURN res = SQLFetchScroll(stmt, orientation, offset);
@@ -487,7 +494,7 @@ namespace ignite
using odbc::Statement;
using odbc::meta::ColumnMetaVector;
- LOG_MSG("SQLNumResultCols called\n");
+ LOG_MSG("SQLNumResultCols called");
Statement *statement = reinterpret_cast<Statement*>(stmt);
@@ -499,7 +506,7 @@ namespace ignite
if (columnNum)
{
*columnNum = static_cast<SQLSMALLINT>(res);
- LOG_MSG("columnNum: %d\n", *columnNum);
+ LOG_MSG("columnNum: " << *columnNum);
}
return statement->GetDiagnosticRecords().GetReturnCode();
@@ -518,7 +525,7 @@ namespace ignite
using odbc::Statement;
using utility::SqlStringToString;
- LOG_MSG("SQLTables called\n");
+ LOG_MSG("SQLTables called");
Statement *statement = reinterpret_cast<Statement*>(stmt);
@@ -530,10 +537,10 @@ namespace ignite
std::string table = SqlStringToString(tableName, tableNameLen);
std::string tableTypeStr = SqlStringToString(tableType, tableTypeLen);
- LOG_MSG("catalog: %s\n", catalog.c_str());
- LOG_MSG("schema: %s\n", schema.c_str());
- LOG_MSG("table: %s\n", table.c_str());
- LOG_MSG("tableType: %s\n", tableTypeStr.c_str());
+ LOG_MSG("catalog: " << catalog);
+ LOG_MSG("schema: " << schema);
+ LOG_MSG("table: " << table);
+ LOG_MSG("tableType: " << tableTypeStr);
statement->ExecuteGetTablesMetaQuery(catalog, schema, table, tableTypeStr);
@@ -553,7 +560,7 @@ namespace ignite
using odbc::Statement;
using utility::SqlStringToString;
- LOG_MSG("SQLColumns called\n");
+ LOG_MSG("SQLColumns called");
Statement *statement = reinterpret_cast<Statement*>(stmt);
@@ -565,10 +572,10 @@ namespace ignite
std::string table = SqlStringToString(tableName, tableNameLen);
std::string column = SqlStringToString(columnName, columnNameLen);
- LOG_MSG("catalog: %s\n", catalog.c_str());
- LOG_MSG("schema: %s\n", schema.c_str());
- LOG_MSG("table: %s\n", table.c_str());
- LOG_MSG("column: %s\n", column.c_str());
+ LOG_MSG("catalog: " << catalog);
+ LOG_MSG("schema: " << schema);
+ LOG_MSG("table: " << table);
+ LOG_MSG("column: " << column);
statement->ExecuteGetColumnsMetaQuery(schema, table, column);
@@ -579,7 +586,7 @@ namespace ignite
{
using odbc::Statement;
- LOG_MSG("SQLMoreResults called\n");
+ LOG_MSG("SQLMoreResults called");
Statement *statement = reinterpret_cast<Statement*>(stmt);
@@ -604,7 +611,7 @@ namespace ignite
{
using odbc::Statement;
- LOG_MSG("SQLBindParameter called: %d, %d, %d\n", paramIdx, bufferType, paramSqlType);
+ LOG_MSG("SQLBindParameter called: " << paramIdx << ", " << bufferType << ", " << paramSqlType);
Statement *statement = reinterpret_cast<Statement*>(stmt);
@@ -625,7 +632,7 @@ namespace ignite
{
using namespace utility;
- LOG_MSG("SQLNativeSql called\n");
+ LOG_MSG("SQLNativeSql called");
std::string in = SqlStringToString(inQuery, inQueryLen);
@@ -650,7 +657,7 @@ namespace ignite
using odbc::meta::ColumnMetaVector;
using odbc::meta::ColumnMeta;
- LOG_MSG("SQLColAttribute called: %d (%s)\n", fieldId, ColumnMeta::AttrIdToString(fieldId));
+ LOG_MSG("SQLColAttribute called: " << fieldId << " (" << ColumnMeta::AttrIdToString(fieldId) << ")");
Statement *statement = reinterpret_cast<Statement*>(stmt);
@@ -689,7 +696,7 @@ namespace ignite
using odbc::Statement;
using odbc::SqlLen;
- LOG_MSG("SQLDescribeCol called\n");
+ LOG_MSG("SQLDescribeCol called");
Statement *statement = reinterpret_cast<Statement*>(stmt);
@@ -709,13 +716,13 @@ namespace ignite
statement->GetColumnAttribute(columnNum, SQL_DESC_SCALE, 0, 0, 0, &decimalDigitsRes);
statement->GetColumnAttribute(columnNum, SQL_DESC_NULLABLE, 0, 0, 0, &nullableRes);
- LOG_MSG("columnNum: %lld\n", columnNum);
- LOG_MSG("dataTypeRes: %lld\n", dataTypeRes);
- LOG_MSG("columnSizeRes: %lld\n", columnSizeRes);
- LOG_MSG("decimalDigitsRes: %lld\n", decimalDigitsRes);
- LOG_MSG("nullableRes: %lld\n", nullableRes);
- LOG_MSG("columnNameBuf: %s\n", columnNameBuf ? reinterpret_cast<const char*>(columnNameBuf) : "<null>");
- LOG_MSG("columnNameLen: %d\n", columnNameLen ? *columnNameLen : -1);
+ LOG_MSG("columnNum: " << columnNum);
+ LOG_MSG("dataTypeRes: " << dataTypeRes);
+ LOG_MSG("columnSizeRes: " << columnSizeRes);
+ LOG_MSG("decimalDigitsRes: " << decimalDigitsRes);
+ LOG_MSG("nullableRes: " << nullableRes);
+ LOG_MSG("columnNameBuf: " << (columnNameBuf ? reinterpret_cast<const char*>(columnNameBuf) : "<null>"));
+ LOG_MSG("columnNameLen: " << (columnNameLen ? *columnNameLen : -1));
if (dataType)
*dataType = static_cast<SQLSMALLINT>(dataTypeRes);
@@ -737,7 +744,7 @@ namespace ignite
{
using odbc::Statement;
- LOG_MSG("SQLRowCount called\n");
+ LOG_MSG("SQLRowCount called");
Statement *statement = reinterpret_cast<Statement*>(stmt);
@@ -769,7 +776,7 @@ namespace ignite
using odbc::Statement;
using utility::SqlStringToString;
- LOG_MSG("SQLForeignKeys called\n");
+ LOG_MSG("SQLForeignKeys called");
Statement *statement = reinterpret_cast<Statement*>(stmt);
@@ -783,12 +790,12 @@ namespace ignite
std::string foreignSchema = SqlStringToString(foreignSchemaName, foreignSchemaNameLen);
std::string foreignTable = SqlStringToString(foreignTableName, foreignTableNameLen);
- LOG_MSG("primaryCatalog: %s\n", primaryCatalog.c_str());
- LOG_MSG("primarySchema: %s\n", primarySchema.c_str());
- LOG_MSG("primaryTable: %s\n", primaryTable.c_str());
- LOG_MSG("foreignCatalog: %s\n", foreignCatalog.c_str());
- LOG_MSG("foreignSchema: %s\n", foreignSchema.c_str());
- LOG_MSG("foreignTable: %s\n", foreignTable.c_str());
+ LOG_MSG("primaryCatalog: " << primaryCatalog);
+ LOG_MSG("primarySchema: " << primarySchema);
+ LOG_MSG("primaryTable: " << primaryTable);
+ LOG_MSG("foreignCatalog: " << foreignCatalog);
+ LOG_MSG("foreignSchema: " << foreignSchema);
+ LOG_MSG("foreignTable: " << foreignTable);
statement->ExecuteGetForeignKeysQuery(primaryCatalog, primarySchema,
primaryTable, foreignCatalog, foreignSchema, foreignTable);
@@ -809,7 +816,7 @@ namespace ignite
#ifdef ODBC_DEBUG
using odbc::type_traits::StatementAttrIdToString;
- LOG_MSG("Attr: %s (%d)\n", StatementAttrIdToString(attr), attr);
+ LOG_MSG("Attr: " << StatementAttrIdToString(attr) << " (" << attr << ")");
#endif //ODBC_DEBUG
Statement *statement = reinterpret_cast<Statement*>(stmt);
@@ -834,7 +841,7 @@ namespace ignite
#ifdef ODBC_DEBUG
using odbc::type_traits::StatementAttrIdToString;
- LOG_MSG("Attr: %s (%d)\n", StatementAttrIdToString(attr), attr);
+ LOG_MSG("Attr: " << StatementAttrIdToString(attr) << " (" << attr << ")");
#endif //ODBC_DEBUG
Statement *statement = reinterpret_cast<Statement*>(stmt);
@@ -858,7 +865,7 @@ namespace ignite
using odbc::Statement;
using utility::SqlStringToString;
- LOG_MSG("SQLPrimaryKeys called\n");
+ LOG_MSG("SQLPrimaryKeys called");
Statement *statement = reinterpret_cast<Statement*>(stmt);
@@ -869,9 +876,9 @@ namespace ignite
std::string schema = SqlStringToString(schemaName, schemaNameLen);
std::string table = SqlStringToString(tableName, tableNameLen);
- LOG_MSG("catalog: %s\n", catalog.c_str());
- LOG_MSG("schema: %s\n", schema.c_str());
- LOG_MSG("table: %s\n", table.c_str());
+ LOG_MSG("catalog: " << catalog);
+ LOG_MSG("schema: " << schema);
+ LOG_MSG("table: " << table);
statement->ExecuteGetPrimaryKeysQuery(catalog, schema, table);
@@ -882,7 +889,7 @@ namespace ignite
{
using odbc::Statement;
- LOG_MSG("SQLNumParams called\n");
+ LOG_MSG("SQLNumParams called");
Statement *statement = reinterpret_cast<Statement*>(stmt);
@@ -909,7 +916,7 @@ namespace ignite
using odbc::app::ApplicationDataBuffer;
- LOG_MSG("SQLGetDiagField called: %d\n", recNum);
+ LOG_MSG("SQLGetDiagField called: " << recNum);
SqlLen outResLen;
ApplicationDataBuffer outBuffer(IGNITE_ODBC_C_TYPE_DEFAULT, buffer, bufferLen, &outResLen);
@@ -960,7 +967,7 @@ namespace ignite
using odbc::app::ApplicationDataBuffer;
- LOG_MSG("SQLGetDiagRec called\n");
+ LOG_MSG("SQLGetDiagRec called");
const DiagnosticRecordStorage* records = 0;
@@ -1007,7 +1014,7 @@ namespace ignite
{
using odbc::Statement;
- LOG_MSG("SQLGetTypeInfo called\n");
+ LOG_MSG("SQLGetTypeInfo called");
Statement *statement = reinterpret_cast<Statement*>(stmt);
@@ -1023,7 +1030,7 @@ namespace ignite
{
using namespace odbc;
- LOG_MSG("SQLEndTran called\n");
+ LOG_MSG("SQLEndTran called");
SQLRETURN result;
@@ -1086,7 +1093,7 @@ namespace ignite
using odbc::Statement;
using odbc::app::ApplicationDataBuffer;
- LOG_MSG("SQLGetData called\n");
+ LOG_MSG("SQLGetData called");
Statement *statement = reinterpret_cast<Statement*>(stmt);
@@ -1109,7 +1116,7 @@ namespace ignite
{
using odbc::Environment;
- LOG_MSG("SQLSetEnvAttr called\n");
+ LOG_MSG("SQLSetEnvAttr called");
Environment *environment = reinterpret_cast<Environment*>(env);
@@ -1132,7 +1139,7 @@ namespace ignite
using odbc::app::ApplicationDataBuffer;
- LOG_MSG("SQLGetEnvAttr called\n");
+ LOG_MSG("SQLGetEnvAttr called");
Environment *environment = reinterpret_cast<Environment*>(env);
@@ -1166,7 +1173,7 @@ namespace ignite
using utility::SqlStringToString;
- LOG_MSG("SQLSpecialColumns called\n");
+ LOG_MSG("SQLSpecialColumns called");
Statement *statement = reinterpret_cast<Statement*>(stmt);
@@ -1177,9 +1184,9 @@ namespace ignite
std::string schema = SqlStringToString(schemaName, schemaNameLen);
std::string table = SqlStringToString(tableName, tableNameLen);
- LOG_MSG("catalog: %s\n", catalog.c_str());
- LOG_MSG("schema: %s\n", schema.c_str());
- LOG_MSG("table: %s\n", table.c_str());
+ LOG_MSG("catalog: " << catalog);
+ LOG_MSG("schema: " << schema);
+ LOG_MSG("table: " << table);
statement->ExecuteSpecialColumnsQuery(idType, catalog, schema, table, scope, nullable);
@@ -1190,7 +1197,7 @@ namespace ignite
{
using namespace ignite::odbc;
- LOG_MSG("SQLParamData called\n");
+ LOG_MSG("SQLParamData called");
Statement *statement = reinterpret_cast<Statement*>(stmt);
@@ -1206,7 +1213,7 @@ namespace ignite
{
using namespace ignite::odbc;
- LOG_MSG("SQLPutData called\n");
+ LOG_MSG("SQLPutData called");
Statement *statement = reinterpret_cast<Statement*>(stmt);
@@ -1227,7 +1234,7 @@ namespace ignite
{
using namespace ignite::odbc;
- LOG_MSG("SQLDescribeParam called\n");
+ LOG_MSG("SQLDescribeParam called");
Statement *statement = reinterpret_cast<Statement*>(stmt);
@@ -1255,7 +1262,7 @@ namespace ignite
using ignite::odbc::app::ApplicationDataBuffer;
- LOG_MSG("SQLError called\n");
+ LOG_MSG("SQLError called");
SQLHANDLE handle = 0;
http://git-wip-us.apache.org/repos/asf/ignite/blob/825fe9cd/modules/platforms/cpp/odbc/src/query/column_metadata_query.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/query/column_metadata_query.cpp b/modules/platforms/cpp/odbc/src/query/column_metadata_query.cpp
index 1cd2a9f..9aa5f7d 100644
--- a/modules/platforms/cpp/odbc/src/query/column_metadata_query.cpp
+++ b/modules/platforms/cpp/odbc/src/query/column_metadata_query.cpp
@@ -20,6 +20,7 @@
#include "ignite/odbc/type_traits.h"
#include "ignite/odbc/connection.h"
#include "ignite/odbc/message.h"
+#include "ignite/odbc/log.h"
#include "ignite/odbc/query/column_metadata_query.h"
namespace
@@ -292,8 +293,7 @@ namespace ignite
if (rsp.GetStatus() != RESPONSE_STATUS_SUCCESS)
{
- LOG_MSG("Error: %s\n", rsp.GetError().c_str());
-
+ LOG_MSG("Error: " << rsp.GetError());
diag.AddStatusRecord(SQL_STATE_HY000_GENERAL_ERROR, rsp.GetError());
return SQL_RESULT_ERROR;
@@ -303,11 +303,10 @@ namespace ignite
for (size_t i = 0; i < meta.size(); ++i)
{
- LOG_MSG("[%d] SchemaName: %s\n", i, meta[i].GetSchemaName().c_str());
- LOG_MSG("[%d] TableName: %s\n", i, meta[i].GetTableName().c_str());
- LOG_MSG("[%d] ColumnName: %s\n", i, meta[i].GetColumnName().c_str());
- LOG_MSG("[%d] ColumnType: %d\n", i, meta[i].GetDataType());
- LOG_MSG("\n");
+ LOG_MSG("\n[" << i << "] SchemaName: " << meta[i].GetSchemaName()
+ << "\n[" << i << "] TableName: " << meta[i].GetTableName()
+ << "\n[" << i << "] ColumnName: " << meta[i].GetColumnName()
+ << "\n[" << i << "] ColumnType: " << meta[i].GetDataType());
}
return SQL_RESULT_SUCCESS;
http://git-wip-us.apache.org/repos/asf/ignite/blob/825fe9cd/modules/platforms/cpp/odbc/src/query/data_query.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/query/data_query.cpp b/modules/platforms/cpp/odbc/src/query/data_query.cpp
index 5b1b758..c9762ad 100644
--- a/modules/platforms/cpp/odbc/src/query/data_query.cpp
+++ b/modules/platforms/cpp/odbc/src/query/data_query.cpp
@@ -17,6 +17,7 @@
#include "ignite/odbc/connection.h"
#include "ignite/odbc/message.h"
+#include "ignite/odbc/log.h"
#include "ignite/odbc/query/data_query.h"
namespace ignite
@@ -40,7 +41,7 @@ namespace ignite
{
Close();
}
-
+
SqlResult DataQuery::Execute()
{
if (cursor.get())
@@ -186,7 +187,7 @@ namespace ignite
if (rsp.GetStatus() != RESPONSE_STATUS_SUCCESS)
{
- LOG_MSG("Error: %s\n", rsp.GetError().c_str());
+ LOG_MSG("Error: " << rsp.GetError());
diag.AddStatusRecord(SQL_STATE_HY000_GENERAL_ERROR, rsp.GetError());
@@ -197,15 +198,13 @@ namespace ignite
resultMeta.assign(rsp.GetMeta().begin(), rsp.GetMeta().end());
- LOG_MSG("Query id: %lld\n", cursor->GetQueryId());
-
+ LOG_MSG("Query id: " << cursor->GetQueryId());
for (size_t i = 0; i < rsp.GetMeta().size(); ++i)
{
- LOG_MSG("[%d] SchemaName: %s\n", i, rsp.GetMeta()[i].GetSchemaName().c_str());
- LOG_MSG("[%d] TypeName: %s\n", i, rsp.GetMeta()[i].GetTableName().c_str());
- LOG_MSG("[%d] ColumnName: %s\n", i, rsp.GetMeta()[i].GetColumnName().c_str());
- LOG_MSG("[%d] ColumnType: %d\n", i, rsp.GetMeta()[i].GetDataType());
- LOG_MSG("\n");
+ LOG_MSG("\n[" << i << "] SchemaName: " << rsp.GetMeta()[i].GetSchemaName()
+ << "\n[" << i << "] TypeName: " << rsp.GetMeta()[i].GetTableName()
+ << "\n[" << i << "] ColumnName: " << rsp.GetMeta()[i].GetColumnName()
+ << "\n[" << i << "] ColumnType: " << rsp.GetMeta()[i].GetDataType());
}
return SQL_RESULT_SUCCESS;
@@ -227,11 +226,11 @@ namespace ignite
return SQL_RESULT_ERROR;
}
- LOG_MSG("Query id: %lld\n", rsp.GetQueryId());
+ LOG_MSG("Query id: " << rsp.GetQueryId());
if (rsp.GetStatus() != RESPONSE_STATUS_SUCCESS)
{
- LOG_MSG("Error: %s\n", rsp.GetError().c_str());
+ LOG_MSG("Error: " << rsp.GetError());
diag.AddStatusRecord(SQL_STATE_HY000_GENERAL_ERROR, rsp.GetError());
@@ -261,7 +260,7 @@ namespace ignite
if (rsp.GetStatus() != RESPONSE_STATUS_SUCCESS)
{
- LOG_MSG("Error: %s\n", rsp.GetError().c_str());
+ LOG_MSG("Error: " << rsp.GetError());
diag.AddStatusRecord(SQL_STATE_HY000_GENERAL_ERROR, rsp.GetError());
http://git-wip-us.apache.org/repos/asf/ignite/blob/825fe9cd/modules/platforms/cpp/odbc/src/query/table_metadata_query.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/query/table_metadata_query.cpp b/modules/platforms/cpp/odbc/src/query/table_metadata_query.cpp
index 3cddd1b..4fd5f7b 100644
--- a/modules/platforms/cpp/odbc/src/query/table_metadata_query.cpp
+++ b/modules/platforms/cpp/odbc/src/query/table_metadata_query.cpp
@@ -20,6 +20,7 @@
#include "ignite/odbc/type_traits.h"
#include "ignite/odbc/connection.h"
#include "ignite/odbc/message.h"
+#include "ignite/odbc/log.h"
#include "ignite/odbc/query/table_metadata_query.h"
namespace
@@ -218,7 +219,7 @@ namespace ignite
if (rsp.GetStatus() != RESPONSE_STATUS_SUCCESS)
{
- LOG_MSG("Error: %s\n", rsp.GetError().c_str());
+ LOG_MSG("Error: " << rsp.GetError());
diag.AddStatusRecord(SQL_STATE_HY000_GENERAL_ERROR, rsp.GetError());
@@ -229,11 +230,10 @@ namespace ignite
for (size_t i = 0; i < meta.size(); ++i)
{
- LOG_MSG("[%d] CatalogName: %s\n", i, meta[i].GetCatalogName().c_str());
- LOG_MSG("[%d] SchemaName: %s\n", i, meta[i].GetSchemaName().c_str());
- LOG_MSG("[%d] TableName: %s\n", i, meta[i].GetTableName().c_str());
- LOG_MSG("[%d] TableType: %s\n", i, meta[i].GetTableType().c_str());
- LOG_MSG("\n");
+ LOG_MSG("\n[" << i << "] CatalogName: " << meta[i].GetCatalogName()
+ << "\n[" << i << "] SchemaName: " << meta[i].GetSchemaName()
+ << "\n[" << i << "] TableName: " << meta[i].GetTableName()
+ << "\n[" << i << "] TableType: " << meta[i].GetTableType());
}
return SQL_RESULT_SUCCESS;
http://git-wip-us.apache.org/repos/asf/ignite/blob/825fe9cd/modules/platforms/cpp/odbc/src/statement.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/statement.cpp b/modules/platforms/cpp/odbc/src/statement.cpp
index 09ad81c..2395d66 100644
--- a/modules/platforms/cpp/odbc/src/statement.cpp
+++ b/modules/platforms/cpp/odbc/src/statement.cpp
@@ -27,6 +27,7 @@
#include "ignite/odbc/utility.h"
#include "ignite/odbc/message.h"
#include "ignite/odbc/statement.h"
+#include "ignite/odbc/log.h"
namespace ignite
{
@@ -232,7 +233,7 @@ namespace ignite
{
SQLULEN val = reinterpret_cast<SQLULEN>(value);
- LOG_MSG("SQL_ATTR_ROW_ARRAY_SIZE: %d\n", val);
+ LOG_MSG("SQL_ATTR_ROW_ARRAY_SIZE: " << val);
if (val != 1)
{
@@ -986,7 +987,7 @@ namespace ignite
if (paramNum > 0 && static_cast<size_t>(paramNum) <= paramTypes.size())
type = paramTypes[paramNum - 1];
- LOG_MSG("Type: %d\n", type);
+ LOG_MSG("Type: " << type);
if (!type)
{
@@ -1044,7 +1045,7 @@ namespace ignite
if (rsp.GetStatus() != RESPONSE_STATUS_SUCCESS)
{
- LOG_MSG("Error: %s\n", rsp.GetError().c_str());
+ LOG_MSG("Error: " << rsp.GetError());
AddStatusRecord(SQL_STATE_HY000_GENERAL_ERROR, rsp.GetError());
@@ -1054,7 +1055,9 @@ namespace ignite
paramTypes = rsp.GetTypeIds();
for (size_t i = 0; i < paramTypes.size(); ++i)
- LOG_MSG("[%zu] Parameter type: %u\n", i, paramTypes[i]);
+ {
+ LOG_MSG("[" << i << "] Parameter type: " << paramTypes[i]);
+ }
return SQL_RESULT_SUCCESS;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/825fe9cd/modules/platforms/cpp/odbc/src/utility.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/utility.cpp b/modules/platforms/cpp/odbc/src/utility.cpp
index c15c23c..63454dc 100644
--- a/modules/platforms/cpp/odbc/src/utility.cpp
+++ b/modules/platforms/cpp/odbc/src/utility.cpp
@@ -22,20 +22,6 @@
#include "ignite/odbc/utility.h"
#include "ignite/odbc/system/odbc_constants.h"
-#ifdef ODBC_DEBUG
-
-FILE* log_file = NULL;
-
-void logInit(const char* path)
-{
- if (!log_file)
- {
- log_file = fopen(path, "w");
- }
-}
-
-#endif //ODBC_DEBUG
-
namespace ignite
{
namespace utility
@@ -155,11 +141,11 @@ namespace ignite
res.clear();
}
- std::string HexDump(const char* data, size_t count)
+ std::string HexDump(const void* data, size_t count)
{
std::stringstream dump;
size_t cnt = 0;
- for(const char* p = data, *e = data + count; p != e; ++p)
+ for(const uint8_t* p = (const uint8_t*)data, *e = (const uint8_t*)data + count; p != e; ++p)
{
if (cnt++ % 16 == 0)
{