Merge branch 'poco-1.10.1' into devel

This commit is contained in:
Günter Obiltschnig
2020-02-08 20:44:46 +01:00
16 changed files with 423 additions and 269 deletions

View File

@@ -3,18 +3,9 @@ language: cpp
cache: cache:
- apt - apt
before_install:
# we need a recent version of CMake
# linux prereqisite packages
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then wget --no-check-certificate https://www.cmake.org/files/v3.5/cmake-3.5.1-Linux-x86_64.tar.gz; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then tar -xzvf cmake-3.5.1-Linux-x86_64.tar.gz; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then export PATH=$PWD/cmake-3.5.1-Linux-x86_64/bin:$PATH; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get update -qq; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -qq -y libssl-dev unixodbc-dev libmysqlclient-dev g++-arm-linux-gnueabi g++-arm-linux-gnueabihf clang-3.5 libc++-dev ninja-build sloccount cppcheck; fi
services: services:
- mongodb - mongodb
- redis-server - redis
- postgresql - postgresql
- mysql - mysql
@@ -28,15 +19,12 @@ notifications:
slack: slack:
secure: "EKysuMlTU3Uv5XFX+zuwHK/ej4wtD8+UjO5xvchCFMkRgM0V3rERVT1rV6NocNBH4hjTcvue9DEKdWAtqdDh06vTOHGKdnZ/e204jA38HfcIA0SPVbQXzjckQXALvKl51OPOmGuI7Feo4wyohzUyGoDLo1bom02xqDfC3caQB5Q=" secure: "EKysuMlTU3Uv5XFX+zuwHK/ej4wtD8+UjO5xvchCFMkRgM0V3rERVT1rV6NocNBH4hjTcvue9DEKdWAtqdDh06vTOHGKdnZ/e204jA38HfcIA0SPVbQXzjckQXALvKl51OPOmGuI7Feo4wyohzUyGoDLo1bom02xqDfC3caQB5Q="
env: jobs:
global: TEST_NAME=""
before_script:
- echo ${TEST_NAME}
matrix:
include: include:
- env: TEST_NAME="android API level 19" - name: Android (API level 19)
os: linux
dist: bionic
arch: amd64
addons: addons:
apt: apt:
packages: packages:
@@ -65,7 +53,10 @@ matrix:
/opt/android-sdk/cmake/3.10.2.4988404/bin/cmake --build cmake-build --target all #&& /opt/android-sdk/cmake/3.10.2.4988404/bin/cmake --build cmake-build --target all #&&
#cd cmake-build && travis_wait 30 /opt/android-sdk/cmake/3.10.2.4988404/bin/ctest -E Foundation --output-on-failure FIXME Android emulator hangs #cd cmake-build && travis_wait 30 /opt/android-sdk/cmake/3.10.2.4988404/bin/ctest -E Foundation --output-on-failure FIXME Android emulator hangs
- env: TEST_NAME="android API level 24 arm64-v8a" - name: Android (API level 24 arm64-v8a)
os: linux
dist: bionic
arch: amd64
addons: addons:
apt: apt:
packages: packages:
@@ -94,50 +85,166 @@ matrix:
/opt/android-sdk/cmake/3.10.2.4988404/bin/cmake --build cmake-build --target all #&& /opt/android-sdk/cmake/3.10.2.4988404/bin/cmake --build cmake-build --target all #&&
#cd cmake-build && travis_wait 30 /opt/android-sdk/cmake/3.10.2.4988404/bin/ctest -E Foundation --output-on-failure FIXME Android emulator hangs #cd cmake-build && travis_wait 30 /opt/android-sdk/cmake/3.10.2.4988404/bin/ctest -E Foundation --output-on-failure FIXME Android emulator hangs
- env: TEST_NAME="clang (make)" - name: Linux (clang, make)
os: linux
dist: bionic
arch: amd64
addons:
apt:
packages:
- libssl-dev
- unixodbc-dev
- libmysqlclient-dev
compiler: clang compiler: clang
script: script:
- ./configure --everything --omit=PDF --config=Linux-clang && make all -s -j2 && sudo make install - ./configure --everything --omit=PDF --config=Linux-clang && make all -s -j2 && sudo make install
- sudo -s ./travis/runtests.sh - sudo -s ./travis/runtests.sh
# - env: TEST_NAME="arm-linux-gnueabi- (make)" - name: Linux (gcc, make)
# script: os: linux
# - ./configure --omit=PDF,Data/ODBC,Data/MySQL,Crypto,NetSSL,PageCompiler && make all -s -j2 CROSS_COMPILE=arm-linux-gnueabi- POCO_TARGET_OSARCH=armv7l dist: bionic
arch: amd64
- env: TEST_NAME="gcc-5.4.0 (CMake)" addons:
apt:
packages:
- libssl-dev
- unixodbc-dev
- libmysqlclient-dev
compiler: gcc compiler: gcc
script: script:
- cmake -H. -Bcmake-build -GNinja -DENABLE_PDF=OFF -DENABLE_TESTS=ON && cmake --build cmake-build --target all && cd cmake-build && sudo -s PWD=`pwd` PATH=$PWD/cmake-3.5.1-Linux-x86_64/bin:$PATH ctest --output-on-failure -E "(DataMySQL)|(DataODBC)" - ./configure --everything --omit=PDF && make all -s -j2 && sudo make install
- sudo -s ./travis/runtests.sh
- env: TEST_NAME="clang (CMake)" - name: Linux (gcc, make, arm64)
compiler: clang os: linux
dist: bionic
arch: arm64
addons:
apt:
packages:
- libssl-dev
- libmysqlclient-dev
compiler: gcc
script:
# skip some libs due to build timeout
- ./configure --everything --omit=PDF,Data/ODBC,Data/PostgreSQL,MongoDB,Redis && make all -s -j2 && sudo make install
- sudo -s ./travis/runtests.sh
- name: Linux (gcc, make, ppc64le)
os: linux
dist: bionic
arch: ppc64le
addons:
apt:
packages:
- libssl-dev
- unixodbc-dev
- libmysqlclient-dev
compiler: gcc
script:
- ./configure --everything --omit=PDF,Redis,MongoDB && make all -s -j2 && sudo make install
- sudo -s ./travis/runtests.sh
- name: Linux (gcc, make, s390x)
os: linux
dist: bionic
arch: s390x
addons:
apt:
packages:
- libssl-dev
- unixodbc-dev
- libmysqlclient-dev
compiler: gcc
script:
- ./configure --everything --omit=PDF && make all -s -j2 && sudo make install
- sudo -s ./travis/runtests.sh
- name: macOS (clang, make)
os: osx
osx_image: xcode11.3
addons:
homebrew:
packages:
- openssl
- mysql-client
script:
- ./configure --everything --omit=PDF,Data/ODBC,Data/PostgreSQL && make all -s -j2 && sudo make install
- sudo -s ./travis/runtests.sh
- name: Linux (gcc, cmake)
os: linux
dist: bionic
arch: amd64
compiler: gcc
addons:
apt:
packages:
- cmake
- ninja-build
- libssl-dev
- unixodbc-dev
- libmysqlclient-dev
script: script:
- cmake -H. -Bcmake-build -GNinja -DENABLE_PDF=OFF -DENABLE_TESTS=ON && cmake --build cmake-build --target all && cd cmake-build && sudo -s PWD=`pwd` PATH=$PWD/cmake-3.5.1-Linux-x86_64/bin:$PATH ctest --output-on-failure -E "(DataMySQL)|(DataODBC)" - cmake -H. -Bcmake-build -GNinja -DENABLE_PDF=OFF -DENABLE_TESTS=ON && cmake --build cmake-build --target all && cd cmake-build && sudo -s PWD=`pwd` PATH=$PWD/cmake-3.5.1-Linux-x86_64/bin:$PATH ctest --output-on-failure -E "(DataMySQL)|(DataODBC)"
- env: TEST_NAME="arm-linux-gnueabi-g++ (CMake)" - name: Linux (clang, cmake)
os: linux
dist: bionic
arch: amd64
compiler: clang
addons:
apt:
packages:
- cmake
- ninja-build
- libssl-dev
- unixodbc-dev
- libmysqlclient-dev
script:
- cmake -H. -Bcmake-build -GNinja -DENABLE_PDF=OFF -DENABLE_TESTS=ON && cmake --build cmake-build --target all && cd cmake-build && sudo -s PWD=`pwd` PATH=$PWD/cmake-3.5.1-Linux-x86_64/bin:$PATH ctest --output-on-failure -E "(DataMySQL)|(DataODBC)"
- name: Linux cross (arm-linux-gnueabi-g++, cmake)
os: linux
dist: bionic
arch: amd64
addons:
apt:
packages:
- cmake
- ninja-build
- libssl-dev
- unixodbc-dev
- libmysqlclient-dev
- g++-arm-linux-gnueabi
script: script:
- export CC="arm-linux-gnueabi-gcc" - export CC="arm-linux-gnueabi-gcc"
- export CXX="arm-linux-gnueabi-g++" - export CXX="arm-linux-gnueabi-g++"
- cmake -H. -Bcmake-build -GNinja -DENABLE_PDF=OFF -DENABLE_NETSSL=OFF -DENABLE_CRYPTO=OFF -DENABLE_JWT=OFF -DENABLE_TESTS=ON && cmake --build cmake-build --target all - cmake -H. -Bcmake-build -GNinja -DENABLE_PDF=OFF -DENABLE_NETSSL=OFF -DENABLE_CRYPTO=OFF -DENABLE_JWT=OFF -DENABLE_TESTS=ON && cmake --build cmake-build --target all
- env: TEST_NAME="arm-linux-gnueabihf-g++ (CMake)" - name: Linux cross (arm-linux-gnueabihf-g++, cmake)
os: linux
dist: bionic
arch: amd64
addons:
apt:
packages:
- cmake
- ninja-build
- libssl-dev
- unixodbc-dev
- libmysqlclient-dev
- g++-arm-linux-gnueabihf
script: script:
- export CC="arm-linux-gnueabihf-gcc" - export CC="arm-linux-gnueabihf-gcc"
- export CXX="arm-linux-gnueabihf-g++" - export CXX="arm-linux-gnueabihf-g++"
- cmake -H. -Bcmake-build -GNinja -DENABLE_PDF=OFF -DENABLE_NETSSL=OFF -DENABLE_CRYPTO=OFF -DENABLE_JWT=OFF -DENABLE_TESTS=ON && cmake --build cmake-build --target all - cmake -H. -Bcmake-build -GNinja -DENABLE_PDF=OFF -DENABLE_NETSSL=OFF -DENABLE_CRYPTO=OFF -DENABLE_JWT=OFF -DENABLE_TESTS=ON && cmake --build cmake-build --target all
# TODO osx build
# TODO run test suite
# script:
# - ./configure && make all -s -j2
# - sudo ifconfig -a
# - sudo ifconfig venet0 multicast
# - sudo ifconfig -a
# - export POCO_BASE=`pwd`
# - sudo -E build/script/runtests.sh
# build documentation and release # build documentation and release
- env: TEST_NAME="documentation & release" - name: Documentation & Release
os: linux
dist: bionic
arch: amd64
compiler: clang compiler: clang
script: script:
- . env.sh && mkdoc all && mkrel all - . env.sh && mkdoc all && mkrel all
@@ -145,21 +252,44 @@ matrix:
# QA jobs for code analytics and metrics # QA jobs for code analytics and metrics
# static code analysis with cppcheck (we can add --enable=all later) # static code analysis with cppcheck (we can add --enable=all later)
- env: TEST_NAME="cppcheck" - name: CppCheck
os: linux
dist: bionic
arch: amd64
addons:
apt:
packages:
- cppcheck
script: cppcheck --force --quiet --inline-suppr -j2 -iData/SQLite/src/sqlite3.c . script: cppcheck --force --quiet --inline-suppr -j2 -iData/SQLite/src/sqlite3.c .
# search for TODO within source tree # search for TODO within source tree
- env: TEST_NAME="TODO" - name: TODO
os: linux
dist: bionic
arch: amd64
script: grep -r TODO * script: grep -r TODO *
# search for FIXME within source tree # search for FIXME within source tree
- env: TEST_NAME="FIXME" - name: FIXME
os: linux
dist: bionic
arch: amd64
script: grep -r FIXME * script: grep -r FIXME *
# search for HACK within source tree # search for HACK within source tree
- env: TEST_NAME="HACK" - name: HACK
os: linux
dist: bionic
arch: amd64
script: grep -r HACK * script: grep -r HACK *
# some statistics about the code base # some statistics about the code base
- env: TEST_NAME="sloccount" - name: Sloccount
os: linux
dist: bionic
arch: amd64
addons:
apt:
packages:
- sloccount
script: sloccount . script: sloccount .

