mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-13 18:45:10 +01:00
Merge branch 'poco-1.10.1' into devel
This commit is contained in:
commit
aec9205eab
222
.travis.yml
222
.travis.yml
@ -3,18 +3,9 @@ language: cpp
|
||||
cache:
|
||||
- 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:
|
||||
- mongodb
|
||||
- redis-server
|
||||
- redis
|
||||
- postgresql
|
||||
- mysql
|
||||
|
||||
@ -28,15 +19,12 @@ notifications:
|
||||
slack:
|
||||
secure: "EKysuMlTU3Uv5XFX+zuwHK/ej4wtD8+UjO5xvchCFMkRgM0V3rERVT1rV6NocNBH4hjTcvue9DEKdWAtqdDh06vTOHGKdnZ/e204jA38HfcIA0SPVbQXzjckQXALvKl51OPOmGuI7Feo4wyohzUyGoDLo1bom02xqDfC3caQB5Q="
|
||||
|
||||
env:
|
||||
global: TEST_NAME=""
|
||||
|
||||
before_script:
|
||||
- echo ${TEST_NAME}
|
||||
|
||||
matrix:
|
||||
jobs:
|
||||
include:
|
||||
- env: TEST_NAME="android API level 19"
|
||||
- name: Android (API level 19)
|
||||
os: linux
|
||||
dist: bionic
|
||||
arch: amd64
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@ -65,7 +53,10 @@ matrix:
|
||||
/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
|
||||
|
||||
- env: TEST_NAME="android API level 24 arm64-v8a"
|
||||
- name: Android (API level 24 arm64-v8a)
|
||||
os: linux
|
||||
dist: bionic
|
||||
arch: amd64
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@ -94,50 +85,166 @@ matrix:
|
||||
/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
|
||||
|
||||
- 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
|
||||
script:
|
||||
- ./configure --everything --omit=PDF --config=Linux-clang && make all -s -j2 && sudo make install
|
||||
- sudo -s ./travis/runtests.sh
|
||||
|
||||
# - env: TEST_NAME="arm-linux-gnueabi- (make)"
|
||||
# script:
|
||||
# - ./configure --omit=PDF,Data/ODBC,Data/MySQL,Crypto,NetSSL,PageCompiler && make all -s -j2 CROSS_COMPILE=arm-linux-gnueabi- POCO_TARGET_OSARCH=armv7l
|
||||
|
||||
- env: TEST_NAME="gcc-5.4.0 (CMake)"
|
||||
- name: Linux (gcc, make)
|
||||
os: linux
|
||||
dist: bionic
|
||||
arch: amd64
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libssl-dev
|
||||
- unixodbc-dev
|
||||
- libmysqlclient-dev
|
||||
compiler: gcc
|
||||
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)"
|
||||
compiler: clang
|
||||
- name: Linux (gcc, make, arm64)
|
||||
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:
|
||||
- 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:
|
||||
- export CC="arm-linux-gnueabi-gcc"
|
||||
- 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
|
||||
|
||||
- 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:
|
||||
- export CC="arm-linux-gnueabihf-gcc"
|
||||
- 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
|
||||
|
||||
# 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
|
||||
- env: TEST_NAME="documentation & release"
|
||||
- name: Documentation & Release
|
||||
os: linux
|
||||
dist: bionic
|
||||
arch: amd64
|
||||
compiler: clang
|
||||
script:
|
||||
- . env.sh && mkdoc all && mkrel all
|
||||
@ -145,21 +252,44 @@ matrix:
|
||||
|
||||
# QA jobs for code analytics and metrics
|
||||
# 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 .
|
||||
|
||||
# search for TODO within source tree
|
||||
- env: TEST_NAME="TODO"
|
||||
- name: TODO
|
||||
os: linux
|
||||
dist: bionic
|
||||
arch: amd64
|
||||
script: grep -r TODO *
|
||||
|
||||
# search for FIXME within source tree
|
||||
- env: TEST_NAME="FIXME"
|
||||
- name: FIXME
|
||||
os: linux
|
||||
dist: bionic
|
||||
arch: amd64
|
||||
script: grep -r FIXME *
|
||||
|
||||
# search for HACK within source tree
|
||||
- env: TEST_NAME="HACK"
|
||||
- name: HACK
|
||||
os: linux
|
||||
dist: bionic
|
||||
arch: amd64
|
||||
script: grep -r HACK *
|
||||
|
||||
# some statistics about the code base
|
||||
- env: TEST_NAME="sloccount"
|
||||
- name: Sloccount
|
||||
os: linux
|
||||
dist: bionic
|
||||
arch: amd64
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- sloccount
|
||||
script: sloccount .
|
||||
|
@ -11,6 +11,9 @@ Release 1.10.1 (2020-02-10)
|
||||
- GH #2791: allow pre-allocation of the buffer in Poco::LogStreamBuf.
|
||||
- GH #2816: Modernise TLS configuration
|
||||
- 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
|
||||
(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.
|
||||
|
@ -46,7 +46,7 @@ TextTestResult::TextTestResult(const std::string& ignore):
|
||||
ifs.close();
|
||||
}
|
||||
}
|
||||
catch (std::exception e)
|
||||
catch (std::exception& e)
|
||||
{
|
||||
std::cout << e.what() << std::endl;
|
||||
}
|
||||
@ -147,7 +147,7 @@ void TextTestResult::addFailure(Test* test, CppUnitException* e)
|
||||
void TextTestResult::startTest(Test* test)
|
||||
{
|
||||
TestResult::startTest(test);
|
||||
_ostr << "\n" << shortName(test->toString()) << ": ";
|
||||
_ostr << "\n" << shortName(test->toString()) << ": " << std::flush;
|
||||
}
|
||||
|
||||
|
||||
|
@ -47,7 +47,7 @@ public:
|
||||
/// Connection string format:
|
||||
/// <str> == <assignment> | <assignment> ';' <str>
|
||||
/// <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> == [~;]*
|
||||
///
|
||||
/// The following settings are supported:
|
||||
@ -61,6 +61,9 @@ public:
|
||||
/// - character-set: connection character set (default: utf8)
|
||||
/// - reset: reset connection when returned to SessionPool by calling
|
||||
/// 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()
|
||||
/// could change the character encoding used for the connection. Therefore the
|
||||
|
@ -92,6 +92,7 @@ void SessionImpl::open(const std::string& connect)
|
||||
options["secure-auth"] = "";
|
||||
options["character-set"] = "utf8";
|
||||
options["reset"] = "";
|
||||
options["fail-readonly"] = "";
|
||||
|
||||
const std::string& connString = connectionString();
|
||||
for (std::string::const_iterator start = connString.begin();;)
|
||||
@ -153,6 +154,13 @@ void SessionImpl::open(const std::string& connect)
|
||||
else if (!options["reset"].empty())
|
||||
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
|
||||
_handle.connect(options["host"].c_str(),
|
||||
options["user"].c_str(),
|
||||
|
@ -103,7 +103,7 @@ public:
|
||||
|
||||
void bind(std::size_t pos, const Poco::Int16& val, Direction dir);
|
||||
/// Binds an Int16.
|
||||
|
||||
|
||||
void bind(std::size_t pos, const std::vector<Poco::Int16>& val, Direction dir);
|
||||
/// Binds an Int16 vector.
|
||||
|
||||
@ -344,7 +344,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();
|
||||
@ -375,7 +375,7 @@ private:
|
||||
/// Sets the description field for the parameter, if needed.
|
||||
|
||||
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
|
||||
/// due to security risk.
|
||||
|
||||
@ -392,11 +392,11 @@ private:
|
||||
|
||||
_lengthIndicator.push_back(0);
|
||||
|
||||
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)))
|
||||
@ -413,7 +413,7 @@ private:
|
||||
|
||||
SQLPOINTER pVal = (SQLPOINTER) val.rawContent();
|
||||
SQLINTEGER size = (SQLINTEGER) val.size();
|
||||
|
||||
|
||||
_inParams.insert(ParamMap::value_type(pVal, size));
|
||||
|
||||
SQLLEN* pLenIn = new SQLLEN;
|
||||
@ -424,15 +424,15 @@ private:
|
||||
|
||||
_lengthIndicator.push_back(pLenIn);
|
||||
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
SQL_PARAM_INPUT,
|
||||
SQL_C_BINARY,
|
||||
SQL_LONGVARBINARY,
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
SQL_PARAM_INPUT,
|
||||
SQL_C_BINARY,
|
||||
SQL_LONGVARBINARY,
|
||||
(SQLUINTEGER) size,
|
||||
0,
|
||||
pVal,
|
||||
(SQLINTEGER) size,
|
||||
(SQLINTEGER) size,
|
||||
_lengthIndicator.back())))
|
||||
{
|
||||
throw StatementException(_rStmt, "SQLBindParameter(LOB)");
|
||||
@ -457,15 +457,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()");
|
||||
@ -518,15 +518,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()");
|
||||
@ -571,7 +571,7 @@ private:
|
||||
_charPtrs.resize(pos + 1, 0);
|
||||
|
||||
_charPtrs[pos] = (char*) std::calloc(val.size() * size, sizeof(char));
|
||||
|
||||
|
||||
std::size_t strSize;
|
||||
std::size_t offset = 0;
|
||||
typename C::const_iterator it = val.begin();
|
||||
@ -579,21 +579,21 @@ private:
|
||||
for (; it != end; ++it)
|
||||
{
|
||||
strSize = it->size();
|
||||
if (strSize > size)
|
||||
if (strSize > size)
|
||||
throw LengthExceededException("SQLBindParameter(std::vector<std::string>)");
|
||||
std::memcpy(_charPtrs[pos] + offset, it->c_str(), strSize);
|
||||
offset += size;
|
||||
}
|
||||
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
toODBCDirection(dir),
|
||||
SQL_C_CHAR,
|
||||
SQL_LONGVARCHAR,
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
toODBCDirection(dir),
|
||||
SQL_C_CHAR,
|
||||
SQL_LONGVARCHAR,
|
||||
(SQLUINTEGER) size - 1,
|
||||
0,
|
||||
_charPtrs[pos],
|
||||
(SQLINTEGER) size,
|
||||
_charPtrs[pos],
|
||||
(SQLINTEGER) size,
|
||||
&(*_vecLengthIndicator[pos])[0])))
|
||||
{
|
||||
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 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);
|
||||
@ -716,21 +716,21 @@ private:
|
||||
for (; cIt != cEnd; ++cIt)
|
||||
{
|
||||
blobSize = cIt->size();
|
||||
if (blobSize > size)
|
||||
if (blobSize > size)
|
||||
throw LengthExceededException("SQLBindParameter(std::vector<BLOB>)");
|
||||
std::memcpy(_charPtrs[pos] + offset, cIt->rawContent(), blobSize * sizeof(CharType));
|
||||
offset += size;
|
||||
}
|
||||
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
SQL_PARAM_INPUT,
|
||||
SQL_C_BINARY,
|
||||
SQL_LONGVARBINARY,
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
SQL_PARAM_INPUT,
|
||||
SQL_C_BINARY,
|
||||
SQL_LONGVARBINARY,
|
||||
(SQLUINTEGER) size,
|
||||
0,
|
||||
_charPtrs[pos],
|
||||
(SQLINTEGER) size,
|
||||
_charPtrs[pos],
|
||||
(SQLINTEGER) size,
|
||||
&(*_vecLengthIndicator[pos])[0])))
|
||||
{
|
||||
throw StatementException(_rStmt, "SQLBindParameter(std::vector<BLOB>)");
|
||||
@ -753,8 +753,6 @@ private:
|
||||
|
||||
setParamSetSize(length);
|
||||
|
||||
SQLINTEGER size = (SQLINTEGER) sizeof(SQL_DATE_STRUCT);
|
||||
|
||||
if (_vecLengthIndicator.size() <= pos)
|
||||
{
|
||||
_vecLengthIndicator.resize(pos + 1, 0);
|
||||
@ -773,15 +771,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[])");
|
||||
@ -803,8 +801,6 @@ private:
|
||||
|
||||
setParamSetSize(val.size());
|
||||
|
||||
SQLINTEGER size = (SQLINTEGER) sizeof(SQL_TIME_STRUCT);
|
||||
|
||||
if (_vecLengthIndicator.size() <= pos)
|
||||
{
|
||||
_vecLengthIndicator.resize(pos + 1, 0);
|
||||
@ -823,15 +819,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[])");
|
||||
@ -854,8 +850,6 @@ private:
|
||||
|
||||
setParamSetSize(length);
|
||||
|
||||
SQLINTEGER size = (SQLINTEGER) sizeof(SQL_TIMESTAMP_STRUCT);
|
||||
|
||||
if (_vecLengthIndicator.size() <= pos)
|
||||
{
|
||||
_vecLengthIndicator.resize(pos + 1, 0);
|
||||
@ -874,15 +868,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[])");
|
||||
@ -905,8 +899,6 @@ private:
|
||||
|
||||
setParamSetSize(length);
|
||||
|
||||
SQLINTEGER size = SQL_NULL_DATA;
|
||||
|
||||
if (_vecLengthIndicator.size() <= pos)
|
||||
{
|
||||
_vecLengthIndicator.resize(pos + 1, 0);
|
||||
@ -917,32 +909,32 @@ private:
|
||||
SQLSMALLINT decDigits = 0;
|
||||
getColSizeAndPrecision(pos, SQL_C_STINYINT, colSize, decDigits);
|
||||
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
SQL_PARAM_INPUT,
|
||||
SQL_C_STINYINT,
|
||||
Utility::sqlDataType(SQL_C_STINYINT),
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
SQL_PARAM_INPUT,
|
||||
SQL_C_STINYINT,
|
||||
Utility::sqlDataType(SQL_C_STINYINT),
|
||||
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,
|
||||
std::size_t actualSize = 0);
|
||||
/// 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 unsuccesfully 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 unsuccesfully exhausted, the values
|
||||
/// are both set to zero and no exception is thrown.
|
||||
/// However, if the colSize is succesfully retrieved and it is greater than
|
||||
/// session-wide maximum allowed field size, LengthExceededException is thrown.
|
||||
@ -953,7 +945,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();
|
||||
@ -962,9 +954,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.
|
||||
{
|
||||
@ -1000,7 +992,7 @@ private:
|
||||
ParamMap _inParams;
|
||||
ParamMap _outParams;
|
||||
ParameterBinding _paramBinding;
|
||||
|
||||
|
||||
DateMap _dates;
|
||||
TimeMap _times;
|
||||
TimestampMap _timestamps;
|
||||
|
@ -2,14 +2,14 @@
|
||||
// WebNotifier.cpp
|
||||
//
|
||||
// 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.
|
||||
// Since callbacks are only registered for session, in order to see the
|
||||
// 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
|
||||
// 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.
|
||||
//
|
||||
// Copyright (c) 2008, Applied Informatics Software Engineering GmbH.
|
||||
@ -128,7 +128,7 @@ public:
|
||||
std::cout << std::endl << "WebSocket connection established." << std::endl << PROMPT;
|
||||
|
||||
char buffer[1024];
|
||||
int n, count = 0;
|
||||
int n;
|
||||
do
|
||||
{
|
||||
n = _pWS->receiveFrame(buffer, sizeof(buffer), _flags);
|
||||
@ -184,7 +184,7 @@ public:
|
||||
|
||||
if (uri != "/favicon.ico")
|
||||
std::cout << "Unknown URI: " << uri << std::endl;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -250,7 +250,7 @@ public:
|
||||
_notifier.insert -= delegate(this, &DBEventHandler::onInsert);
|
||||
_notifier.update -= delegate(this, &DBEventHandler::onUpdate);
|
||||
}
|
||||
|
||||
|
||||
std::size_t execute(const std::string& sql)
|
||||
/// Exectutes the SQL statement.
|
||||
{
|
||||
|
@ -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); \
|
||||
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
|
||||
#define GET_UINT32(n,b,i) \
|
||||
do { \
|
||||
@ -241,7 +195,6 @@ do { \
|
||||
(b)[(i) + 7] = (unsigned char) ( (n) ); \
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
SHA2Engine::SHA2Engine(ALGORITHM algorithm):
|
||||
|
@ -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,
|
||||
/* 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,
|
||||
/* 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,
|
||||
/* 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,
|
||||
/* 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,
|
||||
/* 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,
|
||||
/* 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,
|
||||
/* 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,
|
||||
/* f0 */ -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,
|
||||
/* 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,
|
||||
/* 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,
|
||||
/* 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,
|
||||
/* 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,
|
||||
/* 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,
|
||||
/* 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,
|
||||
/* 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,
|
||||
};
|
||||
|
||||
|
||||
@ -54,13 +54,13 @@ UTF16Encoding::UTF16Encoding(ByteOrderType byteOrder)
|
||||
setByteOrder(byteOrder);
|
||||
}
|
||||
|
||||
|
||||
|
||||
UTF16Encoding::UTF16Encoding(int byteOrderMark)
|
||||
{
|
||||
setByteOrder(byteOrderMark);
|
||||
}
|
||||
|
||||
|
||||
|
||||
UTF16Encoding::~UTF16Encoding()
|
||||
{
|
||||
}
|
||||
@ -75,7 +75,7 @@ UTF16Encoding::ByteOrderType UTF16Encoding::getByteOrder() const
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
void UTF16Encoding::setByteOrder(ByteOrderType byteOrder)
|
||||
{
|
||||
#if defined(POCO_ARCH_BIG_ENDIAN)
|
||||
@ -85,7 +85,7 @@ void UTF16Encoding::setByteOrder(ByteOrderType byteOrder)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
void UTF16Encoding::setByteOrder(int byteOrderMark)
|
||||
{
|
||||
_flipBytes = byteOrderMark != 0xFEFF;
|
||||
@ -124,7 +124,7 @@ int UTF16Encoding::convert(const unsigned char* bytes) const
|
||||
|
||||
if (_flipBytes)
|
||||
{
|
||||
ByteOrder::flipBytes(uc);
|
||||
uc = ByteOrder::flipBytes(uc);
|
||||
}
|
||||
|
||||
if (uc >= 0xd800 && uc < 0xdc00)
|
||||
@ -136,7 +136,7 @@ int UTF16Encoding::convert(const unsigned char* bytes) const
|
||||
|
||||
if (_flipBytes)
|
||||
{
|
||||
ByteOrder::flipBytes(uc2);
|
||||
uc2 = ByteOrder::flipBytes(uc2);
|
||||
}
|
||||
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;
|
||||
*p++ = *bytes++;
|
||||
*p++ = *bytes++;
|
||||
if (_flipBytes)
|
||||
ByteOrder::flipBytes(uc);
|
||||
if (_flipBytes)
|
||||
{
|
||||
uc = ByteOrder::flipBytes(uc);
|
||||
}
|
||||
if (uc >= 0xd800 && uc < 0xdc00)
|
||||
{
|
||||
if (length >= 4)
|
||||
@ -211,8 +213,10 @@ int UTF16Encoding::queryConvert(const unsigned char* bytes, int length) const
|
||||
p = (unsigned char*) &uc2;
|
||||
*p++ = *bytes++;
|
||||
*p++ = *bytes++;
|
||||
if (_flipBytes)
|
||||
ByteOrder::flipBytes(uc2);
|
||||
if (_flipBytes)
|
||||
{
|
||||
uc2 = ByteOrder::flipBytes(uc2);
|
||||
}
|
||||
if (uc2 >= 0xdc00 && uc < 0xe000)
|
||||
{
|
||||
ret = ((uc & 0x3ff) << 10) + (uc2 & 0x3ff) + 0x10000;
|
||||
|
@ -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,
|
||||
/* 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,
|
||||
/* 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,
|
||||
/* 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,
|
||||
/* 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,
|
||||
/* 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,
|
||||
/* 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,
|
||||
/* 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,
|
||||
/* f0 */ -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,
|
||||
/* 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,
|
||||
/* 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,
|
||||
/* 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,
|
||||
/* 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,
|
||||
/* 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,
|
||||
/* 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,
|
||||
/* 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,
|
||||
};
|
||||
|
||||
|
||||
@ -54,13 +54,13 @@ UTF32Encoding::UTF32Encoding(ByteOrderType byteOrder)
|
||||
setByteOrder(byteOrder);
|
||||
}
|
||||
|
||||
|
||||
|
||||
UTF32Encoding::UTF32Encoding(int byteOrderMark)
|
||||
{
|
||||
setByteOrder(byteOrderMark);
|
||||
}
|
||||
|
||||
|
||||
|
||||
UTF32Encoding::~UTF32Encoding()
|
||||
{
|
||||
}
|
||||
@ -75,7 +75,7 @@ UTF32Encoding::ByteOrderType UTF32Encoding::getByteOrder() const
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
void UTF32Encoding::setByteOrder(ByteOrderType byteOrder)
|
||||
{
|
||||
#if defined(POCO_ARCH_BIG_ENDIAN)
|
||||
@ -85,7 +85,7 @@ void UTF32Encoding::setByteOrder(ByteOrderType byteOrder)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
void UTF32Encoding::setByteOrder(int byteOrderMark)
|
||||
{
|
||||
_flipBytes = byteOrderMark != 0xFEFF;
|
||||
@ -126,7 +126,7 @@ int UTF32Encoding::convert(const unsigned char* bytes) const
|
||||
|
||||
if (_flipBytes)
|
||||
{
|
||||
ByteOrder::flipBytes(uc);
|
||||
uc = ByteOrder::flipBytes(uc);
|
||||
}
|
||||
|
||||
return uc;
|
||||
@ -160,8 +160,10 @@ int UTF32Encoding::queryConvert(const unsigned char* bytes, int length) const
|
||||
*p++ = *bytes++;
|
||||
*p++ = *bytes++;
|
||||
*p++ = *bytes++;
|
||||
if (_flipBytes)
|
||||
ByteOrder::flipBytes(uc);
|
||||
if (_flipBytes)
|
||||
{
|
||||
uc = ByteOrder::flipBytes(uc);
|
||||
}
|
||||
return uc;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
///
|
||||
/// Releases the socket's SocketImpl 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);
|
||||
/// Restricts incoming and outgoing
|
||||
@ -81,7 +81,7 @@ public:
|
||||
/// Bind a local address to the socket.
|
||||
///
|
||||
/// This is usually only done when establishing a server
|
||||
/// socket.
|
||||
/// socket.
|
||||
///
|
||||
/// If reuseAddress is true, sets the SO_REUSEADDR
|
||||
/// socket option.
|
||||
@ -92,7 +92,7 @@ public:
|
||||
/// Bind a local address to the socket.
|
||||
///
|
||||
/// This is usually only done when establishing a server
|
||||
/// socket.
|
||||
/// socket.
|
||||
///
|
||||
/// If reuseAddress is true, sets the SO_REUSEADDR
|
||||
/// socket option.
|
||||
@ -108,6 +108,9 @@ public:
|
||||
///
|
||||
/// Returns the number of bytes sent, which may be
|
||||
/// 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);
|
||||
/// Sends the contents of the given buffers through
|
||||
@ -115,22 +118,34 @@ public:
|
||||
///
|
||||
/// Returns the number of bytes sent, which may be
|
||||
/// 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);
|
||||
/// Receives data from the socket and stores it
|
||||
/// in buffer. Up to length bytes are 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);
|
||||
/// Receives data from the socket and stores it in buffers.
|
||||
///
|
||||
/// 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);
|
||||
/// Receives data from the socket and stores it in buffers.
|
||||
///
|
||||
/// 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);
|
||||
/// Sends the contents of the given buffer through
|
||||
@ -138,6 +153,9 @@ public:
|
||||
///
|
||||
/// Returns the number of bytes sent, which may be
|
||||
/// 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);
|
||||
/// Sends the contents of the given buffers through
|
||||
@ -145,6 +163,9 @@ public:
|
||||
///
|
||||
/// Returns the number of bytes sent, which may be
|
||||
/// 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);
|
||||
/// Receives data from the socket and stores it
|
||||
@ -152,6 +173,9 @@ public:
|
||||
/// Stores the address of the sender in address.
|
||||
///
|
||||
/// 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);
|
||||
/// Receives data from the socket and stores it
|
||||
@ -160,6 +184,9 @@ public:
|
||||
/// ppSA, and the length of native address in ppSALen.
|
||||
///
|
||||
/// 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);
|
||||
/// Receives data from the socket and stores it
|
||||
@ -168,6 +195,9 @@ public:
|
||||
/// Stores the address of the sender in address.
|
||||
///
|
||||
/// 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);
|
||||
/// Receives data from the socket and stores it
|
||||
@ -176,13 +206,16 @@ public:
|
||||
/// ppSA, and the length of native address in ppSALen.
|
||||
///
|
||||
/// 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);
|
||||
/// Sets the value of the SO_BROADCAST socket option.
|
||||
///
|
||||
/// Setting this flag allows sending datagrams to
|
||||
/// the broadcast address.
|
||||
|
||||
|
||||
bool getBroadcast() const;
|
||||
/// Returns the value of the SO_BROADCAST socket option.
|
||||
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
/// for the given address family.
|
||||
///
|
||||
/// 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
|
||||
/// set later on.
|
||||
|
||||
@ -68,10 +68,10 @@ public:
|
||||
///
|
||||
/// Releases the socket's SocketImpl 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);
|
||||
/// Initializes the socket and establishes a connection to
|
||||
/// Initializes the socket and establishes a connection to
|
||||
/// the TCP server at the given address.
|
||||
///
|
||||
/// Can also be used for UDP sockets. In this case, no
|
||||
@ -79,24 +79,24 @@ public:
|
||||
/// packets are restricted to the specified address.
|
||||
|
||||
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.
|
||||
|
||||
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
|
||||
/// connection the socket is set to nonblocking mode.
|
||||
|
||||
void shutdownReceive();
|
||||
/// Shuts down the receiving part of the socket connection.
|
||||
|
||||
|
||||
void shutdownSend();
|
||||
/// Shuts down the sending part of the socket connection.
|
||||
|
||||
|
||||
void shutdown();
|
||||
/// Shuts down both the receiving and the sending part
|
||||
/// of the socket connection.
|
||||
|
||||
|
||||
int sendBytes(const void* buffer, int length, int flags = 0);
|
||||
/// Sends the contents of the given buffer through
|
||||
/// the socket.
|
||||
@ -106,6 +106,9 @@ public:
|
||||
///
|
||||
/// Certain socket implementations may also return a negative
|
||||
/// 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);
|
||||
/// Sends the contents of the given buffers through
|
||||
@ -113,6 +116,9 @@ public:
|
||||
///
|
||||
/// Returns the number of bytes sent, which may be
|
||||
/// 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);
|
||||
/// Sends the contents of the given buffer through
|
||||
@ -126,38 +132,50 @@ public:
|
||||
///
|
||||
/// Certain socket implementations may also return a negative
|
||||
/// 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);
|
||||
/// Receives data from the socket and stores it
|
||||
/// in buffer. Up to length bytes are received.
|
||||
///
|
||||
/// Returns the number of bytes received.
|
||||
/// A return value of 0 means a graceful shutdown
|
||||
/// Returns the number of bytes received.
|
||||
/// A return value of 0 means a graceful shutdown
|
||||
/// of the connection from the peer.
|
||||
///
|
||||
/// Throws a TimeoutException if a receive timeout has
|
||||
/// been set and nothing is received within that interval.
|
||||
/// 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);
|
||||
/// Receives data from the socket and stores it in buffers.
|
||||
///
|
||||
/// 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);
|
||||
/// Receives data from the socket and stores it in buffers.
|
||||
///
|
||||
/// 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);
|
||||
/// Receives data from the socket and stores it
|
||||
/// in buffer. Up to length bytes are received. FIFOBuffer has
|
||||
/// writable/readable transition notifications which may be enabled
|
||||
/// to notify the caller when the buffer transitions between empty,
|
||||
/// in buffer. Up to length bytes are received. FIFOBuffer has
|
||||
/// writable/readable transition notifications which may be enabled
|
||||
/// to notify the caller when the buffer transitions between empty,
|
||||
/// partially full and full states.
|
||||
///
|
||||
/// Returns the number of bytes received.
|
||||
/// A return value of 0 means a graceful shutdown
|
||||
/// Returns the number of bytes received.
|
||||
/// A return value of 0 means a graceful shutdown
|
||||
/// of the connection from the peer.
|
||||
///
|
||||
/// Throws a TimeoutException if a receive timeout has
|
||||
|
@ -47,10 +47,11 @@ MulticastSocketTest::~MulticastSocketTest()
|
||||
|
||||
void MulticastSocketTest::testMulticast()
|
||||
{
|
||||
try
|
||||
try
|
||||
{
|
||||
MulticastEchoServer echoServer;
|
||||
MulticastSocket ms(SocketAddress::IPv4);
|
||||
ms.setReceiveTimeout(Poco::Timespan(5, 0));
|
||||
int n = ms.sendTo("hello", 5, echoServer.group());
|
||||
assertTrue (n == 5);
|
||||
char buffer[256];
|
||||
|
@ -14,3 +14,4 @@ N7CppUnit10TestCallerI9TimerTestEE.testTimer
|
||||
N7CppUnit10TestCallerI15FileChannelTestEE.testPurgeAge
|
||||
N7CppUnit10TestCallerI8FileTestEE.testFileAttributes2
|
||||
N7CppUnit10TestCallerI14ICMPSocketTestEE.testSendToReceiveFrom
|
||||
N7CppUnit10TestCallerI22HTTPSClientSessionTestEE.testCachedSession
|
||||
|
@ -13,10 +13,14 @@ AAAIntroduction
|
||||
- GH #2791: allow pre-allocation of the buffer in Poco::LogStreamBuf.
|
||||
- GH #2816: Modernise TLS configuration
|
||||
- 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
|
||||
(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.
|
||||
|
||||
|
||||
!!!Release 1.10.0
|
||||
|
||||
!!Summary of Changes
|
||||
|
@ -1,6 +1,8 @@
|
||||
set -ev
|
||||
osname=`uname`
|
||||
osarch=`uname -m`
|
||||
export POCO_BASE=`pwd`
|
||||
export EXCLUDE_TESTS="Data/MySQL Data/ODBC MongoDB PDF"
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user