mirror of
https://github.com/pocoproject/poco.git
synced 2025-03-23 23:49:26 +01:00
purge trailing whitespace (#1947)
This commit is contained in:
parent
1101439eb0
commit
151304135e
12
.gitattributes
vendored
12
.gitattributes
vendored
@ -1,17 +1,17 @@
|
||||
# Set default behaviour, in case users don't have core.autocrlf set.
|
||||
* 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.
|
||||
*.txt text
|
||||
*.cpp text
|
||||
*.c text
|
||||
*.h text
|
||||
*.cmd text
|
||||
*.sln text
|
||||
*.vcproj text
|
||||
*.vcxproj text
|
||||
*.vcxproj.filters text
|
||||
*.cmd text
|
||||
*.sln text
|
||||
*.vcproj text
|
||||
*.vcxproj text
|
||||
*.vcxproj.filters text
|
||||
*.page text
|
||||
*.html text
|
||||
*.xhtml text
|
||||
|
38
.travis.yml
38
.travis.yml
@ -11,7 +11,7 @@ branches:
|
||||
before_install:
|
||||
- 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 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 add-apt-repository -y ppa:ubuntu-toolchain-r/test; fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get update -qq; fi
|
||||
@ -30,7 +30,7 @@ services:
|
||||
|
||||
dist: trusty
|
||||
sudo: enabled
|
||||
|
||||
|
||||
addons:
|
||||
postgresql: "9.4"
|
||||
|
||||
@ -39,16 +39,16 @@ notifications:
|
||||
email:
|
||||
on_success: never # default: change
|
||||
on_failure: always # default: always
|
||||
slack:
|
||||
slack:
|
||||
rooms:
|
||||
- pocoproject:ItIUZvs8aJGyPdaKxIKMnS1t#travis
|
||||
on_success: never # default: change
|
||||
on_failure: always # default: always
|
||||
|
||||
|
||||
env:
|
||||
global:
|
||||
global:
|
||||
TEST_NAME=""
|
||||
|
||||
|
||||
before_script:
|
||||
- echo ${TEST_NAME}
|
||||
- chmod 755 ./travis/Linux/runtests.sh
|
||||
@ -70,7 +70,7 @@ matrix:
|
||||
- export CXX="g++-4.9"
|
||||
- $CXX --version
|
||||
- ./configure --everything && make -s -j2 && ./travis/Linux/runtests.sh
|
||||
|
||||
|
||||
- env: TEST_NAME="gcc 5.4 (make) bundled"
|
||||
compiler: gcc
|
||||
script:
|
||||
@ -78,15 +78,15 @@ matrix:
|
||||
- export CXX="g++-5"
|
||||
- $CXX --version
|
||||
- ./configure --everything && make -s -j2 && ./travis/Linux/runtests.sh
|
||||
|
||||
|
||||
#- env: TEST_NAME="gcc 5.4 (make) unbundled"
|
||||
# ======================================= unit tests fail ures due to unbundled pcre
|
||||
# There was 1 error:
|
||||
# There was 1 error:
|
||||
# 1: N7CppUnit10TestCallerI21RegularExpressionTestEE.testSubst2
|
||||
# "St9bad_alloc: std::bad_alloc"
|
||||
# in "<unknown>", line -1
|
||||
#
|
||||
# There were 4 failures:
|
||||
#
|
||||
# There were 4 failures:
|
||||
# 1: N7CppUnit10TestCallerI21RegularExpressionTestEE.testMatch4
|
||||
# "re.match("123 456", 0, matches) == 3"
|
||||
# in "src/RegularExpressionTest.cpp", line 103
|
||||
@ -99,7 +99,7 @@ matrix:
|
||||
# 4: N7CppUnit10TestCallerI21RegularExpressionTestEE.testGroup
|
||||
# "re.match("abcd 1234", 0, matches) == 3"
|
||||
# in "src/RegularExpressionTest.cpp", line 271
|
||||
#
|
||||
#
|
||||
# failed=Foundation
|
||||
# =======================================
|
||||
# compiler: gcc
|
||||
@ -109,7 +109,7 @@ matrix:
|
||||
# - export CXX="g++-5"
|
||||
# - $CXX --version
|
||||
# - ./configure --everything --unbundled && make -s -j2 && ./travis/Linux/runtests.sh
|
||||
|
||||
|
||||
- env: TEST_NAME="gcc 4.9 (CMake)"
|
||||
compiler: gcc
|
||||
script:
|
||||
@ -120,7 +120,7 @@ matrix:
|
||||
- source ./travis/ignored.sh
|
||||
- export POCO_BASE=`pwd`
|
||||
- mkdir cmake-build && cd cmake-build && cmake -DENABLE_TESTS=ON .. && make -s -j2 && ctest -VV -E Data && cd ..
|
||||
|
||||
|
||||
|
||||
- env: TEST_NAME="clang (make) bundled"
|
||||
os: osx
|
||||
@ -141,7 +141,7 @@ matrix:
|
||||
- export CXX="clang++-4.0"
|
||||
- $CXX --version
|
||||
- ./configure --config=Linux-clang --everything && make -s -j2 && ./travis/Linux/runtests.sh
|
||||
|
||||
|
||||
- env: TEST_NAME="clang 5.0 (make) bundled"
|
||||
compiler: clang
|
||||
script:
|
||||
@ -151,20 +151,20 @@ matrix:
|
||||
- export CXX="clang++-5.0"
|
||||
- $CXX --version
|
||||
- ./configure --config=Linux-clang --everything && make -s -j2 && ./travis/Linux/runtests.sh
|
||||
|
||||
|
||||
#- env: TEST_NAME="clang 3.5.0 (make) unbundled"
|
||||
# ======================================= 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
|
||||
# ** 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
|
||||
# =======================================
|
||||
# =======================================
|
||||
# script:
|
||||
# - export CC="clang"
|
||||
# - export CXX="clang++"
|
||||
# - $CXX --version
|
||||
# - ./configure --config=Linux-clang --everything --unbundled && make -s -j2 && ./travis/Linux/runtests.sh
|
||||
|
||||
|
||||
#- env: TEST_NAME="arm-linux-gnueabi-g++ (make)"
|
||||
# compiler: gcc
|
||||
# script:
|
||||
@ -190,7 +190,7 @@ matrix:
|
||||
# - $CXX --version
|
||||
# - source ./travis/ignored.sh
|
||||
# - 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 ..
|
||||
|
||||
- env: TEST_NAME="arm-linux-gnueabihf-g++ (CMake)"
|
||||
|
@ -8,7 +8,7 @@ vc.project.platforms = Win32, x64
|
||||
vc.project.configurations = debug_shared, release_shared
|
||||
vc.project.prototype = ApacheConnector_vs90.vcproj
|
||||
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.debug_shared = ${vc.project.compiler.defines.shared}
|
||||
vc.project.compiler.defines.release_shared = ${vc.project.compiler.defines.shared}
|
||||
|
@ -16,7 +16,7 @@ file (usually <[httpd.conf]>):
|
||||
|
||||
LoadModule poco_module modules/mod_pocod.so
|
||||
----
|
||||
|
||||
|
||||
!!!Configuring ApacheConnector
|
||||
ApacheConnector must be able to find shared libraries containing request handler, as well
|
||||
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>...
|
||||
----
|
||||
|
||||
|
||||
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.
|
||||
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
|
||||
----
|
||||
|
||||
|
||||
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.
|
||||
|
||||
@ -76,8 +76,8 @@ Following is a sample for a request handler implementation. The complete sample
|
||||
#include "Poco/DateTimeFormatter.h"
|
||||
#include "Poco/DateTimeFormat.h"
|
||||
#include "Poco/ClassLibrary.h"
|
||||
|
||||
|
||||
|
||||
|
||||
using Poco::Net::HTTPRequestHandler;
|
||||
using Poco::Net::HTTPRequestHandlerFactory;
|
||||
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::DateTimeFormatter;
|
||||
using Poco::DateTimeFormat;
|
||||
|
||||
|
||||
|
||||
|
||||
class TimeRequestHandler: public HTTPRequestHandler
|
||||
/// Return a HTML document with the current date and time.
|
||||
{
|
||||
public:
|
||||
TimeRequestHandler()
|
||||
TimeRequestHandler()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response)
|
||||
{
|
||||
Timestamp now;
|
||||
std::string dt(DateTimeFormatter::format(now, DateTimeFormat::SORTABLE_FORMAT));
|
||||
|
||||
|
||||
response.setChunkedTransferEncoding(true);
|
||||
response.setContentType("text/html");
|
||||
|
||||
|
||||
std::ostream& ostr = response.send();
|
||||
ostr << "<html><head><title>TimeServer powered by POCO ApacheConnector</title>";
|
||||
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>";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class TimeRequestHandlerFactory: public HTTPRequestHandlerFactory
|
||||
{
|
||||
public:
|
||||
TimeRequestHandlerFactory()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
HTTPRequestHandler* createRequestHandler(const HTTPServerRequest& request)
|
||||
{
|
||||
return new TimeRequestHandler;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
POCO_BEGIN_MANIFEST(HTTPRequestHandlerFactory)
|
||||
POCO_EXPORT_CLASS(TimeRequestHandlerFactory)
|
||||
POCO_END_MANIFEST
|
||||
|
@ -25,10 +25,10 @@ class ApacheServerRequest: public Poco::Net::HTTPServerRequest
|
||||
{
|
||||
public:
|
||||
ApacheServerRequest(
|
||||
ApacheRequestRec* pApacheRequest,
|
||||
const char* serverName,
|
||||
int serverPort,
|
||||
const char* clientName,
|
||||
ApacheRequestRec* pApacheRequest,
|
||||
const char* serverName,
|
||||
int serverPort,
|
||||
const char* clientName,
|
||||
int clientPort);
|
||||
/// Creates a new ApacheServerRequest.
|
||||
|
||||
|
@ -55,14 +55,14 @@ public:
|
||||
/// The returned stream is valid until the response
|
||||
/// object is destroyed.
|
||||
///
|
||||
/// Must not be called after sendFile(), sendBuffer()
|
||||
/// Must not be called after sendFile(), sendBuffer()
|
||||
/// or redirect() has been called.
|
||||
|
||||
void sendFile(const std::string& path, const std::string& mediaType);
|
||||
/// Sends the response header to the client, followed
|
||||
/// 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.
|
||||
///
|
||||
/// Throws a FileNotFoundException if the file
|
||||
@ -77,10 +77,10 @@ public:
|
||||
/// to length and chunked transfer encoding is disabled.
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
/// Must not be called after send(), sendFile()
|
||||
/// Must not be called after send(), sendFile()
|
||||
/// or redirect() has been called.
|
||||
|
||||
void redirect(const std::string& uri, Poco::Net::HTTPResponse::HTTPStatus status);
|
||||
|
@ -33,7 +33,7 @@ protected:
|
||||
int writeToDevice(const char* buffer, std::streamsize length);
|
||||
|
||||
private:
|
||||
enum
|
||||
enum
|
||||
{
|
||||
STREAM_BUFFER_SIZE = 1024
|
||||
};
|
||||
|
@ -91,7 +91,7 @@ class FormRequestHandler: public HTTPRequestHandler
|
||||
/// Return a HTML document with the current date and time.
|
||||
{
|
||||
public:
|
||||
FormRequestHandler()
|
||||
FormRequestHandler()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ class TimeRequestHandler: public HTTPRequestHandler
|
||||
/// Return a HTML document with the current date and time.
|
||||
{
|
||||
public:
|
||||
TimeRequestHandler()
|
||||
TimeRequestHandler()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ extern "C" int ApacheConnector_handler(request_rec *r)
|
||||
return DECLINED;
|
||||
|
||||
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;
|
||||
|
||||
// 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(
|
||||
"AddPocoRequestHandler",
|
||||
reinterpret_cast<cmd_func>(ApacheConnector_uris),
|
||||
"AddPocoRequestHandler",
|
||||
reinterpret_cast<cmd_func>(ApacheConnector_uris),
|
||||
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."),
|
||||
AP_INIT_RAW_ARGS(
|
||||
"AddPocoConfig",
|
||||
reinterpret_cast<cmd_func>(ApacheConnector_config),
|
||||
"AddPocoConfig",
|
||||
reinterpret_cast<cmd_func>(ApacheConnector_config),
|
||||
NULL,
|
||||
RSRC_CONF,
|
||||
RSRC_CONF,
|
||||
"Path of the POCO configuration file."),
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
module AP_MODULE_DECLARE_DATA poco_module =
|
||||
module AP_MODULE_DECLARE_DATA poco_module =
|
||||
{
|
||||
STANDARD20_MODULE_STUFF,
|
||||
NULL,
|
||||
|
@ -16,10 +16,10 @@
|
||||
|
||||
|
||||
ApacheServerRequest::ApacheServerRequest(
|
||||
ApacheRequestRec* pApacheRequest,
|
||||
const char* serverName,
|
||||
int serverPort,
|
||||
const char* clientName,
|
||||
ApacheRequestRec* pApacheRequest,
|
||||
const char* serverName,
|
||||
int serverPort,
|
||||
const char* clientName,
|
||||
int clientPort):
|
||||
_pApacheRequest(pApacheRequest),
|
||||
_pResponse(0),
|
||||
|
@ -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),
|
||||
_pApacheRequest(pApacheRequest),
|
||||
_haveData(haveData)
|
||||
|
@ -337,7 +337,7 @@ set(CPACK_PACKAGE_INSTALL_DIRECTORY "/usr/local")
|
||||
include(CPack)
|
||||
|
||||
#############################################################
|
||||
# cmake config files
|
||||
# cmake config files
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
write_basic_package_version_file(
|
||||
|
@ -18,7 +18,7 @@ David Shawley
|
||||
Sergey Skorokhodov
|
||||
Tom Tan
|
||||
Sergey N. Yatskevich
|
||||
Marc Chevrier
|
||||
Marc Chevrier
|
||||
Philippe Cuvillier
|
||||
Marian Krivos
|
||||
Franky Braem
|
||||
@ -40,7 +40,7 @@ Pascal Bach
|
||||
Cristian Thiago Moecke
|
||||
Sergei Nikulov
|
||||
Aaron Kaluszka
|
||||
Iyed Bennour
|
||||
Iyed Bennour
|
||||
Scott Davis
|
||||
Kristin Cowalcijk
|
||||
Yuval Kashtan
|
||||
|
@ -74,7 +74,7 @@ public:
|
||||
bool getBool(const std::string& name) const;
|
||||
/// Returns the attribute's value as a boolean.
|
||||
/// The returned value is 'true', iff the stored value is not "false".
|
||||
///
|
||||
///
|
||||
/// Throws a Poco::NotFoundException if the attribute does not exist.
|
||||
|
||||
bool getBool(const std::string& name, bool defaultValue) const;
|
||||
|
@ -34,13 +34,13 @@ class CppParser_API AttributesParser
|
||||
/// structs/classes, functions, types, etc. can be annotated
|
||||
/// 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
|
||||
/// with the syntax:
|
||||
/// //@ <attrDecl>[,<attrDec>...]
|
||||
/// where <attrDecl> is
|
||||
/// <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).
|
||||
/// <value> is a string, integer, identifier, bool literal, or a complex value
|
||||
/// in the form
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
OP_BITAND_ASSIGN, // &=
|
||||
OP_AND, // &&
|
||||
OP_BITOR, // |
|
||||
OP_BITOR_ASSIGN, // |=
|
||||
OP_BITOR_ASSIGN, // |=
|
||||
OP_OR, // ||
|
||||
OP_XOR, // ^
|
||||
OP_XOR_ASSIGN, // ^=
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
public:
|
||||
std::string beginNameSpaceDecl; // contains either $(NS)_BEGIN or the namespace x { decl
|
||||
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);
|
||||
|
@ -96,7 +96,7 @@ OperatorToken::OperatorToken()
|
||||
_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') ||
|
||||
(next >= 'a' && next <= 'z') ||
|
||||
(next >= '0' && next <= '9') ||
|
||||
(next == '_' || next == '$'))
|
||||
(next == '_' || next == '$'))
|
||||
{
|
||||
_value += (char) istr.get();
|
||||
next = istr.peek();
|
||||
@ -517,14 +517,14 @@ void NumberLiteralToken::finish(std::istream& istr)
|
||||
{
|
||||
_value += (char) istr.get();
|
||||
next = istr.peek();
|
||||
while (std::isxdigit(next))
|
||||
{
|
||||
_value += (char) istr.get();
|
||||
next = istr.peek();
|
||||
while (std::isxdigit(next))
|
||||
{
|
||||
_value += (char) istr.get();
|
||||
next = istr.peek();
|
||||
}
|
||||
while (next == 'L' || next == 'l' || next == 'U' || next == 'u')
|
||||
{
|
||||
_value += (char) istr.get();
|
||||
_value += (char) istr.get();
|
||||
next = istr.peek();
|
||||
}
|
||||
return;
|
||||
@ -587,13 +587,13 @@ void NumberLiteralToken::finish(std::istream& istr)
|
||||
if (_isFloat)
|
||||
{
|
||||
if (next == 'L' || next == 'l' || next == 'F' || next == 'f')
|
||||
_value += (char) istr.get();
|
||||
_value += (char) istr.get();
|
||||
}
|
||||
else
|
||||
{
|
||||
while (next == 'L' || next == 'l' || next == 'U' || next == 'u')
|
||||
{
|
||||
_value += (char) istr.get();
|
||||
_value += (char) istr.get();
|
||||
next = istr.peek();
|
||||
}
|
||||
}
|
||||
@ -656,7 +656,7 @@ void CommentToken::finish(std::istream& istr)
|
||||
{
|
||||
next = istr.get();
|
||||
_value += (char) next;
|
||||
if (next == '*' && istr.peek() == '/')
|
||||
if (next == '*' && istr.peek() == '/')
|
||||
{
|
||||
_value += (char) istr.get();
|
||||
break;
|
||||
@ -704,7 +704,7 @@ void PreprocessorToken::finish(std::istream& istr)
|
||||
int next = istr.peek();
|
||||
while (next != -1 && next != '\r' && next != '\n')
|
||||
{
|
||||
if (next == '\\')
|
||||
if (next == '\\')
|
||||
{
|
||||
istr.get();
|
||||
int p = istr.peek();
|
||||
|
@ -108,7 +108,7 @@ Symbol* NameSpace::lookup(const std::string& name, std::set<const NameSpace*>& a
|
||||
bool currentNSInserted = true;
|
||||
|
||||
|
||||
if (head.empty())
|
||||
if (head.empty())
|
||||
{
|
||||
alreadyVisited.insert(this);
|
||||
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);
|
||||
pos += 2;
|
||||
poco_assert (pos < name.length());
|
||||
tail.assign(name, pos, name.length() - pos);
|
||||
tail.assign(name, pos, name.length() - pos);
|
||||
}
|
||||
else head = name;
|
||||
}
|
||||
|
@ -628,7 +628,7 @@ const Token* Parser::parseFunc(const Token* pNext, std::string& decl)
|
||||
expectOperator(pNext, OperatorToken::OP_CLOSPARENT, ")");
|
||||
pNext = next();
|
||||
while (pNext->is(Poco::Token::IDENTIFIER_TOKEN) || pNext->is(Poco::Token::KEYWORD_TOKEN))
|
||||
{
|
||||
{
|
||||
if (isKeyword(pNext, IdentifierToken::KW_CONST))
|
||||
{
|
||||
if (pFunc) pFunc->makeConst();
|
||||
@ -636,7 +636,7 @@ const Token* Parser::parseFunc(const Token* pNext, std::string& decl)
|
||||
}
|
||||
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))
|
||||
pNext = next();
|
||||
}
|
||||
|
@ -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.prototype = TestSuite_vs90.vcproj
|
||||
vc.project.compiler.include = ..\\..\\Foundation\\include
|
||||
vc.project.linker.dependencies.Win32 =
|
||||
vc.project.linker.dependencies.x64 =
|
||||
vc.project.linker.dependencies.WinCE =
|
||||
vc.project.linker.dependencies.Win32 =
|
||||
vc.project.linker.dependencies.x64 =
|
||||
vc.project.linker.dependencies.WinCE =
|
||||
|
@ -22,7 +22,7 @@ target_include_directories( "${LIBNAME}"
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
PRIVATE
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})
|
||||
|
@ -7,8 +7,8 @@ vc.project.outdir = ${vc.project.pocobase}
|
||||
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.prototype = ${vc.project.name}_vs90.vcproj
|
||||
vc.project.compiler.include =
|
||||
vc.project.compiler.defines =
|
||||
vc.project.compiler.include =
|
||||
vc.project.compiler.defines =
|
||||
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.release_shared = ${vc.project.compiler.defines.shared}
|
||||
|
@ -16,7 +16,7 @@
|
||||
#define IDC_CHK_AUTORUN 1013
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 131
|
||||
|
@ -52,7 +52,7 @@ protected:
|
||||
// Construct the active test
|
||||
inline ActiveTest::ActiveTest(Test *test): TestDecorator(test)
|
||||
{
|
||||
_currentTestResult = NULL;
|
||||
_currentTestResult = NULL;
|
||||
_threadHandle = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ inline ActiveTest::ActiveTest(Test *test): TestDecorator(test)
|
||||
// Pend until the test has completed
|
||||
inline ActiveTest::~ActiveTest()
|
||||
{
|
||||
CSingleLock(&_runCompleted, TRUE);
|
||||
CSingleLock(&_runCompleted, TRUE);
|
||||
CloseHandle(_threadHandle);
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ inline ActiveTest::~ActiveTest()
|
||||
// Set the test result that we are to run
|
||||
inline void ActiveTest::setTestResult(TestResult* result)
|
||||
{
|
||||
_currentTestResult = result;
|
||||
_currentTestResult = result;
|
||||
}
|
||||
|
||||
|
||||
|
@ -56,7 +56,7 @@ private:
|
||||
|
||||
|
||||
// Construct with lightweight synchronization
|
||||
inline GUITestResult::GUITestResult(TestRunnerDlg* runner): _runner(runner)
|
||||
inline GUITestResult::GUITestResult(TestRunnerDlg* runner): _runner(runner)
|
||||
{
|
||||
setSynchronizationObject(new LightweightSynchronizationObject());
|
||||
}
|
||||
@ -71,7 +71,7 @@ inline GUITestResult::~GUITestResult()
|
||||
// Override without protection to prevent deadlock
|
||||
inline void GUITestResult::stop()
|
||||
{
|
||||
_stop = true;
|
||||
_stop = true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -44,12 +44,12 @@ protected:
|
||||
|
||||
|
||||
// Construct a ProgressBar
|
||||
inline ProgressBar::ProgressBar(CWnd* baseWindow, CRect& bounds):
|
||||
_baseWindow(baseWindow),
|
||||
_bounds(bounds),
|
||||
inline ProgressBar::ProgressBar(CWnd* baseWindow, CRect& bounds):
|
||||
_baseWindow(baseWindow),
|
||||
_bounds(bounds),
|
||||
_error(false),
|
||||
_total(0),
|
||||
_progress(0),
|
||||
_total(0),
|
||||
_progress(0),
|
||||
_progressX(0)
|
||||
{
|
||||
WINDOWINFO wi;
|
||||
|
@ -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>
|
||||
<H3>Contents</H3>
|
||||
<PRE>README.html this file
|
||||
|
||||
|
||||
test the source code
|
||||
framework the testing framework
|
||||
		extensions	some framework extension classes
|
||||
textui a command line interface to run tests
|
||||
		extensions	some framework extension classes
|
||||
textui a command line interface to run tests
|
||||
ms code for a Microsoft specific TestRunner
|
||||
samples some example test cases and extensions to the framework
|
||||
multicaster a sample illustrating a publish/subscribe
|
||||
multicaster a sample illustrating a publish/subscribe
|
||||
				multicaster under test
|
||||
doc documentation</PRE>
|
||||
<H3>Installation</H3>
|
||||
|
@ -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>For example, to test the equality comparison for a Complex number class, write:</P>
|
||||
<TT><PRE>	class ComplexNumberTest : public TestCase {
|
||||
	public:
|
||||
	public:
|
||||
ComplexNumberTest (string name) : TestCase (name) {}
|
||||
void runTest () {
|
||||
assert (Complex (10, 1) == Complex (10, 1));
|
||||
@ -59,7 +59,7 @@
|
||||
	void		setUp () {
|
||||
			 m_10_1 = new Complex (10, 1);
|
||||
			 m_1_1 = new Complex (1, 1);
|
||||
			 m_11_2 = new Complex (11, 2);
|
||||
			 m_11_2 = new Complex (11, 2);
|
||||
}
|
||||
	void		tearDown () {
|
||||
			 delete m_10_1, delete m_1_1, delete m_11_2;
|
||||
@ -83,7 +83,7 @@
|
||||
	void		setUp () {
|
||||
			 m_10_1 = new Complex (10, 1);
|
||||
			 m_1_1 = new Complex (1, 1);
|
||||
			 m_11_2 = new Complex (11, 2);
|
||||
			 m_11_2 = new Complex (11, 2);
|
||||
}
|
||||
	void		tearDown () {
|
||||
			 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 |
@ -54,8 +54,8 @@ class TestCaller: public TestCase
|
||||
typedef void (Fixture::*TestMethod)();
|
||||
|
||||
public:
|
||||
TestCaller(const std::string& name, TestMethod test):
|
||||
TestCase(name),
|
||||
TestCaller(const std::string& name, TestMethod test):
|
||||
TestCase(name),
|
||||
_test(test),
|
||||
_fixture(new Fixture(name))
|
||||
{
|
||||
|
@ -78,8 +78,8 @@
|
||||
#pragma warning(disable:4503) // decorated name length exceeded - mainly a problem with STLPort
|
||||
#pragma warning(disable:4018) // signed/unsigned comparison
|
||||
#pragma warning(disable:4284) // return type for operator -> is not UDT
|
||||
#pragma warning(disable:4251) // ... needs to have dll-interface warning
|
||||
#pragma warning(disable:4273)
|
||||
#pragma warning(disable:4251) // ... needs to have dll-interface warning
|
||||
#pragma warning(disable:4273)
|
||||
#pragma warning(disable:4275) // ... non dll-interface class used as base for dll-interface class
|
||||
#endif
|
||||
|
||||
|
@ -20,8 +20,8 @@ class CppUnit_API CppUnitException: public std::exception
|
||||
/// descriptive strings through its what() method
|
||||
{
|
||||
public:
|
||||
CppUnitException(const std::string& message = "",
|
||||
long lineNumber = CPPUNIT_UNKNOWNLINENUMBER,
|
||||
CppUnitException(const std::string& message = "",
|
||||
long lineNumber = CPPUNIT_UNKNOWNLINENUMBER,
|
||||
const std::string& fileName = CPPUNIT_UNKNOWNFILENAME);
|
||||
CppUnitException(const std::string& message,
|
||||
long lineNumber,
|
||||
@ -110,26 +110,26 @@ inline const char* CppUnitException::what() const throw ()
|
||||
|
||||
inline long CppUnitException::lineNumber() const
|
||||
{
|
||||
return _lineNumber;
|
||||
return _lineNumber;
|
||||
}
|
||||
|
||||
|
||||
inline long CppUnitException::data1LineNumber() const
|
||||
{
|
||||
return _data1lineNumber;
|
||||
return _data1lineNumber;
|
||||
}
|
||||
|
||||
|
||||
inline long CppUnitException::data2LineNumber() const
|
||||
{
|
||||
return _data2lineNumber;
|
||||
return _data2lineNumber;
|
||||
}
|
||||
|
||||
|
||||
// The file in which the error occurred
|
||||
inline const std::string& CppUnitException::fileName() const
|
||||
{
|
||||
return _fileName;
|
||||
return _fileName;
|
||||
}
|
||||
|
||||
|
||||
|
@ -45,11 +45,11 @@ namespace CppUnit {
|
||||
*
|
||||
* see TestSuite
|
||||
*/
|
||||
template <class ClassUnderTest>
|
||||
template <class ClassUnderTest>
|
||||
class Orthodox: public TestCase
|
||||
{
|
||||
public:
|
||||
Orthodox(): TestCase("Orthodox")
|
||||
Orthodox(): TestCase("Orthodox")
|
||||
{
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ protected:
|
||||
|
||||
|
||||
// Run an orthodoxy test
|
||||
template <class ClassUnderTest>
|
||||
template <class ClassUnderTest>
|
||||
void Orthodox<ClassUnderTest>::runTest()
|
||||
{
|
||||
// make sure we have a default constructor
|
||||
@ -90,7 +90,7 @@ void Orthodox<ClassUnderTest>::runTest()
|
||||
|
||||
|
||||
// Exercise a call
|
||||
template <class ClassUnderTest>
|
||||
template <class ClassUnderTest>
|
||||
ClassUnderTest Orthodox<ClassUnderTest>::call(ClassUnderTest object)
|
||||
{
|
||||
return object;
|
||||
|
@ -29,7 +29,7 @@ class CppUnit_API RepeatedTest: public TestDecorator
|
||||
REFERENCEOBJECT (RepeatedTest)
|
||||
|
||||
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
|
||||
inline void RepeatedTest::run(TestResult *result)
|
||||
{
|
||||
for (int n = 0; n < _timesRepeat; n++)
|
||||
for (int n = 0; n < _timesRepeat; n++)
|
||||
{
|
||||
if (result->shouldStop())
|
||||
break;
|
||||
|
@ -46,7 +46,7 @@ inline void Test::run(TestResult *result)
|
||||
// Counts the number of test cases that will be run by this test.
|
||||
inline int Test::countTestCases()
|
||||
{
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -54,8 +54,8 @@ class TestCaller: public TestCase
|
||||
typedef void (Fixture::*TestMethod)();
|
||||
|
||||
public:
|
||||
TestCaller(const std::string& name, TestMethod test):
|
||||
TestCase(name),
|
||||
TestCaller(const std::string& name, TestMethod test):
|
||||
TestCase(name),
|
||||
_test(test),
|
||||
_fixture(new Fixture(name))
|
||||
{
|
||||
@ -64,8 +64,8 @@ public:
|
||||
// Returns the name of the test case instance
|
||||
virtual std::string toString()
|
||||
{
|
||||
const std::type_info& thisClass = typeid(*this);
|
||||
return std::string(thisClass.name()) + "." + name();
|
||||
const std::type_info& thisClass = typeid(*this);
|
||||
return std::string(thisClass.name()) + "." + name();
|
||||
}
|
||||
|
||||
|
||||
|
@ -131,7 +131,7 @@ protected:
|
||||
long lineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER,
|
||||
const std::string& fileName = CppUnitException::CPPUNIT_UNKNOWNFILENAME);
|
||||
|
||||
void assertEquals(const std::string& expected,
|
||||
void assertEquals(const std::string& expected,
|
||||
const std::string& actual,
|
||||
long lineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER,
|
||||
const std::string& fileName = CppUnitException::CPPUNIT_UNKNOWNFILENAME);
|
||||
@ -151,7 +151,7 @@ protected:
|
||||
long lineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER,
|
||||
const std::string& fileName = CppUnitException::CPPUNIT_UNKNOWNFILENAME);
|
||||
|
||||
void assertNull(const void* pointer,
|
||||
void assertNull(const void* pointer,
|
||||
const std::string& pointerExpression = "",
|
||||
long lineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER,
|
||||
const std::string& fileName = CppUnitException::CPPUNIT_UNKNOWNFILENAME);
|
||||
@ -185,14 +185,14 @@ inline TestCase::~TestCase()
|
||||
// Returns a count of all the tests executed
|
||||
inline int TestCase::countTestCases()
|
||||
{
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// Returns the name of the test case
|
||||
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
|
||||
inline std::string TestCase::toString()
|
||||
{
|
||||
const std::type_info& thisClass = typeid(*this);
|
||||
return std::string(thisClass.name()) + "." + name();
|
||||
const std::type_info& thisClass = typeid(*this);
|
||||
return std::string(thisClass.name()) + "." + name();
|
||||
}
|
||||
|
||||
|
||||
|
@ -57,7 +57,7 @@ inline TestFailure::TestFailure(Test* failedTest, CppUnitException* thrownExcept
|
||||
|
||||
// Deletes the owned exception.
|
||||
inline TestFailure::~TestFailure()
|
||||
{
|
||||
{
|
||||
delete _thrownException;
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ protected:
|
||||
// Construct a TestResult
|
||||
inline TestResult::TestResult(): _syncObject(new SynchronizationObject())
|
||||
{
|
||||
_runTests = 0;
|
||||
_runTests = 0;
|
||||
_stop = false;
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ inline TestResult::TestResult(): _syncObject(new SynchronizationObject())
|
||||
// caused the error
|
||||
inline void TestResult::addError(Test* test, CppUnitException* e)
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
ExclusiveZone zone(_syncObject);
|
||||
_errors.push_back(new TestFailure(test, e));
|
||||
}
|
||||
|
||||
@ -130,7 +130,7 @@ inline void TestResult::addError(Test* test, CppUnitException* e)
|
||||
// caused the failure.
|
||||
inline void TestResult::addFailure(Test* test, CppUnitException* e)
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
ExclusiveZone zone(_syncObject);
|
||||
_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.
|
||||
inline void TestResult::startTest(Test* test)
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
ExclusiveZone zone(_syncObject);
|
||||
_runTests++;
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ inline void TestResult::endTest(Test* test)
|
||||
// Gets the number of run tests.
|
||||
inline int TestResult::runTests()
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
ExclusiveZone zone(_syncObject);
|
||||
return _runTests;
|
||||
}
|
||||
|
||||
@ -161,7 +161,7 @@ inline int TestResult::runTests()
|
||||
// Gets the number of detected errors.
|
||||
inline int TestResult::testErrors()
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
ExclusiveZone zone(_syncObject);
|
||||
return (int) _errors.size();
|
||||
}
|
||||
|
||||
@ -169,7 +169,7 @@ inline int TestResult::testErrors()
|
||||
// Gets the number of detected failures.
|
||||
inline int TestResult::testFailures()
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
ExclusiveZone zone(_syncObject);
|
||||
return (int) _failures.size();
|
||||
}
|
||||
|
||||
@ -177,15 +177,15 @@ inline int TestResult::testFailures()
|
||||
// Returns whether the entire test was successful or not.
|
||||
inline bool TestResult::wasSuccessful()
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
return _failures.size() == 0 && _errors.size () == 0;
|
||||
ExclusiveZone zone(_syncObject);
|
||||
return _failures.size() == 0 && _errors.size () == 0;
|
||||
}
|
||||
|
||||
|
||||
// Returns a std::vector of the errors.
|
||||
inline std::vector<TestFailure*>& TestResult::errors()
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
ExclusiveZone zone(_syncObject);
|
||||
return _errors;
|
||||
}
|
||||
|
||||
@ -193,7 +193,7 @@ inline std::vector<TestFailure*>& TestResult::errors()
|
||||
// Returns a std::vector of the failures.
|
||||
inline std::vector<TestFailure*>& TestResult::failures()
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
ExclusiveZone zone(_syncObject);
|
||||
return _failures;
|
||||
}
|
||||
|
||||
@ -201,7 +201,7 @@ inline std::vector<TestFailure*>& TestResult::failures()
|
||||
// Returns whether testing should be stopped
|
||||
inline bool TestResult::shouldStop()
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
ExclusiveZone zone(_syncObject);
|
||||
return _stop;
|
||||
}
|
||||
|
||||
@ -209,7 +209,7 @@ inline bool TestResult::shouldStop()
|
||||
// Stop testing
|
||||
inline void TestResult::stop()
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
ExclusiveZone zone(_syncObject);
|
||||
_stop = true;
|
||||
}
|
||||
|
||||
@ -218,7 +218,7 @@ inline void TestResult::stop()
|
||||
// TestResult assumes ownership of the object
|
||||
inline void TestResult::setSynchronizationObject(SynchronizationObject* syncObject)
|
||||
{
|
||||
delete _syncObject;
|
||||
delete _syncObject;
|
||||
_syncObject = syncObject;
|
||||
}
|
||||
|
||||
|
@ -24,14 +24,14 @@ class CppUnit_API TestSetup: public TestDecorator
|
||||
REFERENCEOBJECT (TestSetup)
|
||||
|
||||
public:
|
||||
TestSetup(Test* test): TestDecorator(test)
|
||||
TestSetup(Test* test): TestDecorator(test)
|
||||
{
|
||||
}
|
||||
|
||||
void run(TestResult* result);
|
||||
|
||||
protected:
|
||||
void setUp()
|
||||
void setUp()
|
||||
{
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ protected:
|
||||
inline void TestSetup::run(TestResult* result)
|
||||
{
|
||||
setUp();
|
||||
TestDecorator::run(result);
|
||||
TestDecorator::run(result);
|
||||
tearDown();
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ inline void TestSuite::addTest(Test* test)
|
||||
// Returns a std::string representation of the test suite.
|
||||
inline std::string TestSuite::toString()
|
||||
{
|
||||
return "suite " + _name;
|
||||
return "suite " + _name;
|
||||
}
|
||||
|
||||
|
||||
|
@ -32,26 +32,26 @@ inline std::string estring(std::string& expandedString)
|
||||
// Create a std::string from an int
|
||||
inline std::string estring(int number)
|
||||
{
|
||||
char buffer[50];
|
||||
sprintf(buffer, "%d", number);
|
||||
return std::string (buffer);
|
||||
char buffer[50];
|
||||
sprintf(buffer, "%d", number);
|
||||
return std::string (buffer);
|
||||
}
|
||||
|
||||
|
||||
// Create a string from a long
|
||||
inline std::string estring(long number)
|
||||
{
|
||||
char buffer[50];
|
||||
sprintf(buffer, "%ld", number);
|
||||
return std::string (buffer);
|
||||
char buffer[50];
|
||||
sprintf(buffer, "%ld", number);
|
||||
return std::string (buffer);
|
||||
}
|
||||
|
||||
|
||||
// Create a std::string from a double
|
||||
inline std::string estring(double number)
|
||||
{
|
||||
char buffer[50];
|
||||
sprintf(buffer, "%lf", number);
|
||||
char buffer[50];
|
||||
sprintf(buffer, "%lf", number);
|
||||
return std::string(buffer);
|
||||
}
|
||||
|
||||
@ -59,8 +59,8 @@ inline std::string estring(double number)
|
||||
// Create a std::string from a double
|
||||
inline std::string estring(const void* ptr)
|
||||
{
|
||||
char buffer[50];
|
||||
sprintf(buffer, "%p", ptr);
|
||||
char buffer[50];
|
||||
sprintf(buffer, "%p", ptr);
|
||||
return std::string(buffer);
|
||||
}
|
||||
|
||||
|
@ -111,11 +111,11 @@ void TestCase::run(TestResult *result)
|
||||
result->startTest(this);
|
||||
|
||||
setUp();
|
||||
try
|
||||
try
|
||||
{
|
||||
runTest();
|
||||
}
|
||||
catch (CppUnitException& e)
|
||||
catch (CppUnitException& e)
|
||||
{
|
||||
CppUnitException* copy = new CppUnitException(e);
|
||||
result->addFailure(this, copy);
|
||||
|
@ -29,7 +29,7 @@ int TestDecorator::countTestCases()
|
||||
void TestDecorator::run(TestResult* result)
|
||||
{
|
||||
_test->run(result);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string TestDecorator::toString()
|
||||
|
@ -34,7 +34,7 @@ TestRunner::~TestRunner()
|
||||
|
||||
void TestRunner::printBanner()
|
||||
{
|
||||
_ostr
|
||||
_ostr
|
||||
<< "Usage: driver [-all] [-print] [-wait] [name] ..." << 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 printed = false;
|
||||
|
||||
for (int i = 1; i < args.size(); i++)
|
||||
for (int i = 1; i < args.size(); i++)
|
||||
{
|
||||
const std::string& arg = args[i];
|
||||
if (arg == "-wait")
|
||||
if (arg == "-wait")
|
||||
{
|
||||
wait = true;
|
||||
continue;
|
||||
@ -64,7 +64,7 @@ bool TestRunner::run(const std::vector<std::string>& args)
|
||||
}
|
||||
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);
|
||||
}
|
||||
@ -83,7 +83,7 @@ bool TestRunner::run(const std::vector<std::string>& args)
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
@ -93,7 +93,7 @@ bool TestRunner::run(const std::vector<std::string>& args)
|
||||
}
|
||||
numberOfTests++;
|
||||
|
||||
if (!testToRun)
|
||||
if (!testToRun)
|
||||
{
|
||||
_ostr << "Test " << testCase << " not found." << std::endl;
|
||||
return false;
|
||||
@ -103,20 +103,20 @@ bool TestRunner::run(const std::vector<std::string>& args)
|
||||
|
||||
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;
|
||||
numberOfTests++;
|
||||
}
|
||||
}
|
||||
|
||||
if (numberOfTests == 0 && !printed)
|
||||
if (numberOfTests == 0 && !printed)
|
||||
{
|
||||
printBanner();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (wait)
|
||||
if (wait)
|
||||
{
|
||||
_ostr << "<RETURN> to continue" << std::endl;
|
||||
std::cin.get();
|
||||
|
@ -21,7 +21,7 @@ void TestSuite::deleteContents()
|
||||
// Runs the tests and collects their result in a TestResult.
|
||||
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 ())
|
||||
break;
|
||||
|
@ -89,7 +89,7 @@ void TextTestResult::startTest(Test* test)
|
||||
|
||||
void TextTestResult::printErrors(std::ostream& stream)
|
||||
{
|
||||
if (testErrors() != 0)
|
||||
if (testErrors() != 0)
|
||||
{
|
||||
stream << "\n";
|
||||
|
||||
@ -108,7 +108,7 @@ void TextTestResult::printErrors(std::ostream& stream)
|
||||
<< ": "
|
||||
<< failure->failedTest()->toString() << "\n"
|
||||
<< " \"" << (e ? e->what() : "") << "\"\n"
|
||||
<< " in \""
|
||||
<< " in \""
|
||||
<< (e ? e->fileName() : std::string())
|
||||
<< "\", line ";
|
||||
if (e == 0)
|
||||
@ -156,7 +156,7 @@ void TextTestResult::printFailures(std::ostream& stream)
|
||||
<< ": "
|
||||
<< failure->failedTest()->toString() << "\n"
|
||||
<< " \"" << (e ? e->what() : "") << "\"\n"
|
||||
<< " in \""
|
||||
<< " in \""
|
||||
<< (e ? e->fileName() : std::string())
|
||||
<< "\", line ";
|
||||
if (e == 0)
|
||||
@ -168,7 +168,7 @@ void TextTestResult::printFailures(std::ostream& stream)
|
||||
stream << e->lineNumber();
|
||||
if (e->data2LineNumber() != CppUnitException::CPPUNIT_UNKNOWNLINENUMBER)
|
||||
{
|
||||
stream << " data lines "
|
||||
stream << " data lines "
|
||||
<< e->data1LineNumber()
|
||||
<< ", " << e->data2LineNumber();
|
||||
}
|
||||
@ -196,8 +196,8 @@ void TextTestResult::printHeader(std::ostream& stream)
|
||||
{
|
||||
stream << "\n\n";
|
||||
if (wasSuccessful())
|
||||
stream << "OK ("
|
||||
<< runTests() << " tests)"
|
||||
stream << "OK ("
|
||||
<< runTests() << " tests)"
|
||||
<< std::endl;
|
||||
else
|
||||
stream << "!!!FAILURES!!!" << std::endl
|
||||
|
@ -29,7 +29,7 @@ target_include_directories( "${LIBNAME}"
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
PRIVATE
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
${OPENSSL_INCLUDE_DIR}
|
||||
)
|
||||
|
@ -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.prototype = ${vc.project.name}_vs90.vcproj
|
||||
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.debug_shared = ${vc.project.compiler.defines.shared}
|
||||
vc.project.compiler.defines.release_shared = ${vc.project.compiler.defines.shared}
|
||||
|
@ -75,10 +75,10 @@ class Crypto_API Cipher: public Poco::RefCountedObject
|
||||
/// // and write pass it to the underlying file stream.
|
||||
/// Poco::FileOutputStream sink("encrypted.dat");
|
||||
/// CryptoOutputStream encryptor(sink, pCipher->createEncryptor());
|
||||
///
|
||||
///
|
||||
/// Poco::FileInputStream source("source.txt");
|
||||
/// Poco::StreamCopier::copyStream(source, encryptor);
|
||||
///
|
||||
///
|
||||
/// // Always close output streams to flush all internal buffers
|
||||
/// encryptor.close();
|
||||
/// sink.close();
|
||||
|
@ -42,8 +42,8 @@ public:
|
||||
/// Destroys the CipherFactory.
|
||||
|
||||
Cipher* createCipher(const CipherKey& key);
|
||||
/// Creates a Cipher object for the given Cipher name. Valid cipher
|
||||
/// names depend on the OpenSSL version the library is linked with;
|
||||
/// Creates a Cipher object for the given Cipher name. Valid cipher
|
||||
/// names depend on the OpenSSL version the library is linked with;
|
||||
/// see the output of
|
||||
///
|
||||
/// openssl enc --help
|
||||
|
@ -38,7 +38,7 @@ class Crypto_API CipherKey
|
||||
/// file.
|
||||
///
|
||||
/// 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:
|
||||
///
|
||||
/// std::string password = "secret";
|
||||
@ -68,22 +68,22 @@ public:
|
||||
/// an iteration count of at least 1000.
|
||||
};
|
||||
|
||||
CipherKey(const std::string& name,
|
||||
const std::string& passphrase,
|
||||
CipherKey(const std::string& name,
|
||||
const std::string& passphrase,
|
||||
const std::string& salt = "",
|
||||
int iterationCount = DEFAULT_ITERATION_COUNT,
|
||||
const std::string& digest = "md5");
|
||||
/// Creates a new CipherKeyImpl object using the given
|
||||
/// cipher name, passphrase, salt value, iteration count and digest.
|
||||
|
||||
CipherKey(const std::string& name,
|
||||
const ByteVec& key,
|
||||
CipherKey(const std::string& name,
|
||||
const ByteVec& key,
|
||||
const ByteVec& iv);
|
||||
/// Creates a new CipherKeyImpl object using the given cipher
|
||||
/// name, key and initialization vector.
|
||||
|
||||
CipherKey(const std::string& name);
|
||||
/// Creates a new CipherKeyImpl object. Autoinitializes key and
|
||||
/// Creates a new CipherKeyImpl object. Autoinitializes key and
|
||||
/// initialization vector.
|
||||
|
||||
~CipherKey();
|
||||
|
@ -60,11 +60,11 @@ public:
|
||||
/// the given cipher name, passphrase, salt value
|
||||
/// and iteration count.
|
||||
|
||||
CipherKeyImpl(const std::string& name,
|
||||
const ByteVec& key,
|
||||
CipherKeyImpl(const std::string& name,
|
||||
const ByteVec& key,
|
||||
const ByteVec& iv
|
||||
);
|
||||
/// Creates a new CipherKeyImpl object, using the
|
||||
/// Creates a new CipherKeyImpl object, using the
|
||||
/// given cipher name, key and initialization vector.
|
||||
|
||||
CipherKeyImpl(const std::string& name);
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#if defined(__APPLE__)
|
||||
// OS X 10.7 deprecates some OpenSSL functions
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
|
||||
@ -33,20 +33,20 @@ enum RSAPaddingMode
|
||||
/// The padding mode used for RSA public key encryption.
|
||||
{
|
||||
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,
|
||||
/// 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.
|
||||
|
||||
RSA_PADDING_SSLV23,
|
||||
/// PKCS #1 v1.5 padding with an SSL-specific modification that denotes
|
||||
/// that the server is SSL3 capable.
|
||||
/// PKCS #1 v1.5 padding with an SSL-specific modification that denotes
|
||||
/// that the server is SSL3 capable.
|
||||
|
||||
RSA_PADDING_NONE
|
||||
/// 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
|
||||
/// is insecure.
|
||||
/// 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
|
||||
/// is insecure.
|
||||
};
|
||||
|
||||
|
||||
@ -108,7 +108,7 @@ void Crypto_API initializeCrypto();
|
||||
/// libraries, by calling OpenSSLInitializer::initialize().
|
||||
///
|
||||
/// 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
|
||||
/// (Cipher, CipherKey, RSAKey, X509Certificate).
|
||||
/// However, it is recommended to call initializeCrypto()
|
||||
@ -120,7 +120,7 @@ void Crypto_API initializeCrypto();
|
||||
|
||||
|
||||
void Crypto_API uninitializeCrypto();
|
||||
/// Uninitializes the Crypto library by calling
|
||||
/// Uninitializes the Crypto library by calling
|
||||
/// OpenSSLInitializer::uninitialize().
|
||||
|
||||
|
||||
|
@ -45,9 +45,9 @@ public:
|
||||
/// Returns the block size for this CryptoTransform.
|
||||
|
||||
virtual int setPadding(int padding);
|
||||
/// 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
|
||||
/// no padding is performed, the total amount of data encrypted or decrypted must then be a multiple of
|
||||
/// 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
|
||||
/// 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.
|
||||
|
||||
virtual std::streamsize transform(const unsigned char* input,
|
||||
|
@ -40,7 +40,7 @@ class Crypto_API ECDSADigestEngine: public Poco::DigestEngine
|
||||
/// signed. Then, the hash value is encrypted, using
|
||||
/// 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
|
||||
/// using the ECDSA public key and compare the resulting
|
||||
/// hash with the actual hash of the data.
|
||||
@ -66,9 +66,9 @@ public:
|
||||
/// digest can be computed.
|
||||
|
||||
const DigestEngine::Digest& digest();
|
||||
/// Finishes the computation of the digest
|
||||
/// Finishes the computation of the digest
|
||||
/// (the first time it's called) and
|
||||
/// returns the message digest.
|
||||
/// returns the message digest.
|
||||
///
|
||||
/// Can be called multiple times.
|
||||
|
||||
|
@ -62,8 +62,8 @@ public:
|
||||
|
||||
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
|
||||
/// using the given passphrase for the private key. Can only by used for signing if
|
||||
/// a private key is available.
|
||||
/// using the given passphrase for the private key. Can only by used for signing if
|
||||
/// a private key is available.
|
||||
|
||||
ECKeyImpl(std::istream* pPublicKeyStream, std::istream* pPrivateKeyStream, const std::string& privateKeyPassphrase);
|
||||
/// Creates the ECKey. Can only by used for signing if pPrivKey
|
||||
@ -91,7 +91,7 @@ public:
|
||||
void save(const std::string& publicKeyFile,
|
||||
const std::string& privateKeyFile = "",
|
||||
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
|
||||
/// is not exported.
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
virtual void save(const std::string& publicKeyPairFile,
|
||||
const std::string& privateKeyPairFile = "",
|
||||
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
|
||||
/// is not exported.
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
virtual void save(const std::string& publicKeyFile,
|
||||
const std::string& privateKeyFile = "",
|
||||
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
|
||||
/// is not exported.
|
||||
|
@ -30,9 +30,9 @@ namespace Crypto {
|
||||
|
||||
|
||||
class RSACipherImpl: public Cipher
|
||||
/// An implementation of the Cipher class for
|
||||
/// An implementation of the Cipher class for
|
||||
/// 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.
|
||||
///
|
||||
/// Encryption is using the public key, decryption
|
||||
|
@ -39,7 +39,7 @@ class Crypto_API RSADigestEngine: public Poco::DigestEngine
|
||||
/// signed. Then, the hash value is encrypted, using
|
||||
/// 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
|
||||
/// using the RSA public key and compare the resulting
|
||||
/// hash with the actual hash of the data.
|
||||
@ -76,9 +76,9 @@ public:
|
||||
/// digest can be computed.
|
||||
|
||||
const DigestEngine::Digest& digest();
|
||||
/// Finishes the computation of the digest
|
||||
/// Finishes the computation of the digest
|
||||
/// (the first time it's called) and
|
||||
/// returns the message digest.
|
||||
/// returns the message digest.
|
||||
///
|
||||
/// Can be called multiple times.
|
||||
|
||||
|
@ -67,8 +67,8 @@ public:
|
||||
|
||||
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
|
||||
/// using the given passphrase for the private key. Can only by used for signing if
|
||||
/// a private key is available.
|
||||
/// using the given passphrase for the private key. Can only by used for signing if
|
||||
/// a private key is available.
|
||||
|
||||
RSAKeyImpl(std::istream* pPublicKeyStream, std::istream* pPrivateKeyStream, const std::string& privateKeyPassphrase);
|
||||
/// Creates the RSAKey. Can only by used for signing if pPrivKey
|
||||
@ -99,7 +99,7 @@ public:
|
||||
void save(const std::string& publicKeyFile,
|
||||
const std::string& privateKeyFile = "",
|
||||
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
|
||||
/// is not exported.
|
||||
|
@ -62,13 +62,13 @@ public:
|
||||
|
||||
explicit X509Certificate(X509* pCert);
|
||||
/// Creates the X509Certificate from an existing
|
||||
/// OpenSSL certificate. Ownership is taken of
|
||||
/// OpenSSL certificate. Ownership is taken of
|
||||
/// the certificate.
|
||||
|
||||
X509Certificate(X509* pCert, bool shared);
|
||||
/// Creates the X509Certificate from an existing
|
||||
/// OpenSSL certificate. Ownership is taken of
|
||||
/// the certificate. If shared is true, the
|
||||
/// OpenSSL certificate. Ownership is taken of
|
||||
/// the certificate. If shared is true, the
|
||||
/// certificate's reference count is incremented.
|
||||
|
||||
X509Certificate(const X509Certificate& cert);
|
||||
@ -76,7 +76,7 @@ public:
|
||||
|
||||
X509Certificate& operator = (const X509Certificate& cert);
|
||||
/// Assigns a certificate.
|
||||
|
||||
|
||||
void swap(X509Certificate& cert);
|
||||
/// Exchanges the certificate with another one.
|
||||
|
||||
@ -91,7 +91,7 @@ public:
|
||||
/// string in decimal encoding.
|
||||
|
||||
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;
|
||||
/// Extracts the information specified by the given
|
||||
|
@ -26,7 +26,7 @@ namespace Crypto {
|
||||
|
||||
|
||||
CipherKeyImpl::CipherKeyImpl(const std::string& name,
|
||||
const std::string& passphrase,
|
||||
const std::string& passphrase,
|
||||
const std::string& salt,
|
||||
int iterationCount,
|
||||
const std::string& digest): _pCipher(0),
|
||||
@ -54,8 +54,8 @@ CipherKeyImpl::CipherKeyImpl(const std::string& name,
|
||||
}
|
||||
|
||||
|
||||
CipherKeyImpl::CipherKeyImpl(const std::string& name,
|
||||
const ByteVec& key,
|
||||
CipherKeyImpl::CipherKeyImpl(const std::string& name,
|
||||
const ByteVec& key,
|
||||
const ByteVec& iv): _pCipher(0),
|
||||
_pDigest(0),
|
||||
_name(name),
|
||||
|
@ -28,7 +28,7 @@ CryptoTransform::~CryptoTransform()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
int CryptoTransform::setPadding(int padding)
|
||||
{
|
||||
return 1;
|
||||
|
@ -77,8 +77,8 @@ ECKeyImpl::ECKeyImpl(int curve):
|
||||
}
|
||||
|
||||
|
||||
ECKeyImpl::ECKeyImpl(const std::string& publicKeyFile,
|
||||
const std::string& privateKeyFile,
|
||||
ECKeyImpl::ECKeyImpl(const std::string& publicKeyFile,
|
||||
const std::string& privateKeyFile,
|
||||
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))
|
||||
|
@ -87,8 +87,8 @@ void OpenSSLInitializer::initialize()
|
||||
// https://sourceforge.net/p/poco/bugs/110/
|
||||
//
|
||||
// From http://www.openssl.org/docs/crypto/threads.html :
|
||||
// "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
|
||||
// "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
|
||||
// default thread identifying APIs"
|
||||
#ifndef OPENSSL_NO_DEPRECATED
|
||||
CRYPTO_set_id_callback(&OpenSSLInitializer::id);
|
||||
|
@ -90,8 +90,8 @@ RSAKeyImpl::RSAKeyImpl(int keyLength, unsigned long exponent): KeyPairImpl("rsa"
|
||||
}
|
||||
|
||||
|
||||
RSAKeyImpl::RSAKeyImpl(const std::string& publicKeyFile,
|
||||
const std::string& privateKeyFile,
|
||||
RSAKeyImpl::RSAKeyImpl(const std::string& publicKeyFile,
|
||||
const std::string& privateKeyFile,
|
||||
const std::string& privateKeyPassphrase): KeyPairImpl("rsa", KT_RSA_IMPL),
|
||||
_pRSA(0)
|
||||
{
|
||||
@ -109,7 +109,7 @@ RSAKeyImpl::RSAKeyImpl(const std::string& publicKeyFile,
|
||||
if (!pubKey)
|
||||
{
|
||||
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.
|
||||
if (rc != 0) throw Poco::FileException("Failed to load public key", publicKeyFile);
|
||||
pubKey = PEM_read_bio_RSA_PUBKEY(bio, &_pRSA, 0, 0);
|
||||
@ -174,7 +174,7 @@ RSAKeyImpl::RSAKeyImpl(std::istream* pPublicKeyStream,
|
||||
if (!publicKey)
|
||||
{
|
||||
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.
|
||||
if (rc != 1) throw Poco::FileException("Failed to load public key");
|
||||
publicKey = PEM_read_bio_RSA_PUBKEY(bio, &_pRSA, 0, 0);
|
||||
@ -306,8 +306,8 @@ void RSAKeyImpl::save(const std::string& publicKeyFile,
|
||||
if (privateKeyPassphrase.empty())
|
||||
rc = PEM_write_bio_RSAPrivateKey(bio, _pRSA, 0, 0, 0, 0, 0);
|
||||
else
|
||||
rc = PEM_write_bio_RSAPrivateKey(bio, _pRSA, EVP_des_ede3_cbc(),
|
||||
reinterpret_cast<unsigned char*>(const_cast<char*>(privateKeyPassphrase.c_str())),
|
||||
rc = PEM_write_bio_RSAPrivateKey(bio, _pRSA, EVP_des_ede3_cbc(),
|
||||
reinterpret_cast<unsigned char*>(const_cast<char*>(privateKeyPassphrase.c_str())),
|
||||
static_cast<int>(privateKeyPassphrase.length()), 0, 0);
|
||||
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())
|
||||
rc = PEM_write_bio_RSAPrivateKey(bio, _pRSA, 0, 0, 0, 0, 0);
|
||||
else
|
||||
rc = PEM_write_bio_RSAPrivateKey(bio, _pRSA, EVP_des_ede3_cbc(),
|
||||
reinterpret_cast<unsigned char*>(const_cast<char*>(privateKeyPassphrase.c_str())),
|
||||
rc = PEM_write_bio_RSAPrivateKey(bio, _pRSA, EVP_des_ede3_cbc(),
|
||||
reinterpret_cast<unsigned char*>(const_cast<char*>(privateKeyPassphrase.c_str())),
|
||||
static_cast<int>(privateKeyPassphrase.length()), 0, 0);
|
||||
if (!rc)
|
||||
if (!rc)
|
||||
{
|
||||
BIO_free(bio);
|
||||
throw Poco::FileException("Failed to write private key to stream");
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <openssl/pem.h>
|
||||
#ifdef _WIN32
|
||||
// fix for WIN32 header conflict
|
||||
#undef X509_NAME
|
||||
#undef X509_NAME
|
||||
#endif
|
||||
#include <openssl/x509v3.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");
|
||||
try
|
||||
{
|
||||
if (!PEM_write_bio_X509(pBIO, _pCert))
|
||||
if (!PEM_write_bio_X509(pBIO, _pCert))
|
||||
throw Poco::IOException("Failed to write certificate to stream");
|
||||
|
||||
char *pData;
|
||||
@ -182,7 +182,7 @@ void X509Certificate::save(const std::string& path) const
|
||||
}
|
||||
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);
|
||||
}
|
||||
catch (...)
|
||||
@ -247,7 +247,7 @@ std::string X509Certificate::subjectName(NID nid) 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)))
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
cmnName = commonName();
|
||||
if (!cmnName.empty() && domainNames.empty())
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
Bag Attributes
|
||||
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
|
||||
issuer=/C=CH/ST=Zug/O=Crypto Vally/CN=CV Intermediate CA v3
|
||||
-----BEGIN CERTIFICATE-----
|
||||
@ -105,7 +105,7 @@ D9vIMsVTPxxnOIRWskE=
|
||||
-----END CERTIFICATE-----
|
||||
Bag Attributes
|
||||
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>
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDXPX+EQwbPNE83
|
||||
|
@ -21,7 +21,7 @@
|
||||
class CryptoTest: public CppUnit::TestCase
|
||||
{
|
||||
public:
|
||||
enum
|
||||
enum
|
||||
{
|
||||
MAX_DATA_SIZE = 10000
|
||||
};
|
||||
|
@ -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.prototype = ${vc.project.name}_vs90.vcproj
|
||||
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.debug_shared = ${vc.project.compiler.defines.shared}
|
||||
vc.project.compiler.defines.release_shared = ${vc.project.compiler.defines.shared}
|
||||
|
@ -108,7 +108,7 @@ public:
|
||||
/// 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);
|
||||
|
||||
@ -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::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::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::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::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);
|
||||
|
||||
@ -236,7 +236,7 @@ private:
|
||||
/// Don't copy the binder
|
||||
|
||||
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
|
||||
/// due to security risk.
|
||||
{
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
|
||||
// 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.
|
||||
#define POCO_DATA_MYSQL_CONNECTOR_NAME "mysql"
|
||||
|
||||
@ -67,14 +67,14 @@ public:
|
||||
} } } // namespace Poco::Data::MySQL
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// Automatic Connector registration
|
||||
//
|
||||
//
|
||||
|
||||
struct MySQL_API MySQLConnectorRegistrator
|
||||
/// Connector registering class.
|
||||
/// 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.
|
||||
{
|
||||
MySQLConnectorRegistrator()
|
||||
@ -120,9 +120,9 @@ struct MySQL_API MySQLConnectorRegistrator
|
||||
POCO_DATA_MYSQL_FORCE_SYMBOL(pocoMySQLConnectorRegistrator)
|
||||
#endif // POCO_NO_AUTOMATIC_LIB_INIT
|
||||
|
||||
//
|
||||
//
|
||||
// End automatic Connector registration
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
#endif // Data_MySQL_Connector_INCLUDED
|
||||
|
@ -32,7 +32,7 @@ namespace Data {
|
||||
namespace MySQL {
|
||||
|
||||
// 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
|
||||
/// Base class for all MySQL exceptions
|
||||
|
@ -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();
|
||||
}
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
@ -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();
|
||||
}
|
||||
@ -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();
|
||||
}
|
||||
@ -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();
|
||||
}
|
||||
|
@ -20,10 +20,10 @@ namespace MySQL {
|
||||
|
||||
|
||||
MySQLStatementImpl::MySQLStatementImpl(SessionImpl& h) :
|
||||
Poco::Data::StatementImpl(h),
|
||||
_stmt(h.handle()),
|
||||
Poco::Data::StatementImpl(h),
|
||||
_stmt(h.handle()),
|
||||
_pBinder(new Binder),
|
||||
_pExtractor(new Extractor(_stmt, _metadata)),
|
||||
_pExtractor(new Extractor(_stmt, _metadata)),
|
||||
_hasNext(NEXT_DONTKNOW)
|
||||
{
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ namespace
|
||||
|
||||
switch (field.type)
|
||||
{
|
||||
case MYSQL_TYPE_TINY:
|
||||
case MYSQL_TYPE_TINY:
|
||||
if (unsig) return Poco::Data::MetaColumn::FDT_UINT8;
|
||||
return Poco::Data::MetaColumn::FDT_INT8;
|
||||
|
||||
@ -95,19 +95,19 @@ namespace
|
||||
return Poco::Data::MetaColumn::FDT_INT16;
|
||||
|
||||
case MYSQL_TYPE_INT24:
|
||||
case MYSQL_TYPE_LONG:
|
||||
case MYSQL_TYPE_LONG:
|
||||
if (unsig) return Poco::Data::MetaColumn::FDT_UINT32;
|
||||
return Poco::Data::MetaColumn::FDT_INT32;
|
||||
|
||||
case MYSQL_TYPE_FLOAT:
|
||||
case MYSQL_TYPE_FLOAT:
|
||||
return Poco::Data::MetaColumn::FDT_FLOAT;
|
||||
|
||||
case MYSQL_TYPE_DECIMAL:
|
||||
case MYSQL_TYPE_NEWDECIMAL:
|
||||
case MYSQL_TYPE_DOUBLE:
|
||||
case MYSQL_TYPE_DOUBLE:
|
||||
return Poco::Data::MetaColumn::FDT_DOUBLE;
|
||||
|
||||
case MYSQL_TYPE_LONGLONG:
|
||||
case MYSQL_TYPE_LONGLONG:
|
||||
if (unsig) return Poco::Data::MetaColumn::FDT_UINT64;
|
||||
return Poco::Data::MetaColumn::FDT_INT64;
|
||||
|
||||
@ -226,12 +226,12 @@ std::size_t ResultMetadata::length(std::size_t pos) const
|
||||
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);
|
||||
}
|
||||
|
||||
bool ResultMetadata::isNull(std::size_t pos) const
|
||||
bool ResultMetadata::isNull(std::size_t pos) const
|
||||
{
|
||||
return (_isNull[pos] != 0);
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ const std::string SessionImpl::MYSQL_REPEATABLE_READ = "REPEATABLE READ";
|
||||
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),
|
||||
_handle(0),
|
||||
_connected(false),
|
||||
@ -88,7 +88,7 @@ void SessionImpl::open(const std::string& connect)
|
||||
options["character-set"] = "utf8";
|
||||
|
||||
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 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;
|
||||
|
||||
start = finish + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (options["user"].empty())
|
||||
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());
|
||||
|
||||
// Real connect
|
||||
_handle.connect(options["host"].c_str(),
|
||||
options["user"].c_str(),
|
||||
options["password"].c_str(),
|
||||
db,
|
||||
_handle.connect(options["host"].c_str(),
|
||||
options["user"].c_str(),
|
||||
options["password"].c_str(),
|
||||
db,
|
||||
port);
|
||||
|
||||
addFeature("autoCommit",
|
||||
&SessionImpl::autoCommit,
|
||||
addFeature("autoCommit",
|
||||
&SessionImpl::autoCommit,
|
||||
&SessionImpl::isAutoCommit);
|
||||
|
||||
_connected = true;
|
||||
|
@ -119,7 +119,7 @@ bool StatementExecutor::fetch()
|
||||
int res = mysql_stmt_fetch(_pHandle);
|
||||
|
||||
// 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);
|
||||
|
||||
return (res == 0) || (res == MYSQL_DATA_TRUNCATED);
|
||||
|
@ -24,7 +24,7 @@
|
||||
class MySQLTest: public CppUnit::TestCase
|
||||
/// MySQL test class
|
||||
/// Tested:
|
||||
///
|
||||
///
|
||||
/// Driver | DB | OS
|
||||
/// ----------------+---------------------------+------------------------------------------
|
||||
/// 03.51.12.00 | MySQL 5.0.27-community-nt | MS Windows XP Professional x64 v.2003/SP1
|
||||
|
@ -152,7 +152,7 @@ private:
|
||||
} } // 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),
|
||||
_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()));
|
||||
|
||||
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);
|
||||
|
||||
rc = mysql_stmt_execute(hstmt);
|
||||
poco_assert (rc == 0);
|
||||
|
||||
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);
|
||||
|
||||
std::string str[3] = { "111", "222", "333" };
|
||||
@ -289,10 +289,10 @@ void SQLExecutor::simpleAccess()
|
||||
std::string result;
|
||||
|
||||
count = 0;
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
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();
|
||||
}
|
||||
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); }
|
||||
poco_assert (count == 2);
|
||||
Person result;
|
||||
Statement stmt = (*_pSession << "SELECT * FROM Person", into(result), limit(1));
|
||||
Statement stmt = (*_pSession << "SELECT * FROM Person", into(result), limit(1));
|
||||
stmt.execute();
|
||||
poco_assert (result == p1);
|
||||
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;
|
||||
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);
|
||||
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);
|
||||
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;
|
||||
@ -1683,8 +1683,8 @@ void SQLExecutor::internalExtraction()
|
||||
catch(ConnectionException& ce){ std::cout << ce.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);
|
||||
RecordSet rset(stmt);
|
||||
|
||||
@ -1788,9 +1788,9 @@ void SQLExecutor::doNull()
|
||||
{
|
||||
std::string funct = "null()";
|
||||
|
||||
*_pSession << "INSERT INTO Vectors VALUES (?, ?, ?)",
|
||||
use(Poco::Data::Keywords::null),
|
||||
use(Poco::Data::Keywords::null),
|
||||
*_pSession << "INSERT INTO Vectors VALUES (?, ?, ?)",
|
||||
use(Poco::Data::Keywords::null),
|
||||
use(Poco::Data::Keywords::null),
|
||||
use(Poco::Data::Keywords::null), now;
|
||||
|
||||
int count = 0;
|
||||
@ -1823,12 +1823,12 @@ void SQLExecutor::doNull()
|
||||
|
||||
|
||||
void SQLExecutor::setTransactionIsolation(Session& session, Poco::UInt32 ti)
|
||||
{
|
||||
{
|
||||
if (session.hasTransactionIsolation(ti))
|
||||
{
|
||||
std::string funct = "setTransactionIsolation()";
|
||||
|
||||
try
|
||||
try
|
||||
{
|
||||
Transaction t(session, false);
|
||||
t.setIsolation(ti);
|
||||
@ -2129,9 +2129,9 @@ void SQLExecutor::reconnect()
|
||||
poco_assert (_pSession->isConnected());
|
||||
_pSession->close();
|
||||
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");
|
||||
}
|
||||
catch(NotConnectedException&){ }
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
~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);
|
||||
/// 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).
|
||||
/// The purpose of the function is to verify that driver behaves
|
||||
/// correctly. If this test passes, subsequent tests failures are likely ours.
|
||||
|
@ -10,7 +10,7 @@ include ODBC.make
|
||||
|
||||
objects = Binder ConnectionHandle Connector EnvironmentHandle \
|
||||
Extractor ODBCException ODBCMetaColumn ODBCStatementImpl \
|
||||
Parameter Preparator SessionImpl TypeInfo Unicode Utility
|
||||
Parameter Preparator SessionImpl TypeInfo Unicode Utility
|
||||
|
||||
target = PocoDataODBC
|
||||
target_version = $(LIBVERSION)
|
||||
|
@ -361,7 +361,7 @@ public:
|
||||
/// Returns bound data size for parameter at specified position.
|
||||
|
||||
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.
|
||||
|
||||
void reset();
|
||||
@ -394,7 +394,7 @@ private:
|
||||
/// Sets the description field for the parameter, if needed.
|
||||
|
||||
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
|
||||
/// due to security risk.
|
||||
|
||||
@ -417,14 +417,14 @@ private:
|
||||
}
|
||||
_lengthIndicator.push_back(pLenIn);
|
||||
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
toODBCDirection(dir),
|
||||
cDataType,
|
||||
Utility::sqlDataType(cDataType),
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
toODBCDirection(dir),
|
||||
cDataType,
|
||||
Utility::sqlDataType(cDataType),
|
||||
colSize,
|
||||
decDigits,
|
||||
(SQLPOINTER)&val, 0,
|
||||
(SQLPOINTER)&val, 0,
|
||||
_lengthIndicator.back())))
|
||||
{
|
||||
throw StatementException(_rStmt, "SQLBindParameter()");
|
||||
@ -454,15 +454,15 @@ private:
|
||||
_lengthIndicator.push_back(pLenIn);
|
||||
SQLSMALLINT sqlType = (isInBound(dir) && size <= _maxVarBinColSize) ? SQL_VARBINARY : SQL_LONGVARBINARY;
|
||||
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
SQL_PARAM_INPUT,
|
||||
SQL_C_BINARY,
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
SQL_PARAM_INPUT,
|
||||
SQL_C_BINARY,
|
||||
sqlType,
|
||||
(SQLUINTEGER) size,
|
||||
0,
|
||||
pVal,
|
||||
(SQLINTEGER) size,
|
||||
(SQLINTEGER) size,
|
||||
_lengthIndicator.back())))
|
||||
{
|
||||
throw StatementException(_rStmt, "SQLBindParameter(LOB)");
|
||||
@ -487,15 +487,15 @@ private:
|
||||
_vecLengthIndicator[pos] = new LengthVec(length);
|
||||
}
|
||||
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
toODBCDirection(dir),
|
||||
cDataType,
|
||||
Utility::sqlDataType(cDataType),
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
toODBCDirection(dir),
|
||||
cDataType,
|
||||
Utility::sqlDataType(cDataType),
|
||||
colSize,
|
||||
decDigits,
|
||||
(SQLPOINTER) &val[0],
|
||||
0,
|
||||
(SQLPOINTER) &val[0],
|
||||
0,
|
||||
&(*_vecLengthIndicator[pos])[0])))
|
||||
{
|
||||
throw StatementException(_rStmt, "SQLBindParameter()");
|
||||
@ -548,15 +548,15 @@ private:
|
||||
typename C::const_iterator end = val.end();
|
||||
for (int i = 0; it != end; ++it, ++i) _boolPtrs[pos][i] = *it;
|
||||
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
toODBCDirection(dir),
|
||||
cDataType,
|
||||
Utility::sqlDataType(cDataType),
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
toODBCDirection(dir),
|
||||
cDataType,
|
||||
Utility::sqlDataType(cDataType),
|
||||
colSize,
|
||||
decDigits,
|
||||
(SQLPOINTER) &_boolPtrs[pos][0],
|
||||
0,
|
||||
(SQLPOINTER) &_boolPtrs[pos][0],
|
||||
0,
|
||||
&(*_vecLengthIndicator[pos])[0])))
|
||||
{
|
||||
throw StatementException(_rStmt, "SQLBindParameter()");
|
||||
@ -616,15 +616,15 @@ private:
|
||||
}
|
||||
SQLSMALLINT sqlType = (isInBound(dir) && size < _maxCharColLength) ? SQL_VARCHAR : SQL_LONGVARCHAR;
|
||||
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
toODBCDirection(dir),
|
||||
SQL_C_CHAR,
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
toODBCDirection(dir),
|
||||
SQL_C_CHAR,
|
||||
sqlType,
|
||||
(SQLUINTEGER) size - 1,
|
||||
0,
|
||||
_charPtrs[pos],
|
||||
(SQLINTEGER) size,
|
||||
_charPtrs[pos],
|
||||
(SQLINTEGER) size,
|
||||
&(*_vecLengthIndicator[pos])[0])))
|
||||
{
|
||||
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 lEnd = _vecLengthIndicator[pos]->end();
|
||||
typename C::const_iterator cIt = val.begin();
|
||||
for (; lIt != lEnd; ++lIt, ++cIt)
|
||||
for (; lIt != lEnd; ++lIt, ++cIt)
|
||||
{
|
||||
SQLLEN sz = static_cast<SQLLEN>(cIt->size());
|
||||
if (sz > size) size = static_cast<SQLINTEGER>(sz);
|
||||
@ -753,15 +753,15 @@ private:
|
||||
}
|
||||
SQLSMALLINT sqlType = (isInBound(dir) && size <= _maxVarBinColSize) ? SQL_VARBINARY : SQL_LONGVARBINARY;
|
||||
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
SQL_PARAM_INPUT,
|
||||
SQL_C_BINARY,
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
SQL_PARAM_INPUT,
|
||||
SQL_C_BINARY,
|
||||
sqlType,
|
||||
(SQLUINTEGER) size,
|
||||
0,
|
||||
_charPtrs[pos],
|
||||
(SQLINTEGER) size,
|
||||
_charPtrs[pos],
|
||||
(SQLINTEGER) size,
|
||||
&(*_vecLengthIndicator[pos])[0])))
|
||||
{
|
||||
throw StatementException(_rStmt, "SQLBindParameter(std::vector<BLOB>)");
|
||||
@ -802,15 +802,15 @@ private:
|
||||
SQLSMALLINT decDigits = 0;
|
||||
getColSizeAndPrecision(pos, SQL_TYPE_DATE, colSize, decDigits);
|
||||
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
toODBCDirection(dir),
|
||||
SQL_C_TYPE_DATE,
|
||||
SQL_TYPE_DATE,
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
toODBCDirection(dir),
|
||||
SQL_C_TYPE_DATE,
|
||||
SQL_TYPE_DATE,
|
||||
colSize,
|
||||
decDigits,
|
||||
(SQLPOINTER) &(*_dateVecVec[pos])[0],
|
||||
0,
|
||||
(SQLPOINTER) &(*_dateVecVec[pos])[0],
|
||||
0,
|
||||
&(*_vecLengthIndicator[pos])[0])))
|
||||
{
|
||||
throw StatementException(_rStmt, "SQLBindParameter(Date[])");
|
||||
@ -850,15 +850,15 @@ private:
|
||||
SQLSMALLINT decDigits = 0;
|
||||
getColSizeAndPrecision(pos, SQL_TYPE_TIME, colSize, decDigits);
|
||||
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
toODBCDirection(dir),
|
||||
SQL_C_TYPE_TIME,
|
||||
SQL_TYPE_TIME,
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
toODBCDirection(dir),
|
||||
SQL_C_TYPE_TIME,
|
||||
SQL_TYPE_TIME,
|
||||
colSize,
|
||||
decDigits,
|
||||
(SQLPOINTER) &(*_timeVecVec[pos])[0],
|
||||
0,
|
||||
(SQLPOINTER) &(*_timeVecVec[pos])[0],
|
||||
0,
|
||||
&(*_vecLengthIndicator[pos])[0])))
|
||||
{
|
||||
throw StatementException(_rStmt, "SQLBindParameter(Time[])");
|
||||
@ -899,15 +899,15 @@ private:
|
||||
SQLSMALLINT decDigits = 0;
|
||||
getColSizeAndPrecision(pos, SQL_TYPE_TIMESTAMP, colSize, decDigits);
|
||||
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
toODBCDirection(dir),
|
||||
SQL_C_TYPE_TIMESTAMP,
|
||||
SQL_TYPE_TIMESTAMP,
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
toODBCDirection(dir),
|
||||
SQL_C_TYPE_TIMESTAMP,
|
||||
SQL_TYPE_TIMESTAMP,
|
||||
colSize,
|
||||
decDigits,
|
||||
(SQLPOINTER) &(*_dateTimeVecVec[pos])[0],
|
||||
0,
|
||||
(SQLPOINTER) &(*_dateTimeVecVec[pos])[0],
|
||||
0,
|
||||
&(*_vecLengthIndicator[pos])[0])))
|
||||
{
|
||||
throw StatementException(_rStmt, "SQLBindParameter(Time[])");
|
||||
@ -941,31 +941,31 @@ private:
|
||||
SQLSMALLINT colType = _pTypeInfo->tryTypeidToCType(bindElemType, SQL_C_STINYINT);
|
||||
getColSizeAndPrecision(pos, colType, colSize, decDigits);
|
||||
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
SQL_PARAM_INPUT,
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
SQL_PARAM_INPUT,
|
||||
colType,
|
||||
Utility::sqlDataType(colType),
|
||||
colSize,
|
||||
decDigits,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
&(*_vecLengthIndicator[pos])[0])))
|
||||
{
|
||||
throw StatementException(_rStmt, "SQLBindParameter()");
|
||||
}
|
||||
}
|
||||
|
||||
void getColSizeAndPrecision(std::size_t pos,
|
||||
SQLSMALLINT cDataType,
|
||||
SQLINTEGER& colSize,
|
||||
void getColSizeAndPrecision(std::size_t pos,
|
||||
SQLSMALLINT cDataType,
|
||||
SQLINTEGER& colSize,
|
||||
SQLSMALLINT& decDigits);
|
||||
/// Used to retrieve column size and precision.
|
||||
/// Not all drivers cooperate with this inquiry under all circumstances
|
||||
/// This function runs for query and stored procedure parameters (in and
|
||||
/// out-bound). Some drivers, however, do not care about knowing this
|
||||
/// information to start with. For that reason, after all the attempts
|
||||
/// to discover the required values are unsuccessfully exhausted, the values
|
||||
/// This function runs for query and stored procedure parameters (in and
|
||||
/// out-bound). Some drivers, however, do not care about knowing this
|
||||
/// information to start with. For that reason, after all the attempts
|
||||
/// to discover the required values are unsuccessfully exhausted, the values
|
||||
/// are both set to zero and no exception is thrown.
|
||||
|
||||
void setParamSetSize(std::size_t length);
|
||||
@ -974,7 +974,7 @@ private:
|
||||
void getColumnOrParameterSize(std::size_t pos, SQLINTEGER& size);
|
||||
/// Fills the column or parameter size into the 'size' argument.
|
||||
/// 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.
|
||||
|
||||
void freeMemory();
|
||||
@ -984,9 +984,9 @@ private:
|
||||
template<typename T>
|
||||
void getMinValueSize(T& val, SQLINTEGER& size)
|
||||
/// 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.
|
||||
/// 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
|
||||
/// uses the smaller of maximum found and maximum predefined data length.
|
||||
{
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
|
||||
// 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.
|
||||
#define POCO_DATA_ODBC_CONNECTOR_NAME "odbc"
|
||||
|
||||
@ -75,14 +75,14 @@ inline const std::string& Connector::name() const
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// Automatic Connector registration
|
||||
//
|
||||
//
|
||||
|
||||
struct ODBC_API ODBCConnectorRegistrator
|
||||
/// Connector registering class.
|
||||
/// 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.
|
||||
{
|
||||
ODBCConnectorRegistrator()
|
||||
@ -128,9 +128,9 @@ struct ODBC_API ODBCConnectorRegistrator
|
||||
POCO_DATA_ODBC_FORCE_SYMBOL(pocoODBCConnectorRegistrator)
|
||||
#endif // POCO_NO_AUTOMATIC_LIB_INIT
|
||||
|
||||
//
|
||||
//
|
||||
// End automatic Connector registration
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
#endif // Data_ODBC_Connector_INCLUDED
|
||||
|
@ -36,7 +36,7 @@ template <typename H, SQLSMALLINT handleType>
|
||||
class Diagnostics
|
||||
/// Utility class providing functionality for retrieving ODBC diagnostic
|
||||
/// 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.
|
||||
{
|
||||
public:
|
||||
@ -92,7 +92,7 @@ public:
|
||||
}
|
||||
|
||||
std::string connectionName() const
|
||||
/// Returns the connection name.
|
||||
/// Returns the connection name.
|
||||
/// 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),
|
||||
/// connection name defaults to NOT_APPLICABLE.
|
||||
@ -146,54 +146,54 @@ public:
|
||||
|
||||
reset();
|
||||
|
||||
while (!Utility::isError(SQLGetDiagRec(handleType,
|
||||
handle,
|
||||
count,
|
||||
df._sqlState,
|
||||
&df._nativeError,
|
||||
df._message,
|
||||
SQL_MESSAGE_LENGTH,
|
||||
&messageLength)))
|
||||
while (!Utility::isError(SQLGetDiagRec(handleType,
|
||||
handle,
|
||||
count,
|
||||
df._sqlState,
|
||||
&df._nativeError,
|
||||
df._message,
|
||||
SQL_MESSAGE_LENGTH,
|
||||
&messageLength)))
|
||||
{
|
||||
if (1 == count)
|
||||
{
|
||||
// success of the following two calls is optional
|
||||
// (they fail if connection has not been established yet
|
||||
// or return empty string if not applicable for the context)
|
||||
if (Utility::isError(SQLGetDiagField(handleType,
|
||||
handle,
|
||||
count,
|
||||
SQL_DIAG_CONNECTION_NAME,
|
||||
_connectionName,
|
||||
sizeof(_connectionName),
|
||||
if (Utility::isError(SQLGetDiagField(handleType,
|
||||
handle,
|
||||
count,
|
||||
SQL_DIAG_CONNECTION_NAME,
|
||||
_connectionName,
|
||||
sizeof(_connectionName),
|
||||
&messageLength)))
|
||||
{
|
||||
std::size_t len = sizeof(_connectionName) > none.length() ?
|
||||
std::size_t len = sizeof(_connectionName) > none.length() ?
|
||||
none.length() : sizeof(_connectionName) - 1;
|
||||
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;
|
||||
std::memcpy(_connectionName, na.c_str(), len);
|
||||
}
|
||||
|
||||
if (Utility::isError(SQLGetDiagField(handleType,
|
||||
handle,
|
||||
count,
|
||||
SQL_DIAG_SERVER_NAME,
|
||||
_serverName,
|
||||
sizeof(_serverName),
|
||||
if (Utility::isError(SQLGetDiagField(handleType,
|
||||
handle,
|
||||
count,
|
||||
SQL_DIAG_SERVER_NAME,
|
||||
_serverName,
|
||||
sizeof(_serverName),
|
||||
&messageLength)))
|
||||
{
|
||||
std::size_t len = sizeof(_serverName) > none.length() ?
|
||||
std::size_t len = sizeof(_serverName) > none.length() ?
|
||||
none.length() : sizeof(_serverName) - 1;
|
||||
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;
|
||||
std::memcpy(_serverName, na.c_str(), len);
|
||||
}
|
||||
|
@ -66,11 +66,11 @@ public:
|
||||
std::string& toString(int index, std::string& str) const
|
||||
/// Generates the string for the diagnostic record.
|
||||
{
|
||||
if ((index < 0) || (index > (count() - 1)))
|
||||
if ((index < 0) || (index > (count() - 1)))
|
||||
return str;
|
||||
|
||||
std::string s;
|
||||
Poco::format(s,
|
||||
Poco::format(s,
|
||||
"===========================\n"
|
||||
"ODBC Diagnostic record #%d:\n"
|
||||
"===========================\n"
|
||||
@ -90,7 +90,7 @@ public:
|
||||
{
|
||||
std::string str;
|
||||
|
||||
Poco::format(str,
|
||||
Poco::format(str,
|
||||
"Connection:%s\nServer:%s\n",
|
||||
_diagnostics.connectionName(),
|
||||
_diagnostics.serverName());
|
||||
|
@ -52,7 +52,7 @@ class ODBC_API Extractor: public Poco::Data::AbstractExtractor
|
||||
public:
|
||||
typedef Preparator::Ptr PreparatorPtr;
|
||||
|
||||
Extractor(const StatementHandle& rStmt,
|
||||
Extractor(const StatementHandle& rStmt,
|
||||
Preparator::Ptr pPreparator);
|
||||
/// Creates the Extractor.
|
||||
|
||||
@ -339,7 +339,7 @@ public:
|
||||
/// Returns true if the value at [col,row] is null.
|
||||
|
||||
void reset();
|
||||
/// Resets the internally cached length indicators.
|
||||
/// Resets the internally cached length indicators.
|
||||
|
||||
private:
|
||||
static const int CHUNK_SIZE = 1024;
|
||||
@ -365,7 +365,7 @@ private:
|
||||
{
|
||||
if (isNull(pos)) return false;
|
||||
poco_assert_dbg (typeid(T) == _pPreparator->at(pos).type());
|
||||
val = *AnyCast<T>(&_pPreparator->at(pos));
|
||||
val = *AnyCast<T>(&_pPreparator->at(pos));
|
||||
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::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::deque<Poco::UTF16String>& values);
|
||||
bool extractBoundImplContainer(std::size_t pos, std::list<Poco::UTF16String>& values);
|
||||
@ -466,8 +466,8 @@ private:
|
||||
|
||||
resizeLengths(pos);
|
||||
|
||||
rc = SQLGetData(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
rc = SQLGetData(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
cType, //C data type
|
||||
&value, //returned value
|
||||
0, //buffer length (ignored)
|
||||
@ -476,9 +476,9 @@ private:
|
||||
if (Utility::isError(rc))
|
||||
throw StatementException(_rStmt, "SQLGetData()");
|
||||
|
||||
if (isNullLengthIndicator(_lengths[pos]))
|
||||
if (isNullLengthIndicator(_lengths[pos]))
|
||||
return false;
|
||||
else
|
||||
else
|
||||
{
|
||||
//for fixed-length data, buffer must be large enough
|
||||
//otherwise, driver may write past the end
|
||||
@ -570,7 +570,7 @@ private:
|
||||
case MetaColumn::FDT_TIMESTAMP:
|
||||
{ return extAny<T, Poco::DateTime>(pos, val); }
|
||||
|
||||
default:
|
||||
default:
|
||||
throw DataFormatException("Unsupported data type.");
|
||||
}
|
||||
|
||||
@ -578,8 +578,8 @@ private:
|
||||
}
|
||||
|
||||
bool isNullLengthIndicator(SQLLEN val) const;
|
||||
/// The reason for this utility wrapper are platforms where
|
||||
/// SQLLEN macro (a.k.a. SQLINTEGER) yields 64-bit value,
|
||||
/// The reason for this utility wrapper are platforms where
|
||||
/// SQLLEN macro (a.k.a. SQLINTEGER) yields 64-bit value,
|
||||
/// while SQL_NULL_DATA (#define'd as -1 literal) remains 32-bit.
|
||||
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
return extractBoundImplContainerLOB(pos, values);
|
||||
@ -705,7 +705,7 @@ inline void Extractor::reset()
|
||||
|
||||
inline void Extractor::resizeLengths(std::size_t pos)
|
||||
{
|
||||
if (pos >= _lengths.size())
|
||||
if (pos >= _lengths.size())
|
||||
_lengths.resize(pos + 1, (SQLLEN) 0);
|
||||
}
|
||||
|
||||
|
@ -39,14 +39,14 @@ class Handle
|
||||
/// ODBC handle class template
|
||||
{
|
||||
public:
|
||||
Handle(const ConnectionHandle& rConnection):
|
||||
Handle(const ConnectionHandle& rConnection):
|
||||
_rConnection(rConnection),
|
||||
_handle(0)
|
||||
/// Creates the Handle.
|
||||
{
|
||||
if (Utility::isError(SQLAllocHandle(handleType,
|
||||
_rConnection,
|
||||
&_handle)))
|
||||
if (Utility::isError(SQLAllocHandle(handleType,
|
||||
_rConnection,
|
||||
&_handle)))
|
||||
{
|
||||
throw ODBCException("Could not allocate statement handle.");
|
||||
}
|
||||
@ -58,7 +58,7 @@ public:
|
||||
try
|
||||
{
|
||||
#if defined(_DEBUG)
|
||||
SQLRETURN rc =
|
||||
SQLRETURN rc =
|
||||
#endif
|
||||
SQLFreeHandle(handleType, _handle);
|
||||
// N.B. Destructors should not throw, but neither do we want to
|
||||
|
@ -41,7 +41,7 @@ template <class H, SQLSMALLINT handleType>
|
||||
class HandleException: public ODBCException
|
||||
{
|
||||
public:
|
||||
HandleException(const H& handle, int code = 0) :
|
||||
HandleException(const H& handle, int code = 0) :
|
||||
ODBCException(code),
|
||||
_error(handle)
|
||||
/// Creates HandleException
|
||||
@ -49,29 +49,29 @@ public:
|
||||
message(_error.toString());
|
||||
}
|
||||
|
||||
HandleException(const H& handle, const std::string& msg):
|
||||
ODBCException(msg),
|
||||
HandleException(const H& handle, const std::string& msg):
|
||||
ODBCException(msg),
|
||||
_error(handle)
|
||||
/// Creates HandleException
|
||||
{
|
||||
extendedMessage(_error.toString());
|
||||
}
|
||||
|
||||
HandleException(const H& handle, const std::string& msg, const std::string& arg):
|
||||
ODBCException(msg, arg),
|
||||
HandleException(const H& handle, const std::string& msg, const std::string& arg):
|
||||
ODBCException(msg, arg),
|
||||
_error(handle)
|
||||
/// 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),
|
||||
_error(handle)
|
||||
/// Creates HandleException
|
||||
{
|
||||
}
|
||||
|
||||
HandleException(const HandleException& exc):
|
||||
HandleException(const HandleException& exc):
|
||||
ODBCException(exc),
|
||||
_error(exc._error)
|
||||
/// Creates HandleException
|
||||
|
@ -45,10 +45,10 @@ public:
|
||||
/// Destroys the ODBCMetaColumn.
|
||||
|
||||
std::size_t dataLength() const;
|
||||
/// 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,
|
||||
/// or the actual character length for a variable-length data type. Its value always excludes the
|
||||
/// null-termination byte that ends the character string.
|
||||
/// 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,
|
||||
/// or the actual character length for a variable-length data type. Its value always excludes the
|
||||
/// null-termination byte that ends the character string.
|
||||
/// This information is returned from the SQL_DESC_LENGTH record field of the IRD.
|
||||
|
||||
private:
|
||||
|
@ -76,7 +76,7 @@ protected:
|
||||
/// Returns true if another compile is possible.
|
||||
|
||||
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.
|
||||
|
||||
void bindImpl();
|
||||
@ -123,8 +123,8 @@ private:
|
||||
void doPrepare();
|
||||
/// Prepares placeholders for data returned by statement.
|
||||
/// It is called during statement compilation for SQL statements
|
||||
/// returning data. For stored procedures returning datasets,
|
||||
/// it is called upon the first check for data availability
|
||||
/// returning data. For stored procedures returning datasets,
|
||||
/// it is called upon the first check for data availability
|
||||
/// (see hasNext() function).
|
||||
|
||||
bool hasData() const;
|
||||
@ -137,8 +137,8 @@ private:
|
||||
/// Returns true if there is a row fetched but not yet extracted.
|
||||
|
||||
void putData();
|
||||
/// Called whenever SQLExecute returns SQL_NEED_DATA. This is expected
|
||||
/// behavior for PB_AT_EXEC binding mode.
|
||||
/// Called whenever SQLExecute returns SQL_NEED_DATA. This is expected
|
||||
/// behavior for PB_AT_EXEC binding mode.
|
||||
|
||||
void getData();
|
||||
|
||||
|
@ -47,11 +47,11 @@ public:
|
||||
/// Returns the SQL data type.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
bool isNullable() const;
|
||||
|
@ -49,13 +49,13 @@ namespace ODBC {
|
||||
|
||||
|
||||
class ODBC_API Preparator : public AbstractPreparator
|
||||
/// Class used for database preparation where we first have to register all data types
|
||||
/// with respective memory output locations before extracting data.
|
||||
/// Class used for database preparation where we first have to register all data types
|
||||
/// with respective memory output locations before extracting data.
|
||||
/// 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,
|
||||
/// however with numerous driver implementation dependent limitations and inferior performance).
|
||||
/// In order to fit this functionality into Poco DataConnectors framework, every ODBC SQL statement
|
||||
/// instantiates its own Preparator object.
|
||||
/// In ODBC, SQLBindCol/SQLFetch is the preferred method of data retrieval (SQLGetData is available,
|
||||
/// however with numerous driver implementation dependent limitations and inferior performance).
|
||||
/// In order to fit this functionality into Poco DataConnectors framework, every ODBC SQL statement
|
||||
/// instantiates its own Preparator object.
|
||||
/// This is done once per statement execution (from StatementImpl::bindImpl()).
|
||||
///
|
||||
/// 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.
|
||||
/// - 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
|
||||
///
|
||||
///
|
||||
{
|
||||
public:
|
||||
typedef std::vector<char*> CharArray;
|
||||
@ -96,8 +96,8 @@ public:
|
||||
DT_DATETIME
|
||||
};
|
||||
|
||||
Preparator(const StatementHandle& rStmt,
|
||||
const std::string& statement,
|
||||
Preparator(const StatementHandle& rStmt,
|
||||
const std::string& statement,
|
||||
std::size_t maxFieldSize,
|
||||
DataExtraction dataExtraction,
|
||||
bool isPostgres
|
||||
@ -397,12 +397,12 @@ public:
|
||||
|
||||
std::size_t maxDataSize(std::size_t pos) const;
|
||||
/// 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.
|
||||
|
||||
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.
|
||||
/// This is usually equal to the column size, except for
|
||||
/// Returns the returned length for the column and row specified.
|
||||
/// This is usually equal to the column size, except for
|
||||
/// variable length fields (BLOB and variable length strings).
|
||||
/// For null values, the return value is -1 (SQL_NO_DATA)
|
||||
|
||||
@ -437,7 +437,7 @@ private:
|
||||
if (pVal)
|
||||
return prepareFixedSize<Poco::Int8>(pos, SQL_C_STINYINT, pVal->size());
|
||||
else
|
||||
return prepareFixedSize<Poco::Int8>(pos, SQL_C_STINYINT);
|
||||
return prepareFixedSize<Poco::Int8>(pos, SQL_C_STINYINT);
|
||||
|
||||
case MetaColumn::FDT_UINT8:
|
||||
if (pVal)
|
||||
@ -550,7 +550,7 @@ private:
|
||||
else
|
||||
return prepareFixedSize<DateTime>(pos, SQL_C_TYPE_TIMESTAMP);
|
||||
|
||||
default:
|
||||
default:
|
||||
throw DataFormatException("Unsupported data type.");
|
||||
}
|
||||
}
|
||||
@ -569,11 +569,11 @@ private:
|
||||
_values[pos] = Poco::Any(T());
|
||||
|
||||
T* pVal = AnyCast<T>(&_values[pos]);
|
||||
if (Utility::isError(SQLBindCol(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
valueType,
|
||||
(SQLPOINTER) pVal,
|
||||
(SQLINTEGER) dataSize,
|
||||
if (Utility::isError(SQLBindCol(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
valueType,
|
||||
(SQLPOINTER) pVal,
|
||||
(SQLINTEGER) dataSize,
|
||||
&_lengths[pos])))
|
||||
{
|
||||
throw StatementException(_rStmt, "SQLBindCol()");
|
||||
@ -598,11 +598,11 @@ private:
|
||||
std::vector<T>& cache = RefAnyCast<std::vector<T> >(_values[pos]);
|
||||
cache.resize(length);
|
||||
|
||||
if (Utility::isError(SQLBindCol(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
valueType,
|
||||
(SQLPOINTER) &cache[0],
|
||||
(SQLINTEGER) dataSize,
|
||||
if (Utility::isError(SQLBindCol(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
valueType,
|
||||
(SQLPOINTER) &cache[0],
|
||||
(SQLINTEGER) dataSize,
|
||||
&_lenLengths[pos][0])))
|
||||
{
|
||||
throw StatementException(_rStmt, "SQLBindCol()");
|
||||
@ -616,18 +616,18 @@ private:
|
||||
poco_assert (DE_BOUND == _dataExtraction);
|
||||
poco_assert (pos < _values.size());
|
||||
|
||||
T* pCache = new T[size];
|
||||
T* pCache = new T[size];
|
||||
std::memset(pCache, 0, size);
|
||||
|
||||
_values[pos] = Any(pCache);
|
||||
_lengths[pos] = (SQLLEN) size;
|
||||
_varLengthArrays.insert(IndexMap::value_type(pos, dt));
|
||||
|
||||
if (Utility::isError(SQLBindCol(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
valueType,
|
||||
(SQLPOINTER) pCache,
|
||||
(SQLINTEGER) size*sizeof(T),
|
||||
if (Utility::isError(SQLBindCol(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
valueType,
|
||||
(SQLPOINTER) pCache,
|
||||
(SQLINTEGER) size*sizeof(T),
|
||||
&_lengths[pos])))
|
||||
{
|
||||
throw StatementException(_rStmt, "SQLBindCol()");
|
||||
@ -650,11 +650,11 @@ private:
|
||||
_lenLengths[pos].resize(length);
|
||||
_varLengthArrays.insert(IndexMap::value_type(pos, DT));
|
||||
|
||||
if (Utility::isError(SQLBindCol(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
valueType,
|
||||
(SQLPOINTER) pArray,
|
||||
(SQLINTEGER) size,
|
||||
if (Utility::isError(SQLBindCol(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
valueType,
|
||||
(SQLPOINTER) pArray,
|
||||
(SQLINTEGER) size,
|
||||
&_lenLengths[pos][0])))
|
||||
{
|
||||
throw StatementException(_rStmt, "SQLBindCol()");
|
||||
|
@ -53,15 +53,15 @@ public:
|
||||
|
||||
SessionImpl(const std::string& connect,
|
||||
std::size_t loginTimeout,
|
||||
std::size_t maxFieldSize = ODBC_MAX_FIELD_SIZE,
|
||||
std::size_t maxFieldSize = ODBC_MAX_FIELD_SIZE,
|
||||
bool autoBind = true,
|
||||
bool autoExtract = true);
|
||||
/// Creates the SessionImpl. Opens a connection to the database.
|
||||
/// Throws NotConnectedException if connection was not successful.
|
||||
|
||||
//@ deprecated
|
||||
SessionImpl(const std::string& connect,
|
||||
Poco::Any maxFieldSize = ODBC_MAX_FIELD_SIZE,
|
||||
SessionImpl(const std::string& connect,
|
||||
Poco::Any maxFieldSize = ODBC_MAX_FIELD_SIZE,
|
||||
bool enforceCapability=false,
|
||||
bool autoBind = true,
|
||||
bool autoExtract = true);
|
||||
|
@ -124,8 +124,8 @@ private:
|
||||
void fillCTypes();
|
||||
void fillSQLTypes();
|
||||
|
||||
DataTypeMap _cDataTypes;
|
||||
DataTypeMap _sqlDataTypes;
|
||||
DataTypeMap _cDataTypes;
|
||||
DataTypeMap _sqlDataTypes;
|
||||
TypeInfoVec _typeInfo;
|
||||
CppTypeInfoMap _cppDataTypes;
|
||||
SQLHDBC* _pHDBC;
|
||||
|
@ -27,7 +27,7 @@ inline void makeUTF16(SQLCHAR* pSQLChar, SQLINTEGER length, std::wstring& target
|
||||
/// Utility function for conversion from UTF-8 to UTF-16
|
||||
{
|
||||
int len = length;
|
||||
if (SQL_NTS == len)
|
||||
if (SQL_NTS == len)
|
||||
len = (int) std::strlen((const char *) pSQLChar);
|
||||
|
||||
UnicodeConverter::toUTF16((const char *) pSQLChar, len, target);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user