View File

@@ -11,6 +11,9 @@ Release 1.10.1 (2020-02-10)
- GH #2791: allow pre-allocation of the buffer in Poco::LogStreamBuf. - GH #2791: allow pre-allocation of the buffer in Poco::LogStreamBuf.
- GH #2816: Modernise TLS configuration - GH #2816: Modernise TLS configuration
- GH #2818: Add getSpecifiedPort() method in Poco::URI. - GH #2818: Add getSpecifiedPort() method in Poco::URI.
- GH #2909: Test failures on s390x architecture with 1.10.0
- GH #2911: Poco::UTF16Encoding and Poco::UTF32Encoding byte order conversion bug
- GH #2912: Poco::SHA2Engine computes incorrect hash on big-endian systems
- MySQL: resetting the session when putting it back into a SessionPool is now optional - MySQL: resetting the session when putting it back into a SessionPool is now optional
(and disabled by default) due to a bug in MySQL messing up the character encoding when doing so. (and disabled by default) due to a bug in MySQL messing up the character encoding when doing so.
- Poco::AutoPtr and Poco::SharedPtr now support comparison with nullptr. - Poco::AutoPtr and Poco::SharedPtr now support comparison with nullptr.

View File

@@ -46,7 +46,7 @@ TextTestResult::TextTestResult(const std::string& ignore):
ifs.close(); ifs.close();
} }
} }
catch (std::exception e) catch (std::exception& e)
{ {
std::cout << e.what() << std::endl; std::cout << e.what() << std::endl;
} }
@@ -147,7 +147,7 @@ void TextTestResult::addFailure(Test* test, CppUnitException* e)
void TextTestResult::startTest(Test* test) void TextTestResult::startTest(Test* test)
{ {
TestResult::startTest(test); TestResult::startTest(test);
_ostr << "\n" << shortName(test->toString()) << ": "; _ostr << "\n" << shortName(test->toString()) << ": " << std::flush;
} }

View File

@@ -47,7 +47,7 @@ public:
/// Connection string format: /// Connection string format:
/// <str> == <assignment> | <assignment> ';' <str> /// <str> == <assignment> | <assignment> ';' <str>
/// <assignment> == <name> '=' <value> /// <assignment> == <name> '=' <value>
/// <name> == 'host' | 'port' | 'user' | 'password' | 'db' | 'compress' | 'auto-reconnect' | 'reset' /// <name> == 'host' | 'port' | 'user' | 'password' | 'db' | 'compress' | 'auto-reconnect' | 'reset' | 'fail-readonly'
/// <value> == [~;]* /// <value> == [~;]*
/// ///
/// The following settings are supported: /// The following settings are supported:
@@ -61,6 +61,9 @@ public:
/// - character-set: connection character set (default: utf8) /// - character-set: connection character set (default: utf8)
/// - reset: reset connection when returned to SessionPool by calling /// - reset: reset connection when returned to SessionPool by calling
/// mysql_reset_connection(). /// mysql_reset_connection().
/// - fail-readonly: if set to true, the session will fail
/// if the database becomes read-only. This corresponds to
/// setFailIfInnoReadOnly(true).
/// ///
/// Warning: Due to a bug in MySQL, resetting the connection with mysql_reset_connection() /// Warning: Due to a bug in MySQL, resetting the connection with mysql_reset_connection()
/// could change the character encoding used for the connection. Therefore the /// could change the character encoding used for the connection. Therefore the

View File

