purge trailing whitespace (#1947)

This commit is contained in:
Aleksandar Fabijanic 2017-10-20 15:37:19 -05:00 committed by GitHub
parent 1101439eb0
commit 151304135e
1204 changed files with 16595 additions and 16595 deletions

12
.gitattributes vendored
View File

@ -1,17 +1,17 @@
# Set default behaviour, in case users don't have core.autocrlf set. # Set default behaviour, in case users don't have core.autocrlf set.
* text=auto * text=auto
# Explicitly declare text files we want to always be normalized and converted # Explicitly declare text files we want to always be normalized and converted
# to native line endings on checkout. # to native line endings on checkout.
*.txt text *.txt text
*.cpp text *.cpp text
*.c text *.c text
*.h text *.h text
*.cmd text *.cmd text
*.sln text *.sln text
*.vcproj text *.vcproj text
*.vcxproj text *.vcxproj text
*.vcxproj.filters text *.vcxproj.filters text
*.page text *.page text
*.html text *.html text
*.xhtml text *.xhtml text

View File

@ -11,7 +11,7 @@ branches:
before_install: before_install:
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get update -qq; fi - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get update -qq; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -qq -y libpcre3-dev libssl-dev libexpat1-dev; fi - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -qq -y libpcre3-dev libssl-dev libexpat1-dev; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -qq -y libpq-dev unixodbc-dev libmysqlclient-dev libsqlite3-dev; fi - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -qq -y libpq-dev unixodbc-dev libmysqlclient-dev libsqlite3-dev; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -qq -y sloccount cppcheck; fi - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -qq -y sloccount cppcheck; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; fi - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get update -qq; fi - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get update -qq; fi
@ -30,7 +30,7 @@ services:
dist: trusty dist: trusty
sudo: enabled sudo: enabled
addons: addons:
postgresql: "9.4" postgresql: "9.4"
@ -39,16 +39,16 @@ notifications:
email: email:
on_success: never # default: change on_success: never # default: change
on_failure: always # default: always on_failure: always # default: always
slack: slack:
rooms: rooms:
- pocoproject:ItIUZvs8aJGyPdaKxIKMnS1t#travis - pocoproject:ItIUZvs8aJGyPdaKxIKMnS1t#travis
on_success: never # default: change on_success: never # default: change
on_failure: always # default: always on_failure: always # default: always
env: env:
global: global:
TEST_NAME="" TEST_NAME=""
before_script: before_script:
- echo ${TEST_NAME} - echo ${TEST_NAME}
- chmod 755 ./travis/Linux/runtests.sh - chmod 755 ./travis/Linux/runtests.sh
@ -70,7 +70,7 @@ matrix:
- export CXX="g++-4.9" - export CXX="g++-4.9"
- $CXX --version - $CXX --version
- ./configure --everything && make -s -j2 && ./travis/Linux/runtests.sh - ./configure --everything && make -s -j2 && ./travis/Linux/runtests.sh
- env: TEST_NAME="gcc 5.4 (make) bundled" - env: TEST_NAME="gcc 5.4 (make) bundled"
compiler: gcc compiler: gcc
script: script:
@ -78,15 +78,15 @@ matrix:
- export CXX="g++-5" - export CXX="g++-5"
- $CXX --version - $CXX --version
- ./configure --everything && make -s -j2 && ./travis/Linux/runtests.sh - ./configure --everything && make -s -j2 && ./travis/Linux/runtests.sh
#- env: TEST_NAME="gcc 5.4 (make) unbundled" #- env: TEST_NAME="gcc 5.4 (make) unbundled"
# ======================================= unit tests fail ures due to unbundled pcre # ======================================= unit tests fail ures due to unbundled pcre
# There was 1 error: # There was 1 error:
# 1: N7CppUnit10TestCallerI21RegularExpressionTestEE.testSubst2 # 1: N7CppUnit10TestCallerI21RegularExpressionTestEE.testSubst2
# "St9bad_alloc: std::bad_alloc" # "St9bad_alloc: std::bad_alloc"
# in "<unknown>", line -1 # in "<unknown>", line -1
# #
# There were 4 failures: # There were 4 failures:
# 1: N7CppUnit10TestCallerI21RegularExpressionTestEE.testMatch4 # 1: N7CppUnit10TestCallerI21RegularExpressionTestEE.testMatch4
# "re.match("123 456", 0, matches) == 3" # "re.match("123 456", 0, matches) == 3"
# in "src/RegularExpressionTest.cpp", line 103 # in "src/RegularExpressionTest.cpp", line 103
@ -99,7 +99,7 @@ matrix:
# 4: N7CppUnit10TestCallerI21RegularExpressionTestEE.testGroup # 4: N7CppUnit10TestCallerI21RegularExpressionTestEE.testGroup
# "re.match("abcd 1234", 0, matches) == 3" # "re.match("abcd 1234", 0, matches) == 3"
# in "src/RegularExpressionTest.cpp", line 271 # in "src/RegularExpressionTest.cpp", line 271
# #
# failed=Foundation # failed=Foundation
# ======================================= # =======================================
# compiler: gcc # compiler: gcc
@ -109,7 +109,7 @@ matrix:
# - export CXX="g++-5" # - export CXX="g++-5"
# - $CXX --version # - $CXX --version
# - ./configure --everything --unbundled && make -s -j2 && ./travis/Linux/runtests.sh # - ./configure --everything --unbundled && make -s -j2 && ./travis/Linux/runtests.sh
- env: TEST_NAME="gcc 4.9 (CMake)" - env: TEST_NAME="gcc 4.9 (CMake)"
compiler: gcc compiler: gcc
script: script:
@ -120,7 +120,7 @@ matrix:
- source ./travis/ignored.sh - source ./travis/ignored.sh
- export POCO_BASE=`pwd` - export POCO_BASE=`pwd`
- mkdir cmake-build && cd cmake-build && cmake -DENABLE_TESTS=ON .. && make -s -j2 && ctest -VV -E Data && cd .. - mkdir cmake-build && cd cmake-build && cmake -DENABLE_TESTS=ON .. && make -s -j2 && ctest -VV -E Data && cd ..
- env: TEST_NAME="clang (make) bundled" - env: TEST_NAME="clang (make) bundled"
os: osx os: osx
@ -141,7 +141,7 @@ matrix:
- export CXX="clang++-4.0" - export CXX="clang++-4.0"
- $CXX --version - $CXX --version
- ./configure --config=Linux-clang --everything && make -s -j2 && ./travis/Linux/runtests.sh - ./configure --config=Linux-clang --everything && make -s -j2 && ./travis/Linux/runtests.sh
- env: TEST_NAME="clang 5.0 (make) bundled" - env: TEST_NAME="clang 5.0 (make) bundled"
compiler: clang compiler: clang
script: script:
@ -151,20 +151,20 @@ matrix:
- export CXX="clang++-5.0" - export CXX="clang++-5.0"
- $CXX --version - $CXX --version
- ./configure --config=Linux-clang --everything && make -s -j2 && ./travis/Linux/runtests.sh - ./configure --config=Linux-clang --everything && make -s -j2 && ./travis/Linux/runtests.sh
#- env: TEST_NAME="clang 3.5.0 (make) unbundled" #- env: TEST_NAME="clang 3.5.0 (make) unbundled"
# ======================================= compiler error on generating debug info for auto return # ======================================= compiler error on generating debug info for auto return
# error: debug information for auto is not yet supported # error: debug information for auto is not yet supported
# error: debug information for auto is not yet supported # error: debug information for auto is not yet supported
# ** Creating dependency info for src/Timespan.cpp # ** Creating dependency info for src/Timespan.cpp
# make[1]: *** [/home/travis/build/Kampbell/poco/CppUnit/obj/Linux/x86_64/debug_shared/TestRunner.o] Error 1 # compiler: clang # make[1]: *** [/home/travis/build/Kampbell/poco/CppUnit/obj/Linux/x86_64/debug_shared/TestRunner.o] Error 1 # compiler: clang
# ======================================= # =======================================
# script: # script:
# - export CC="clang" # - export CC="clang"
# - export CXX="clang++" # - export CXX="clang++"
# - $CXX --version # - $CXX --version
# - ./configure --config=Linux-clang --everything --unbundled && make -s -j2 && ./travis/Linux/runtests.sh # - ./configure --config=Linux-clang --everything --unbundled && make -s -j2 && ./travis/Linux/runtests.sh
#- env: TEST_NAME="arm-linux-gnueabi-g++ (make)" #- env: TEST_NAME="arm-linux-gnueabi-g++ (make)"
# compiler: gcc # compiler: gcc
# script: # script:
@ -190,7 +190,7 @@ matrix:
# - $CXX --version # - $CXX --version
# - source ./travis/ignored.sh # - source ./travis/ignored.sh
# - export POCO_BASE=`pwd` # - export POCO_BASE=`pwd`
# - mkdir cmake-build # - mkdir cmake-build
# - cd cmake-build && cmake -DENABLE_NETSSL=OFF -DENABLE_CRYPTO=OFF -DENABLE_TESTS=ON .. && make -s -j2 && cd .. # - cd cmake-build && cmake -DENABLE_NETSSL=OFF -DENABLE_CRYPTO=OFF -DENABLE_TESTS=ON .. && make -s -j2 && cd ..
- env: TEST_NAME="arm-linux-gnueabihf-g++ (CMake)" - env: TEST_NAME="arm-linux-gnueabihf-g++ (CMake)"

View File

@ -8,7 +8,7 @@ vc.project.platforms = Win32, x64
vc.project.configurations = debug_shared, release_shared vc.project.configurations = debug_shared, release_shared
vc.project.prototype = ApacheConnector_vs90.vcproj vc.project.prototype = ApacheConnector_vs90.vcproj
vc.project.compiler.include = ..\\Foundation\\include;..\\Net\\include;..\\Util\\include vc.project.compiler.include = ..\\Foundation\\include;..\\Net\\include;..\\Util\\include
vc.project.compiler.defines = vc.project.compiler.defines =
vc.project.compiler.defines.shared = ApacheHandlers_EXPORTS vc.project.compiler.defines.shared = ApacheHandlers_EXPORTS
vc.project.compiler.defines.debug_shared = ${vc.project.compiler.defines.shared} vc.project.compiler.defines.debug_shared = ${vc.project.compiler.defines.shared}
vc.project.compiler.defines.release_shared = ${vc.project.compiler.defines.shared} vc.project.compiler.defines.release_shared = ${vc.project.compiler.defines.shared}

View File

@ -16,7 +16,7 @@ file (usually <[httpd.conf]>):
LoadModule poco_module modules/mod_pocod.so LoadModule poco_module modules/mod_pocod.so
---- ----
!!!Configuring ApacheConnector !!!Configuring ApacheConnector
ApacheConnector must be able to find shared libraries containing request handler, as well ApacheConnector must be able to find shared libraries containing request handler, as well
as optional configuration files. ApacheConnector provides an Poco::Util::Application class as optional configuration files. ApacheConnector provides an Poco::Util::Application class
@ -30,7 +30,7 @@ is used in the Apache configuration file:
AddPocoRequestHandler <FactoryClass> <SharedLibrary> <Path>... AddPocoRequestHandler <FactoryClass> <SharedLibrary> <Path>...
---- ----
The first argument specifies the name of the request handler factory class. The second argument The first argument specifies the name of the request handler factory class. The second argument
contains the path of the shared library containing the request handler. contains the path of the shared library containing the request handler.
The third (and optionally following) argument(s) specify the URI paths handled by the The third (and optionally following) argument(s) specify the URI paths handled by the
@ -38,7 +38,7 @@ request handler. For example:
AddPocoRequestHandler TimeRequestHandlerFactory p:/Poco/ApacheConnector/samples/TimeServer/bin/TimeServerd.dll /time AddPocoRequestHandler TimeRequestHandlerFactory p:/Poco/ApacheConnector/samples/TimeServer/bin/TimeServerd.dll /time
---- ----
loads the TimeRequestHandlerFactory from TimeServerd.dll. Whenever a request for a URI starting with "/time" loads the TimeRequestHandlerFactory from TimeServerd.dll. Whenever a request for a URI starting with "/time"
is sent by a client, this request will be handled by the TimeRequestHandler. is sent by a client, this request will be handled by the TimeRequestHandler.
@ -76,8 +76,8 @@ Following is a sample for a request handler implementation. The complete sample
#include "Poco/DateTimeFormatter.h" #include "Poco/DateTimeFormatter.h"
#include "Poco/DateTimeFormat.h" #include "Poco/DateTimeFormat.h"
#include "Poco/ClassLibrary.h" #include "Poco/ClassLibrary.h"
using Poco::Net::HTTPRequestHandler; using Poco::Net::HTTPRequestHandler;
using Poco::Net::HTTPRequestHandlerFactory; using Poco::Net::HTTPRequestHandlerFactory;
using Poco::Net::HTTPServerRequest; using Poco::Net::HTTPServerRequest;
@ -85,24 +85,24 @@ Following is a sample for a request handler implementation. The complete sample
using Poco::Timestamp; using Poco::Timestamp;
using Poco::DateTimeFormatter; using Poco::DateTimeFormatter;
using Poco::DateTimeFormat; using Poco::DateTimeFormat;
class TimeRequestHandler: public HTTPRequestHandler class TimeRequestHandler: public HTTPRequestHandler
/// Return a HTML document with the current date and time. /// Return a HTML document with the current date and time.
{ {
public: public:
TimeRequestHandler() TimeRequestHandler()
{ {
} }
void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response) void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response)
{ {
Timestamp now; Timestamp now;
std::string dt(DateTimeFormatter::format(now, DateTimeFormat::SORTABLE_FORMAT)); std::string dt(DateTimeFormatter::format(now, DateTimeFormat::SORTABLE_FORMAT));
response.setChunkedTransferEncoding(true); response.setChunkedTransferEncoding(true);
response.setContentType("text/html"); response.setContentType("text/html");
std::ostream& ostr = response.send(); std::ostream& ostr = response.send();
ostr << "<html><head><title>TimeServer powered by POCO ApacheConnector</title>"; ostr << "<html><head><title>TimeServer powered by POCO ApacheConnector</title>";
ostr << "<meta http-equiv=\"refresh\" content=\"1\"></head>"; ostr << "<meta http-equiv=\"refresh\" content=\"1\"></head>";
@ -111,22 +111,22 @@ Following is a sample for a request handler implementation. The complete sample
ostr << "</p></body></html>"; ostr << "</p></body></html>";
} }
}; };
class TimeRequestHandlerFactory: public HTTPRequestHandlerFactory class TimeRequestHandlerFactory: public HTTPRequestHandlerFactory
{ {
public: public:
TimeRequestHandlerFactory() TimeRequestHandlerFactory()
{ {
} }
HTTPRequestHandler* createRequestHandler(const HTTPServerRequest& request) HTTPRequestHandler* createRequestHandler(const HTTPServerRequest& request)
{ {
return new TimeRequestHandler; return new TimeRequestHandler;
} }
}; };
POCO_BEGIN_MANIFEST(HTTPRequestHandlerFactory) POCO_BEGIN_MANIFEST(HTTPRequestHandlerFactory)
POCO_EXPORT_CLASS(TimeRequestHandlerFactory) POCO_EXPORT_CLASS(TimeRequestHandlerFactory)
POCO_END_MANIFEST POCO_END_MANIFEST

View File