@@ -92,6 +92,7 @@ void SessionImpl::open(const std::string& connect)
options["secure-auth"] = ""; options["secure-auth"] = "";
options["character-set"] = "utf8"; options["character-set"] = "utf8";
options["reset"] = ""; options["reset"] = "";
options["fail-readonly"] = "";
const std::string& connString = connectionString(); const std::string& connString = connectionString();
for (std::string::const_iterator start = connString.begin();;) for (std::string::const_iterator start = connString.begin();;)
@@ -153,6 +154,13 @@ void SessionImpl::open(const std::string& connect)
else if (!options["reset"].empty()) else if (!options["reset"].empty())
throw MySQLException("create session: specify correct reset option (true or false)"); throw MySQLException("create session: specify correct reset option (true or false)");
if (options["fail-readonly"] == "true")
_failIfInnoReadOnly = true;
else if (options["fail-readonly"] == "false")
_failIfInnoReadOnly = false;
else if (!options["fail-readonly"].empty())
throw MySQLException("create session: specify correct fail-readonly option (true or false)");
// Real connect // Real connect
_handle.connect(options["host"].c_str(), _handle.connect(options["host"].c_str(),
options["user"].c_str(), options["user"].c_str(),

View File

@@ -103,7 +103,7 @@ public:
void bind(std::size_t pos, const Poco::Int16& val, Direction dir); void bind(std::size_t pos, const Poco::Int16& val, Direction dir);
/// Binds an Int16. /// Binds an Int16.
void bind(std::size_t pos, const std::vector<Poco::Int16>& val, Direction dir); void bind(std::size_t pos, const std::vector<Poco::Int16>& val, Direction dir);
/// Binds an Int16 vector. /// Binds an Int16 vector.
@@ -344,7 +344,7 @@ public:
/// Returns bound data size for parameter at specified position. /// Returns bound data size for parameter at specified position.
void synchronize(); void synchronize();
/// Transfers the results of non-POD outbound parameters from internal /// Transfers the results of non-POD outbound parameters from internal
/// holders back into the externally supplied buffers. /// holders back into the externally supplied buffers.
void reset(); void reset();
@@ -375,7 +375,7 @@ private:
/// Sets the description field for the parameter, if needed. /// Sets the description field for the parameter, if needed.
void bind(std::size_t pos, const char* const& pVal, Direction dir); void bind(std::size_t pos, const char* const& pVal, Direction dir);
/// Binds a const char ptr. /// Binds a const char ptr.
/// This is a private no-op in this implementation /// This is a private no-op in this implementation
/// due to security risk. /// due to security risk.
@@ -392,11 +392,11 @@ private:
_lengthIndicator.push_back(0); _lengthIndicator.push_back(0);
if (Utility::isError(SQLBindParameter(_rStmt, if (Utility::isError(SQLBindParameter(_rStmt,
(SQLUSMALLINT) pos + 1, (SQLUSMALLINT) pos + 1,
toODBCDirection(dir), toODBCDirection(dir),
cDataType, cDataType,
Utility::sqlDataType(cDataType), Utility::sqlDataType(cDataType),
colSize, colSize,
decDigits, decDigits,
(SQLPOINTER) &val, 0, 0))) (SQLPOINTER) &val, 0, 0)))
@@ -413,7 +413,7 @@ private:
SQLPOINTER pVal = (SQLPOINTER) val.rawContent(); SQLPOINTER pVal = (SQLPOINTER) val.rawContent();
SQLINTEGER size = (SQLINTEGER) val.size(); SQLINTEGER size = (SQLINTEGER) val.size();
_inParams.insert(ParamMap::value_type(pVal, size)); _inParams.insert(ParamMap::value_type(pVal, size));
SQLLEN* pLenIn = new SQLLEN; SQLLEN* pLenIn = new SQLLEN;
@@ -424,15 +424,15 @@ private:
_lengthIndicator.push_back(pLenIn); _lengthIndicator.push_back(pLenIn);
if (Utility::isError(SQLBindParameter(_rStmt, if (Utility::isError(SQLBindParameter(_rStmt,
(SQLUSMALLINT) pos + 1, (SQLUSMALLINT) pos + 1,
SQL_PARAM_INPUT, SQL_PARAM_INPUT,
SQL_C_BINARY, SQL_C_BINARY,
SQL_LONGVARBINARY, SQL_LONGVARBINARY,
(SQLUINTEGER) size, (SQLUINTEGER) size,
0, 0,
pVal, pVal,
(SQLINTEGER) size, (SQLINTEGER) size,
_lengthIndicator.back()))) _lengthIndicator.back())))
{ {
throw StatementException(_rStmt, "SQLBindParameter(LOB)"); throw StatementException(_rStmt, "SQLBindParameter(LOB)");
@@ -457,15 +457,15 @@ private:
_vecLengthIndicator[pos] = new LengthVec(length); _vecLengthIndicator[pos] = new LengthVec(length);
} }
if (Utility::isError(SQLBindParameter(_rStmt, if (Utility::isError(SQLBindParameter(_rStmt,
(SQLUSMALLINT) pos + 1, (SQLUSMALLINT) pos + 1,
toODBCDirection(dir), toODBCDirection(dir),
cDataType, cDataType,
Utility::sqlDataType(cDataType), Utility::sqlDataType(cDataType),
colSize, colSize,
decDigits, decDigits,
(SQLPOINTER) &val[0], (SQLPOINTER) &val[0],
0, 0,
&(*_vecLengthIndicator[pos])[0]))) &(*_vecLengthIndicator[pos])[0])))
{ {
throw StatementException(_rStmt, "SQLBindParameter()"); throw StatementException(_rStmt, "SQLBindParameter()");
@@ -518,15 +518,15 @@ private:
typename C::const_iterator end = val.end(); typename C::const_iterator end = val.end();
for (int i = 0; it != end; ++it, ++i) _boolPtrs[pos][i] = *it; for (int i = 0; it != end; ++it, ++i) _boolPtrs[pos][i] = *it;
if (Utility::isError(SQLBindParameter(_rStmt, if (Utility::isError(SQLBindParameter(_rStmt,
(SQLUSMALLINT) pos + 1, (SQLUSMALLINT) pos + 1,
toODBCDirection(dir), toODBCDirection(dir),
cDataType, cDataType,
Utility::sqlDataType(cDataType), Utility::sqlDataType(cDataType),
colSize, colSize,
decDigits, decDigits,
(SQLPOINTER) &_boolPtrs[pos][0], (SQLPOINTER) &_boolPtrs[pos][0],
0, 0,
&(*_vecLengthIndicator[pos])[0]))) &(*_vecLengthIndicator[pos])[0])))
{ {
throw StatementException(_rStmt, "SQLBindParameter()"); throw StatementException(_rStmt, "SQLBindParameter()");
@@ -571,7 +571,7 @@ private:
_charPtrs.resize(pos + 1, 0); _charPtrs.resize(pos + 1, 0);
_charPtrs[pos] = (char*) std::calloc(val.size() * size, sizeof(char)); _charPtrs[pos] = (char*) std::calloc(val.size() * size, sizeof(char));
std::size_t strSize; std::size_t strSize;
std::size_t offset = 0; std::size_t offset = 0;
typename C::const_iterator it = val.begin(); typename C::const_iterator it = val.begin();
@@ -579,21 +579,21 @@ private:
for (; it != end; ++it) for (; it != end; ++it)
{ {
strSize = it->size(); strSize = it->size();
if (strSize > size) if (strSize > size)
throw LengthExceededException("SQLBindParameter(std::vector<std::string>)"); throw LengthExceededException("SQLBindParameter(std::vector<std::string>)");
std::memcpy(_charPtrs[pos] + offset, it->c_str(), strSize); std::memcpy(_charPtrs[pos] + offset, it->c_str(), strSize);
offset += size; offset += size;
} }
if (Utility::isError(SQLBindParameter(_rStmt, if (Utility::isError(SQLBindParameter(_rStmt,
(SQLUSMALLINT) pos + 1, (SQLUSMALLINT) pos + 1,
toODBCDirection(dir), toODBCDirection(dir),
SQL_C_CHAR, SQL_C_CHAR,
SQL_LONGVARCHAR, SQL_LONGVARCHAR,
(SQLUINTEGER) size - 1, (SQLUINTEGER) size - 1,
0, 0,
_charPtrs[pos], _charPtrs[pos],
(SQLINTEGER) size, (SQLINTEGER) size,
&(*_vecLengthIndicator[pos])[0]))) &(*_vecLengthIndicator[pos])[0])))
{ {
throw StatementException(_rStmt, "SQLBindParameter(std::vector<std::string>)"); throw StatementException(_rStmt, "SQLBindParameter(std::vector<std::string>)");
@@ -696,7 +696,7 @@ private:
std::vector<SQLLEN>::iterator lIt = _vecLengthIndicator[pos]->begin(); std::vector<SQLLEN>::iterator lIt = _vecLengthIndicator[pos]->begin();
std::vector<SQLLEN>::iterator lEnd = _vecLengthIndicator[pos]->end(); std::vector<SQLLEN>::iterator lEnd = _vecLengthIndicator[pos]->end();
typename C::const_iterator cIt = val.begin(); typename C::const_iterator cIt = val.begin();
for (; lIt != lEnd; ++lIt, ++cIt) for (; lIt != lEnd; ++lIt, ++cIt)
{ {
SQLLEN sz = static_cast<SQLLEN>(cIt->size()); SQLLEN sz = static_cast<SQLLEN>(cIt->size());
if (sz > size) size = static_cast<SQLINTEGER>(sz); if (sz > size) size = static_cast<SQLINTEGER>(sz);
@@ -716,21 +716,21 @@ private:
for (; cIt != cEnd; ++cIt) for (; cIt != cEnd; ++cIt)
{ {
blobSize = cIt->size(); blobSize = cIt->size();
if (blobSize > size) if (blobSize > size)
throw LengthExceededException("SQLBindParameter(std::vector<BLOB>)"); throw LengthExceededException("SQLBindParameter(std::vector<BLOB>)");
std::memcpy(_charPtrs[pos] + offset, cIt->rawContent(), blobSize * sizeof(CharType)); std::memcpy(_charPtrs[pos] + offset, cIt->rawContent(), blobSize * sizeof(CharType));
offset += size; offset += size;
} }
if (Utility::isError(SQLBindParameter(_rStmt, if (Utility::isError(SQLBindParameter(_rStmt,
(SQLUSMALLINT) pos + 1, (SQLUSMALLINT) pos + 1,
SQL_PARAM_INPUT, SQL_PARAM_INPUT,
SQL_C_BINARY, SQL_C_BINARY,
SQL_LONGVARBINARY, SQL_LONGVARBINARY,
(SQLUINTEGER) size, (SQLUINTEGER) size,
0, 0,
_charPtrs[pos], _charPtrs[pos],
(SQLINTEGER) size, (SQLINTEGER) size,
&(*_vecLengthIndicator[pos])[0]))) &(*_vecLengthIndicator[pos])[0])))
{ {
throw StatementException(_rStmt, "SQLBindParameter(std::vector<BLOB>)"); throw StatementException(_rStmt, "SQLBindParameter(std::vector<BLOB>)");
@@ -753,8 +753,6 @@ private:
setParamSetSize(length); setParamSetSize(length);
SQLINTEGER size = (SQLINTEGER) sizeof(SQL_DATE_STRUCT);
if (_vecLengthIndicator.size() <= pos) if (_vecLengthIndicator.size() <= pos)
{ {
_vecLengthIndicator.resize(pos + 1, 0); _vecLengthIndicator.resize(pos + 1, 0);
@@ -773,15 +771,15 @@ private:
SQLSMALLINT decDigits = 0; SQLSMALLINT decDigits = 0;
getColSizeAndPrecision(pos, SQL_TYPE_DATE, colSize, decDigits); getColSizeAndPrecision(pos, SQL_TYPE_DATE, colSize, decDigits);
if (Utility::isError(SQLBindParameter(_rStmt, if (Utility::isError(SQLBindParameter(_rStmt,
(SQLUSMALLINT) pos + 1, (SQLUSMALLINT) pos + 1,
toODBCDirection(dir), toODBCDirection(dir),
SQL_C_TYPE_DATE, SQL_C_TYPE_DATE,
SQL_TYPE_DATE, SQL_TYPE_DATE,
colSize, colSize,
decDigits, decDigits,
(SQLPOINTER) &(*_dateVecVec[pos])[0], (SQLPOINTER) &(*_dateVecVec[pos])[0],
0, 0,
&(*_vecLengthIndicator[pos])[0]))) &(*_vecLengthIndicator[pos])[0])))
{ {
throw StatementException(_rStmt, "SQLBindParameter(Date[])"); throw StatementException(_rStmt, "SQLBindParameter(Date[])");
@@ -803,8 +801,6 @@ private:
setParamSetSize(val.size()); setParamSetSize(val.size());
SQLINTEGER size = (SQLINTEGER) sizeof(SQL_TIME_STRUCT);
if (_vecLengthIndicator.size() <= pos) if (_vecLengthIndicator.size() <= pos)
{ {
_vecLengthIndicator.resize(pos + 1, 0); _vecLengthIndicator.resize(pos + 1, 0);
@@ -823,15 +819,15 @@ private:
SQLSMALLINT decDigits = 0; SQLSMALLINT decDigits = 0;
getColSizeAndPrecision(pos, SQL_TYPE_TIME, colSize, decDigits); getColSizeAndPrecision(pos, SQL_TYPE_TIME, colSize, decDigits);
if (Utility::isError(SQLBindParameter(_rStmt, if (Utility::isError(SQLBindParameter(_rStmt,
(SQLUSMALLINT) pos + 1, (SQLUSMALLINT) pos + 1,
toODBCDirection(dir), toODBCDirection(dir),
SQL_C_TYPE_TIME, SQL_C_TYPE_TIME,
SQL_TYPE_TIME, SQL_TYPE_TIME,
colSize, colSize,
decDigits, decDigits,
(SQLPOINTER) &(*_timeVecVec[pos])[0], (SQLPOINTER) &(*_timeVecVec[pos])[0],
0, 0,
&(*_vecLengthIndicator[pos])[0]))) &(*_vecLengthIndicator[pos])[0])))
{ {
throw StatementException(_rStmt, "SQLBindParameter(Time[])"); throw StatementException(_rStmt, "SQLBindParameter(Time[])");
@@ -854,8 +850,6 @@ private:
setParamSetSize(length); setParamSetSize(length);
SQLINTEGER size = (SQLINTEGER) sizeof(SQL_TIMESTAMP_STRUCT);
if (_vecLengthIndicator.size() <= pos) if (_vecLengthIndicator.size() <= pos)
{ {
_vecLengthIndicator.resize(pos + 1, 0); _vecLengthIndicator.resize(pos + 1, 0);
@@ -874,15 +868,15 @@ private:
SQLSMALLINT decDigits = 0; SQLSMALLINT decDigits = 0;
getColSizeAndPrecision(pos, SQL_TYPE_TIMESTAMP, colSize, decDigits); getColSizeAndPrecision(pos, SQL_TYPE_TIMESTAMP, colSize, decDigits);
if (Utility::isError(SQLBindParameter(_rStmt, if (Utility::isError(SQLBindParameter(_rStmt,
(SQLUSMALLINT) pos + 1, (SQLUSMALLINT) pos + 1,
toODBCDirection(dir), toODBCDirection(dir),
SQL_C_TYPE_TIMESTAMP, SQL_C_TYPE_TIMESTAMP,
SQL_TYPE_TIMESTAMP, SQL_TYPE_TIMESTAMP,
colSize, colSize,
decDigits, decDigits,
(SQLPOINTER) &(*_dateTimeVecVec[pos])[0], (SQLPOINTER) &(*_dateTimeVecVec[pos])[0],
0, 0,
&(*_vecLengthIndicator[pos])[0]))) &(*_vecLengthIndicator[pos])[0])))
{ {
throw StatementException(_rStmt, "SQLBindParameter(Time[])"); throw StatementException(_rStmt, "SQLBindParameter(Time[])");
@@ -905,8 +899,6 @@ private:
setParamSetSize(length); setParamSetSize(length);
SQLINTEGER size = SQL_NULL_DATA;
if (_vecLengthIndicator.size() <= pos) if (_vecLengthIndicator.size() <= pos)
{ {
_vecLengthIndicator.resize(pos + 1, 0); _vecLengthIndicator.resize(pos + 1, 0);
@@ -917,32 +909,32 @@ private:
SQLSMALLINT decDigits = 0; SQLSMALLINT decDigits = 0;
getColSizeAndPrecision(pos, SQL_C_STINYINT, colSize, decDigits); getColSizeAndPrecision(pos, SQL_C_STINYINT, colSize, decDigits);
if (Utility::isError(SQLBindParameter(_rStmt, if (Utility::isError(SQLBindParameter(_rStmt,
(SQLUSMALLINT) pos + 1, (SQLUSMALLINT) pos + 1,
SQL_PARAM_INPUT, SQL_PARAM_INPUT,
SQL_C_STINYINT, SQL_C_STINYINT,
Utility::sqlDataType(SQL_C_STINYINT), Utility::sqlDataType(SQL_C_STINYINT),
colSize, colSize,
decDigits, decDigits,
0, 0,
0, 0,
&(*_vecLengthIndicator[pos])[0]))) &(*_vecLengthIndicator[pos])[0])))
{ {
throw StatementException(_rStmt, "SQLBindParameter()"); throw StatementException(_rStmt, "SQLBindParameter()");
} }
} }
void getColSizeAndPrecision(std::size_t pos, void getColSizeAndPrecision(std::size_t pos,
SQLSMALLINT cDataType, SQLSMALLINT cDataType,
SQLINTEGER& colSize, SQLINTEGER& colSize,
SQLSMALLINT& decDigits, SQLSMALLINT& decDigits,
std::size_t actualSize = 0); std::size_t actualSize = 0);
/// Used to retrieve column size and precision. /// Used to retrieve column size and precision.
/// Not all drivers cooperate with this inquiry under all circumstances /// Not all drivers cooperate with this inquiry under all circumstances
/// This function runs for query and stored procedure parameters (in and /// This function runs for query and stored procedure parameters (in and
/// out-bound). Some drivers, however, do not care about knowing this /// out-bound). Some drivers, however, do not care about knowing this
/// information to start with. For that reason, after all the attempts /// information to start with. For that reason, after all the attempts
/// to discover the required values are unsuccesfully exhausted, the values /// to discover the required values are unsuccesfully exhausted, the values
/// are both set to zero and no exception is thrown. /// are both set to zero and no exception is thrown.
/// However, if the colSize is succesfully retrieved and it is greater than /// However, if the colSize is succesfully retrieved and it is greater than
/// session-wide maximum allowed field size, LengthExceededException is thrown. /// session-wide maximum allowed field size, LengthExceededException is thrown.
@@ -953,7 +945,7 @@ private:
void getColumnOrParameterSize(std::size_t pos, SQLINTEGER& size); void getColumnOrParameterSize(std::size_t pos, SQLINTEGER& size);
/// Fills the column or parameter size into the 'size' argument. /// Fills the column or parameter size into the 'size' argument.
/// Does nothing if neither can be obtained from the driver, so /// Does nothing if neither can be obtained from the driver, so
/// size should be set to some default value prior to calling this /// size should be set to some default value prior to calling this
/// function in order to avoid undefined size value. /// function in order to avoid undefined size value.
void freeMemory(); void freeMemory();
@@ -962,9 +954,9 @@ private:
template<typename T> template<typename T>
void getMinValueSize(T& val, SQLINTEGER& size) void getMinValueSize(T& val, SQLINTEGER& size)
/// Some ODBC drivers return DB-wide maximum allowed size for variable size columns, /// Some ODBC drivers return DB-wide maximum allowed size for variable size columns,
/// rather than the allowed size for the actual column. In such cases, the length is /// rather than the allowed size for the actual column. In such cases, the length is
/// automatically resized to the maximum field size allowed by the session. /// automatically resized to the maximum field size allowed by the session.
/// This function, in order to prevent unnecessary memory allocation, does further /// This function, in order to prevent unnecessary memory allocation, does further
/// optimization, looking for the maximum length within supplied data container and /// optimization, looking for the maximum length within supplied data container and
/// uses the smaller of maximum found and maximum predefined data length. /// uses the smaller of maximum found and maximum predefined data length.
{ {
@@ -1000,7 +992,7 @@ private:
ParamMap _inParams; ParamMap _inParams;
ParamMap _outParams; ParamMap _outParams;
ParameterBinding _paramBinding; ParameterBinding _paramBinding;
DateMap _dates; DateMap _dates;
TimeMap _times; TimeMap _times;
TimestampMap _timestamps; TimestampMap _timestamps;

View File

@@ -2,14 +2,14 @@
// WebNotifier.cpp // WebNotifier.cpp
// //
// This sample demonstrates a combination of Data and Net libraries by // This sample demonstrates a combination of Data and Net libraries by
// creating a database, registering callbacks for insert/update events // creating a database, registering callbacks for insert/update events
// and sending database modifications to the web client through web socket. // and sending database modifications to the web client through web socket.
// Since callbacks are only registered for session, in order to see the // Since callbacks are only registered for session, in order to see the
// effects, database updates should be done through the shell provided by // effects, database updates should be done through the shell provided by
// this example. // this example.
// //
// This is only a demo. For production-grade a better web socket management // This is only a demo. For production-grade a better web socket management
// facility as well as persisting notification functionality (e.g. via // facility as well as persisting notification functionality (e.g. via
// triggers and external functions) should be used. // triggers and external functions) should be used.
// //
// Copyright (c) 2008, Applied Informatics Software Engineering GmbH. // Copyright (c) 2008, Applied Informatics Software Engineering GmbH.
@@ -128,7 +128,7 @@ public:
std::cout << std::endl << "WebSocket connection established." << std::endl << PROMPT; std::cout << std::endl << "WebSocket connection established." << std::endl << PROMPT;
char buffer[1024]; char buffer[1024];
int n, count = 0; int n;
do do
{ {
n = _pWS->receiveFrame(buffer, sizeof(buffer), _flags); n = _pWS->receiveFrame(buffer, sizeof(buffer), _flags);
@@ -184,7 +184,7 @@ public:
if (uri != "/favicon.ico") if (uri != "/favicon.ico")
std::cout << "Unknown URI: " << uri << std::endl; std::cout << "Unknown URI: " << uri << std::endl;
return 0; return 0;
} }
@@ -250,7 +250,7 @@ public:
_notifier.insert -= delegate(this, &DBEventHandler::onInsert); _notifier.insert -= delegate(this, &DBEventHandler::onInsert);
_notifier.update -= delegate(this, &DBEventHandler::onUpdate); _notifier.update -= delegate(this, &DBEventHandler::onUpdate);
} }
std::size_t execute(const std::string& sql) std::size_t execute(const std::string& sql)
/// Exectutes the SQL statement. /// Exectutes the SQL statement.
{ {

View File

@@ -151,52 +151,6 @@ static const unsigned char padding[128] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
temp2 = S642(a) + F640(a,b,c); \ temp2 = S642(a) + F640(a,b,c); \
d += temp1; h = temp1 + temp2; \ d += temp1; h = temp1 + temp2; \
} }
#ifdef POCO_ARCH_BIG_ENDIAN
#ifndef GET_UINT32
#define GET_UINT32(n,b,i) \
do { \
(n) = ( (Poco::UInt32) (b)[(i) ] ) \
| ( (Poco::UInt32) (b)[(i) + 1] << 8 ) \
| ( (Poco::UInt32) (b)[(i) + 2] << 16 ) \
| ( (Poco::UInt32) (b)[(i) + 3] << 24 ); \
} while( 0 )
#endif
#ifndef PUT_UINT32
#define PUT_UINT32(n,b,i) \
do { \
(b)[(i) ] = (unsigned char) ( (n) ); \
(b)[(i) + 1] = (unsigned char) ( (n) >> 8 ); \
(b)[(i) + 2] = (unsigned char) ( (n) >> 16 ); \
(b)[(i) + 3] = (unsigned char) ( (n) >> 24 ); \
} while( 0 )
#endif
#ifndef GET_UINT64
#define GET_UINT64(n,b,i) \
{ \
(n) = ( (Poco::UInt64) (b)[(i) ] ) \
| ( (Poco::UInt64) (b)[(i) + 1] << 8 ) \
| ( (Poco::UInt64) (b)[(i) + 2] << 16 ) \
| ( (Poco::UInt64) (b)[(i) + 3] << 24 ) \
| ( (Poco::UInt64) (b)[(i) + 4] << 32 ) \
| ( (Poco::UInt64) (b)[(i) + 5] << 40 ) \
| ( (Poco::UInt64) (b)[(i) + 6] << 48 ) \
| ( (Poco::UInt64) (b)[(i) + 7] << 56 ); \
}
#endif
#ifndef PUT_UINT64
#define PUT_UINT64(n,b,i) \
{ \
(b)[(i) ] = (unsigned char) ( (n) ); \
(b)[(i) + 1] = (unsigned char) ( (n) >> 8 ); \
(b)[(i) + 2] = (unsigned char) ( (n) >> 16 ); \
(b)[(i) + 3] = (unsigned char) ( (n) >> 24 ); \
(b)[(i) + 4] = (unsigned char) ( (n) >> 32 ); \
(b)[(i) + 5] = (unsigned char) ( (n) >> 40 ); \
(b)[(i) + 6] = (unsigned char) ( (n) >> 48 ); \
(b)[(i) + 7] = (unsigned char) ( (n) >> 56 ); \
}
#endif
#else
#ifndef GET_UINT32 #ifndef GET_UINT32
#define GET_UINT32(n,b,i) \ #define GET_UINT32(n,b,i) \
do { \ do { \
@@ -241,7 +195,6 @@ do { \
(b)[(i) + 7] = (unsigned char) ( (n) ); \ (b)[(i) + 7] = (unsigned char) ( (n) ); \
} }
#endif #endif
#endif
SHA2Engine::SHA2Engine(ALGORITHM algorithm): SHA2Engine::SHA2Engine(ALGORITHM algorithm):

View File

@@ -28,24 +28,24 @@ const char* UTF16Encoding::_names[] =
}; };
const TextEncoding::CharacterMap UTF16Encoding::_charMap = const TextEncoding::CharacterMap UTF16Encoding::_charMap =
{ {
/* 00 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* 00 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
/* 10 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* 10 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
/* 20 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* 20 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
/* 30 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* 30 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
/* 40 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* 40 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
/* 50 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* 50 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
/* 60 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* 60 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
/* 70 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* 70 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
/* 80 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* 80 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
/* 90 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* 90 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
/* a0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* a0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
/* b0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* b0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
/* c0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* c0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
/* d0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* d0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
/* e0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* e0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
/* f0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* f0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
}; };
@@ -54,13 +54,13 @@ UTF16Encoding::UTF16Encoding(ByteOrderType byteOrder)
setByteOrder(byteOrder); setByteOrder(byteOrder);
} }
UTF16Encoding::UTF16Encoding(int byteOrderMark) UTF16Encoding::UTF16Encoding(int byteOrderMark)
{ {
setByteOrder(byteOrderMark); setByteOrder(byteOrderMark);
} }
UTF16Encoding::~UTF16Encoding() UTF16Encoding::~UTF16Encoding()
{ {
} }
@@ -75,7 +75,7 @@ UTF16Encoding::ByteOrderType UTF16Encoding::getByteOrder() const
#endif #endif
} }
void UTF16Encoding::setByteOrder(ByteOrderType byteOrder) void UTF16Encoding::setByteOrder(ByteOrderType byteOrder)
{ {
#if defined(POCO_ARCH_BIG_ENDIAN) #if defined(POCO_ARCH_BIG_ENDIAN)
@@ -85,7 +85,7 @@ void UTF16Encoding::setByteOrder(ByteOrderType byteOrder)
#endif #endif
} }
void UTF16Encoding::setByteOrder(int byteOrderMark) void UTF16Encoding::setByteOrder(int byteOrderMark)
{ {
_flipBytes = byteOrderMark != 0xFEFF; _flipBytes = byteOrderMark != 0xFEFF;
@@ -124,7 +124,7 @@ int UTF16Encoding::convert(const unsigned char* bytes) const
if (_flipBytes) if (_flipBytes)
{ {
ByteOrder::flipBytes(uc); uc = ByteOrder::flipBytes(uc);
} }
if (uc >= 0xd800 && uc < 0xdc00) if (uc >= 0xd800 && uc < 0xdc00)
@@ -136,7 +136,7 @@ int UTF16Encoding::convert(const unsigned char* bytes) const
if (_flipBytes) if (_flipBytes)
{ {
ByteOrder::flipBytes(uc2); uc2 = ByteOrder::flipBytes(uc2);
} }
if (uc2 >= 0xdc00 && uc2 < 0xe000) if (uc2 >= 0xdc00 && uc2 < 0xe000)
{ {
@@ -201,8 +201,10 @@ int UTF16Encoding::queryConvert(const unsigned char* bytes, int length) const
unsigned char* p = (unsigned char*) &uc; unsigned char* p = (unsigned char*) &uc;
*p++ = *bytes++; *p++ = *bytes++;
*p++ = *bytes++; *p++ = *bytes++;
if (_flipBytes) if (_flipBytes)
ByteOrder::flipBytes(uc); {
uc = ByteOrder::flipBytes(uc);
}
if (uc >= 0xd800 && uc < 0xdc00) if (uc >= 0xd800 && uc < 0xdc00)
{ {
if (length >= 4) if (length >= 4)
@@ -211,8 +213,10 @@ int UTF16Encoding::queryConvert(const unsigned char* bytes, int length) const
p = (unsigned char*) &uc2; p = (unsigned char*) &uc2;
*p++ = *bytes++; *p++ = *bytes++;
*p++ = *bytes++; *p++ = *bytes++;
if (_flipBytes) if (_flipBytes)
ByteOrder::flipBytes(uc2); {
uc2 = ByteOrder::flipBytes(uc2);
}
if (uc2 >= 0xdc00 && uc < 0xe000) if (uc2 >= 0xdc00 && uc < 0xe000)
{ {
ret = ((uc & 0x3ff) << 10) + (uc2 & 0x3ff) + 0x10000; ret = ((uc & 0x3ff) << 10) + (uc2 & 0x3ff) + 0x10000;

View File

@@ -28,24 +28,24 @@ const char* UTF32Encoding::_names[] =
}; };
const TextEncoding::CharacterMap UTF32Encoding::_charMap = const TextEncoding::CharacterMap UTF32Encoding::_charMap =
{ {
/* 00 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* 00 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
/* 10 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* 10 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
/* 20 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* 20 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
/* 30 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* 30 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
/* 40 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* 40 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
/* 50 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* 50 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
/* 60 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* 60 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
/* 70 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* 70 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
/* 80 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* 80 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
/* 90 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* 90 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
/* a0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* a0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
/* b0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* b0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
/* c0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* c0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
/* d0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* d0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
/* e0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* e0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
/* f0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* f0 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
}; };
@@ -54,13 +54,13 @@ UTF32Encoding::UTF32Encoding(ByteOrderType byteOrder)
setByteOrder(byteOrder); setByteOrder(byteOrder);
} }
UTF32Encoding::UTF32Encoding(int byteOrderMark) UTF32Encoding::UTF32Encoding(int byteOrderMark)
{ {
setByteOrder(byteOrderMark); setByteOrder(byteOrderMark);
} }
UTF32Encoding::~UTF32Encoding() UTF32Encoding::~UTF32Encoding()
{ {
} }
@@ -75,7 +75,7 @@ UTF32Encoding::ByteOrderType UTF32Encoding::getByteOrder() const
#endif #endif
} }
void UTF32Encoding::setByteOrder(ByteOrderType byteOrder) void UTF32Encoding::setByteOrder(ByteOrderType byteOrder)
{ {
#if defined(POCO_ARCH_BIG_ENDIAN) #if defined(POCO_ARCH_BIG_ENDIAN)
@@ -85,7 +85,7 @@ void UTF32Encoding::setByteOrder(ByteOrderType byteOrder)
#endif #endif
} }
void UTF32Encoding::setByteOrder(int byteOrderMark) void UTF32Encoding::setByteOrder(int byteOrderMark)
{ {
_flipBytes = byteOrderMark != 0xFEFF; _flipBytes = byteOrderMark != 0xFEFF;
@@ -126,7 +126,7 @@ int UTF32Encoding::convert(const unsigned char* bytes) const
if (_flipBytes) if (_flipBytes)
{ {
ByteOrder::flipBytes(uc); uc = ByteOrder::flipBytes(uc);
} }
return uc; return uc;
@@ -160,8 +160,10 @@ int UTF32Encoding::queryConvert(const unsigned char* bytes, int length) const
*p++ = *bytes++; *p++ = *bytes++;
*p++ = *bytes++; *p++ = *bytes++;
*p++ = *bytes++; *p++ = *bytes++;
if (_flipBytes) if (_flipBytes)
ByteOrder::flipBytes(uc); {
uc = ByteOrder::flipBytes(uc);
}
return uc; return uc;
} }

View File

@@ -69,7 +69,7 @@ public:
/// ///
/// Releases the socket's SocketImpl and /// Releases the socket's SocketImpl and
/// attaches the SocketImpl from the other socket and /// attaches the SocketImpl from the other socket and
/// increments the reference count of the SocketImpl. /// increments the reference count of the SocketImpl.
void connect(const SocketAddress& address); void connect(const SocketAddress& address);
/// Restricts incoming and outgoing /// Restricts incoming and outgoing
@@ -81,7 +81,7 @@ public:
/// Bind a local address to the socket. /// Bind a local address to the socket.
/// ///
/// This is usually only done when establishing a server /// This is usually only done when establishing a server
/// socket. /// socket.
/// ///
/// If reuseAddress is true, sets the SO_REUSEADDR /// If reuseAddress is true, sets the SO_REUSEADDR
/// socket option. /// socket option.
@@ -92,7 +92,7 @@ public:
/// Bind a local address to the socket. /// Bind a local address to the socket.
/// ///
/// This is usually only done when establishing a server /// This is usually only done when establishing a server
/// socket. /// socket.
/// ///
/// If reuseAddress is true, sets the SO_REUSEADDR /// If reuseAddress is true, sets the SO_REUSEADDR
/// socket option. /// socket option.
@@ -108,6 +108,9 @@ public:
/// ///
/// Returns the number of bytes sent, which may be /// Returns the number of bytes sent, which may be
/// less than the number of bytes specified. /// less than the number of bytes specified.
///
/// The flags parameter can be used to pass system-defined flags
/// for send() like MSG_DONTROUTE.
int sendBytes(const SocketBufVec& buffer, int flags = 0); int sendBytes(const SocketBufVec& buffer, int flags = 0);
/// Sends the contents of the given buffers through /// Sends the contents of the given buffers through
@@ -115,22 +118,34 @@ public:
/// ///
/// Returns the number of bytes sent, which may be /// Returns the number of bytes sent, which may be
/// less than the number of bytes specified. /// less than the number of bytes specified.
///
/// The flags parameter can be used to pass system-defined flags
/// for send() like MSG_DONTROUTE.
int receiveBytes(void* buffer, int length, int flags = 0); int receiveBytes(void* buffer, int length, int flags = 0);
/// Receives data from the socket and stores it /// Receives data from the socket and stores it
/// in buffer. Up to length bytes are received. /// in buffer. Up to length bytes are received.
/// ///
/// Returns the number of bytes received. /// Returns the number of bytes received.
///
/// The flags parameter can be used to pass system-defined flags
/// for recv() like MSG_PEEK.
int receiveBytes(SocketBufVec& buffer, int flags = 0); int receiveBytes(SocketBufVec& buffer, int flags = 0);
/// Receives data from the socket and stores it in buffers. /// Receives data from the socket and stores it in buffers.
/// ///
/// Returns the number of bytes received. /// Returns the number of bytes received.
///
/// The flags parameter can be used to pass system-defined flags
/// for recv() like MSG_PEEK.
int receiveBytes(Poco::Buffer<char>& buffer, int flags = 0, const Poco::Timespan& timeout = 100000); int receiveBytes(Poco::Buffer<char>& buffer, int flags = 0, const Poco::Timespan& timeout = 100000);
/// Receives data from the socket and stores it in buffers. /// Receives data from the socket and stores it in buffers.
/// ///
/// Returns the number of bytes received. /// Returns the number of bytes received.
///
/// The flags parameter can be used to pass system-defined flags
/// for recv() like MSG_PEEK.
int sendTo(const void* buffer, int length, const SocketAddress& address, int flags = 0); int sendTo(const void* buffer, int length, const SocketAddress& address, int flags = 0);
/// Sends the contents of the given buffer through /// Sends the contents of the given buffer through
@@ -138,6 +153,9 @@ public:
/// ///
/// Returns the number of bytes sent, which may be /// Returns the number of bytes sent, which may be
/// less than the number of bytes specified. /// less than the number of bytes specified.
///
/// The flags parameter can be used to pass system-defined flags
/// for sendto() like MSG_DONTROUTE.
int sendTo(const SocketBufVec& buffers, const SocketAddress& address, int flags = 0); int sendTo(const SocketBufVec& buffers, const SocketAddress& address, int flags = 0);
/// Sends the contents of the given buffers through /// Sends the contents of the given buffers through
@@ -145,6 +163,9 @@ public:
/// ///
/// Returns the number of bytes sent, which may be /// Returns the number of bytes sent, which may be
/// less than the number of bytes specified. /// less than the number of bytes specified.
///
/// The flags parameter can be used to pass system-defined flags
/// for sendto() like MSG_DONTROUTE.
int receiveFrom(void* buffer, int length, SocketAddress& address, int flags = 0); int receiveFrom(void* buffer, int length, SocketAddress& address, int flags = 0);
/// Receives data from the socket and stores it /// Receives data from the socket and stores it
@@ -152,6 +173,9 @@ public:
/// Stores the address of the sender in address. /// Stores the address of the sender in address.
/// ///
/// Returns the number of bytes received. /// Returns the number of bytes received.
///
/// The flags parameter can be used to pass system-defined flags
/// for recvfrom() like MSG_PEEK.
int receiveFrom(void* buffer, int length, struct sockaddr** ppSA, poco_socklen_t** ppSALen, int flags = 0); int receiveFrom(void* buffer, int length, struct sockaddr** ppSA, poco_socklen_t** ppSALen, int flags = 0);
/// Receives data from the socket and stores it /// Receives data from the socket and stores it
@@ -160,6 +184,9 @@ public:
/// ppSA, and the length of native address in ppSALen. /// ppSA, and the length of native address in ppSALen.
/// ///
/// Returns the number of bytes received. /// Returns the number of bytes received.
///
/// The flags parameter can be used to pass system-defined flags
/// for recvfrom() like MSG_PEEK.
int receiveFrom(SocketBufVec& buffers, SocketAddress& address, int flags = 0); int receiveFrom(SocketBufVec& buffers, SocketAddress& address, int flags = 0);
/// Receives data from the socket and stores it /// Receives data from the socket and stores it
@@ -168,6 +195,9 @@ public:
/// Stores the address of the sender in address. /// Stores the address of the sender in address.
/// ///
/// Returns the number of bytes received. /// Returns the number of bytes received.
///
/// The flags parameter can be used to pass system-defined flags
/// for recvfrom() like MSG_PEEK.
int receiveFrom(SocketBufVec& buffers, struct sockaddr** ppSA, poco_socklen_t** ppSALen, int flags = 0); int receiveFrom(SocketBufVec& buffers, struct sockaddr** ppSA, poco_socklen_t** ppSALen, int flags = 0);
/// Receives data from the socket and stores it /// Receives data from the socket and stores it
@@ -176,13 +206,16 @@ public:
/// ppSA, and the length of native address in ppSALen. /// ppSA, and the length of native address in ppSALen.
/// ///
/// Returns the number of bytes received. /// Returns the number of bytes received.
///
/// The flags parameter can be used to pass system-defined flags
/// for recvfrom() like MSG_PEEK.
void setBroadcast(bool flag); void setBroadcast(bool flag);
/// Sets the value of the SO_BROADCAST socket option. /// Sets the value of the SO_BROADCAST socket option.
/// ///
/// Setting this flag allows sending datagrams to /// Setting this flag allows sending datagrams to
/// the broadcast address. /// the broadcast address.
bool getBroadcast() const; bool getBroadcast() const;
/// Returns the value of the SO_BROADCAST socket option. /// Returns the value of the SO_BROADCAST socket option.

View File

@@ -50,7 +50,7 @@ public:
/// for the given address family. /// for the given address family.
/// ///
/// This is useful if certain socket options /// This is useful if certain socket options
/// (like send and receive buffer) sizes, that must /// (like send and receive buffer) sizes, that must
/// be set before connecting the socket, will be /// be set before connecting the socket, will be
/// set later on. /// set later on.
@@ -68,10 +68,10 @@ public:
/// ///
/// Releases the socket's SocketImpl and /// Releases the socket's SocketImpl and
/// attaches the SocketImpl from the other socket and /// attaches the SocketImpl from the other socket and
/// increments the reference count of the SocketImpl. /// increments the reference count of the SocketImpl.
void connect(const SocketAddress& address); void connect(const SocketAddress& address);
/// Initializes the socket and establishes a connection to /// Initializes the socket and establishes a connection to
/// the TCP server at the given address. /// the TCP server at the given address.
/// ///
/// Can also be used for UDP sockets. In this case, no /// Can also be used for UDP sockets. In this case, no
@@ -79,24 +79,24 @@ public:
/// packets are restricted to the specified address. /// packets are restricted to the specified address.
void connect(const SocketAddress& address, const Poco::Timespan& timeout); void connect(const SocketAddress& address, const Poco::Timespan& timeout);
/// Initializes the socket, sets the socket timeout and /// Initializes the socket, sets the socket timeout and
/// establishes a connection to the TCP server at the given address. /// establishes a connection to the TCP server at the given address.
void connectNB(const SocketAddress& address); void connectNB(const SocketAddress& address);
/// Initializes the socket and establishes a connection to /// Initializes the socket and establishes a connection to
/// the TCP server at the given address. Prior to opening the /// the TCP server at the given address. Prior to opening the
/// connection the socket is set to nonblocking mode. /// connection the socket is set to nonblocking mode.
void shutdownReceive(); void shutdownReceive();
/// Shuts down the receiving part of the socket connection. /// Shuts down the receiving part of the socket connection.
void shutdownSend(); void shutdownSend();
/// Shuts down the sending part of the socket connection. /// Shuts down the sending part of the socket connection.
void shutdown(); void shutdown();
/// Shuts down both the receiving and the sending part /// Shuts down both the receiving and the sending part
/// of the socket connection. /// of the socket connection.
int sendBytes(const void* buffer, int length, int flags = 0); int sendBytes(const void* buffer, int length, int flags = 0);
/// Sends the contents of the given buffer through /// Sends the contents of the given buffer through
/// the socket. /// the socket.
@@ -106,6 +106,9 @@ public:
/// ///
/// Certain socket implementations may also return a negative /// Certain socket implementations may also return a negative
/// value denoting a certain condition. /// value denoting a certain condition.
///
/// The flags parameter can be used to pass system-defined flags
/// for send() like MSG_OOB.
int sendBytes(const SocketBufVec& buffer, int flags = 0); int sendBytes(const SocketBufVec& buffer, int flags = 0);
/// Sends the contents of the given buffers through /// Sends the contents of the given buffers through
@@ -113,6 +116,9 @@ public:
/// ///
/// Returns the number of bytes sent, which may be /// Returns the number of bytes sent, which may be
/// less than the number of bytes specified. /// less than the number of bytes specified.
///
/// The flags parameter can be used to pass system-defined flags
/// for send() like MSG_OOB.
int sendBytes(Poco::FIFOBuffer& buffer); int sendBytes(Poco::FIFOBuffer& buffer);
/// Sends the contents of the given buffer through /// Sends the contents of the given buffer through
@@ -126,38 +132,50 @@ public:
/// ///
/// Certain socket implementations may also return a negative /// Certain socket implementations may also return a negative
/// value denoting a certain condition. /// value denoting a certain condition.
///
/// The flags parameter can be used to pass system-defined flags
/// for send() like MSG_OOB.
int receiveBytes(void* buffer, int length, int flags = 0); int receiveBytes(void* buffer, int length, int flags = 0);
/// Receives data from the socket and stores it /// Receives data from the socket and stores it
/// in buffer. Up to length bytes are received. /// in buffer. Up to length bytes are received.
/// ///
/// Returns the number of bytes received. /// Returns the number of bytes received.
/// A return value of 0 means a graceful shutdown /// A return value of 0 means a graceful shutdown
/// of the connection from the peer. /// of the connection from the peer.
/// ///
/// Throws a TimeoutException if a receive timeout has /// Throws a TimeoutException if a receive timeout has
/// been set and nothing is received within that interval. /// been set and nothing is received within that interval.
/// Throws a NetException (or a subclass) in case of other errors. /// Throws a NetException (or a subclass) in case of other errors.
///
/// The flags parameter can be used to pass system-defined flags
/// for recv() like MSG_OOB, MSG_PEEK or MSG_WAITALL.
int receiveBytes(SocketBufVec& buffer, int flags = 0); int receiveBytes(SocketBufVec& buffer, int flags = 0);
/// Receives data from the socket and stores it in buffers. /// Receives data from the socket and stores it in buffers.
/// ///
/// Returns the number of bytes received. /// Returns the number of bytes received.
///
/// The flags parameter can be used to pass system-defined flags
/// for recv() like MSG_OOB, MSG_PEEK or MSG_WAITALL.
int receiveBytes(Poco::Buffer<char>& buffer, int flags = 0, const Poco::Timespan& timeout = 100000); int receiveBytes(Poco::Buffer<char>& buffer, int flags = 0, const Poco::Timespan& timeout = 100000);
/// Receives data from the socket and stores it in buffers. /// Receives data from the socket and stores it in buffers.
/// ///
/// Returns the number of bytes received. /// Returns the number of bytes received.
///
/// The flags parameter can be used to pass system-defined flags
/// for recv() like MSG_OOB, MSG_PEEK or MSG_WAITALL.
int receiveBytes(Poco::FIFOBuffer& buffer); int receiveBytes(Poco::FIFOBuffer& buffer);
/// Receives data from the socket and stores it /// Receives data from the socket and stores it
/// in buffer. Up to length bytes are received. FIFOBuffer has /// in buffer. Up to length bytes are received. FIFOBuffer has
/// writable/readable transition notifications which may be enabled /// writable/readable transition notifications which may be enabled
/// to notify the caller when the buffer transitions between empty, /// to notify the caller when the buffer transitions between empty,
/// partially full and full states. /// partially full and full states.
/// ///
/// Returns the number of bytes received. /// Returns the number of bytes received.
/// A return value of 0 means a graceful shutdown /// A return value of 0 means a graceful shutdown
/// of the connection from the peer. /// of the connection from the peer.
/// ///
/// Throws a TimeoutException if a receive timeout has /// Throws a TimeoutException if a receive timeout has

View File

@@ -47,10 +47,11 @@ MulticastSocketTest::~MulticastSocketTest()
void MulticastSocketTest::testMulticast() void MulticastSocketTest::testMulticast()
{ {
try try
{ {
MulticastEchoServer echoServer; MulticastEchoServer echoServer;
MulticastSocket ms(SocketAddress::IPv4); MulticastSocket ms(SocketAddress::IPv4);
ms.setReceiveTimeout(Poco::Timespan(5, 0));
int n = ms.sendTo("hello", 5, echoServer.group()); int n = ms.sendTo("hello", 5, echoServer.group());
assertTrue (n == 5); assertTrue (n == 5);
char buffer[256]; char buffer[256];

View File

@@ -14,3 +14,4 @@ N7CppUnit10TestCallerI9TimerTestEE.testTimer
N7CppUnit10TestCallerI15FileChannelTestEE.testPurgeAge N7CppUnit10TestCallerI15FileChannelTestEE.testPurgeAge
N7CppUnit10TestCallerI8FileTestEE.testFileAttributes2 N7CppUnit10TestCallerI8FileTestEE.testFileAttributes2
N7CppUnit10TestCallerI14ICMPSocketTestEE.testSendToReceiveFrom N7CppUnit10TestCallerI14ICMPSocketTestEE.testSendToReceiveFrom
N7CppUnit10TestCallerI22HTTPSClientSessionTestEE.testCachedSession

View File

@@ -13,10 +13,14 @@ AAAIntroduction
- GH #2791: allow pre-allocation of the buffer in Poco::LogStreamBuf. - GH #2791: allow pre-allocation of the buffer in Poco::LogStreamBuf.
- GH #2816: Modernise TLS configuration - GH #2816: Modernise TLS configuration
- GH #2818: Add getSpecifiedPort() method in Poco::URI. - GH #2818: Add getSpecifiedPort() method in Poco::URI.
- GH #2909: Test failures on s390x architecture with 1.10.0
- GH #2911: Poco::UTF16Encoding and Poco::UTF32Encoding byte order conversion bug
- GH #2912: Poco::SHA2Engine computes incorrect hash on big-endian systems
- MySQL: resetting the session when putting it back into a SessionPool is now optional - MySQL: resetting the session when putting it back into a SessionPool is now optional
(and disabled by default) due to a bug in MySQL messing up the character encoding when doing so. (and disabled by default) due to a bug in MySQL messing up the character encoding when doing so.
- Poco::AutoPtr and Poco::SharedPtr now support comparison with nullptr. - Poco::AutoPtr and Poco::SharedPtr now support comparison with nullptr.
!!!Release 1.10.0 !!!Release 1.10.0
!!Summary of Changes !!Summary of Changes

View File

@@ -1,6 +1,8 @@
set -ev set -ev
osname=`uname`
osarch=`uname -m`
export POCO_BASE=`pwd` export POCO_BASE=`pwd`
export EXCLUDE_TESTS="Data/MySQL Data/ODBC MongoDB PDF" export EXCLUDE_TESTS="Data/MySQL Data/ODBC MongoDB PDF"
export PATH=$PATH:. export PATH=$PATH:.
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.:$POCO_BASE/lib/$osname/$osarch
build/script/runtests.sh build/script/runtests.sh