@ -25,10 +25,10 @@ class ApacheServerRequest: public Poco::Net::HTTPServerRequest
{ {
public: public:
ApacheServerRequest( ApacheServerRequest(
ApacheRequestRec* pApacheRequest, ApacheRequestRec* pApacheRequest,
const char* serverName, const char* serverName,
int serverPort, int serverPort,
const char* clientName, const char* clientName,
int clientPort); int clientPort);
/// Creates a new ApacheServerRequest. /// Creates a new ApacheServerRequest.

View File

@ -55,14 +55,14 @@ public:
/// The returned stream is valid until the response /// The returned stream is valid until the response
/// object is destroyed. /// object is destroyed.
/// ///
/// Must not be called after sendFile(), sendBuffer() /// Must not be called after sendFile(), sendBuffer()
/// or redirect() has been called. /// or redirect() has been called.
void sendFile(const std::string& path, const std::string& mediaType); void sendFile(const std::string& path, const std::string& mediaType);
/// Sends the response header to the client, followed /// Sends the response header to the client, followed
/// by the content of the given file. /// by the content of the given file.
/// ///
/// Must not be called after send(), sendBuffer() /// Must not be called after send(), sendBuffer()
/// or redirect() has been called. /// or redirect() has been called.
/// ///
/// Throws a FileNotFoundException if the file /// Throws a FileNotFoundException if the file
@ -77,10 +77,10 @@ public:
/// to length and chunked transfer encoding is disabled. /// to length and chunked transfer encoding is disabled.
/// ///
/// If both the HTTP message header and body (from the /// If both the HTTP message header and body (from the
/// given buffer) fit into one single network packet, the /// given buffer) fit into one single network packet, the
/// complete response can be sent in one network packet. /// complete response can be sent in one network packet.
/// ///
/// Must not be called after send(), sendFile() /// Must not be called after send(), sendFile()
/// or redirect() has been called. /// or redirect() has been called.
void redirect(const std::string& uri, Poco::Net::HTTPResponse::HTTPStatus status); void redirect(const std::string& uri, Poco::Net::HTTPResponse::HTTPStatus status);

View File

@ -33,7 +33,7 @@ protected:
int writeToDevice(const char* buffer, std::streamsize length); int writeToDevice(const char* buffer, std::streamsize length);
private: private:
enum enum
{ {
STREAM_BUFFER_SIZE = 1024 STREAM_BUFFER_SIZE = 1024
}; };

View File

@ -91,7 +91,7 @@ class FormRequestHandler: public HTTPRequestHandler
/// Return a HTML document with the current date and time. /// Return a HTML document with the current date and time.
{ {
public: public:
FormRequestHandler() FormRequestHandler()
{ {
} }

View File

@ -32,7 +32,7 @@ class TimeRequestHandler: public HTTPRequestHandler
/// Return a HTML document with the current date and time. /// Return a HTML document with the current date and time.
{ {
public: public:
TimeRequestHandler() TimeRequestHandler()
{ {
} }

View File

@ -175,7 +175,7 @@ extern "C" int ApacheConnector_handler(request_rec *r)
return DECLINED; return DECLINED;
apr_status_t rv; apr_status_t rv;
if ((rv = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK))) if ((rv = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK)))
return rv; return rv;
// The properties conn_rec->remote_ip and conn_rec->remote_addr have undergone significant changes in Apache 2.4. // The properties conn_rec->remote_ip and conn_rec->remote_addr have undergone significant changes in Apache 2.4.
@ -274,25 +274,25 @@ extern "C" const char* ApacheConnector_config(cmd_parms *cmd, void *in_dconf, co
} }
extern "C" const command_rec ApacheConnector_cmds[] = extern "C" const command_rec ApacheConnector_cmds[] =
{ {
AP_INIT_RAW_ARGS( AP_INIT_RAW_ARGS(
"AddPocoRequestHandler", "AddPocoRequestHandler",
reinterpret_cast<cmd_func>(ApacheConnector_uris), reinterpret_cast<cmd_func>(ApacheConnector_uris),
NULL, NULL,
RSRC_CONF, RSRC_CONF,
"POCO RequestHandlerFactory class name followed by shared library path followed by a list of ' ' separated URIs that must be handled by this module."), "POCO RequestHandlerFactory class name followed by shared library path followed by a list of ' ' separated URIs that must be handled by this module."),
AP_INIT_RAW_ARGS( AP_INIT_RAW_ARGS(
"AddPocoConfig", "AddPocoConfig",
reinterpret_cast<cmd_func>(ApacheConnector_config), reinterpret_cast<cmd_func>(ApacheConnector_config),
NULL, NULL,
RSRC_CONF, RSRC_CONF,
"Path of the POCO configuration file."), "Path of the POCO configuration file."),
{ NULL } { NULL }
}; };
module AP_MODULE_DECLARE_DATA poco_module = module AP_MODULE_DECLARE_DATA poco_module =
{ {
STANDARD20_MODULE_STUFF, STANDARD20_MODULE_STUFF,
NULL, NULL,

View File

@ -16,10 +16,10 @@
ApacheServerRequest::ApacheServerRequest( ApacheServerRequest::ApacheServerRequest(
ApacheRequestRec* pApacheRequest, ApacheRequestRec* pApacheRequest,
const char* serverName, const char* serverName,
int serverPort, int serverPort,
const char* clientName, const char* clientName,
int clientPort): int clientPort):
_pApacheRequest(pApacheRequest), _pApacheRequest(pApacheRequest),
_pResponse(0), _pResponse(0),

View File

@ -21,7 +21,7 @@ using Poco::BufferedStreamBuf;
// //
ApacheStreamBuf::ApacheStreamBuf(ApacheRequestRec* pApacheRequest, bool haveData): ApacheStreamBuf::ApacheStreamBuf(ApacheRequestRec* pApacheRequest, bool haveData):
BufferedStreamBuf(STREAM_BUFFER_SIZE, std::ios::in | std::ios::out), BufferedStreamBuf(STREAM_BUFFER_SIZE, std::ios::in | std::ios::out),
_pApacheRequest(pApacheRequest), _pApacheRequest(pApacheRequest),
_haveData(haveData) _haveData(haveData)

View File

@ -337,7 +337,7 @@ set(CPACK_PACKAGE_INSTALL_DIRECTORY "/usr/local")
include(CPack) include(CPack)
############################################################# #############################################################
# cmake config files # cmake config files
include(CMakePackageConfigHelpers) include(CMakePackageConfigHelpers)
write_basic_package_version_file( write_basic_package_version_file(

View File

@ -18,7 +18,7 @@ David Shawley
Sergey Skorokhodov Sergey Skorokhodov
Tom Tan Tom Tan
Sergey N. Yatskevich Sergey N. Yatskevich
Marc Chevrier Marc Chevrier
Philippe Cuvillier Philippe Cuvillier
Marian Krivos Marian Krivos
Franky Braem Franky Braem
@ -40,7 +40,7 @@ Pascal Bach
Cristian Thiago Moecke Cristian Thiago Moecke
Sergei Nikulov Sergei Nikulov
Aaron Kaluszka Aaron Kaluszka
Iyed Bennour Iyed Bennour
Scott Davis Scott Davis
Kristin Cowalcijk Kristin Cowalcijk
Yuval Kashtan Yuval Kashtan

View File

@ -74,7 +74,7 @@ public:
bool getBool(const std::string& name) const; bool getBool(const std::string& name) const;
/// Returns the attribute's value as a boolean. /// Returns the attribute's value as a boolean.
/// The returned value is 'true', iff the stored value is not "false". /// The returned value is 'true', iff the stored value is not "false".
/// ///
/// Throws a Poco::NotFoundException if the attribute does not exist. /// Throws a Poco::NotFoundException if the attribute does not exist.
bool getBool(const std::string& name, bool defaultValue) const; bool getBool(const std::string& name, bool defaultValue) const;

View File

@ -34,13 +34,13 @@ class CppParser_API AttributesParser
/// structs/classes, functions, types, etc. can be annotated /// structs/classes, functions, types, etc. can be annotated
/// with attributes. /// with attributes.
/// ///
/// Attributes always come immediately before the symbol that /// Attributes always come immediately before the symbol that
/// is being annotated, and are written inside special comments /// is being annotated, and are written inside special comments
/// with the syntax: /// with the syntax:
/// //@ <attrDecl>[,<attrDec>...] /// //@ <attrDecl>[,<attrDec>...]
/// where <attrDecl> is /// where <attrDecl> is
/// <name>[=<value>] /// <name>[=<value>]
/// <name> is a valid C++ identifier, or two identifiers separated by /// <name> is a valid C++ identifier, or two identifiers separated by
/// a period (struct accessor notation). /// a period (struct accessor notation).
/// <value> is a string, integer, identifier, bool literal, or a complex value /// <value> is a string, integer, identifier, bool literal, or a complex value
/// in the form /// in the form

View File

@ -66,7 +66,7 @@ public:
OP_BITAND_ASSIGN, // &= OP_BITAND_ASSIGN, // &=
OP_AND, // && OP_AND, // &&
OP_BITOR, // | OP_BITOR, // |
OP_BITOR_ASSIGN, // |= OP_BITOR_ASSIGN, // |=
OP_OR, // || OP_OR, // ||
OP_XOR, // ^ OP_XOR, // ^
OP_XOR_ASSIGN, // ^= OP_XOR_ASSIGN, // ^=

View File

@ -37,7 +37,7 @@ public:
public: public:
std::string beginNameSpaceDecl; // contains either $(NS)_BEGIN or the namespace x { decl std::string beginNameSpaceDecl; // contains either $(NS)_BEGIN or the namespace x { decl
std::string endNameSpaceDecl; // contains either $(NS)_END or the closing brackets } std::string endNameSpaceDecl; // contains either $(NS)_END or the closing brackets }
std::vector<std::string> classDecls; // contains strings of the form "class X;" std::vector<std::string> classDecls; // contains strings of the form "class X;"
}; };
static void parse(const std::string& file, NameSpace::SymbolTable& st, const std::string& exec, const std::string& options, const std::string& path); static void parse(const std::string& file, NameSpace::SymbolTable& st, const std::string& exec, const std::string& options, const std::string& path);

View File

@ -96,7 +96,7 @@ OperatorToken::OperatorToken()
_opMap[":"] = i++; _opMap[":"] = i++;
_opMap["::"] = i++; _opMap["::"] = i++;
_opMap[";"] = i++; _opMap[";"] = i++;
_opMap["?"] = i++; _opMap["?"] = i++;
} }
@ -345,7 +345,7 @@ void IdentifierToken::finish(std::istream& istr)
while ((next >= 'A' && next <= 'Z') || while ((next >= 'A' && next <= 'Z') ||
(next >= 'a' && next <= 'z') || (next >= 'a' && next <= 'z') ||
(next >= '0' && next <= '9') || (next >= '0' && next <= '9') ||
(next == '_' || next == '$')) (next == '_' || next == '$'))
{ {
_value += (char) istr.get(); _value += (char) istr.get();
next = istr.peek(); next = istr.peek();
@ -517,14 +517,14 @@ void NumberLiteralToken::finish(std::istream& istr)
{ {
_value += (char) istr.get(); _value += (char) istr.get();
next = istr.peek(); next = istr.peek();
while (std::isxdigit(next)) while (std::isxdigit(next))
{ {
_value += (char) istr.get(); _value += (char) istr.get();
next = istr.peek(); next = istr.peek();
} }
while (next == 'L' || next == 'l' || next == 'U' || next == 'u') while (next == 'L' || next == 'l' || next == 'U' || next == 'u')
{ {
_value += (char) istr.get(); _value += (char) istr.get();
next = istr.peek(); next = istr.peek();
} }
return; return;
@ -587,13 +587,13 @@ void NumberLiteralToken::finish(std::istream& istr)
if (_isFloat) if (_isFloat)
{ {
if (next == 'L' || next == 'l' || next == 'F' || next == 'f') if (next == 'L' || next == 'l' || next == 'F' || next == 'f')
_value += (char) istr.get(); _value += (char) istr.get();
} }
else else
{ {
while (next == 'L' || next == 'l' || next == 'U' || next == 'u') while (next == 'L' || next == 'l' || next == 'U' || next == 'u')
{ {
_value += (char) istr.get(); _value += (char) istr.get();
next = istr.peek(); next = istr.peek();
} }
} }
@ -656,7 +656,7 @@ void CommentToken::finish(std::istream& istr)
{ {
next = istr.get(); next = istr.get();
_value += (char) next; _value += (char) next;
if (next == '*' && istr.peek() == '/') if (next == '*' && istr.peek() == '/')
{ {
_value += (char) istr.get(); _value += (char) istr.get();
break; break;
@ -704,7 +704,7 @@ void PreprocessorToken::finish(std::istream& istr)
int next = istr.peek(); int next = istr.peek();
while (next != -1 && next != '\r' && next != '\n') while (next != -1 && next != '\r' && next != '\n')
{ {
if (next == '\\') if (next == '\\')
{ {
istr.get(); istr.get();
int p = istr.peek(); int p = istr.peek();

View File

@ -108,7 +108,7 @@ Symbol* NameSpace::lookup(const std::string& name, std::set<const NameSpace*>& a
bool currentNSInserted = true; bool currentNSInserted = true;
if (head.empty()) if (head.empty())
{ {
alreadyVisited.insert(this); alreadyVisited.insert(this);
return root()->lookup(tail, alreadyVisited); return root()->lookup(tail, alreadyVisited);
@ -220,7 +220,7 @@ void NameSpace::splitName(const std::string& name, std::string& head, std::strin
head.assign(name, 0, pos); head.assign(name, 0, pos);
pos += 2; pos += 2;
poco_assert (pos < name.length()); poco_assert (pos < name.length());
tail.assign(name, pos, name.length() - pos); tail.assign(name, pos, name.length() - pos);
} }
else head = name; else head = name;
} }

View File

@ -628,7 +628,7 @@ const Token* Parser::parseFunc(const Token* pNext, std::string& decl)
expectOperator(pNext, OperatorToken::OP_CLOSPARENT, ")"); expectOperator(pNext, OperatorToken::OP_CLOSPARENT, ")");
pNext = next(); pNext = next();
while (pNext->is(Poco::Token::IDENTIFIER_TOKEN) || pNext->is(Poco::Token::KEYWORD_TOKEN)) while (pNext->is(Poco::Token::IDENTIFIER_TOKEN) || pNext->is(Poco::Token::KEYWORD_TOKEN))
{ {
if (isKeyword(pNext, IdentifierToken::KW_CONST)) if (isKeyword(pNext, IdentifierToken::KW_CONST))
{ {
if (pFunc) pFunc->makeConst(); if (pFunc) pFunc->makeConst();
@ -636,7 +636,7 @@ const Token* Parser::parseFunc(const Token* pNext, std::string& decl)
} }
if (isKeyword(pNext, IdentifierToken::KW_THROW)) if (isKeyword(pNext, IdentifierToken::KW_THROW))
{ {
while (!isOperator(pNext, OperatorToken::OP_ASSIGN) && !isOperator(pNext, OperatorToken::OP_SEMICOLON) && while (!isOperator(pNext, OperatorToken::OP_ASSIGN) && !isOperator(pNext, OperatorToken::OP_SEMICOLON) &&
!isOperator(pNext, OperatorToken::OP_OPENBRACE) && !isEOF(pNext)) !isOperator(pNext, OperatorToken::OP_OPENBRACE) && !isEOF(pNext))
pNext = next(); pNext = next();
} }

View File

@ -7,6 +7,6 @@ vc.project.platforms = Win32, x64
vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md
vc.project.prototype = TestSuite_vs90.vcproj vc.project.prototype = TestSuite_vs90.vcproj
vc.project.compiler.include = ..\\..\\Foundation\\include vc.project.compiler.include = ..\\..\\Foundation\\include
vc.project.linker.dependencies.Win32 = vc.project.linker.dependencies.Win32 =
vc.project.linker.dependencies.x64 = vc.project.linker.dependencies.x64 =
vc.project.linker.dependencies.WinCE = vc.project.linker.dependencies.WinCE =

View File

@ -22,7 +22,7 @@ target_include_directories( "${LIBNAME}"
PUBLIC PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
PRIVATE PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/src
) )
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS}) target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})

View File

@ -7,8 +7,8 @@ vc.project.outdir = ${vc.project.pocobase}
vc.project.platforms = Win32, x64, WinCE vc.project.platforms = Win32, x64, WinCE
vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md
vc.project.prototype = ${vc.project.name}_vs90.vcproj vc.project.prototype = ${vc.project.name}_vs90.vcproj
vc.project.compiler.include = vc.project.compiler.include =
vc.project.compiler.defines = vc.project.compiler.defines =
vc.project.compiler.defines.shared = ${vc.project.name}_EXPORTS, _CRT_SECURE_NO_WARNINGS vc.project.compiler.defines.shared = ${vc.project.name}_EXPORTS, _CRT_SECURE_NO_WARNINGS
vc.project.compiler.defines.debug_shared = ${vc.project.compiler.defines.shared} vc.project.compiler.defines.debug_shared = ${vc.project.compiler.defines.shared}
vc.project.compiler.defines.release_shared = ${vc.project.compiler.defines.shared} vc.project.compiler.defines.release_shared = ${vc.project.compiler.defines.shared}

View File

@ -16,7 +16,7 @@
#define IDC_CHK_AUTORUN 1013 #define IDC_CHK_AUTORUN 1013
// Next default values for new objects // Next default values for new objects
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 131 #define _APS_NEXT_RESOURCE_VALUE 131

View File

@ -52,7 +52,7 @@ protected:
// Construct the active test // Construct the active test
inline ActiveTest::ActiveTest(Test *test): TestDecorator(test) inline ActiveTest::ActiveTest(Test *test): TestDecorator(test)
{ {
_currentTestResult = NULL; _currentTestResult = NULL;
_threadHandle = INVALID_HANDLE_VALUE; _threadHandle = INVALID_HANDLE_VALUE;
} }
@ -60,7 +60,7 @@ inline ActiveTest::ActiveTest(Test *test): TestDecorator(test)
// Pend until the test has completed // Pend until the test has completed
inline ActiveTest::~ActiveTest() inline ActiveTest::~ActiveTest()
{ {
CSingleLock(&_runCompleted, TRUE); CSingleLock(&_runCompleted, TRUE);
CloseHandle(_threadHandle); CloseHandle(_threadHandle);
} }
@ -68,7 +68,7 @@ inline ActiveTest::~ActiveTest()
// Set the test result that we are to run // Set the test result that we are to run
inline void ActiveTest::setTestResult(TestResult* result) inline void ActiveTest::setTestResult(TestResult* result)
{ {
_currentTestResult = result; _currentTestResult = result;
} }

View File

@ -56,7 +56,7 @@ private:
// Construct with lightweight synchronization // Construct with lightweight synchronization
inline GUITestResult::GUITestResult(TestRunnerDlg* runner): _runner(runner) inline GUITestResult::GUITestResult(TestRunnerDlg* runner): _runner(runner)
{ {
setSynchronizationObject(new LightweightSynchronizationObject()); setSynchronizationObject(new LightweightSynchronizationObject());
} }
@ -71,7 +71,7 @@ inline GUITestResult::~GUITestResult()
// Override without protection to prevent deadlock // Override without protection to prevent deadlock
inline void GUITestResult::stop() inline void GUITestResult::stop()
{ {
_stop = true; _stop = true;
} }

View File

@ -44,12 +44,12 @@ protected:
// Construct a ProgressBar // Construct a ProgressBar
inline ProgressBar::ProgressBar(CWnd* baseWindow, CRect& bounds): inline ProgressBar::ProgressBar(CWnd* baseWindow, CRect& bounds):
_baseWindow(baseWindow), _baseWindow(baseWindow),
_bounds(bounds), _bounds(bounds),
_error(false), _error(false),
_total(0), _total(0),
_progress(0), _progress(0),
_progressX(0) _progressX(0)
{ {
WINDOWINFO wi; WINDOWINFO wi;

View File

@ -15,14 +15,14 @@
<P>CppUnit is a simple unit test framework for C++. It is a port from JUnit, a testing framework for Java, developed by Kent Beck and Erich Gamma. </P> <P>CppUnit is a simple unit test framework for C++. It is a port from JUnit, a testing framework for Java, developed by Kent Beck and Erich Gamma. </P>
<H3>Contents</H3> <H3>Contents</H3>
<PRE>README.html&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this file <PRE>README.html&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this file
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; test&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the source code &nbsp;&nbsp;&nbsp; test&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the source code
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; framework&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the testing framework &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; framework&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the testing framework
&#9;&#9;extensions&#9;some framework extension classes &#9;&#9;extensions&#9;some framework extension classes
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; textui&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a command line interface to run tests &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; textui&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a command line interface to run tests
&nbsp;&nbsp;&nbsp;&nbsp;ms&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; code for a Microsoft specific TestRunner &nbsp;&nbsp;&nbsp;&nbsp;ms&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; code for a Microsoft specific TestRunner
&nbsp;&nbsp;&nbsp;&nbsp;samples&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; some example test cases and extensions to the framework &nbsp;&nbsp;&nbsp;&nbsp;samples&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; some example test cases and extensions to the framework
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; multicaster&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a sample illustrating a publish/subscribe &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; multicaster&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a sample illustrating a publish/subscribe
&#9;&#9;&#9;&#9;multicaster under test &#9;&#9;&#9;&#9;multicaster under test
&nbsp;&nbsp;&nbsp; doc&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; documentation</PRE> &nbsp;&nbsp;&nbsp; doc&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; documentation</PRE>
<H3>Installation</H3> <H3>Installation</H3>

View File

@ -17,7 +17,7 @@
<P>Subclass the TestCase class. Override the method "runTest ()". When you want to check a value, call "assert (bool)" and pass in an expression that is true if the test succeeds. </P> <P>Subclass the TestCase class. Override the method "runTest ()". When you want to check a value, call "assert (bool)" and pass in an expression that is true if the test succeeds. </P>
<P>For example, to test the equality comparison for a Complex number class, write:</P> <P>For example, to test the equality comparison for a Complex number class, write:</P>
<TT><PRE>&#9;class ComplexNumberTest : public TestCase {&nbsp; <TT><PRE>&#9;class ComplexNumberTest : public TestCase {&nbsp;
&#9;public: &#9;public:
ComplexNumberTest (string name) : TestCase (name) {} ComplexNumberTest (string name) : TestCase (name) {}
void runTest () { void runTest () {
assert (Complex (10, 1) == Complex (10, 1)); assert (Complex (10, 1) == Complex (10, 1));
@ -59,7 +59,7 @@
&#9;void&#9;&#9;setUp () { &#9;void&#9;&#9;setUp () {
&#9;&#9;&#9; m_10_1 = new Complex (10, 1); &#9;&#9;&#9; m_10_1 = new Complex (10, 1);
&#9;&#9;&#9; m_1_1 = new Complex (1, 1); &#9;&#9;&#9; m_1_1 = new Complex (1, 1);
&#9;&#9;&#9; m_11_2 = new Complex (11, 2); &#9;&#9;&#9; m_11_2 = new Complex (11, 2);
} }
&#9;void&#9;&#9;tearDown () { &#9;void&#9;&#9;tearDown () {
&#9;&#9;&#9; delete m_10_1, delete m_1_1, delete m_11_2; &#9;&#9;&#9; delete m_10_1, delete m_1_1, delete m_11_2;
@ -83,7 +83,7 @@
&#9;void&#9;&#9;setUp () { &#9;void&#9;&#9;setUp () {
&#9;&#9;&#9; m_10_1 = new Complex (10, 1); &#9;&#9;&#9; m_10_1 = new Complex (10, 1);
&#9;&#9;&#9; m_1_1 = new Complex (1, 1); &#9;&#9;&#9; m_1_1 = new Complex (1, 1);
&#9;&#9;&#9; m_11_2 = new Complex (11, 2); &#9;&#9;&#9; m_11_2 = new Complex (11, 2);
} }
&#9;void&#9;&#9;tearDown () { &#9;void&#9;&#9;tearDown () {
&#9;&#9;&#9; delete m_10_1, delete m_1_1, delete m_11_2; &#9;&#9;&#9; delete m_10_1, delete m_1_1, delete m_11_2;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -54,8 +54,8 @@ class TestCaller: public TestCase
typedef void (Fixture::*TestMethod)(); typedef void (Fixture::*TestMethod)();
public: public:
TestCaller(const std::string& name, TestMethod test): TestCaller(const std::string& name, TestMethod test):
TestCase(name), TestCase(name),
_test(test), _test(test),
_fixture(new Fixture(name)) _fixture(new Fixture(name))
{ {

View File

@ -78,8 +78,8 @@
#pragma warning(disable:4503) // decorated name length exceeded - mainly a problem with STLPort #pragma warning(disable:4503) // decorated name length exceeded - mainly a problem with STLPort
#pragma warning(disable:4018) // signed/unsigned comparison #pragma warning(disable:4018) // signed/unsigned comparison
#pragma warning(disable:4284) // return type for operator -> is not UDT #pragma warning(disable:4284) // return type for operator -> is not UDT
#pragma warning(disable:4251) // ... needs to have dll-interface warning #pragma warning(disable:4251) // ... needs to have dll-interface warning
#pragma warning(disable:4273) #pragma warning(disable:4273)
#pragma warning(disable:4275) // ... non dll-interface class used as base for dll-interface class #pragma warning(disable:4275) // ... non dll-interface class used as base for dll-interface class
#endif #endif

View File

@ -20,8 +20,8 @@ class CppUnit_API CppUnitException: public std::exception
/// descriptive strings through its what() method /// descriptive strings through its what() method
{ {
public: public:
CppUnitException(const std::string& message = "", CppUnitException(const std::string& message = "",
long lineNumber = CPPUNIT_UNKNOWNLINENUMBER, long lineNumber = CPPUNIT_UNKNOWNLINENUMBER,
const std::string& fileName = CPPUNIT_UNKNOWNFILENAME); const std::string& fileName = CPPUNIT_UNKNOWNFILENAME);
CppUnitException(const std::string& message, CppUnitException(const std::string& message,
long lineNumber, long lineNumber,
@ -110,26 +110,26 @@ inline const char* CppUnitException::what() const throw ()
inline long CppUnitException::lineNumber() const inline long CppUnitException::lineNumber() const
{ {
return _lineNumber; return _lineNumber;
} }
inline long CppUnitException::data1LineNumber() const inline long CppUnitException::data1LineNumber() const
{ {
return _data1lineNumber; return _data1lineNumber;
} }
inline long CppUnitException::data2LineNumber() const inline long CppUnitException::data2LineNumber() const
{ {
return _data2lineNumber; return _data2lineNumber;
} }
// The file in which the error occurred // The file in which the error occurred
inline const std::string& CppUnitException::fileName() const inline const std::string& CppUnitException::fileName() const
{ {
return _fileName; return _fileName;
} }

View File

@ -45,11 +45,11 @@ namespace CppUnit {
* *
* see TestSuite * see TestSuite
*/ */
template <class ClassUnderTest> template <class ClassUnderTest>
class Orthodox: public TestCase class Orthodox: public TestCase
{ {
public: public:
Orthodox(): TestCase("Orthodox") Orthodox(): TestCase("Orthodox")
{ {
} }
@ -60,7 +60,7 @@ protected:
// Run an orthodoxy test // Run an orthodoxy test
template <class ClassUnderTest> template <class ClassUnderTest>
void Orthodox<ClassUnderTest>::runTest() void Orthodox<ClassUnderTest>::runTest()
{ {
// make sure we have a default constructor // make sure we have a default constructor
@ -90,7 +90,7 @@ void Orthodox<ClassUnderTest>::runTest()
// Exercise a call // Exercise a call
template <class ClassUnderTest> template <class ClassUnderTest>
ClassUnderTest Orthodox<ClassUnderTest>::call(ClassUnderTest object) ClassUnderTest Orthodox<ClassUnderTest>::call(ClassUnderTest object)
{ {
return object; return object;

View File

@ -29,7 +29,7 @@ class CppUnit_API RepeatedTest: public TestDecorator
REFERENCEOBJECT (RepeatedTest) REFERENCEOBJECT (RepeatedTest)
public: public:
RepeatedTest(Test* test, int timesRepeat): TestDecorator (test), _timesRepeat (timesRepeat) RepeatedTest(Test* test, int timesRepeat): TestDecorator (test), _timesRepeat (timesRepeat)
{ {
} }
@ -59,7 +59,7 @@ inline std::string RepeatedTest::toString()
// Runs a repeated test // Runs a repeated test
inline void RepeatedTest::run(TestResult *result) inline void RepeatedTest::run(TestResult *result)
{ {
for (int n = 0; n < _timesRepeat; n++) for (int n = 0; n < _timesRepeat; n++)
{ {
if (result->shouldStop()) if (result->shouldStop())
break; break;

View File

@ -46,7 +46,7 @@ inline void Test::run(TestResult *result)
// Counts the number of test cases that will be run by this test. // Counts the number of test cases that will be run by this test.
inline int Test::countTestCases() inline int Test::countTestCases()
{ {
return 0; return 0;
} }

View File

@ -54,8 +54,8 @@ class TestCaller: public TestCase
typedef void (Fixture::*TestMethod)(); typedef void (Fixture::*TestMethod)();
public: public:
TestCaller(const std::string& name, TestMethod test): TestCaller(const std::string& name, TestMethod test):
TestCase(name), TestCase(name),
_test(test), _test(test),
_fixture(new Fixture(name)) _fixture(new Fixture(name))
{ {
@ -64,8 +64,8 @@ public:
// Returns the name of the test case instance // Returns the name of the test case instance
virtual std::string toString() virtual std::string toString()
{ {
const std::type_info& thisClass = typeid(*this); const std::type_info& thisClass = typeid(*this);
return std::string(thisClass.name()) + "." + name(); return std::string(thisClass.name()) + "." + name();
} }

View File

@ -131,7 +131,7 @@ protected:
long lineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER, long lineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER,
const std::string& fileName = CppUnitException::CPPUNIT_UNKNOWNFILENAME); const std::string& fileName = CppUnitException::CPPUNIT_UNKNOWNFILENAME);
void assertEquals(const std::string& expected, void assertEquals(const std::string& expected,
const std::string& actual, const std::string& actual,
long lineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER, long lineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER,
const std::string& fileName = CppUnitException::CPPUNIT_UNKNOWNFILENAME); const std::string& fileName = CppUnitException::CPPUNIT_UNKNOWNFILENAME);
@ -151,7 +151,7 @@ protected:
long lineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER, long lineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER,
const std::string& fileName = CppUnitException::CPPUNIT_UNKNOWNFILENAME); const std::string& fileName = CppUnitException::CPPUNIT_UNKNOWNFILENAME);
void assertNull(const void* pointer, void assertNull(const void* pointer,
const std::string& pointerExpression = "", const std::string& pointerExpression = "",
long lineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER, long lineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER,
const std::string& fileName = CppUnitException::CPPUNIT_UNKNOWNFILENAME); const std::string& fileName = CppUnitException::CPPUNIT_UNKNOWNFILENAME);
@ -185,14 +185,14 @@ inline TestCase::~TestCase()
// Returns a count of all the tests executed // Returns a count of all the tests executed
inline int TestCase::countTestCases() inline int TestCase::countTestCases()
{ {
return 1; return 1;
} }
// Returns the name of the test case // Returns the name of the test case
inline const std::string& TestCase::name() const inline const std::string& TestCase::name() const
{ {
return _name; return _name;
} }
@ -211,8 +211,8 @@ inline void TestCase::tearDown()
// Returns the name of the test case instance // Returns the name of the test case instance
inline std::string TestCase::toString() inline std::string TestCase::toString()
{ {
const std::type_info& thisClass = typeid(*this); const std::type_info& thisClass = typeid(*this);
return std::string(thisClass.name()) + "." + name(); return std::string(thisClass.name()) + "." + name();
} }

View File

@ -57,7 +57,7 @@ inline TestFailure::TestFailure(Test* failedTest, CppUnitException* thrownExcept
// Deletes the owned exception. // Deletes the owned exception.
inline TestFailure::~TestFailure() inline TestFailure::~TestFailure()
{ {
delete _thrownException; delete _thrownException;
} }

View File

@ -112,7 +112,7 @@ protected:
// Construct a TestResult // Construct a TestResult
inline TestResult::TestResult(): _syncObject(new SynchronizationObject()) inline TestResult::TestResult(): _syncObject(new SynchronizationObject())
{ {
_runTests = 0; _runTests = 0;
_stop = false; _stop = false;
} }
@ -121,7 +121,7 @@ inline TestResult::TestResult(): _syncObject(new SynchronizationObject())
// caused the error // caused the error
inline void TestResult::addError(Test* test, CppUnitException* e) inline void TestResult::addError(Test* test, CppUnitException* e)
{ {
ExclusiveZone zone(_syncObject); ExclusiveZone zone(_syncObject);
_errors.push_back(new TestFailure(test, e)); _errors.push_back(new TestFailure(test, e));
} }
@ -130,7 +130,7 @@ inline void TestResult::addError(Test* test, CppUnitException* e)
// caused the failure. // caused the failure.
inline void TestResult::addFailure(Test* test, CppUnitException* e) inline void TestResult::addFailure(Test* test, CppUnitException* e)
{ {
ExclusiveZone zone(_syncObject); ExclusiveZone zone(_syncObject);
_failures.push_back(new TestFailure(test, e)); _failures.push_back(new TestFailure(test, e));
} }
@ -138,7 +138,7 @@ inline void TestResult::addFailure(Test* test, CppUnitException* e)
// Informs the result that a test will be started. // Informs the result that a test will be started.
inline void TestResult::startTest(Test* test) inline void TestResult::startTest(Test* test)
{ {
ExclusiveZone zone(_syncObject); ExclusiveZone zone(_syncObject);
_runTests++; _runTests++;
} }
@ -153,7 +153,7 @@ inline void TestResult::endTest(Test* test)
// Gets the number of run tests. // Gets the number of run tests.
inline int TestResult::runTests() inline int TestResult::runTests()
{ {
ExclusiveZone zone(_syncObject); ExclusiveZone zone(_syncObject);
return _runTests; return _runTests;
} }
@ -161,7 +161,7 @@ inline int TestResult::runTests()
// Gets the number of detected errors. // Gets the number of detected errors.
inline int TestResult::testErrors() inline int TestResult::testErrors()
{ {
ExclusiveZone zone(_syncObject); ExclusiveZone zone(_syncObject);
return (int) _errors.size(); return (int) _errors.size();
} }
@ -169,7 +169,7 @@ inline int TestResult::testErrors()
// Gets the number of detected failures. // Gets the number of detected failures.
inline int TestResult::testFailures() inline int TestResult::testFailures()
{ {
ExclusiveZone zone(_syncObject); ExclusiveZone zone(_syncObject);
return (int) _failures.size(); return (int) _failures.size();
} }
@ -177,15 +177,15 @@ inline int TestResult::testFailures()
// Returns whether the entire test was successful or not. // Returns whether the entire test was successful or not.
inline bool TestResult::wasSuccessful() inline bool TestResult::wasSuccessful()
{ {
ExclusiveZone zone(_syncObject); ExclusiveZone zone(_syncObject);
return _failures.size() == 0 && _errors.size () == 0; return _failures.size() == 0 && _errors.size () == 0;
} }
// Returns a std::vector of the errors. // Returns a std::vector of the errors.
inline std::vector<TestFailure*>& TestResult::errors() inline std::vector<TestFailure*>& TestResult::errors()
{ {
ExclusiveZone zone(_syncObject); ExclusiveZone zone(_syncObject);
return _errors; return _errors;
} }
@ -193,7 +193,7 @@ inline std::vector<TestFailure*>& TestResult::errors()
// Returns a std::vector of the failures. // Returns a std::vector of the failures.
inline std::vector<TestFailure*>& TestResult::failures() inline std::vector<TestFailure*>& TestResult::failures()
{ {
ExclusiveZone zone(_syncObject); ExclusiveZone zone(_syncObject);
return _failures; return _failures;
} }
@ -201,7 +201,7 @@ inline std::vector<TestFailure*>& TestResult::failures()
// Returns whether testing should be stopped // Returns whether testing should be stopped
inline bool TestResult::shouldStop() inline bool TestResult::shouldStop()
{ {
ExclusiveZone zone(_syncObject); ExclusiveZone zone(_syncObject);
return _stop; return _stop;
} }
@ -209,7 +209,7 @@ inline bool TestResult::shouldStop()
// Stop testing // Stop testing
inline void TestResult::stop() inline void TestResult::stop()
{ {
ExclusiveZone zone(_syncObject); ExclusiveZone zone(_syncObject);
_stop = true; _stop = true;
} }
@ -218,7 +218,7 @@ inline void TestResult::stop()
// TestResult assumes ownership of the object // TestResult assumes ownership of the object
inline void TestResult::setSynchronizationObject(SynchronizationObject* syncObject) inline void TestResult::setSynchronizationObject(SynchronizationObject* syncObject)
{ {
delete _syncObject; delete _syncObject;
_syncObject = syncObject; _syncObject = syncObject;
} }

View File

@ -24,14 +24,14 @@ class CppUnit_API TestSetup: public TestDecorator
REFERENCEOBJECT (TestSetup) REFERENCEOBJECT (TestSetup)
public: public:
TestSetup(Test* test): TestDecorator(test) TestSetup(Test* test): TestDecorator(test)
{ {
} }
void run(TestResult* result); void run(TestResult* result);
protected: protected:
void setUp() void setUp()
{ {
} }
@ -44,7 +44,7 @@ protected:
inline void TestSetup::run(TestResult* result) inline void TestSetup::run(TestResult* result)
{ {
setUp(); setUp();
TestDecorator::run(result); TestDecorator::run(result);
tearDown(); tearDown();
} }

View File

@ -79,7 +79,7 @@ inline void TestSuite::addTest(Test* test)
// Returns a std::string representation of the test suite. // Returns a std::string representation of the test suite.
inline std::string TestSuite::toString() inline std::string TestSuite::toString()
{ {
return "suite " + _name; return "suite " + _name;
} }

View File

@ -32,26 +32,26 @@ inline std::string estring(std::string& expandedString)
// Create a std::string from an int // Create a std::string from an int
inline std::string estring(int number) inline std::string estring(int number)
{ {
char buffer[50]; char buffer[50];
sprintf(buffer, "%d", number); sprintf(buffer, "%d", number);
return std::string (buffer); return std::string (buffer);
} }
// Create a string from a long // Create a string from a long
inline std::string estring(long number) inline std::string estring(long number)
{ {
char buffer[50]; char buffer[50];
sprintf(buffer, "%ld", number); sprintf(buffer, "%ld", number);
return std::string (buffer); return std::string (buffer);
} }
// Create a std::string from a double // Create a std::string from a double
inline std::string estring(double number) inline std::string estring(double number)
{ {
char buffer[50]; char buffer[50];
sprintf(buffer, "%lf", number); sprintf(buffer, "%lf", number);
return std::string(buffer); return std::string(buffer);
} }
@ -59,8 +59,8 @@ inline std::string estring(double number)
// Create a std::string from a double // Create a std::string from a double
inline std::string estring(const void* ptr) inline std::string estring(const void* ptr)
{ {
char buffer[50]; char buffer[50];
sprintf(buffer, "%p", ptr); sprintf(buffer, "%p", ptr);
return std::string(buffer); return std::string(buffer);
} }

View File

@ -111,11 +111,11 @@ void TestCase::run(TestResult *result)
result->startTest(this); result->startTest(this);
setUp(); setUp();
try try
{ {
runTest(); runTest();
} }
catch (CppUnitException& e) catch (CppUnitException& e)
{ {
CppUnitException* copy = new CppUnitException(e); CppUnitException* copy = new CppUnitException(e);
result->addFailure(this, copy); result->addFailure(this, copy);

View File

@ -29,7 +29,7 @@ int TestDecorator::countTestCases()
void TestDecorator::run(TestResult* result) void TestDecorator::run(TestResult* result)
{ {
_test->run(result); _test->run(result);
} }
std::string TestDecorator::toString() std::string TestDecorator::toString()

View File

@ -34,7 +34,7 @@ TestRunner::~TestRunner()
void TestRunner::printBanner() void TestRunner::printBanner()
{ {
_ostr _ostr
<< "Usage: driver [-all] [-print] [-wait] [name] ..." << std::endl << "Usage: driver [-all] [-print] [-wait] [name] ..." << std::endl
<< " where name is the name of a test case class" << std::endl; << " where name is the name of a test case class" << std::endl;
} }
@ -49,10 +49,10 @@ bool TestRunner::run(const std::vector<std::string>& args)
bool wait = false; bool wait = false;
bool printed = false; bool printed = false;
for (int i = 1; i < args.size(); i++) for (int i = 1; i < args.size(); i++)
{ {
const std::string& arg = args[i]; const std::string& arg = args[i];
if (arg == "-wait") if (arg == "-wait")
{ {
wait = true; wait = true;
continue; continue;
@ -64,7 +64,7 @@ bool TestRunner::run(const std::vector<std::string>& args)
} }
else if (arg == "-print") else if (arg == "-print")
{ {
for (Mappings::iterator it = _mappings.begin(); it != _mappings.end(); ++it) for (Mappings::iterator it = _mappings.begin(); it != _mappings.end(); ++it)
{ {
print(it->first, it->second, 0); print(it->first, it->second, 0);
} }
@ -83,7 +83,7 @@ bool TestRunner::run(const std::vector<std::string>& args)
} }
Test* testToRun = 0; Test* testToRun = 0;
for (Mappings::iterator it = _mappings.begin(); !testToRun && it != _mappings.end(); ++it) for (Mappings::iterator it = _mappings.begin(); !testToRun && it != _mappings.end(); ++it)
{ {
testToRun = find(testCase, it->second, it->first); testToRun = find(testCase, it->second, it->first);
} }
@ -93,7 +93,7 @@ bool TestRunner::run(const std::vector<std::string>& args)
} }
numberOfTests++; numberOfTests++;
if (!testToRun) if (!testToRun)
{ {
_ostr << "Test " << testCase << " not found." << std::endl; _ostr << "Test " << testCase << " not found." << std::endl;
return false; return false;
@ -103,20 +103,20 @@ bool TestRunner::run(const std::vector<std::string>& args)
if (all) if (all)
{ {
for (Mappings::iterator it = _mappings.begin(); it != _mappings.end(); ++it) for (Mappings::iterator it = _mappings.begin(); it != _mappings.end(); ++it)
{ {
if (!run(it->second)) success = false; if (!run(it->second)) success = false;
numberOfTests++; numberOfTests++;
} }
} }
if (numberOfTests == 0 && !printed) if (numberOfTests == 0 && !printed)
{ {
printBanner(); printBanner();
return false; return false;
} }
if (wait) if (wait)
{ {
_ostr << "<RETURN> to continue" << std::endl; _ostr << "<RETURN> to continue" << std::endl;
std::cin.get(); std::cin.get();

View File

@ -21,7 +21,7 @@ void TestSuite::deleteContents()
// Runs the tests and collects their result in a TestResult. // Runs the tests and collects their result in a TestResult.
void TestSuite::run(TestResult *result) void TestSuite::run(TestResult *result)
{ {
for (std::vector<Test*>::iterator it = _tests.begin(); it != _tests.end(); ++it) for (std::vector<Test*>::iterator it = _tests.begin(); it != _tests.end(); ++it)
{ {
if (result->shouldStop ()) if (result->shouldStop ())
break; break;

View File

@ -89,7 +89,7 @@ void TextTestResult::startTest(Test* test)
void TextTestResult::printErrors(std::ostream& stream) void TextTestResult::printErrors(std::ostream& stream)
{ {
if (testErrors() != 0) if (testErrors() != 0)
{ {
stream << "\n"; stream << "\n";
@ -108,7 +108,7 @@ void TextTestResult::printErrors(std::ostream& stream)
<< ": " << ": "
<< failure->failedTest()->toString() << "\n" << failure->failedTest()->toString() << "\n"
<< " \"" << (e ? e->what() : "") << "\"\n" << " \"" << (e ? e->what() : "") << "\"\n"
<< " in \"" << " in \""
<< (e ? e->fileName() : std::string()) << (e ? e->fileName() : std::string())
<< "\", line "; << "\", line ";
if (e == 0) if (e == 0)
@ -156,7 +156,7 @@ void TextTestResult::printFailures(std::ostream& stream)
<< ": " << ": "
<< failure->failedTest()->toString() << "\n" << failure->failedTest()->toString() << "\n"
<< " \"" << (e ? e->what() : "") << "\"\n" << " \"" << (e ? e->what() : "") << "\"\n"
<< " in \"" << " in \""
<< (e ? e->fileName() : std::string()) << (e ? e->fileName() : std::string())
<< "\", line "; << "\", line ";
if (e == 0) if (e == 0)
@ -168,7 +168,7 @@ void TextTestResult::printFailures(std::ostream& stream)
stream << e->lineNumber(); stream << e->lineNumber();
if (e->data2LineNumber() != CppUnitException::CPPUNIT_UNKNOWNLINENUMBER) if (e->data2LineNumber() != CppUnitException::CPPUNIT_UNKNOWNLINENUMBER)
{ {
stream << " data lines " stream << " data lines "
<< e->data1LineNumber() << e->data1LineNumber()
<< ", " << e->data2LineNumber(); << ", " << e->data2LineNumber();
} }
@ -196,8 +196,8 @@ void TextTestResult::printHeader(std::ostream& stream)
{ {
stream << "\n\n"; stream << "\n\n";
if (wasSuccessful()) if (wasSuccessful())
stream << "OK (" stream << "OK ("
<< runTests() << " tests)" << runTests() << " tests)"
<< std::endl; << std::endl;
else else
stream << "!!!FAILURES!!!" << std::endl stream << "!!!FAILURES!!!" << std::endl

View File

@ -29,7 +29,7 @@ target_include_directories( "${LIBNAME}"
PUBLIC PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
PRIVATE PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/src
${OPENSSL_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR}
) )

View File

@ -8,7 +8,7 @@ vc.project.platforms = Win32, x64, WinCE
vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md
vc.project.prototype = ${vc.project.name}_vs90.vcproj vc.project.prototype = ${vc.project.name}_vs90.vcproj
vc.project.compiler.include = ..\\Foundation\\include;..\\openssl\\include vc.project.compiler.include = ..\\Foundation\\include;..\\openssl\\include
vc.project.compiler.defines = vc.project.compiler.defines =
vc.project.compiler.defines.shared = ${vc.project.name}_EXPORTS vc.project.compiler.defines.shared = ${vc.project.name}_EXPORTS
vc.project.compiler.defines.debug_shared = ${vc.project.compiler.defines.shared} vc.project.compiler.defines.debug_shared = ${vc.project.compiler.defines.shared}
vc.project.compiler.defines.release_shared = ${vc.project.compiler.defines.shared} vc.project.compiler.defines.release_shared = ${vc.project.compiler.defines.shared}

View File

@ -75,10 +75,10 @@ class Crypto_API Cipher: public Poco::RefCountedObject
/// // and write pass it to the underlying file stream. /// // and write pass it to the underlying file stream.
/// Poco::FileOutputStream sink("encrypted.dat"); /// Poco::FileOutputStream sink("encrypted.dat");
/// CryptoOutputStream encryptor(sink, pCipher->createEncryptor()); /// CryptoOutputStream encryptor(sink, pCipher->createEncryptor());
/// ///
/// Poco::FileInputStream source("source.txt"); /// Poco::FileInputStream source("source.txt");
/// Poco::StreamCopier::copyStream(source, encryptor); /// Poco::StreamCopier::copyStream(source, encryptor);
/// ///
/// // Always close output streams to flush all internal buffers /// // Always close output streams to flush all internal buffers
/// encryptor.close(); /// encryptor.close();
/// sink.close(); /// sink.close();

View File

@ -42,8 +42,8 @@ public:
/// Destroys the CipherFactory. /// Destroys the CipherFactory.
Cipher* createCipher(const CipherKey& key); Cipher* createCipher(const CipherKey& key);
/// Creates a Cipher object for the given Cipher name. Valid cipher /// Creates a Cipher object for the given Cipher name. Valid cipher
/// names depend on the OpenSSL version the library is linked with; /// names depend on the OpenSSL version the library is linked with;
/// see the output of /// see the output of
/// ///
/// openssl enc --help /// openssl enc --help

View File

@ -38,7 +38,7 @@ class Crypto_API CipherKey
/// file. /// file.
/// ///
/// To create a key using a human-readable password /// To create a key using a human-readable password
/// string, use the following code. We create a AES Cipher and /// string, use the following code. We create a AES Cipher and
/// use a salt value to make the key more robust: /// use a salt value to make the key more robust:
/// ///
/// std::string password = "secret"; /// std::string password = "secret";
@ -68,22 +68,22 @@ public:
/// an iteration count of at least 1000. /// an iteration count of at least 1000.
}; };
CipherKey(const std::string& name, CipherKey(const std::string& name,
const std::string& passphrase, const std::string& passphrase,
const std::string& salt = "", const std::string& salt = "",
int iterationCount = DEFAULT_ITERATION_COUNT, int iterationCount = DEFAULT_ITERATION_COUNT,
const std::string& digest = "md5"); const std::string& digest = "md5");
/// Creates a new CipherKeyImpl object using the given /// Creates a new CipherKeyImpl object using the given
/// cipher name, passphrase, salt value, iteration count and digest. /// cipher name, passphrase, salt value, iteration count and digest.
CipherKey(const std::string& name, CipherKey(const std::string& name,
const ByteVec& key, const ByteVec& key,
const ByteVec& iv); const ByteVec& iv);
/// Creates a new CipherKeyImpl object using the given cipher /// Creates a new CipherKeyImpl object using the given cipher
/// name, key and initialization vector. /// name, key and initialization vector.
CipherKey(const std::string& name); CipherKey(const std::string& name);
/// Creates a new CipherKeyImpl object. Autoinitializes key and /// Creates a new CipherKeyImpl object. Autoinitializes key and
/// initialization vector. /// initialization vector.
~CipherKey(); ~CipherKey();

View File

@ -60,11 +60,11 @@ public:
/// the given cipher name, passphrase, salt value /// the given cipher name, passphrase, salt value
/// and iteration count. /// and iteration count.
CipherKeyImpl(const std::string& name, CipherKeyImpl(const std::string& name,
const ByteVec& key, const ByteVec& key,
const ByteVec& iv const ByteVec& iv
); );
/// Creates a new CipherKeyImpl object, using the /// Creates a new CipherKeyImpl object, using the
/// given cipher name, key and initialization vector. /// given cipher name, key and initialization vector.
CipherKeyImpl(const std::string& name); CipherKeyImpl(const std::string& name);

View File

@ -22,7 +22,7 @@
#if defined(__APPLE__) #if defined(__APPLE__)
// OS X 10.7 deprecates some OpenSSL functions // OS X 10.7 deprecates some OpenSSL functions
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif #endif
@ -33,20 +33,20 @@ enum RSAPaddingMode
/// The padding mode used for RSA public key encryption. /// The padding mode used for RSA public key encryption.
{ {
RSA_PADDING_PKCS1, RSA_PADDING_PKCS1,
/// PKCS #1 v1.5 padding. This currently is the most widely used mode. /// PKCS #1 v1.5 padding. This currently is the most widely used mode.
RSA_PADDING_PKCS1_OAEP, RSA_PADDING_PKCS1_OAEP,
/// EME-OAEP as defined in PKCS #1 v2.0 with SHA-1, MGF1 and an empty /// EME-OAEP as defined in PKCS #1 v2.0 with SHA-1, MGF1 and an empty
/// encoding parameter. This mode is recommended for all new applications. /// encoding parameter. This mode is recommended for all new applications.
RSA_PADDING_SSLV23, RSA_PADDING_SSLV23,
/// PKCS #1 v1.5 padding with an SSL-specific modification that denotes /// PKCS #1 v1.5 padding with an SSL-specific modification that denotes
/// that the server is SSL3 capable. /// that the server is SSL3 capable.
RSA_PADDING_NONE RSA_PADDING_NONE
/// Raw RSA encryption. This mode should only be used to implement cryptographically /// Raw RSA encryption. This mode should only be used to implement cryptographically
/// sound padding modes in the application code. Encrypting user data directly with RSA /// sound padding modes in the application code. Encrypting user data directly with RSA
/// is insecure. /// is insecure.
}; };
@ -108,7 +108,7 @@ void Crypto_API initializeCrypto();
/// libraries, by calling OpenSSLInitializer::initialize(). /// libraries, by calling OpenSSLInitializer::initialize().
/// ///
/// Should be called before using any class from the Crypto library. /// Should be called before using any class from the Crypto library.
/// The Crypto library will be initialized automatically, through /// The Crypto library will be initialized automatically, through
/// OpenSSLInitializer instances held by various Crypto classes /// OpenSSLInitializer instances held by various Crypto classes
/// (Cipher, CipherKey, RSAKey, X509Certificate). /// (Cipher, CipherKey, RSAKey, X509Certificate).
/// However, it is recommended to call initializeCrypto() /// However, it is recommended to call initializeCrypto()
@ -120,7 +120,7 @@ void Crypto_API initializeCrypto();
void Crypto_API uninitializeCrypto(); void Crypto_API uninitializeCrypto();
/// Uninitializes the Crypto library by calling /// Uninitializes the Crypto library by calling
/// OpenSSLInitializer::uninitialize(). /// OpenSSLInitializer::uninitialize().

View File

@ -45,9 +45,9 @@ public:
/// Returns the block size for this CryptoTransform. /// Returns the block size for this CryptoTransform.
virtual int setPadding(int padding); virtual int setPadding(int padding);
/// Enables or disables padding. By default encryption operations are padded using standard block /// Enables or disables padding. By default encryption operations are padded using standard block
/// padding and the padding is checked and removed when decrypting. If the padding parameter is zero then /// padding and the padding is checked and removed when decrypting. If the padding parameter is zero then
/// no padding is performed, the total amount of data encrypted or decrypted must then be a multiple of /// no padding is performed, the total amount of data encrypted or decrypted must then be a multiple of
/// the block size or an error will occur. /// the block size or an error will occur.
virtual std::streamsize transform(const unsigned char* input, virtual std::streamsize transform(const unsigned char* input,

View File

@ -40,7 +40,7 @@ class Crypto_API ECDSADigestEngine: public Poco::DigestEngine
/// signed. Then, the hash value is encrypted, using /// signed. Then, the hash value is encrypted, using
/// the ECDSA private key. /// the ECDSA private key.
/// ///
/// To verify a signature, pass it to the verify() /// To verify a signature, pass it to the verify()
/// member function. It will decrypt the signature /// member function. It will decrypt the signature
/// using the ECDSA public key and compare the resulting /// using the ECDSA public key and compare the resulting
/// hash with the actual hash of the data. /// hash with the actual hash of the data.
@ -66,9 +66,9 @@ public:
/// digest can be computed. /// digest can be computed.
const DigestEngine::Digest& digest(); const DigestEngine::Digest& digest();
/// Finishes the computation of the digest /// Finishes the computation of the digest
/// (the first time it's called) and /// (the first time it's called) and
/// returns the message digest. /// returns the message digest.
/// ///
/// Can be called multiple times. /// Can be called multiple times.

View File

@ -62,8 +62,8 @@ public:
ECKeyImpl(const std::string& publicKeyFile, const std::string& privateKeyFile, const std::string& privateKeyPassphrase); ECKeyImpl(const std::string& publicKeyFile, const std::string& privateKeyFile, const std::string& privateKeyPassphrase);
/// Creates the ECKey, by reading public and private key from the given files and /// Creates the ECKey, by reading public and private key from the given files and
/// using the given passphrase for the private key. Can only by used for signing if /// using the given passphrase for the private key. Can only by used for signing if
/// a private key is available. /// a private key is available.
ECKeyImpl(std::istream* pPublicKeyStream, std::istream* pPrivateKeyStream, const std::string& privateKeyPassphrase); ECKeyImpl(std::istream* pPublicKeyStream, std::istream* pPrivateKeyStream, const std::string& privateKeyPassphrase);
/// Creates the ECKey. Can only by used for signing if pPrivKey /// Creates the ECKey. Can only by used for signing if pPrivKey
@ -91,7 +91,7 @@ public:
void save(const std::string& publicKeyFile, void save(const std::string& publicKeyFile,
const std::string& privateKeyFile = "", const std::string& privateKeyFile = "",
const std::string& privateKeyPassphrase = "") const; const std::string& privateKeyPassphrase = "") const;
/// Exports the public and private keys to the given files. /// Exports the public and private keys to the given files.
/// ///
/// If an empty filename is specified, the corresponding key /// If an empty filename is specified, the corresponding key
/// is not exported. /// is not exported.

View File

@ -57,7 +57,7 @@ public:
virtual void save(const std::string& publicKeyPairFile, virtual void save(const std::string& publicKeyPairFile,
const std::string& privateKeyPairFile = "", const std::string& privateKeyPairFile = "",
const std::string& privateKeyPairPassphrase = "") const; const std::string& privateKeyPairPassphrase = "") const;
/// Exports the public and private keys to the given files. /// Exports the public and private keys to the given files.
/// ///
/// If an empty filename is specified, the corresponding key /// If an empty filename is specified, the corresponding key
/// is not exported. /// is not exported.

View File

@ -58,7 +58,7 @@ public:
virtual void save(const std::string& publicKeyFile, virtual void save(const std::string& publicKeyFile,
const std::string& privateKeyFile = "", const std::string& privateKeyFile = "",
const std::string& privateKeyPassphrase = "") const = 0; const std::string& privateKeyPassphrase = "") const = 0;
/// Exports the public and private keys to the given files. /// Exports the public and private keys to the given files.
/// ///
/// If an empty filename is specified, the corresponding key /// If an empty filename is specified, the corresponding key
/// is not exported. /// is not exported.

View File

@ -30,9 +30,9 @@ namespace Crypto {
class RSACipherImpl: public Cipher class RSACipherImpl: public Cipher
/// An implementation of the Cipher class for /// An implementation of the Cipher class for
/// asymmetric (public-private key) encryption /// asymmetric (public-private key) encryption
/// based on the the RSA algorithm in OpenSSL's /// based on the the RSA algorithm in OpenSSL's
/// crypto library. /// crypto library.
/// ///
/// Encryption is using the public key, decryption /// Encryption is using the public key, decryption

View File

@ -39,7 +39,7 @@ class Crypto_API RSADigestEngine: public Poco::DigestEngine
/// signed. Then, the hash value is encrypted, using /// signed. Then, the hash value is encrypted, using
/// the RSA private key. /// the RSA private key.
/// ///
/// To verify a signature, pass it to the verify() /// To verify a signature, pass it to the verify()
/// member function. It will decrypt the signature /// member function. It will decrypt the signature
/// using the RSA public key and compare the resulting /// using the RSA public key and compare the resulting
/// hash with the actual hash of the data. /// hash with the actual hash of the data.
@ -76,9 +76,9 @@ public:
/// digest can be computed. /// digest can be computed.
const DigestEngine::Digest& digest(); const DigestEngine::Digest& digest();
/// Finishes the computation of the digest /// Finishes the computation of the digest
/// (the first time it's called) and /// (the first time it's called) and
/// returns the message digest. /// returns the message digest.
/// ///
/// Can be called multiple times. /// Can be called multiple times.

View File

@ -67,8 +67,8 @@ public:
RSAKeyImpl(const std::string& publicKeyFile, const std::string& privateKeyFile, const std::string& privateKeyPassphrase); RSAKeyImpl(const std::string& publicKeyFile, const std::string& privateKeyFile, const std::string& privateKeyPassphrase);
/// Creates the RSAKey, by reading public and private key from the given files and /// Creates the RSAKey, by reading public and private key from the given files and
/// using the given passphrase for the private key. Can only by used for signing if /// using the given passphrase for the private key. Can only by used for signing if
/// a private key is available. /// a private key is available.
RSAKeyImpl(std::istream* pPublicKeyStream, std::istream* pPrivateKeyStream, const std::string& privateKeyPassphrase); RSAKeyImpl(std::istream* pPublicKeyStream, std::istream* pPrivateKeyStream, const std::string& privateKeyPassphrase);
/// Creates the RSAKey. Can only by used for signing if pPrivKey /// Creates the RSAKey. Can only by used for signing if pPrivKey
@ -99,7 +99,7 @@ public:
void save(const std::string& publicKeyFile, void save(const std::string& publicKeyFile,
const std::string& privateKeyFile = "", const std::string& privateKeyFile = "",
const std::string& privateKeyPassphrase = "") const; const std::string& privateKeyPassphrase = "") const;
/// Exports the public and private keys to the given files. /// Exports the public and private keys to the given files.
/// ///
/// If an empty filename is specified, the corresponding key /// If an empty filename is specified, the corresponding key
/// is not exported. /// is not exported.

View File

@ -62,13 +62,13 @@ public:
explicit X509Certificate(X509* pCert); explicit X509Certificate(X509* pCert);
/// Creates the X509Certificate from an existing /// Creates the X509Certificate from an existing
/// OpenSSL certificate. Ownership is taken of /// OpenSSL certificate. Ownership is taken of
/// the certificate. /// the certificate.
X509Certificate(X509* pCert, bool shared); X509Certificate(X509* pCert, bool shared);
/// Creates the X509Certificate from an existing /// Creates the X509Certificate from an existing
/// OpenSSL certificate. Ownership is taken of /// OpenSSL certificate. Ownership is taken of
/// the certificate. If shared is true, the /// the certificate. If shared is true, the
/// certificate's reference count is incremented. /// certificate's reference count is incremented.
X509Certificate(const X509Certificate& cert); X509Certificate(const X509Certificate& cert);
@ -76,7 +76,7 @@ public:
X509Certificate& operator = (const X509Certificate& cert); X509Certificate& operator = (const X509Certificate& cert);
/// Assigns a certificate. /// Assigns a certificate.
void swap(X509Certificate& cert); void swap(X509Certificate& cert);
/// Exchanges the certificate with another one. /// Exchanges the certificate with another one.
@ -91,7 +91,7 @@ public:
/// string in decimal encoding. /// string in decimal encoding.
const std::string& issuerName() const; const std::string& issuerName() const;
/// Returns the certificate issuer's distinguished name. /// Returns the certificate issuer's distinguished name.
std::string issuerName(NID nid) const; std::string issuerName(NID nid) const;
/// Extracts the information specified by the given /// Extracts the information specified by the given

View File

@ -26,7 +26,7 @@ namespace Crypto {
CipherKeyImpl::CipherKeyImpl(const std::string& name, CipherKeyImpl::CipherKeyImpl(const std::string& name,
const std::string& passphrase, const std::string& passphrase,
const std::string& salt, const std::string& salt,
int iterationCount, int iterationCount,
const std::string& digest): _pCipher(0), const std::string& digest): _pCipher(0),
@ -54,8 +54,8 @@ CipherKeyImpl::CipherKeyImpl(const std::string& name,
} }
CipherKeyImpl::CipherKeyImpl(const std::string& name, CipherKeyImpl::CipherKeyImpl(const std::string& name,
const ByteVec& key, const ByteVec& key,
const ByteVec& iv): _pCipher(0), const ByteVec& iv): _pCipher(0),
_pDigest(0), _pDigest(0),
_name(name), _name(name),

View File

@ -28,7 +28,7 @@ CryptoTransform::~CryptoTransform()
{ {
} }
int CryptoTransform::setPadding(int padding) int CryptoTransform::setPadding(int padding)
{ {
return 1; return 1;

View File

@ -77,8 +77,8 @@ ECKeyImpl::ECKeyImpl(int curve):
} }
ECKeyImpl::ECKeyImpl(const std::string& publicKeyFile, ECKeyImpl::ECKeyImpl(const std::string& publicKeyFile,
const std::string& privateKeyFile, const std::string& privateKeyFile,
const std::string& privateKeyPassphrase): KeyPairImpl("ec", KT_EC_IMPL), _pEC(0) const std::string& privateKeyPassphrase): KeyPairImpl("ec", KT_EC_IMPL), _pEC(0)
{ {
if (EVPPKey::loadKey(&_pEC, PEM_read_PrivateKey, EVP_PKEY_get1_EC_KEY, privateKeyFile, privateKeyPassphrase)) if (EVPPKey::loadKey(&_pEC, PEM_read_PrivateKey, EVP_PKEY_get1_EC_KEY, privateKeyFile, privateKeyPassphrase))

View File

@ -87,8 +87,8 @@ void OpenSSLInitializer::initialize()
// https://sourceforge.net/p/poco/bugs/110/ // https://sourceforge.net/p/poco/bugs/110/
// //
// From http://www.openssl.org/docs/crypto/threads.html : // From http://www.openssl.org/docs/crypto/threads.html :
// "If the application does not register such a callback using CRYPTO_THREADID_set_callback(), // "If the application does not register such a callback using CRYPTO_THREADID_set_callback(),
// then a default implementation is used - on Windows and BeOS this uses the system's // then a default implementation is used - on Windows and BeOS this uses the system's
// default thread identifying APIs" // default thread identifying APIs"
#ifndef OPENSSL_NO_DEPRECATED #ifndef OPENSSL_NO_DEPRECATED
CRYPTO_set_id_callback(&OpenSSLInitializer::id); CRYPTO_set_id_callback(&OpenSSLInitializer::id);

View File

@ -90,8 +90,8 @@ RSAKeyImpl::RSAKeyImpl(int keyLength, unsigned long exponent): KeyPairImpl("rsa"
} }
RSAKeyImpl::RSAKeyImpl(const std::string& publicKeyFile, RSAKeyImpl::RSAKeyImpl(const std::string& publicKeyFile,
const std::string& privateKeyFile, const std::string& privateKeyFile,
const std::string& privateKeyPassphrase): KeyPairImpl("rsa", KT_RSA_IMPL), const std::string& privateKeyPassphrase): KeyPairImpl("rsa", KT_RSA_IMPL),
_pRSA(0) _pRSA(0)
{ {
@ -109,7 +109,7 @@ RSAKeyImpl::RSAKeyImpl(const std::string& publicKeyFile,
if (!pubKey) if (!pubKey)
{ {
int rc = BIO_reset(bio); int rc = BIO_reset(bio);
// BIO_reset() normally returns 1 for success and 0 or -1 for failure. // BIO_reset() normally returns 1 for success and 0 or -1 for failure.
// File BIOs are an exception, they return 0 for success and -1 for failure. // File BIOs are an exception, they return 0 for success and -1 for failure.
if (rc != 0) throw Poco::FileException("Failed to load public key", publicKeyFile); if (rc != 0) throw Poco::FileException("Failed to load public key", publicKeyFile);
pubKey = PEM_read_bio_RSA_PUBKEY(bio, &_pRSA, 0, 0); pubKey = PEM_read_bio_RSA_PUBKEY(bio, &_pRSA, 0, 0);
@ -174,7 +174,7 @@ RSAKeyImpl::RSAKeyImpl(std::istream* pPublicKeyStream,
if (!publicKey) if (!publicKey)
{ {
int rc = BIO_reset(bio); int rc = BIO_reset(bio);
// BIO_reset() normally returns 1 for success and 0 or -1 for failure. // BIO_reset() normally returns 1 for success and 0 or -1 for failure.
// File BIOs are an exception, they return 0 for success and -1 for failure. // File BIOs are an exception, they return 0 for success and -1 for failure.
if (rc != 1) throw Poco::FileException("Failed to load public key"); if (rc != 1) throw Poco::FileException("Failed to load public key");
publicKey = PEM_read_bio_RSA_PUBKEY(bio, &_pRSA, 0, 0); publicKey = PEM_read_bio_RSA_PUBKEY(bio, &_pRSA, 0, 0);
@ -306,8 +306,8 @@ void RSAKeyImpl::save(const std::string& publicKeyFile,
if (privateKeyPassphrase.empty()) if (privateKeyPassphrase.empty())
rc = PEM_write_bio_RSAPrivateKey(bio, _pRSA, 0, 0, 0, 0, 0); rc = PEM_write_bio_RSAPrivateKey(bio, _pRSA, 0, 0, 0, 0, 0);
else else
rc = PEM_write_bio_RSAPrivateKey(bio, _pRSA, EVP_des_ede3_cbc(), rc = PEM_write_bio_RSAPrivateKey(bio, _pRSA, EVP_des_ede3_cbc(),
reinterpret_cast<unsigned char*>(const_cast<char*>(privateKeyPassphrase.c_str())), reinterpret_cast<unsigned char*>(const_cast<char*>(privateKeyPassphrase.c_str())),
static_cast<int>(privateKeyPassphrase.length()), 0, 0); static_cast<int>(privateKeyPassphrase.length()), 0, 0);
if (!rc) throw Poco::FileException("Failed to write private key to file", privateKeyFile); if (!rc) throw Poco::FileException("Failed to write private key to file", privateKeyFile);
} }
@ -350,10 +350,10 @@ void RSAKeyImpl::save(std::ostream* pPublicKeyStream,
if (privateKeyPassphrase.empty()) if (privateKeyPassphrase.empty())
rc = PEM_write_bio_RSAPrivateKey(bio, _pRSA, 0, 0, 0, 0, 0); rc = PEM_write_bio_RSAPrivateKey(bio, _pRSA, 0, 0, 0, 0, 0);
else else
rc = PEM_write_bio_RSAPrivateKey(bio, _pRSA, EVP_des_ede3_cbc(), rc = PEM_write_bio_RSAPrivateKey(bio, _pRSA, EVP_des_ede3_cbc(),
reinterpret_cast<unsigned char*>(const_cast<char*>(privateKeyPassphrase.c_str())), reinterpret_cast<unsigned char*>(const_cast<char*>(privateKeyPassphrase.c_str())),
static_cast<int>(privateKeyPassphrase.length()), 0, 0); static_cast<int>(privateKeyPassphrase.length()), 0, 0);
if (!rc) if (!rc)
{ {
BIO_free(bio); BIO_free(bio);
throw Poco::FileException("Failed to write private key to stream"); throw Poco::FileException("Failed to write private key to stream");

View File

@ -22,7 +22,7 @@
#include <openssl/pem.h> #include <openssl/pem.h>
#ifdef _WIN32 #ifdef _WIN32
// fix for WIN32 header conflict // fix for WIN32 header conflict
#undef X509_NAME #undef X509_NAME
#endif #endif
#include <openssl/x509v3.h> #include <openssl/x509v3.h>
#include <openssl/err.h> #include <openssl/err.h>
@ -154,7 +154,7 @@ void X509Certificate::save(std::ostream& stream) const
if (!pBIO) throw Poco::IOException("Cannot create BIO for writing certificate"); if (!pBIO) throw Poco::IOException("Cannot create BIO for writing certificate");
try try
{ {
if (!PEM_write_bio_X509(pBIO, _pCert)) if (!PEM_write_bio_X509(pBIO, _pCert))
throw Poco::IOException("Failed to write certificate to stream"); throw Poco::IOException("Failed to write certificate to stream");
char *pData; char *pData;
@ -182,7 +182,7 @@ void X509Certificate::save(const std::string& path) const
} }
try try
{ {
if (!PEM_write_bio_X509(pBIO, _pCert)) if (!PEM_write_bio_X509(pBIO, _pCert))
throw Poco::WriteFileException("Failed to write certificate to file", path); throw Poco::WriteFileException("Failed to write certificate to file", path);
} }
catch (...) catch (...)
@ -247,7 +247,7 @@ std::string X509Certificate::subjectName(NID nid) const
void X509Certificate::extractNames(std::string& cmnName, std::set<std::string>& domainNames) const void X509Certificate::extractNames(std::string& cmnName, std::set<std::string>& domainNames) const
{ {
domainNames.clear(); domainNames.clear();
if (STACK_OF(GENERAL_NAME)* names = static_cast<STACK_OF(GENERAL_NAME)*>(X509_get_ext_d2i(_pCert, NID_subject_alt_name, 0, 0))) if (STACK_OF(GENERAL_NAME)* names = static_cast<STACK_OF(GENERAL_NAME)*>(X509_get_ext_d2i(_pCert, NID_subject_alt_name, 0, 0)))
{ {
for (int i = 0; i < sk_GENERAL_NAME_num(names); ++i) for (int i = 0; i < sk_GENERAL_NAME_num(names); ++i)
@ -262,7 +262,7 @@ void X509Certificate::extractNames(std::string& cmnName, std::set<std::string>&
} }
GENERAL_NAMES_free(names); GENERAL_NAMES_free(names);
} }
cmnName = commonName(); cmnName = commonName();
if (!cmnName.empty() && domainNames.empty()) if (!cmnName.empty() && domainNames.empty())
{ {

View File

@ -1,6 +1,6 @@
Bag Attributes Bag Attributes
friendlyName: vally friendlyName: vally
localKeyID: ED 49 E2 A7 BA 66 AF 36 58 98 85 03 44 85 AE 96 38 03 61 70 localKeyID: ED 49 E2 A7 BA 66 AF 36 58 98 85 03 44 85 AE 96 38 03 61 70
subject=/C=CH/ST=Zug/O=Crypto Vally/CN=CV Server subject=/C=CH/ST=Zug/O=Crypto Vally/CN=CV Server
issuer=/C=CH/ST=Zug/O=Crypto Vally/CN=CV Intermediate CA v3 issuer=/C=CH/ST=Zug/O=Crypto Vally/CN=CV Intermediate CA v3
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
@ -105,7 +105,7 @@ D9vIMsVTPxxnOIRWskE=
-----END CERTIFICATE----- -----END CERTIFICATE-----
Bag Attributes Bag Attributes
friendlyName: vally friendlyName: vally
localKeyID: ED 49 E2 A7 BA 66 AF 36 58 98 85 03 44 85 AE 96 38 03 61 70 localKeyID: ED 49 E2 A7 BA 66 AF 36 58 98 85 03 44 85 AE 96 38 03 61 70
Key Attributes: <No Attributes> Key Attributes: <No Attributes>
-----BEGIN PRIVATE KEY----- -----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDXPX+EQwbPNE83 MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDXPX+EQwbPNE83

View File

@ -21,7 +21,7 @@
class CryptoTest: public CppUnit::TestCase class CryptoTest: public CppUnit::TestCase
{ {
public: public:
enum enum
{ {
MAX_DATA_SIZE = 10000 MAX_DATA_SIZE = 10000
}; };

View File

@ -8,7 +8,7 @@ vc.project.platforms = Win32, x64, WinCE
vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md
vc.project.prototype = ${vc.project.name}_vs90.vcproj vc.project.prototype = ${vc.project.name}_vs90.vcproj
vc.project.compiler.include = ..\\Foundation\\include vc.project.compiler.include = ..\\Foundation\\include
vc.project.compiler.defines = vc.project.compiler.defines =
vc.project.compiler.defines.shared = ${vc.project.name}_EXPORTS vc.project.compiler.defines.shared = ${vc.project.name}_EXPORTS
vc.project.compiler.defines.debug_shared = ${vc.project.compiler.defines.shared} vc.project.compiler.defines.debug_shared = ${vc.project.compiler.defines.shared}
vc.project.compiler.defines.release_shared = ${vc.project.compiler.defines.shared} vc.project.compiler.defines.release_shared = ${vc.project.compiler.defines.shared}

View File

@ -108,7 +108,7 @@ public:
/// Binds a null. /// Binds a null.
virtual void bind(std::size_t pos, const std::vector<Poco::Int8>& val, Direction dir = PD_IN); virtual void bind(std::size_t pos, const std::vector<Poco::Int8>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::deque<Poco::Int8>& val, Direction dir = PD_IN); virtual void bind(std::size_t pos, const std::deque<Poco::Int8>& val, Direction dir = PD_IN);
@ -136,25 +136,25 @@ public:
virtual void bind(std::size_t pos, const std::deque<Poco::Int32>& val, Direction dir = PD_IN); virtual void bind(std::size_t pos, const std::deque<Poco::Int32>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::list<Poco::Int32>& val, Direction dir = PD_IN); virtual void bind(std::size_t pos, const std::list<Poco::Int32>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::vector<Poco::UInt32>& val, Direction dir = PD_IN); virtual void bind(std::size_t pos, const std::vector<Poco::UInt32>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::deque<Poco::UInt32>& val, Direction dir = PD_IN); virtual void bind(std::size_t pos, const std::deque<Poco::UInt32>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::list<Poco::UInt32>& val, Direction dir = PD_IN); virtual void bind(std::size_t pos, const std::list<Poco::UInt32>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::vector<Poco::Int64>& val, Direction dir = PD_IN); virtual void bind(std::size_t pos, const std::vector<Poco::Int64>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::deque<Poco::Int64>& val, Direction dir = PD_IN); virtual void bind(std::size_t pos, const std::deque<Poco::Int64>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::list<Poco::Int64>& val, Direction dir = PD_IN); virtual void bind(std::size_t pos, const std::list<Poco::Int64>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::vector<Poco::UInt64>& val, Direction dir = PD_IN); virtual void bind(std::size_t pos, const std::vector<Poco::UInt64>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::deque<Poco::UInt64>& val, Direction dir = PD_IN); virtual void bind(std::size_t pos, const std::deque<Poco::UInt64>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::list<Poco::UInt64>& val, Direction dir = PD_IN); virtual void bind(std::size_t pos, const std::list<Poco::UInt64>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::vector<bool>& val, Direction dir = PD_IN); virtual void bind(std::size_t pos, const std::vector<bool>& val, Direction dir = PD_IN);
@ -236,7 +236,7 @@ private:
/// Don't copy the binder /// Don't copy the binder
virtual void bind(std::size_t, const char* const&, Direction, const WhenNullCb& ) virtual void bind(std::size_t, const char* const&, Direction, const WhenNullCb& )
/// Binds a const char ptr. /// Binds a const char ptr.
/// This is a private no-op in this implementation /// This is a private no-op in this implementation
/// due to security risk. /// due to security risk.
{ {

View File

@ -24,7 +24,7 @@
// Note: to avoid static (de)initialization problems, // Note: to avoid static (de)initialization problems,
// during connector automatic (un)registration, it is // during connector automatic (un)registration, it is
// best to have this as a macro. // best to have this as a macro.
#define POCO_DATA_MYSQL_CONNECTOR_NAME "mysql" #define POCO_DATA_MYSQL_CONNECTOR_NAME "mysql"
@ -67,14 +67,14 @@ public:
} } } // namespace Poco::Data::MySQL } } } // namespace Poco::Data::MySQL
// //
// Automatic Connector registration // Automatic Connector registration
// //
struct MySQL_API MySQLConnectorRegistrator struct MySQL_API MySQLConnectorRegistrator
/// Connector registering class. /// Connector registering class.
/// A global instance of this class is instantiated /// A global instance of this class is instantiated
/// with sole purpose to automatically register the /// with sole purpose to automatically register the
/// MySQL connector with central Poco Data registry. /// MySQL connector with central Poco Data registry.
{ {
MySQLConnectorRegistrator() MySQLConnectorRegistrator()
@ -120,9 +120,9 @@ struct MySQL_API MySQLConnectorRegistrator
POCO_DATA_MYSQL_FORCE_SYMBOL(pocoMySQLConnectorRegistrator) POCO_DATA_MYSQL_FORCE_SYMBOL(pocoMySQLConnectorRegistrator)
#endif // POCO_NO_AUTOMATIC_LIB_INIT #endif // POCO_NO_AUTOMATIC_LIB_INIT
// //
// End automatic Connector registration // End automatic Connector registration
// //
#endif // Data_MySQL_Connector_INCLUDED #endif // Data_MySQL_Connector_INCLUDED

View File

@ -32,7 +32,7 @@ namespace Data {
namespace MySQL { namespace MySQL {
// End-user include this file and use in code ConnectionException/StatementException // End-user include this file and use in code ConnectionException/StatementException
// So it need not know // So it need not know
class MySQL_API MySQLException: public Poco::Data::DataException class MySQL_API MySQLException: public Poco::Data::DataException
/// Base class for all MySQL exceptions /// Base class for all MySQL exceptions

View File

@ -268,7 +268,7 @@ MYSQL_BIND* Binder::getBindArray() const
/////////////////// ///////////////////
// //
// Private // Private
// //
//////////////////// ////////////////////
@ -293,7 +293,7 @@ void Binder::realBind(std::size_t pos, enum_field_types type, const void* buffer
} }
void Binder::bind(std::size_t pos, const std::vector<Poco::Int8>& val, Direction dir) void Binder::bind(std::size_t pos, const std::vector<Poco::Int8>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
@ -305,13 +305,13 @@ void Binder::bind(std::size_t pos, const std::deque<Poco::Int8>& val, Direction
} }
void Binder::bind(std::size_t pos, const std::list<Poco::Int8>& val, Direction dir) void Binder::bind(std::size_t pos, const std::list<Poco::Int8>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
void Binder::bind(std::size_t pos, const std::vector<Poco::UInt8>& val, Direction dir) void Binder::bind(std::size_t pos, const std::vector<Poco::UInt8>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
@ -323,13 +323,13 @@ void Binder::bind(std::size_t pos, const std::deque<Poco::UInt8>& val, Direction
} }
void Binder::bind(std::size_t pos, const std::list<Poco::UInt8>& val, Direction dir) void Binder::bind(std::size_t pos, const std::list<Poco::UInt8>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
void Binder::bind(std::size_t pos, const std::vector<Poco::Int16>& val, Direction dir) void Binder::bind(std::size_t pos, const std::vector<Poco::Int16>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
@ -341,13 +341,13 @@ void Binder::bind(std::size_t pos, const std::deque<Poco::Int16>& val, Direction
} }
void Binder::bind(std::size_t pos, const std::list<Poco::Int16>& val, Direction dir) void Binder::bind(std::size_t pos, const std::list<Poco::Int16>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
void Binder::bind(std::size_t pos, const std::vector<Poco::UInt16>& val, Direction dir) void Binder::bind(std::size_t pos, const std::vector<Poco::UInt16>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
@ -359,13 +359,13 @@ void Binder::bind(std::size_t pos, const std::deque<Poco::UInt16>& val, Directio
} }
void Binder::bind(std::size_t pos, const std::list<Poco::UInt16>& val, Direction dir) void Binder::bind(std::size_t pos, const std::list<Poco::UInt16>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
void Binder::bind(std::size_t pos, const std::vector<Poco::Int32>& val, Direction dir) void Binder::bind(std::size_t pos, const std::vector<Poco::Int32>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
@ -377,13 +377,13 @@ void Binder::bind(std::size_t pos, const std::deque<Poco::Int32>& val, Direction
} }
void Binder::bind(std::size_t pos, const std::list<Poco::Int32>& val, Direction dir) void Binder::bind(std::size_t pos, const std::list<Poco::Int32>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
void Binder::bind(std::size_t pos, const std::vector<Poco::UInt32>& val, Direction dir) void Binder::bind(std::size_t pos, const std::vector<Poco::UInt32>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
@ -395,13 +395,13 @@ void Binder::bind(std::size_t pos, const std::deque<Poco::UInt32>& val, Directio
} }
void Binder::bind(std::size_t pos, const std::list<Poco::UInt32>& val, Direction dir) void Binder::bind(std::size_t pos, const std::list<Poco::UInt32>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
void Binder::bind(std::size_t pos, const std::vector<Poco::Int64>& val, Direction dir) void Binder::bind(std::size_t pos, const std::vector<Poco::Int64>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
@ -413,13 +413,13 @@ void Binder::bind(std::size_t pos, const std::deque<Poco::Int64>& val, Direction
} }
void Binder::bind(std::size_t pos, const std::list<Poco::Int64>& val, Direction dir) void Binder::bind(std::size_t pos, const std::list<Poco::Int64>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
void Binder::bind(std::size_t pos, const std::vector<Poco::UInt64>& val, Direction dir) void Binder::bind(std::size_t pos, const std::vector<Poco::UInt64>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
@ -431,13 +431,13 @@ void Binder::bind(std::size_t pos, const std::deque<Poco::UInt64>& val, Directio
} }
void Binder::bind(std::size_t pos, const std::list<Poco::UInt64>& val, Direction dir) void Binder::bind(std::size_t pos, const std::list<Poco::UInt64>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
void Binder::bind(std::size_t pos, const std::vector<bool>& val, Direction dir) void Binder::bind(std::size_t pos, const std::vector<bool>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
@ -449,13 +449,13 @@ void Binder::bind(std::size_t pos, const std::deque<bool>& val, Direction dir)
} }
void Binder::bind(std::size_t pos, const std::list<bool>& val, Direction dir) void Binder::bind(std::size_t pos, const std::list<bool>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
void Binder::bind(std::size_t pos, const std::vector<float>& val, Direction dir) void Binder::bind(std::size_t pos, const std::vector<float>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
@ -467,13 +467,13 @@ void Binder::bind(std::size_t pos, const std::deque<float>& val, Direction dir)
} }
void Binder::bind(std::size_t pos, const std::list<float>& val, Direction dir) void Binder::bind(std::size_t pos, const std::list<float>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
void Binder::bind(std::size_t pos, const std::vector<double>& val, Direction dir) void Binder::bind(std::size_t pos, const std::vector<double>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
@ -485,13 +485,13 @@ void Binder::bind(std::size_t pos, const std::deque<double>& val, Direction dir)
} }
void Binder::bind(std::size_t pos, const std::list<double>& val, Direction dir) void Binder::bind(std::size_t pos, const std::list<double>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
void Binder::bind(std::size_t pos, const std::vector<char>& val, Direction dir) void Binder::bind(std::size_t pos, const std::vector<char>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
@ -503,13 +503,13 @@ void Binder::bind(std::size_t pos, const std::deque<char>& val, Direction dir)
} }
void Binder::bind(std::size_t pos, const std::list<char>& val, Direction dir) void Binder::bind(std::size_t pos, const std::list<char>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
void Binder::bind(std::size_t pos, const std::vector<Poco::Data::BLOB>& val, Direction dir) void Binder::bind(std::size_t pos, const std::vector<Poco::Data::BLOB>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
@ -521,13 +521,13 @@ void Binder::bind(std::size_t pos, const std::deque<Poco::Data::BLOB>& val, Dire
} }
void Binder::bind(std::size_t pos, const std::list<Poco::Data::BLOB>& val, Direction dir) void Binder::bind(std::size_t pos, const std::list<Poco::Data::BLOB>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
void Binder::bind(std::size_t pos, const std::vector<Poco::Data::CLOB>& val, Direction dir) void Binder::bind(std::size_t pos, const std::vector<Poco::Data::CLOB>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
@ -539,13 +539,13 @@ void Binder::bind(std::size_t pos, const std::deque<Poco::Data::CLOB>& val, Dire
} }
void Binder::bind(std::size_t pos, const std::list<Poco::Data::CLOB>& val, Direction dir) void Binder::bind(std::size_t pos, const std::list<Poco::Data::CLOB>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
void Binder::bind(std::size_t pos, const std::vector<Poco::DateTime>& val, Direction dir) void Binder::bind(std::size_t pos, const std::vector<Poco::DateTime>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
@ -557,13 +557,13 @@ void Binder::bind(std::size_t pos, const std::deque<Poco::DateTime>& val, Direct
} }
void Binder::bind(std::size_t pos, const std::list<Poco::DateTime>& val, Direction dir) void Binder::bind(std::size_t pos, const std::list<Poco::DateTime>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
void Binder::bind(std::size_t pos, const std::vector<Poco::Data::Date>& val, Direction dir) void Binder::bind(std::size_t pos, const std::vector<Poco::Data::Date>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
@ -575,13 +575,13 @@ void Binder::bind(std::size_t pos, const std::deque<Poco::Data::Date>& val, Dire
} }
void Binder::bind(std::size_t pos, const std::list<Poco::Data::Date>& val, Direction dir) void Binder::bind(std::size_t pos, const std::list<Poco::Data::Date>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
void Binder::bind(std::size_t pos, const std::vector<Poco::Data::Time>& val, Direction dir) void Binder::bind(std::size_t pos, const std::vector<Poco::Data::Time>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
@ -593,7 +593,7 @@ void Binder::bind(std::size_t pos, const std::deque<Poco::Data::Time>& val, Dire
} }
void Binder::bind(std::size_t pos, const std::list<Poco::Data::Time>& val, Direction dir) void Binder::bind(std::size_t pos, const std::list<Poco::Data::Time>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
@ -617,7 +617,7 @@ void Binder::bind(std::size_t pos, const std::list<Poco::Data::NullData>& val, D
} }
void Binder::bind(std::size_t pos, const std::vector<std::string>& val, Direction dir) void Binder::bind(std::size_t pos, const std::vector<std::string>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }
@ -629,7 +629,7 @@ void Binder::bind(std::size_t pos, const std::deque<std::string>& val, Direction
} }
void Binder::bind(std::size_t pos, const std::list<std::string>& val, Direction dir) void Binder::bind(std::size_t pos, const std::list<std::string>& val, Direction dir)
{ {
throw NotImplementedException(); throw NotImplementedException();
} }

View File

@ -20,10 +20,10 @@ namespace MySQL {
MySQLStatementImpl::MySQLStatementImpl(SessionImpl& h) : MySQLStatementImpl::MySQLStatementImpl(SessionImpl& h) :
Poco::Data::StatementImpl(h), Poco::Data::StatementImpl(h),
_stmt(h.handle()), _stmt(h.handle()),
_pBinder(new Binder), _pBinder(new Binder),
_pExtractor(new Extractor(_stmt, _metadata)), _pExtractor(new Extractor(_stmt, _metadata)),
_hasNext(NEXT_DONTKNOW) _hasNext(NEXT_DONTKNOW)
{ {
} }

View File

@ -86,7 +86,7 @@ namespace
switch (field.type) switch (field.type)
{ {
case MYSQL_TYPE_TINY: case MYSQL_TYPE_TINY:
if (unsig) return Poco::Data::MetaColumn::FDT_UINT8; if (unsig) return Poco::Data::MetaColumn::FDT_UINT8;
return Poco::Data::MetaColumn::FDT_INT8; return Poco::Data::MetaColumn::FDT_INT8;
@ -95,19 +95,19 @@ namespace
return Poco::Data::MetaColumn::FDT_INT16; return Poco::Data::MetaColumn::FDT_INT16;
case MYSQL_TYPE_INT24: case MYSQL_TYPE_INT24:
case MYSQL_TYPE_LONG: case MYSQL_TYPE_LONG:
if (unsig) return Poco::Data::MetaColumn::FDT_UINT32; if (unsig) return Poco::Data::MetaColumn::FDT_UINT32;
return Poco::Data::MetaColumn::FDT_INT32; return Poco::Data::MetaColumn::FDT_INT32;
case MYSQL_TYPE_FLOAT: case MYSQL_TYPE_FLOAT:
return Poco::Data::MetaColumn::FDT_FLOAT; return Poco::Data::MetaColumn::FDT_FLOAT;
case MYSQL_TYPE_DECIMAL: case MYSQL_TYPE_DECIMAL:
case MYSQL_TYPE_NEWDECIMAL: case MYSQL_TYPE_NEWDECIMAL:
case MYSQL_TYPE_DOUBLE: case MYSQL_TYPE_DOUBLE:
return Poco::Data::MetaColumn::FDT_DOUBLE; return Poco::Data::MetaColumn::FDT_DOUBLE;
case MYSQL_TYPE_LONGLONG: case MYSQL_TYPE_LONGLONG:
if (unsig) return Poco::Data::MetaColumn::FDT_UINT64; if (unsig) return Poco::Data::MetaColumn::FDT_UINT64;
return Poco::Data::MetaColumn::FDT_INT64; return Poco::Data::MetaColumn::FDT_INT64;
@ -226,12 +226,12 @@ std::size_t ResultMetadata::length(std::size_t pos) const
return _lengths[pos]; return _lengths[pos];
} }
const unsigned char* ResultMetadata::rawData(std::size_t pos) const const unsigned char* ResultMetadata::rawData(std::size_t pos) const
{ {
return reinterpret_cast<const unsigned char*>(_row[pos].buffer); return reinterpret_cast<const unsigned char*>(_row[pos].buffer);
} }
bool ResultMetadata::isNull(std::size_t pos) const bool ResultMetadata::isNull(std::size_t pos) const
{ {
return (_isNull[pos] != 0); return (_isNull[pos] != 0);
} }

View File

@ -44,7 +44,7 @@ const std::string SessionImpl::MYSQL_REPEATABLE_READ = "REPEATABLE READ";
const std::string SessionImpl::MYSQL_SERIALIZABLE = "SERIALIZABLE"; const std::string SessionImpl::MYSQL_SERIALIZABLE = "SERIALIZABLE";
SessionImpl::SessionImpl(const std::string& connectionString, std::size_t loginTimeout) : SessionImpl::SessionImpl(const std::string& connectionString, std::size_t loginTimeout) :
Poco::Data::AbstractSessionImpl<SessionImpl>(connectionString, loginTimeout), Poco::Data::AbstractSessionImpl<SessionImpl>(connectionString, loginTimeout),
_handle(0), _handle(0),
_connected(false), _connected(false),
@ -88,7 +88,7 @@ void SessionImpl::open(const std::string& connect)
options["character-set"] = "utf8"; options["character-set"] = "utf8";
const std::string& connString = connectionString(); const std::string& connString = connectionString();
for (std::string::const_iterator start = connString.begin();;) for (std::string::const_iterator start = connString.begin();;)
{ {
std::string::const_iterator finish = std::find(start, connString.end(), ';'); std::string::const_iterator finish = std::find(start, connString.end(), ';');
std::string::const_iterator middle = std::find(start, finish, '='); std::string::const_iterator middle = std::find(start, finish, '=');
@ -101,7 +101,7 @@ void SessionImpl::open(const std::string& connect)
if ((finish == connString.end()) || (finish + 1 == connString.end())) break; if ((finish == connString.end()) || (finish + 1 == connString.end())) break;
start = finish + 1; start = finish + 1;
} }
if (options["user"].empty()) if (options["user"].empty())
throw MySQLException("create session: specify user name"); throw MySQLException("create session: specify user name");
@ -139,14 +139,14 @@ void SessionImpl::open(const std::string& connect)
_handle.options(MYSQL_SET_CHARSET_NAME, options["character-set"].c_str()); _handle.options(MYSQL_SET_CHARSET_NAME, options["character-set"].c_str());
// Real connect // Real connect
_handle.connect(options["host"].c_str(), _handle.connect(options["host"].c_str(),
options["user"].c_str(), options["user"].c_str(),
options["password"].c_str(), options["password"].c_str(),
db, db,
port); port);
addFeature("autoCommit", addFeature("autoCommit",
&SessionImpl::autoCommit, &SessionImpl::autoCommit,
&SessionImpl::isAutoCommit); &SessionImpl::isAutoCommit);
_connected = true; _connected = true;

View File

@ -119,7 +119,7 @@ bool StatementExecutor::fetch()
int res = mysql_stmt_fetch(_pHandle); int res = mysql_stmt_fetch(_pHandle);
// we have specified zero buffers for BLOBs, so DATA_TRUNCATED is normal in this case // we have specified zero buffers for BLOBs, so DATA_TRUNCATED is normal in this case
if ((res != 0) && (res != MYSQL_NO_DATA) && (res != MYSQL_DATA_TRUNCATED)) if ((res != 0) && (res != MYSQL_NO_DATA) && (res != MYSQL_DATA_TRUNCATED))
throw StatementException("mysql_stmt_fetch error", _pHandle, _query); throw StatementException("mysql_stmt_fetch error", _pHandle, _query);
return (res == 0) || (res == MYSQL_DATA_TRUNCATED); return (res == 0) || (res == MYSQL_DATA_TRUNCATED);

View File

@ -24,7 +24,7 @@
class MySQLTest: public CppUnit::TestCase class MySQLTest: public CppUnit::TestCase
/// MySQL test class /// MySQL test class
/// Tested: /// Tested:
/// ///
/// Driver | DB | OS /// Driver | DB | OS
/// ----------------+---------------------------+------------------------------------------ /// ----------------+---------------------------+------------------------------------------
/// 03.51.12.00 | MySQL 5.0.27-community-nt | MS Windows XP Professional x64 v.2003/SP1 /// 03.51.12.00 | MySQL 5.0.27-community-nt | MS Windows XP Professional x64 v.2003/SP1

View File

@ -152,7 +152,7 @@ private:
} } // namespace Poco::Data } } // namespace Poco::Data
SQLExecutor::SQLExecutor(const std::string& name, Poco::Data::Session* pSession): SQLExecutor::SQLExecutor(const std::string& name, Poco::Data::Session* pSession):
CppUnit::TestCase(name), CppUnit::TestCase(name),
_pSession(pSession) _pSession(pSession)
{ {
@ -179,14 +179,14 @@ void SQLExecutor::bareboneMySQLTest(const std::string& host, const std::string&
mysql_real_query(hsession, sql.c_str(), static_cast<unsigned long>(sql.length())); mysql_real_query(hsession, sql.c_str(), static_cast<unsigned long>(sql.length()));
sql = tableCreateString; sql = tableCreateString;
int rc = mysql_stmt_prepare(hstmt, sql.c_str(), static_cast<unsigned long>(sql.length())); int rc = mysql_stmt_prepare(hstmt, sql.c_str(), static_cast<unsigned long>(sql.length()));
poco_assert (rc == 0); poco_assert (rc == 0);
rc = mysql_stmt_execute(hstmt); rc = mysql_stmt_execute(hstmt);
poco_assert (rc == 0); poco_assert (rc == 0);
sql = "INSERT INTO Test VALUES (?,?,?,?,?)"; sql = "INSERT INTO Test VALUES (?,?,?,?,?)";
rc = mysql_stmt_prepare(hstmt, sql.c_str(), static_cast<unsigned long>(sql.length())); rc = mysql_stmt_prepare(hstmt, sql.c_str(), static_cast<unsigned long>(sql.length()));
poco_assert (rc == 0); poco_assert (rc == 0);
std::string str[3] = { "111", "222", "333" }; std::string str[3] = { "111", "222", "333" };
@ -289,10 +289,10 @@ void SQLExecutor::simpleAccess()
std::string result; std::string result;
count = 0; count = 0;
try try
{ {
Statement stmt(*_pSession); Statement stmt(*_pSession);
stmt << "INSERT INTO Person VALUES (?,?,?,?)", use(lastName), use(firstName), use(address), use(age);//, now; stmt << "INSERT INTO Person VALUES (?,?,?,?)", use(lastName), use(firstName), use(address), use(age);//, now;
stmt.execute(); stmt.execute();
} }
catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); }
@ -1132,7 +1132,7 @@ void SQLExecutor::selectIntoSingleStep()
catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); }
poco_assert (count == 2); poco_assert (count == 2);
Person result; Person result;
Statement stmt = (*_pSession << "SELECT * FROM Person", into(result), limit(1)); Statement stmt = (*_pSession << "SELECT * FROM Person", into(result), limit(1));
stmt.execute(); stmt.execute();
poco_assert (result == p1); poco_assert (result == p1);
poco_assert (!stmt.done()); poco_assert (!stmt.done());
@ -1595,7 +1595,7 @@ void SQLExecutor::tupleVector()
typedef Tuple<int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int> TupleType; typedef Tuple<int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int> TupleType;
std::string funct = "tupleVector()"; std::string funct = "tupleVector()";
TupleType t(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19); TupleType t(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19);
Tuple<int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int> Tuple<int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int>
t10(10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29); t10(10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29);
TupleType t100(100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119); TupleType t100(100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119);
std::vector<TupleType> v; std::vector<TupleType> v;
@ -1683,8 +1683,8 @@ void SQLExecutor::internalExtraction()
catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); }
try try
{ {
Statement stmt = (*_pSession << "SELECT * FROM Vectors", now); Statement stmt = (*_pSession << "SELECT * FROM Vectors", now);
RecordSet rset(stmt); RecordSet rset(stmt);
@ -1788,9 +1788,9 @@ void SQLExecutor::doNull()
{ {
std::string funct = "null()"; std::string funct = "null()";
*_pSession << "INSERT INTO Vectors VALUES (?, ?, ?)", *_pSession << "INSERT INTO Vectors VALUES (?, ?, ?)",
use(Poco::Data::Keywords::null), use(Poco::Data::Keywords::null),
use(Poco::Data::Keywords::null), use(Poco::Data::Keywords::null),
use(Poco::Data::Keywords::null), now; use(Poco::Data::Keywords::null), now;
int count = 0; int count = 0;
@ -1823,12 +1823,12 @@ void SQLExecutor::doNull()
void SQLExecutor::setTransactionIsolation(Session& session, Poco::UInt32 ti) void SQLExecutor::setTransactionIsolation(Session& session, Poco::UInt32 ti)
{ {
if (session.hasTransactionIsolation(ti)) if (session.hasTransactionIsolation(ti))
{ {
std::string funct = "setTransactionIsolation()"; std::string funct = "setTransactionIsolation()";
try try
{ {
Transaction t(session, false); Transaction t(session, false);
t.setIsolation(ti); t.setIsolation(ti);
@ -2129,9 +2129,9 @@ void SQLExecutor::reconnect()
poco_assert (_pSession->isConnected()); poco_assert (_pSession->isConnected());
_pSession->close(); _pSession->close();
poco_assert (!_pSession->isConnected()); poco_assert (!_pSession->isConnected());
try try
{ {
(*_pSession) << "SELECT LastName FROM Person", into(result), now; (*_pSession) << "SELECT LastName FROM Person", into(result), now;
fail ("must fail"); fail ("must fail");
} }
catch(NotConnectedException&){ } catch(NotConnectedException&){ }

View File

@ -37,7 +37,7 @@ public:
~SQLExecutor(); ~SQLExecutor();
void bareboneMySQLTest(const std::string& host, const std::string& user, const std::string& pwd, const std::string& db, const std::string& port, const char* tableCreateString); void bareboneMySQLTest(const std::string& host, const std::string& user, const std::string& pwd, const std::string& db, const std::string& port, const char* tableCreateString);
/// This function uses "bare bone" MySQL API calls (i.e. calls are not /// This function uses "bare bone" MySQL API calls (i.e. calls are not
/// "wrapped" in PocoData framework structures). /// "wrapped" in PocoData framework structures).
/// The purpose of the function is to verify that driver behaves /// The purpose of the function is to verify that driver behaves
/// correctly. If this test passes, subsequent tests failures are likely ours. /// correctly. If this test passes, subsequent tests failures are likely ours.

View File

@ -10,7 +10,7 @@ include ODBC.make
objects = Binder ConnectionHandle Connector EnvironmentHandle \ objects = Binder ConnectionHandle Connector EnvironmentHandle \
Extractor ODBCException ODBCMetaColumn ODBCStatementImpl \ Extractor ODBCException ODBCMetaColumn ODBCStatementImpl \
Parameter Preparator SessionImpl TypeInfo Unicode Utility Parameter Preparator SessionImpl TypeInfo Unicode Utility
target = PocoDataODBC target = PocoDataODBC
target_version = $(LIBVERSION) target_version = $(LIBVERSION)

View File

@ -361,7 +361,7 @@ public:
/// Returns bound data size for parameter at specified position. /// Returns bound data size for parameter at specified position.
void synchronize(); void synchronize();
/// Transfers the results of non-POD outbound parameters from internal /// Transfers the results of non-POD outbound parameters from internal
/// holders back into the externally supplied buffers. /// holders back into the externally supplied buffers.
void reset(); void reset();
@ -394,7 +394,7 @@ private:
/// Sets the description field for the parameter, if needed. /// Sets the description field for the parameter, if needed.
void bind(std::size_t pos, const char* const& pVal, Direction dir, const WhenNullCb& nullCb); void bind(std::size_t pos, const char* const& pVal, Direction dir, const WhenNullCb& nullCb);
/// Binds a const char ptr. /// Binds a const char ptr.
/// This is a private no-op in this implementation /// This is a private no-op in this implementation
/// due to security risk. /// due to security risk.
@ -417,14 +417,14 @@ private:
} }
_lengthIndicator.push_back(pLenIn); _lengthIndicator.push_back(pLenIn);
if (Utility::isError(SQLBindParameter(_rStmt, if (Utility::isError(SQLBindParameter(_rStmt,
(SQLUSMALLINT) pos + 1, (SQLUSMALLINT) pos + 1,
toODBCDirection(dir), toODBCDirection(dir),
cDataType, cDataType,
Utility::sqlDataType(cDataType), Utility::sqlDataType(cDataType),
colSize, colSize,
decDigits, decDigits,
(SQLPOINTER)&val, 0, (SQLPOINTER)&val, 0,
_lengthIndicator.back()))) _lengthIndicator.back())))
{ {
throw StatementException(_rStmt, "SQLBindParameter()"); throw StatementException(_rStmt, "SQLBindParameter()");
@ -454,15 +454,15 @@ private:
_lengthIndicator.push_back(pLenIn); _lengthIndicator.push_back(pLenIn);
SQLSMALLINT sqlType = (isInBound(dir) && size <= _maxVarBinColSize) ? SQL_VARBINARY : SQL_LONGVARBINARY; SQLSMALLINT sqlType = (isInBound(dir) && size <= _maxVarBinColSize) ? SQL_VARBINARY : SQL_LONGVARBINARY;
if (Utility::isError(SQLBindParameter(_rStmt, if (Utility::isError(SQLBindParameter(_rStmt,
(SQLUSMALLINT) pos + 1, (SQLUSMALLINT) pos + 1,
SQL_PARAM_INPUT, SQL_PARAM_INPUT,
SQL_C_BINARY, SQL_C_BINARY,
sqlType, sqlType,
(SQLUINTEGER) size, (SQLUINTEGER) size,
0, 0,
pVal, pVal,
(SQLINTEGER) size, (SQLINTEGER) size,
_lengthIndicator.back()))) _lengthIndicator.back())))
{ {
throw StatementException(_rStmt, "SQLBindParameter(LOB)"); throw StatementException(_rStmt, "SQLBindParameter(LOB)");
@ -487,15 +487,15 @@ private:
_vecLengthIndicator[pos] = new LengthVec(length); _vecLengthIndicator[pos] = new LengthVec(length);
} }
if (Utility::isError(SQLBindParameter(_rStmt, if (Utility::isError(SQLBindParameter(_rStmt,
(SQLUSMALLINT) pos + 1, (SQLUSMALLINT) pos + 1,
toODBCDirection(dir), toODBCDirection(dir),
cDataType, cDataType,
Utility::sqlDataType(cDataType), Utility::sqlDataType(cDataType),
colSize, colSize,
decDigits, decDigits,
(SQLPOINTER) &val[0], (SQLPOINTER) &val[0],
0, 0,
&(*_vecLengthIndicator[pos])[0]))) &(*_vecLengthIndicator[pos])[0])))
{ {
throw StatementException(_rStmt, "SQLBindParameter()"); throw StatementException(_rStmt, "SQLBindParameter()");
@ -548,15 +548,15 @@ private:
typename C::const_iterator end = val.end(); typename C::const_iterator end = val.end();
for (int i = 0; it != end; ++it, ++i) _boolPtrs[pos][i] = *it; for (int i = 0; it != end; ++it, ++i) _boolPtrs[pos][i] = *it;
if (Utility::isError(SQLBindParameter(_rStmt, if (Utility::isError(SQLBindParameter(_rStmt,
(SQLUSMALLINT) pos + 1, (SQLUSMALLINT) pos + 1,
toODBCDirection(dir), toODBCDirection(dir),
cDataType, cDataType,
Utility::sqlDataType(cDataType), Utility::sqlDataType(cDataType),
colSize, colSize,
decDigits, decDigits,
(SQLPOINTER) &_boolPtrs[pos][0], (SQLPOINTER) &_boolPtrs[pos][0],
0, 0,
&(*_vecLengthIndicator[pos])[0]))) &(*_vecLengthIndicator[pos])[0])))
{ {
throw StatementException(_rStmt, "SQLBindParameter()"); throw StatementException(_rStmt, "SQLBindParameter()");
@ -616,15 +616,15 @@ private:
} }
SQLSMALLINT sqlType = (isInBound(dir) && size < _maxCharColLength) ? SQL_VARCHAR : SQL_LONGVARCHAR; SQLSMALLINT sqlType = (isInBound(dir) && size < _maxCharColLength) ? SQL_VARCHAR : SQL_LONGVARCHAR;
if (Utility::isError(SQLBindParameter(_rStmt, if (Utility::isError(SQLBindParameter(_rStmt,
(SQLUSMALLINT) pos + 1, (SQLUSMALLINT) pos + 1,
toODBCDirection(dir), toODBCDirection(dir),
SQL_C_CHAR, SQL_C_CHAR,
sqlType, sqlType,
(SQLUINTEGER) size - 1, (SQLUINTEGER) size - 1,
0, 0,
_charPtrs[pos], _charPtrs[pos],
(SQLINTEGER) size, (SQLINTEGER) size,
&(*_vecLengthIndicator[pos])[0]))) &(*_vecLengthIndicator[pos])[0])))
{ {
throw StatementException(_rStmt, "SQLBindParameter(std::vector<std::string>)"); throw StatementException(_rStmt, "SQLBindParameter(std::vector<std::string>)");
@ -726,7 +726,7 @@ private:
std::vector<SQLLEN>::iterator lIt = _vecLengthIndicator[pos]->begin(); std::vector<SQLLEN>::iterator lIt = _vecLengthIndicator[pos]->begin();
std::vector<SQLLEN>::iterator lEnd = _vecLengthIndicator[pos]->end(); std::vector<SQLLEN>::iterator lEnd = _vecLengthIndicator[pos]->end();
typename C::const_iterator cIt = val.begin(); typename C::const_iterator cIt = val.begin();
for (; lIt != lEnd; ++lIt, ++cIt) for (; lIt != lEnd; ++lIt, ++cIt)
{ {
SQLLEN sz = static_cast<SQLLEN>(cIt->size()); SQLLEN sz = static_cast<SQLLEN>(cIt->size());
if (sz > size) size = static_cast<SQLINTEGER>(sz); if (sz > size) size = static_cast<SQLINTEGER>(sz);
@ -753,15 +753,15 @@ private:
} }
SQLSMALLINT sqlType = (isInBound(dir) && size <= _maxVarBinColSize) ? SQL_VARBINARY : SQL_LONGVARBINARY; SQLSMALLINT sqlType = (isInBound(dir) && size <= _maxVarBinColSize) ? SQL_VARBINARY : SQL_LONGVARBINARY;
if (Utility::isError(SQLBindParameter(_rStmt, if (Utility::isError(SQLBindParameter(_rStmt,
(SQLUSMALLINT) pos + 1, (SQLUSMALLINT) pos + 1,
SQL_PARAM_INPUT, SQL_PARAM_INPUT,
SQL_C_BINARY, SQL_C_BINARY,
sqlType, sqlType,
(SQLUINTEGER) size, (SQLUINTEGER) size,
0, 0,
_charPtrs[pos], _charPtrs[pos],
(SQLINTEGER) size, (SQLINTEGER) size,
&(*_vecLengthIndicator[pos])[0]))) &(*_vecLengthIndicator[pos])[0])))
{ {
throw StatementException(_rStmt, "SQLBindParameter(std::vector<BLOB>)"); throw StatementException(_rStmt, "SQLBindParameter(std::vector<BLOB>)");
@ -802,15 +802,15 @@ private:
SQLSMALLINT decDigits = 0; SQLSMALLINT decDigits = 0;
getColSizeAndPrecision(pos, SQL_TYPE_DATE, colSize, decDigits); getColSizeAndPrecision(pos, SQL_TYPE_DATE, colSize, decDigits);
if (Utility::isError(SQLBindParameter(_rStmt, if (Utility::isError(SQLBindParameter(_rStmt,
(SQLUSMALLINT) pos + 1, (SQLUSMALLINT) pos + 1,
toODBCDirection(dir), toODBCDirection(dir),
SQL_C_TYPE_DATE, SQL_C_TYPE_DATE,
SQL_TYPE_DATE, SQL_TYPE_DATE,
colSize, colSize,
decDigits, decDigits,
(SQLPOINTER) &(*_dateVecVec[pos])[0], (SQLPOINTER) &(*_dateVecVec[pos])[0],
0, 0,
&(*_vecLengthIndicator[pos])[0]))) &(*_vecLengthIndicator[pos])[0])))
{ {
throw StatementException(_rStmt, "SQLBindParameter(Date[])"); throw StatementException(_rStmt, "SQLBindParameter(Date[])");
@ -850,15 +850,15 @@ private:
SQLSMALLINT decDigits = 0; SQLSMALLINT decDigits = 0;
getColSizeAndPrecision(pos, SQL_TYPE_TIME, colSize, decDigits); getColSizeAndPrecision(pos, SQL_TYPE_TIME, colSize, decDigits);
if (Utility::isError(SQLBindParameter(_rStmt, if (Utility::isError(SQLBindParameter(_rStmt,
(SQLUSMALLINT) pos + 1, (SQLUSMALLINT) pos + 1,
toODBCDirection(dir), toODBCDirection(dir),
SQL_C_TYPE_TIME, SQL_C_TYPE_TIME,
SQL_TYPE_TIME, SQL_TYPE_TIME,
colSize, colSize,
decDigits, decDigits,
(SQLPOINTER) &(*_timeVecVec[pos])[0], (SQLPOINTER) &(*_timeVecVec[pos])[0],
0, 0,
&(*_vecLengthIndicator[pos])[0]))) &(*_vecLengthIndicator[pos])[0])))
{ {
throw StatementException(_rStmt, "SQLBindParameter(Time[])"); throw StatementException(_rStmt, "SQLBindParameter(Time[])");
@ -899,15 +899,15 @@ private:
SQLSMALLINT decDigits = 0; SQLSMALLINT decDigits = 0;
getColSizeAndPrecision(pos, SQL_TYPE_TIMESTAMP, colSize, decDigits); getColSizeAndPrecision(pos, SQL_TYPE_TIMESTAMP, colSize, decDigits);
if (Utility::isError(SQLBindParameter(_rStmt, if (Utility::isError(SQLBindParameter(_rStmt,
(SQLUSMALLINT) pos + 1, (SQLUSMALLINT) pos + 1,
toODBCDirection(dir), toODBCDirection(dir),
SQL_C_TYPE_TIMESTAMP, SQL_C_TYPE_TIMESTAMP,
SQL_TYPE_TIMESTAMP, SQL_TYPE_TIMESTAMP,
colSize, colSize,
decDigits, decDigits,
(SQLPOINTER) &(*_dateTimeVecVec[pos])[0], (SQLPOINTER) &(*_dateTimeVecVec[pos])[0],
0, 0,
&(*_vecLengthIndicator[pos])[0]))) &(*_vecLengthIndicator[pos])[0])))
{ {
throw StatementException(_rStmt, "SQLBindParameter(Time[])"); throw StatementException(_rStmt, "SQLBindParameter(Time[])");
@ -941,31 +941,31 @@ private:
SQLSMALLINT colType = _pTypeInfo->tryTypeidToCType(bindElemType, SQL_C_STINYINT); SQLSMALLINT colType = _pTypeInfo->tryTypeidToCType(bindElemType, SQL_C_STINYINT);
getColSizeAndPrecision(pos, colType, colSize, decDigits); getColSizeAndPrecision(pos, colType, colSize, decDigits);
if (Utility::isError(SQLBindParameter(_rStmt, if (Utility::isError(SQLBindParameter(_rStmt,
(SQLUSMALLINT) pos + 1, (SQLUSMALLINT) pos + 1,
SQL_PARAM_INPUT, SQL_PARAM_INPUT,
colType, colType,
Utility::sqlDataType(colType), Utility::sqlDataType(colType),
colSize, colSize,
decDigits, decDigits,
0, 0,
0, 0,
&(*_vecLengthIndicator[pos])[0]))) &(*_vecLengthIndicator[pos])[0])))
{ {
throw StatementException(_rStmt, "SQLBindParameter()"); throw StatementException(_rStmt, "SQLBindParameter()");
} }
} }
void getColSizeAndPrecision(std::size_t pos, void getColSizeAndPrecision(std::size_t pos,
SQLSMALLINT cDataType, SQLSMALLINT cDataType,
SQLINTEGER& colSize, SQLINTEGER& colSize,
SQLSMALLINT& decDigits); SQLSMALLINT& decDigits);
/// Used to retrieve column size and precision. /// Used to retrieve column size and precision.
/// Not all drivers cooperate with this inquiry under all circumstances /// Not all drivers cooperate with this inquiry under all circumstances
/// This function runs for query and stored procedure parameters (in and /// This function runs for query and stored procedure parameters (in and
/// out-bound). Some drivers, however, do not care about knowing this /// out-bound). Some drivers, however, do not care about knowing this
/// information to start with. For that reason, after all the attempts /// information to start with. For that reason, after all the attempts
/// to discover the required values are unsuccessfully exhausted, the values /// to discover the required values are unsuccessfully exhausted, the values
/// are both set to zero and no exception is thrown. /// are both set to zero and no exception is thrown.
void setParamSetSize(std::size_t length); void setParamSetSize(std::size_t length);
@ -974,7 +974,7 @@ private:
void getColumnOrParameterSize(std::size_t pos, SQLINTEGER& size); void getColumnOrParameterSize(std::size_t pos, SQLINTEGER& size);
/// Fills the column or parameter size into the 'size' argument. /// Fills the column or parameter size into the 'size' argument.
/// Does nothing if neither can be obtained from the driver, so /// Does nothing if neither can be obtained from the driver, so
/// size should be set to some default value prior to calling this /// size should be set to some default value prior to calling this
/// function in order to avoid undefined size value. /// function in order to avoid undefined size value.
void freeMemory(); void freeMemory();
@ -984,9 +984,9 @@ private:
template<typename T> template<typename T>
void getMinValueSize(T& val, SQLINTEGER& size) void getMinValueSize(T& val, SQLINTEGER& size)
/// Some ODBC drivers return DB-wide maximum allowed size for variable size columns, /// Some ODBC drivers return DB-wide maximum allowed size for variable size columns,
/// rather than the allowed size for the actual column. In such cases, the length is /// rather than the allowed size for the actual column. In such cases, the length is
/// automatically resized to the maximum field size allowed by the session. /// automatically resized to the maximum field size allowed by the session.
/// This function, in order to prevent unnecessary memory allocation, does further /// This function, in order to prevent unnecessary memory allocation, does further
/// optimization, looking for the maximum length within supplied data container and /// optimization, looking for the maximum length within supplied data container and
/// uses the smaller of maximum found and maximum predefined data length. /// uses the smaller of maximum found and maximum predefined data length.
{ {

View File

@ -23,7 +23,7 @@
// Note: to avoid static (de)initialization problems, // Note: to avoid static (de)initialization problems,
// during connector automatic (un)registration, it is // during connector automatic (un)registration, it is
// best to have this as a macro. // best to have this as a macro.
#define POCO_DATA_ODBC_CONNECTOR_NAME "odbc" #define POCO_DATA_ODBC_CONNECTOR_NAME "odbc"
@ -75,14 +75,14 @@ inline const std::string& Connector::name() const
} } } // namespace Poco::Data::ODBC } } } // namespace Poco::Data::ODBC
// //
// Automatic Connector registration // Automatic Connector registration
// //
struct ODBC_API ODBCConnectorRegistrator struct ODBC_API ODBCConnectorRegistrator
/// Connector registering class. /// Connector registering class.
/// A global instance of this class is instantiated /// A global instance of this class is instantiated
/// with sole purpose to automatically register the /// with sole purpose to automatically register the
/// ODBC connector with central Poco Data registry. /// ODBC connector with central Poco Data registry.
{ {
ODBCConnectorRegistrator() ODBCConnectorRegistrator()
@ -128,9 +128,9 @@ struct ODBC_API ODBCConnectorRegistrator
POCO_DATA_ODBC_FORCE_SYMBOL(pocoODBCConnectorRegistrator) POCO_DATA_ODBC_FORCE_SYMBOL(pocoODBCConnectorRegistrator)
#endif // POCO_NO_AUTOMATIC_LIB_INIT #endif // POCO_NO_AUTOMATIC_LIB_INIT
// //
// End automatic Connector registration // End automatic Connector registration
// //
#endif // Data_ODBC_Connector_INCLUDED #endif // Data_ODBC_Connector_INCLUDED

View File

@ -36,7 +36,7 @@ template <typename H, SQLSMALLINT handleType>
class Diagnostics class Diagnostics
/// Utility class providing functionality for retrieving ODBC diagnostic /// Utility class providing functionality for retrieving ODBC diagnostic
/// records. Diagnostics object must be created with corresponding handle /// records. Diagnostics object must be created with corresponding handle
/// as constructor argument. During construction, diagnostic records fields /// as constructor argument. During construction, diagnostic records fields
/// are populated and the object is ready for querying. /// are populated and the object is ready for querying.
{ {
public: public:
@ -92,7 +92,7 @@ public:
} }
std::string connectionName() const std::string connectionName() const
/// Returns the connection name. /// Returns the connection name.
/// If there is no active connection, connection name defaults to NONE. /// If there is no active connection, connection name defaults to NONE.
/// If connection name is not applicable for query context (such as when querying environment handle), /// If connection name is not applicable for query context (such as when querying environment handle),
/// connection name defaults to NOT_APPLICABLE. /// connection name defaults to NOT_APPLICABLE.
@ -146,54 +146,54 @@ public:
reset(); reset();
while (!Utility::isError(SQLGetDiagRec(handleType, while (!Utility::isError(SQLGetDiagRec(handleType,
handle, handle,
count, count,
df._sqlState, df._sqlState,
&df._nativeError, &df._nativeError,
df._message, df._message,
SQL_MESSAGE_LENGTH, SQL_MESSAGE_LENGTH,
&messageLength))) &messageLength)))
{ {
if (1 == count) if (1 == count)
{ {
// success of the following two calls is optional // success of the following two calls is optional
// (they fail if connection has not been established yet // (they fail if connection has not been established yet
// or return empty string if not applicable for the context) // or return empty string if not applicable for the context)
if (Utility::isError(SQLGetDiagField(handleType, if (Utility::isError(SQLGetDiagField(handleType,
handle, handle,
count, count,
SQL_DIAG_CONNECTION_NAME, SQL_DIAG_CONNECTION_NAME,
_connectionName, _connectionName,
sizeof(_connectionName), sizeof(_connectionName),
&messageLength))) &messageLength)))
{ {
std::size_t len = sizeof(_connectionName) > none.length() ? std::size_t len = sizeof(_connectionName) > none.length() ?
none.length() : sizeof(_connectionName) - 1; none.length() : sizeof(_connectionName) - 1;
std::memcpy(_connectionName, none.c_str(), len); std::memcpy(_connectionName, none.c_str(), len);
} }
else if (0 == _connectionName[0]) else if (0 == _connectionName[0])
{ {
std::size_t len = sizeof(_connectionName) > na.length() ? std::size_t len = sizeof(_connectionName) > na.length() ?
na.length() : sizeof(_connectionName) - 1; na.length() : sizeof(_connectionName) - 1;
std::memcpy(_connectionName, na.c_str(), len); std::memcpy(_connectionName, na.c_str(), len);
} }
if (Utility::isError(SQLGetDiagField(handleType, if (Utility::isError(SQLGetDiagField(handleType,
handle, handle,
count, count,
SQL_DIAG_SERVER_NAME, SQL_DIAG_SERVER_NAME,
_serverName, _serverName,
sizeof(_serverName), sizeof(_serverName),
&messageLength))) &messageLength)))
{ {
std::size_t len = sizeof(_serverName) > none.length() ? std::size_t len = sizeof(_serverName) > none.length() ?
none.length() : sizeof(_serverName) - 1; none.length() : sizeof(_serverName) - 1;
std::memcpy(_serverName, none.c_str(), len); std::memcpy(_serverName, none.c_str(), len);
} }
else if (0 == _serverName[0]) else if (0 == _serverName[0])
{ {
std::size_t len = sizeof(_serverName) > na.length() ? std::size_t len = sizeof(_serverName) > na.length() ?
na.length() : sizeof(_serverName) - 1; na.length() : sizeof(_serverName) - 1;
std::memcpy(_serverName, na.c_str(), len); std::memcpy(_serverName, na.c_str(), len);
} }

View File

@ -66,11 +66,11 @@ public:
std::string& toString(int index, std::string& str) const std::string& toString(int index, std::string& str) const
/// Generates the string for the diagnostic record. /// Generates the string for the diagnostic record.
{ {
if ((index < 0) || (index > (count() - 1))) if ((index < 0) || (index > (count() - 1)))
return str; return str;
std::string s; std::string s;
Poco::format(s, Poco::format(s,
"===========================\n" "===========================\n"
"ODBC Diagnostic record #%d:\n" "ODBC Diagnostic record #%d:\n"
"===========================\n" "===========================\n"
@ -90,7 +90,7 @@ public:
{ {
std::string str; std::string str;
Poco::format(str, Poco::format(str,
"Connection:%s\nServer:%s\n", "Connection:%s\nServer:%s\n",
_diagnostics.connectionName(), _diagnostics.connectionName(),
_diagnostics.serverName()); _diagnostics.serverName());

View File

@ -52,7 +52,7 @@ class ODBC_API Extractor: public Poco::Data::AbstractExtractor
public: public:
typedef Preparator::Ptr PreparatorPtr; typedef Preparator::Ptr PreparatorPtr;
Extractor(const StatementHandle& rStmt, Extractor(const StatementHandle& rStmt,
Preparator::Ptr pPreparator); Preparator::Ptr pPreparator);
/// Creates the Extractor. /// Creates the Extractor.
@ -339,7 +339,7 @@ public:
/// Returns true if the value at [col,row] is null. /// Returns true if the value at [col,row] is null.
void reset(); void reset();
/// Resets the internally cached length indicators. /// Resets the internally cached length indicators.
private: private:
static const int CHUNK_SIZE = 1024; static const int CHUNK_SIZE = 1024;
@ -365,7 +365,7 @@ private:
{ {
if (isNull(pos)) return false; if (isNull(pos)) return false;
poco_assert_dbg (typeid(T) == _pPreparator->at(pos).type()); poco_assert_dbg (typeid(T) == _pPreparator->at(pos).type());
val = *AnyCast<T>(&_pPreparator->at(pos)); val = *AnyCast<T>(&_pPreparator->at(pos));
return true; return true;
} }
@ -384,7 +384,7 @@ private:
bool extractBoundImplContainer(std::size_t pos, std::vector<std::string>& values); bool extractBoundImplContainer(std::size_t pos, std::vector<std::string>& values);
bool extractBoundImplContainer(std::size_t pos, std::deque<std::string>& values); bool extractBoundImplContainer(std::size_t pos, std::deque<std::string>& values);
bool extractBoundImplContainer(std::size_t pos, std::list<std::string>& values); bool extractBoundImplContainer(std::size_t pos, std::list<std::string>& values);
bool extractBoundImplContainer(std::size_t pos, std::vector<Poco::UTF16String>& values); bool extractBoundImplContainer(std::size_t pos, std::vector<Poco::UTF16String>& values);
bool extractBoundImplContainer(std::size_t pos, std::deque<Poco::UTF16String>& values); bool extractBoundImplContainer(std::size_t pos, std::deque<Poco::UTF16String>& values);
bool extractBoundImplContainer(std::size_t pos, std::list<Poco::UTF16String>& values); bool extractBoundImplContainer(std::size_t pos, std::list<Poco::UTF16String>& values);
@ -466,8 +466,8 @@ private:
resizeLengths(pos); resizeLengths(pos);
rc = SQLGetData(_rStmt, rc = SQLGetData(_rStmt,
(SQLUSMALLINT) pos + 1, (SQLUSMALLINT) pos + 1,
cType, //C data type cType, //C data type
&value, //returned value &value, //returned value
0, //buffer length (ignored) 0, //buffer length (ignored)
@ -476,9 +476,9 @@ private:
if (Utility::isError(rc)) if (Utility::isError(rc))
throw StatementException(_rStmt, "SQLGetData()"); throw StatementException(_rStmt, "SQLGetData()");
if (isNullLengthIndicator(_lengths[pos])) if (isNullLengthIndicator(_lengths[pos]))
return false; return false;
else else
{ {
//for fixed-length data, buffer must be large enough //for fixed-length data, buffer must be large enough
//otherwise, driver may write past the end //otherwise, driver may write past the end
@ -570,7 +570,7 @@ private:
case MetaColumn::FDT_TIMESTAMP: case MetaColumn::FDT_TIMESTAMP:
{ return extAny<T, Poco::DateTime>(pos, val); } { return extAny<T, Poco::DateTime>(pos, val); }
default: default:
throw DataFormatException("Unsupported data type."); throw DataFormatException("Unsupported data type.");
} }
@ -578,8 +578,8 @@ private:
} }
bool isNullLengthIndicator(SQLLEN val) const; bool isNullLengthIndicator(SQLLEN val) const;
/// The reason for this utility wrapper are platforms where /// The reason for this utility wrapper are platforms where
/// SQLLEN macro (a.k.a. SQLINTEGER) yields 64-bit value, /// SQLLEN macro (a.k.a. SQLINTEGER) yields 64-bit value,
/// while SQL_NULL_DATA (#define'd as -1 literal) remains 32-bit. /// while SQL_NULL_DATA (#define'd as -1 literal) remains 32-bit.
SQLINTEGER columnSize(std::size_t pos) const; SQLINTEGER columnSize(std::size_t pos) const;
@ -643,42 +643,42 @@ inline bool Extractor::extractBoundImplContainer(std::size_t pos, std::list<Poco
} }
inline bool Extractor::extractBoundImplContainer(std::size_t pos, inline bool Extractor::extractBoundImplContainer(std::size_t pos,
std::vector<Poco::Data::CLOB>& values) std::vector<Poco::Data::CLOB>& values)
{ {
return extractBoundImplContainerLOB(pos, values); return extractBoundImplContainerLOB(pos, values);
} }
inline bool Extractor::extractBoundImplContainer(std::size_t pos, inline bool Extractor::extractBoundImplContainer(std::size_t pos,
std::deque<Poco::Data::CLOB>& values) std::deque<Poco::Data::CLOB>& values)
{ {
return extractBoundImplContainerLOB(pos, values); return extractBoundImplContainerLOB(pos, values);
} }
inline bool Extractor::extractBoundImplContainer(std::size_t pos, inline bool Extractor::extractBoundImplContainer(std::size_t pos,
std::list<Poco::Data::CLOB>& values) std::list<Poco::Data::CLOB>& values)
{ {
return extractBoundImplContainerLOB(pos, values); return extractBoundImplContainerLOB(pos, values);
} }
inline bool Extractor::extractBoundImplContainer(std::size_t pos, inline bool Extractor::extractBoundImplContainer(std::size_t pos,
std::vector<Poco::Data::BLOB>& values) std::vector<Poco::Data::BLOB>& values)
{ {
return extractBoundImplContainerLOB(pos, values); return extractBoundImplContainerLOB(pos, values);
} }
inline bool Extractor::extractBoundImplContainer(std::size_t pos, inline bool Extractor::extractBoundImplContainer(std::size_t pos,
std::deque<Poco::Data::BLOB>& values) std::deque<Poco::Data::BLOB>& values)
{ {
return extractBoundImplContainerLOB(pos, values); return extractBoundImplContainerLOB(pos, values);
} }
inline bool Extractor::extractBoundImplContainer(std::size_t pos, inline bool Extractor::extractBoundImplContainer(std::size_t pos,
std::list<Poco::Data::BLOB>& values) std::list<Poco::Data::BLOB>& values)
{ {
return extractBoundImplContainerLOB(pos, values); return extractBoundImplContainerLOB(pos, values);
@ -705,7 +705,7 @@ inline void Extractor::reset()
inline void Extractor::resizeLengths(std::size_t pos) inline void Extractor::resizeLengths(std::size_t pos)
{ {
if (pos >= _lengths.size()) if (pos >= _lengths.size())
_lengths.resize(pos + 1, (SQLLEN) 0); _lengths.resize(pos + 1, (SQLLEN) 0);
} }

View File

@ -39,14 +39,14 @@ class Handle
/// ODBC handle class template /// ODBC handle class template
{ {
public: public:
Handle(const ConnectionHandle& rConnection): Handle(const ConnectionHandle& rConnection):
_rConnection(rConnection), _rConnection(rConnection),
_handle(0) _handle(0)
/// Creates the Handle. /// Creates the Handle.
{ {
if (Utility::isError(SQLAllocHandle(handleType, if (Utility::isError(SQLAllocHandle(handleType,
_rConnection, _rConnection,
&_handle))) &_handle)))
{ {
throw ODBCException("Could not allocate statement handle."); throw ODBCException("Could not allocate statement handle.");
} }
@ -58,7 +58,7 @@ public:
try try
{ {
#if defined(_DEBUG) #if defined(_DEBUG)
SQLRETURN rc = SQLRETURN rc =
#endif #endif
SQLFreeHandle(handleType, _handle); SQLFreeHandle(handleType, _handle);
// N.B. Destructors should not throw, but neither do we want to // N.B. Destructors should not throw, but neither do we want to

View File

@ -41,7 +41,7 @@ template <class H, SQLSMALLINT handleType>
class HandleException: public ODBCException class HandleException: public ODBCException
{ {
public: public:
HandleException(const H& handle, int code = 0) : HandleException(const H& handle, int code = 0) :
ODBCException(code), ODBCException(code),
_error(handle) _error(handle)
/// Creates HandleException /// Creates HandleException
@ -49,29 +49,29 @@ public:
message(_error.toString()); message(_error.toString());
} }
HandleException(const H& handle, const std::string& msg): HandleException(const H& handle, const std::string& msg):
ODBCException(msg), ODBCException(msg),
_error(handle) _error(handle)
/// Creates HandleException /// Creates HandleException
{ {
extendedMessage(_error.toString()); extendedMessage(_error.toString());
} }
HandleException(const H& handle, const std::string& msg, const std::string& arg): HandleException(const H& handle, const std::string& msg, const std::string& arg):
ODBCException(msg, arg), ODBCException(msg, arg),
_error(handle) _error(handle)
/// Creates HandleException /// Creates HandleException
{ {
} }
HandleException(const H& handle, const std::string& msg, const Poco::Exception& exc): HandleException(const H& handle, const std::string& msg, const Poco::Exception& exc):
ODBCException(msg, exc), ODBCException(msg, exc),
_error(handle) _error(handle)
/// Creates HandleException /// Creates HandleException
{ {
} }
HandleException(const HandleException& exc): HandleException(const HandleException& exc):
ODBCException(exc), ODBCException(exc),
_error(exc._error) _error(exc._error)
/// Creates HandleException /// Creates HandleException

View File

@ -45,10 +45,10 @@ public:
/// Destroys the ODBCMetaColumn. /// Destroys the ODBCMetaColumn.
std::size_t dataLength() const; std::size_t dataLength() const;
/// A numeric value that is either the maximum or actual character length of a character /// A numeric value that is either the maximum or actual character length of a character
/// string or binary data type. It is the maximum character length for a fixed-length data type, /// string or binary data type. It is the maximum character length for a fixed-length data type,
/// or the actual character length for a variable-length data type. Its value always excludes the /// or the actual character length for a variable-length data type. Its value always excludes the
/// null-termination byte that ends the character string. /// null-termination byte that ends the character string.
/// This information is returned from the SQL_DESC_LENGTH record field of the IRD. /// This information is returned from the SQL_DESC_LENGTH record field of the IRD.
private: private:

View File

@ -76,7 +76,7 @@ protected:
/// Returns true if another compile is possible. /// Returns true if another compile is possible.
void compileImpl(); void compileImpl();
/// Compiles the statement, doesn't bind yet. /// Compiles the statement, doesn't bind yet.
/// Does nothing if the statement has already been compiled. /// Does nothing if the statement has already been compiled.
void bindImpl(); void bindImpl();
@ -123,8 +123,8 @@ private:
void doPrepare(); void doPrepare();
/// Prepares placeholders for data returned by statement. /// Prepares placeholders for data returned by statement.
/// It is called during statement compilation for SQL statements /// It is called during statement compilation for SQL statements
/// returning data. For stored procedures returning datasets, /// returning data. For stored procedures returning datasets,
/// it is called upon the first check for data availability /// it is called upon the first check for data availability
/// (see hasNext() function). /// (see hasNext() function).
bool hasData() const; bool hasData() const;
@ -137,8 +137,8 @@ private:
/// Returns true if there is a row fetched but not yet extracted. /// Returns true if there is a row fetched but not yet extracted.
void putData(); void putData();
/// Called whenever SQLExecute returns SQL_NEED_DATA. This is expected /// Called whenever SQLExecute returns SQL_NEED_DATA. This is expected
/// behavior for PB_AT_EXEC binding mode. /// behavior for PB_AT_EXEC binding mode.
void getData(); void getData();

View File

@ -47,11 +47,11 @@ public:
/// Returns the SQL data type. /// Returns the SQL data type.
std::size_t columnSize() const; std::size_t columnSize() const;
/// Returns the the size of the column or expression of the corresponding /// Returns the the size of the column or expression of the corresponding
/// parameter marker as defined by the data source. /// parameter marker as defined by the data source.
std::size_t decimalDigits() const; std::size_t decimalDigits() const;
/// Returns the number of decimal digits of the column or expression /// Returns the number of decimal digits of the column or expression
/// of the corresponding parameter as defined by the data source. /// of the corresponding parameter as defined by the data source.
bool isNullable() const; bool isNullable() const;

View File

@ -49,13 +49,13 @@ namespace ODBC {
class ODBC_API Preparator : public AbstractPreparator class ODBC_API Preparator : public AbstractPreparator
/// Class used for database preparation where we first have to register all data types /// Class used for database preparation where we first have to register all data types
/// with respective memory output locations before extracting data. /// with respective memory output locations before extracting data.
/// Extraction works in two-phases: first prepare is called once, then extract n-times. /// Extraction works in two-phases: first prepare is called once, then extract n-times.
/// In ODBC, SQLBindCol/SQLFetch is the preferred method of data retrieval (SQLGetData is available, /// In ODBC, SQLBindCol/SQLFetch is the preferred method of data retrieval (SQLGetData is available,
/// however with numerous driver implementation dependent limitations and inferior performance). /// however with numerous driver implementation dependent limitations and inferior performance).
/// In order to fit this functionality into Poco DataConnectors framework, every ODBC SQL statement /// In order to fit this functionality into Poco DataConnectors framework, every ODBC SQL statement
/// instantiates its own Preparator object. /// instantiates its own Preparator object.
/// This is done once per statement execution (from StatementImpl::bindImpl()). /// This is done once per statement execution (from StatementImpl::bindImpl()).
/// ///
/// Preparator object is used to : /// Preparator object is used to :
@ -69,7 +69,7 @@ class ODBC_API Preparator : public AbstractPreparator
/// - Value datatypes in this interface prepare() calls serve only for the purpose of type distinction. /// - Value datatypes in this interface prepare() calls serve only for the purpose of type distinction.
/// - Preparator keeps its own std::vector<Any> buffer for fetched data to be later retrieved by Extractor. /// - Preparator keeps its own std::vector<Any> buffer for fetched data to be later retrieved by Extractor.
/// - prepare() methods should not be called when extraction mode is DE_MANUAL /// - prepare() methods should not be called when extraction mode is DE_MANUAL
/// ///
{ {
public: public:
typedef std::vector<char*> CharArray; typedef std::vector<char*> CharArray;
@ -96,8 +96,8 @@ public:
DT_DATETIME DT_DATETIME
}; };
Preparator(const StatementHandle& rStmt, Preparator(const StatementHandle& rStmt,
const std::string& statement, const std::string& statement,
std::size_t maxFieldSize, std::size_t maxFieldSize,
DataExtraction dataExtraction, DataExtraction dataExtraction,
bool isPostgres bool isPostgres
@ -397,12 +397,12 @@ public:
std::size_t maxDataSize(std::size_t pos) const; std::size_t maxDataSize(std::size_t pos) const;
/// Returns max supported size for column at position pos. /// Returns max supported size for column at position pos.
/// Returned length for variable length fields is the one /// Returned length for variable length fields is the one
/// supported by this implementation, not the underlying DB. /// supported by this implementation, not the underlying DB.
std::size_t actualDataSize(std::size_t col, std::size_t row = POCO_DATA_INVALID_ROW) const; std::size_t actualDataSize(std::size_t col, std::size_t row = POCO_DATA_INVALID_ROW) const;
/// Returns the returned length for the column and row specified. /// Returns the returned length for the column and row specified.
/// This is usually equal to the column size, except for /// This is usually equal to the column size, except for
/// variable length fields (BLOB and variable length strings). /// variable length fields (BLOB and variable length strings).
/// For null values, the return value is -1 (SQL_NO_DATA) /// For null values, the return value is -1 (SQL_NO_DATA)
@ -437,7 +437,7 @@ private:
if (pVal) if (pVal)
return prepareFixedSize<Poco::Int8>(pos, SQL_C_STINYINT, pVal->size()); return prepareFixedSize<Poco::Int8>(pos, SQL_C_STINYINT, pVal->size());
else else
return prepareFixedSize<Poco::Int8>(pos, SQL_C_STINYINT); return prepareFixedSize<Poco::Int8>(pos, SQL_C_STINYINT);
case MetaColumn::FDT_UINT8: case MetaColumn::FDT_UINT8:
if (pVal) if (pVal)
@ -550,7 +550,7 @@ private:
else else
return prepareFixedSize<DateTime>(pos, SQL_C_TYPE_TIMESTAMP); return prepareFixedSize<DateTime>(pos, SQL_C_TYPE_TIMESTAMP);
default: default:
throw DataFormatException("Unsupported data type."); throw DataFormatException("Unsupported data type.");
} }
} }
@ -569,11 +569,11 @@ private:
_values[pos] = Poco::Any(T()); _values[pos] = Poco::Any(T());
T* pVal = AnyCast<T>(&_values[pos]); T* pVal = AnyCast<T>(&_values[pos]);
if (Utility::isError(SQLBindCol(_rStmt, if (Utility::isError(SQLBindCol(_rStmt,
(SQLUSMALLINT) pos + 1, (SQLUSMALLINT) pos + 1,
valueType, valueType,
(SQLPOINTER) pVal, (SQLPOINTER) pVal,
(SQLINTEGER) dataSize, (SQLINTEGER) dataSize,
&_lengths[pos]))) &_lengths[pos])))
{ {
throw StatementException(_rStmt, "SQLBindCol()"); throw StatementException(_rStmt, "SQLBindCol()");
@ -598,11 +598,11 @@ private:
std::vector<T>& cache = RefAnyCast<std::vector<T> >(_values[pos]); std::vector<T>& cache = RefAnyCast<std::vector<T> >(_values[pos]);
cache.resize(length); cache.resize(length);
if (Utility::isError(SQLBindCol(_rStmt, if (Utility::isError(SQLBindCol(_rStmt,
(SQLUSMALLINT) pos + 1, (SQLUSMALLINT) pos + 1,
valueType, valueType,
(SQLPOINTER) &cache[0], (SQLPOINTER) &cache[0],
(SQLINTEGER) dataSize, (SQLINTEGER) dataSize,
&_lenLengths[pos][0]))) &_lenLengths[pos][0])))
{ {
throw StatementException(_rStmt, "SQLBindCol()"); throw StatementException(_rStmt, "SQLBindCol()");
@ -616,18 +616,18 @@ private:
poco_assert (DE_BOUND == _dataExtraction); poco_assert (DE_BOUND == _dataExtraction);
poco_assert (pos < _values.size()); poco_assert (pos < _values.size());
T* pCache = new T[size]; T* pCache = new T[size];
std::memset(pCache, 0, size); std::memset(pCache, 0, size);
_values[pos] = Any(pCache); _values[pos] = Any(pCache);
_lengths[pos] = (SQLLEN) size; _lengths[pos] = (SQLLEN) size;
_varLengthArrays.insert(IndexMap::value_type(pos, dt)); _varLengthArrays.insert(IndexMap::value_type(pos, dt));
if (Utility::isError(SQLBindCol(_rStmt, if (Utility::isError(SQLBindCol(_rStmt,
(SQLUSMALLINT) pos + 1, (SQLUSMALLINT) pos + 1,
valueType, valueType,
(SQLPOINTER) pCache, (SQLPOINTER) pCache,
(SQLINTEGER) size*sizeof(T), (SQLINTEGER) size*sizeof(T),
&_lengths[pos]))) &_lengths[pos])))
{ {
throw StatementException(_rStmt, "SQLBindCol()"); throw StatementException(_rStmt, "SQLBindCol()");
@ -650,11 +650,11 @@ private:
_lenLengths[pos].resize(length); _lenLengths[pos].resize(length);
_varLengthArrays.insert(IndexMap::value_type(pos, DT)); _varLengthArrays.insert(IndexMap::value_type(pos, DT));
if (Utility::isError(SQLBindCol(_rStmt, if (Utility::isError(SQLBindCol(_rStmt,
(SQLUSMALLINT) pos + 1, (SQLUSMALLINT) pos + 1,
valueType, valueType,
(SQLPOINTER) pArray, (SQLPOINTER) pArray,
(SQLINTEGER) size, (SQLINTEGER) size,
&_lenLengths[pos][0]))) &_lenLengths[pos][0])))
{ {
throw StatementException(_rStmt, "SQLBindCol()"); throw StatementException(_rStmt, "SQLBindCol()");

View File

@ -53,15 +53,15 @@ public:
SessionImpl(const std::string& connect, SessionImpl(const std::string& connect,
std::size_t loginTimeout, std::size_t loginTimeout,
std::size_t maxFieldSize = ODBC_MAX_FIELD_SIZE, std::size_t maxFieldSize = ODBC_MAX_FIELD_SIZE,
bool autoBind = true, bool autoBind = true,
bool autoExtract = true); bool autoExtract = true);
/// Creates the SessionImpl. Opens a connection to the database. /// Creates the SessionImpl. Opens a connection to the database.
/// Throws NotConnectedException if connection was not successful. /// Throws NotConnectedException if connection was not successful.
//@ deprecated //@ deprecated
SessionImpl(const std::string& connect, SessionImpl(const std::string& connect,
Poco::Any maxFieldSize = ODBC_MAX_FIELD_SIZE, Poco::Any maxFieldSize = ODBC_MAX_FIELD_SIZE,
bool enforceCapability=false, bool enforceCapability=false,
bool autoBind = true, bool autoBind = true,
bool autoExtract = true); bool autoExtract = true);

View File

@ -124,8 +124,8 @@ private:
void fillCTypes(); void fillCTypes();
void fillSQLTypes(); void fillSQLTypes();
DataTypeMap _cDataTypes; DataTypeMap _cDataTypes;
DataTypeMap _sqlDataTypes; DataTypeMap _sqlDataTypes;
TypeInfoVec _typeInfo; TypeInfoVec _typeInfo;
CppTypeInfoMap _cppDataTypes; CppTypeInfoMap _cppDataTypes;
SQLHDBC* _pHDBC; SQLHDBC* _pHDBC;

View File

@ -27,7 +27,7 @@ inline void makeUTF16(SQLCHAR* pSQLChar, SQLINTEGER length, std::wstring& target
/// Utility function for conversion from UTF-8 to UTF-16 /// Utility function for conversion from UTF-8 to UTF-16
{ {
int len = length; int len = length;
if (SQL_NTS == len) if (SQL_NTS == len)
len = (int) std::strlen((const char *) pSQLChar); len = (int) std::strlen((const char *) pSQLChar);
UnicodeConverter::toUTF16((const char *) pSQLChar, len, target); UnicodeConverter::toUTF16((const char *) pSQLChar, len, target);

Some files were not shown because too many files have changed in this diff Show More