mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-29 11:02:08 +00:00
:wMerge branch 'master' of https://github.com/ClickHouse/ClickHouse into KRB_CVE_Fix
This commit is contained in:
commit
09323457b9
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -296,6 +296,9 @@
|
||||
[submodule "contrib/libdivide"]
|
||||
path = contrib/libdivide
|
||||
url = https://github.com/ridiculousfish/libdivide
|
||||
[submodule "contrib/ulid-c"]
|
||||
path = contrib/ulid-c
|
||||
url = https://github.com/ClickHouse/ulid-c.git
|
||||
[submodule "contrib/aws-crt-cpp"]
|
||||
path = contrib/aws-crt-cpp
|
||||
url = https://github.com/ClickHouse/aws-crt-cpp
|
||||
|
@ -18,16 +18,18 @@
|
||||
#define Crypto_Cipher_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Crypto/Crypto.h"
|
||||
#include "Poco/RefCountedObject.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
#include <vector>
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "Poco/Crypto/Crypto.h"
|
||||
#include "Poco/RefCountedObject.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Crypto {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Crypto
|
||||
{
|
||||
|
||||
|
||||
class CryptoTransform;
|
||||
@ -132,7 +134,8 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::Crypto
|
||||
}
|
||||
} // namespace Poco::Crypto
|
||||
|
||||
|
||||
#endif // Crypto_Cipher_INCLUDED
|
||||
|
@ -21,8 +21,10 @@
|
||||
#include "Poco/Crypto/Crypto.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Crypto {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Crypto
|
||||
{
|
||||
|
||||
|
||||
class Cipher;
|
||||
@ -69,7 +71,8 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::Crypto
|
||||
}
|
||||
} // namespace Poco::Crypto
|
||||
|
||||
|
||||
#endif // Crypto_CipherFactory_INCLUDED
|
||||
|
@ -18,15 +18,17 @@
|
||||
#define Crypto_CipherImpl_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Crypto/Crypto.h"
|
||||
#include <openssl/evp.h>
|
||||
#include "Poco/Crypto/Cipher.h"
|
||||
#include "Poco/Crypto/CipherKey.h"
|
||||
#include "Poco/Crypto/Crypto.h"
|
||||
#include "Poco/Crypto/OpenSSLInitializer.h"
|
||||
#include <openssl/evp.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Crypto {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Crypto
|
||||
{
|
||||
|
||||
|
||||
class CipherImpl : public Cipher
|
||||
@ -63,7 +65,8 @@ inline const std::string& CipherImpl::name() const
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Crypto
|
||||
}
|
||||
} // namespace Poco::Crypto
|
||||
|
||||
|
||||
#endif // Crypto_CipherImpl_INCLUDED
|
||||
|
@ -18,12 +18,14 @@
|
||||
#define Crypto_CipherKey_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Crypto/Crypto.h"
|
||||
#include "Poco/Crypto/CipherKeyImpl.h"
|
||||
#include "Poco/Crypto/Crypto.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Crypto {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Crypto
|
||||
{
|
||||
|
||||
|
||||
class Crypto_API CipherKey
|
||||
@ -68,7 +70,8 @@ public:
|
||||
/// an iteration count of at least 1000.
|
||||
};
|
||||
|
||||
CipherKey(const std::string& name,
|
||||
CipherKey(
|
||||
const std::string & name,
|
||||
const std::string & passphrase,
|
||||
const std::string & salt = "",
|
||||
int iterationCount = DEFAULT_ITERATION_COUNT,
|
||||
@ -76,9 +79,7 @@ public:
|
||||
/// Creates a new CipherKeyImpl object using the given
|
||||
/// cipher name, passphrase, salt value, iteration count and digest.
|
||||
|
||||
CipherKey(const std::string& name,
|
||||
const ByteVec& key,
|
||||
const ByteVec& iv);
|
||||
CipherKey(const std::string & name, const ByteVec & key, const ByteVec & iv);
|
||||
/// Creates a new CipherKeyImpl object using the given cipher
|
||||
/// name, key and initialization vector (IV).
|
||||
///
|
||||
@ -195,7 +196,8 @@ inline CipherKeyImpl::Ptr CipherKey::impl()
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Crypto
|
||||
}
|
||||
} // namespace Poco::Crypto
|
||||
|
||||
|
||||
#endif // Crypto_CipherKey_INCLUDED
|
||||
|
@ -18,19 +18,21 @@
|
||||
#define Crypto_CipherKeyImpl_INCLUDED
|
||||
|
||||
|
||||
#include <vector>
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "Poco/Crypto/Crypto.h"
|
||||
#include "Poco/Crypto/OpenSSLInitializer.h"
|
||||
#include "Poco/RefCountedObject.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include <vector>
|
||||
|
||||
|
||||
struct evp_cipher_st;
|
||||
typedef struct evp_cipher_st EVP_CIPHER;
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Crypto {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Crypto
|
||||
{
|
||||
|
||||
|
||||
class CipherKeyImpl : public RefCountedObject
|
||||
@ -54,7 +56,8 @@ public:
|
||||
MODE_CCM /// Counter with CBC-MAC
|
||||
};
|
||||
|
||||
CipherKeyImpl(const std::string& name,
|
||||
CipherKeyImpl(
|
||||
const std::string & name,
|
||||
const std::string & passphrase,
|
||||
const std::string & salt,
|
||||
int iterationCount,
|
||||
@ -63,9 +66,7 @@ public:
|
||||
/// the given cipher name, passphrase, salt value
|
||||
/// and iteration count.
|
||||
|
||||
CipherKeyImpl(const std::string& name,
|
||||
const ByteVec& key,
|
||||
const ByteVec& iv);
|
||||
CipherKeyImpl(const std::string & name, const ByteVec & key, const ByteVec & iv);
|
||||
/// Creates a new CipherKeyImpl object, using the
|
||||
/// given cipher name, key and initialization vector.
|
||||
|
||||
@ -107,9 +108,7 @@ public:
|
||||
/// Returns the cipher object
|
||||
|
||||
private:
|
||||
void generateKey(const std::string& passphrase,
|
||||
const std::string& salt,
|
||||
int iterationCount);
|
||||
void generateKey(const std::string & passphrase, const std::string & salt, int iterationCount);
|
||||
/// Generates key and IV from a password and optional salt string.
|
||||
|
||||
void generateKey();
|
||||
@ -162,7 +161,8 @@ inline const EVP_CIPHER* CipherKeyImpl::cipher()
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Crypto
|
||||
}
|
||||
} // namespace Poco::Crypto
|
||||
|
||||
|
||||
#endif // Crypto_CipherKeyImpl_INCLUDED
|
||||
|
@ -24,17 +24,15 @@
|
||||
#define POCO_EXTERNAL_OPENSSL_SLPRO 2
|
||||
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
#include <openssl/opensslv.h>
|
||||
#include "Poco/Foundation.h"
|
||||
|
||||
|
||||
#ifndef OPENSSL_VERSION_PREREQ
|
||||
# if defined(OPENSSL_VERSION_MAJOR) && defined(OPENSSL_VERSION_MINOR)
|
||||
#define OPENSSL_VERSION_PREREQ(maj, min) \
|
||||
((OPENSSL_VERSION_MAJOR << 16) + OPENSSL_VERSION_MINOR >= ((maj) << 16) + (min))
|
||||
# define OPENSSL_VERSION_PREREQ(maj, min) ((OPENSSL_VERSION_MAJOR << 16) + OPENSSL_VERSION_MINOR >= ((maj) << 16) + (min))
|
||||
# else
|
||||
#define OPENSSL_VERSION_PREREQ(maj, min) \
|
||||
(OPENSSL_VERSION_NUMBER >= (((maj) << 28) | ((min) << 20)))
|
||||
# define OPENSSL_VERSION_PREREQ(maj, min) (OPENSSL_VERSION_NUMBER >= (((maj) << 28) | ((min) << 20)))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@ -114,9 +112,8 @@ enum RSAPaddingMode
|
||||
# endif
|
||||
# pragma comment(lib, "libcrypto" POCO_STATIC_SUFFIX POCO_DEBUG_SUFFIX ".lib")
|
||||
# pragma comment(lib, "libssl" POCO_STATIC_SUFFIX POCO_DEBUG_SUFFIX ".lib")
|
||||
#if !defined(_WIN64) && !defined (_DLL) && \
|
||||
(POCO_INTERNAL_OPENSSL_MSVC_VER == 120) && \
|
||||
(POCO_MSVC_VERSION < POCO_INTERNAL_OPENSSL_MSVC_VER)
|
||||
# if !defined(_WIN64) && !defined(_DLL) && (POCO_INTERNAL_OPENSSL_MSVC_VER == 120) \
|
||||
&& (POCO_MSVC_VERSION < POCO_INTERNAL_OPENSSL_MSVC_VER)
|
||||
# pragma comment(lib, "libPreVS2013CRT" POCO_STATIC_SUFFIX POCO_DEBUG_SUFFIX ".lib")
|
||||
# endif
|
||||
# if !defined(_DLL) && (POCO_MSVS_VERSION >= 2015)
|
||||
@ -164,8 +161,10 @@ enum RSAPaddingMode
|
||||
#endif
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Crypto {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Crypto
|
||||
{
|
||||
|
||||
|
||||
void Crypto_API initializeCrypto();
|
||||
@ -189,7 +188,8 @@ void Crypto_API uninitializeCrypto();
|
||||
/// OpenSSLInitializer::uninitialize().
|
||||
|
||||
|
||||
} } // namespace Poco::Crypto
|
||||
}
|
||||
} // namespace Poco::Crypto
|
||||
|
||||
|
||||
#endif // Crypto_Crypto_INCLUDED
|
||||
|
@ -23,8 +23,10 @@
|
||||
#include "Poco/Exception.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Crypto {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Crypto
|
||||
{
|
||||
|
||||
|
||||
POCO_DECLARE_EXCEPTION(Crypto_API, CryptoException, Poco::Exception)
|
||||
@ -50,7 +52,8 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::Crypto
|
||||
}
|
||||
} // namespace Poco::Crypto
|
||||
|
||||
|
||||
#endif // Crypto_CryptoException_INCLUDED
|
||||
|
@ -19,14 +19,16 @@
|
||||
#define Crypto_CryptoStream_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Crypto/Crypto.h"
|
||||
#include "Poco/BufferedStreamBuf.h"
|
||||
#include "Poco/Buffer.h"
|
||||
#include <iostream>
|
||||
#include "Poco/Buffer.h"
|
||||
#include "Poco/BufferedStreamBuf.h"
|
||||
#include "Poco/Crypto/Crypto.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Crypto {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Crypto
|
||||
{
|
||||
|
||||
|
||||
class CryptoTransform;
|
||||
@ -186,7 +188,8 @@ public:
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::Crypto
|
||||
}
|
||||
} // namespace Poco::Crypto
|
||||
|
||||
|
||||
#endif // Crypto_CryptoStream_INCLUDED
|
||||
|
@ -18,12 +18,14 @@
|
||||
#define Crypto_CryptoTransform_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Crypto/Crypto.h"
|
||||
#include <ios>
|
||||
#include "Poco/Crypto/Crypto.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Crypto {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Crypto
|
||||
{
|
||||
|
||||
|
||||
class Crypto_API CryptoTransform
|
||||
@ -61,11 +63,9 @@ public:
|
||||
/// Must be set before finalize() is called, otherwise
|
||||
/// decryption will fail.
|
||||
|
||||
virtual std::streamsize transform(
|
||||
const unsigned char* input,
|
||||
std::streamsize inputLength,
|
||||
unsigned char* output,
|
||||
std::streamsize outputLength) = 0;
|
||||
virtual std::streamsize
|
||||
transform(const unsigned char * input, std::streamsize inputLength, unsigned char * output, std::streamsize outputLength)
|
||||
= 0;
|
||||
/// Transforms a chunk of data. The inputLength is arbitrary and does not
|
||||
/// need to be a multiple of the block size. The output buffer has a maximum
|
||||
/// capacity of the given outputLength that must be at least
|
||||
@ -81,7 +81,8 @@ public:
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::Crypto
|
||||
}
|
||||
} // namespace Poco::Crypto
|
||||
|
||||
|
||||
#endif // Crypto_CryptoTransform_INCLUDED
|
||||
|
@ -18,14 +18,16 @@
|
||||
#define Crypto_DigestEngine_INCLUDED
|
||||
|
||||
|
||||
#include <openssl/evp.h>
|
||||
#include "Poco/Crypto/Crypto.h"
|
||||
#include "Poco/Crypto/OpenSSLInitializer.h"
|
||||
#include "Poco/DigestEngine.h"
|
||||
#include <openssl/evp.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Crypto {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Crypto
|
||||
{
|
||||
|
||||
|
||||
class Crypto_API DigestEngine : public Poco::DigestEngine
|
||||
@ -74,7 +76,8 @@ inline const std::string& DigestEngine::algorithm() const
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Crypto
|
||||
}
|
||||
} // namespace Poco::Crypto
|
||||
|
||||
|
||||
#endif // Crypto_DigestEngine_INCLUDED
|
||||
|
@ -19,16 +19,18 @@
|
||||
#define Crypto_ECDSADigestEngine_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Crypto/Crypto.h"
|
||||
#include "Poco/Crypto/ECKey.h"
|
||||
#include "Poco/DigestEngine.h"
|
||||
#include "Poco/Crypto/DigestEngine.h"
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
#include "Poco/Crypto/Crypto.h"
|
||||
#include "Poco/Crypto/DigestEngine.h"
|
||||
#include "Poco/Crypto/ECKey.h"
|
||||
#include "Poco/DigestEngine.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Crypto {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Crypto
|
||||
{
|
||||
|
||||
|
||||
class Crypto_API ECDSADigestEngine : public Poco::DigestEngine
|
||||
@ -46,7 +48,6 @@ class Crypto_API ECDSADigestEngine: public Poco::DigestEngine
|
||||
/// hash with the actual hash of the data.
|
||||
{
|
||||
public:
|
||||
|
||||
ECDSADigestEngine(const ECKey & key, const std::string & name);
|
||||
/// Creates the ECDSADigestEngine with the given ECDSA key,
|
||||
/// using the hash algorithm with the given name
|
||||
@ -95,7 +96,8 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::Crypto
|
||||
}
|
||||
} // namespace Poco::Crypto
|
||||
|
||||
|
||||
#endif // Crypto_ECDSADigestEngine_INCLUDED
|
||||
|
@ -20,11 +20,13 @@
|
||||
|
||||
|
||||
#include "Poco/Crypto/Crypto.h"
|
||||
#include "Poco/Crypto/KeyPair.h"
|
||||
#include "Poco/Crypto/ECKeyImpl.h"
|
||||
#include "Poco/Crypto/KeyPair.h"
|
||||
|
||||
namespace Poco {
|
||||
namespace Crypto {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Crypto
|
||||
{
|
||||
|
||||
|
||||
class X509Certificate;
|
||||
@ -129,7 +131,8 @@ inline bool ECKey::hasCurve(const std::string& name)
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Crypto
|
||||
}
|
||||
} // namespace Poco::Crypto
|
||||
|
||||
|
||||
#endif // Crypto_ECKey_INCLUDED
|
||||
|
@ -19,21 +19,23 @@
|
||||
#define Crypto_ECKeyImplImpl_INCLUDED
|
||||
|
||||
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
#include <vector>
|
||||
#include <openssl/ec.h>
|
||||
#include <openssl/objects.h>
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "Poco/Crypto/Crypto.h"
|
||||
#include "Poco/Crypto/EVPPKey.h"
|
||||
#include "Poco/Crypto/KeyPairImpl.h"
|
||||
#include "Poco/Crypto/OpenSSLInitializer.h"
|
||||
#include "Poco/RefCountedObject.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
#include <vector>
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/ec.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Crypto {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Crypto
|
||||
{
|
||||
|
||||
|
||||
class X509Certificate;
|
||||
@ -88,17 +90,15 @@ public:
|
||||
std::string groupName() const;
|
||||
/// Returns the EC key group name.
|
||||
|
||||
void save(const std::string& publicKeyFile,
|
||||
const std::string& privateKeyFile = "",
|
||||
const std::string& privateKeyPassphrase = "") const;
|
||||
void save(const std::string & publicKeyFile, const std::string & privateKeyFile = "", const std::string & privateKeyPassphrase = "")
|
||||
const;
|
||||
/// Exports the public and private keys to the given files.
|
||||
///
|
||||
/// If an empty filename is specified, the corresponding key
|
||||
/// is not exported.
|
||||
|
||||
void save(std::ostream* pPublicKeyStream,
|
||||
std::ostream* pPrivateKeyStream = 0,
|
||||
const std::string& privateKeyPassphrase = "") const;
|
||||
void
|
||||
save(std::ostream * pPublicKeyStream, std::ostream * pPrivateKeyStream = 0, const std::string & privateKeyPassphrase = "") const;
|
||||
/// Exports the public and private key to the given streams.
|
||||
///
|
||||
/// If a null pointer is passed for a stream, the corresponding
|
||||
@ -152,23 +152,22 @@ inline std::string ECKeyImpl::groupName() const
|
||||
}
|
||||
|
||||
|
||||
inline void ECKeyImpl::save(const std::string& publicKeyFile,
|
||||
const std::string& privateKeyFile,
|
||||
const std::string& privateKeyPassphrase) const
|
||||
inline void
|
||||
ECKeyImpl::save(const std::string & publicKeyFile, const std::string & privateKeyFile, const std::string & privateKeyPassphrase) const
|
||||
{
|
||||
EVPPKey(_pEC).save(publicKeyFile, privateKeyFile, privateKeyPassphrase);
|
||||
}
|
||||
|
||||
|
||||
inline void ECKeyImpl::save(std::ostream* pPublicKeyStream,
|
||||
std::ostream* pPrivateKeyStream,
|
||||
const std::string& privateKeyPassphrase) const
|
||||
inline void
|
||||
ECKeyImpl::save(std::ostream * pPublicKeyStream, std::ostream * pPrivateKeyStream, const std::string & privateKeyPassphrase) const
|
||||
{
|
||||
EVPPKey(_pEC).save(pPublicKeyStream, pPrivateKeyStream, privateKeyPassphrase);
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Crypto
|
||||
}
|
||||
} // namespace Poco::Crypto
|
||||
|
||||
|
||||
#endif // Crypto_ECKeyImplImpl_INCLUDED
|
||||
|
@ -19,19 +19,21 @@
|
||||
#define Crypto_EVPPKeyImpl_INCLUDED
|
||||
|
||||
|
||||
#include <sstream>
|
||||
#include <typeinfo>
|
||||
#include <openssl/ec.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/rsa.h>
|
||||
#include "Poco/Crypto/Crypto.h"
|
||||
#include "Poco/Crypto/CryptoException.h"
|
||||
#include "Poco/StreamCopier.h"
|
||||
#include <openssl/ec.h>
|
||||
#include <openssl/rsa.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <sstream>
|
||||
#include <typeinfo>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Crypto {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Crypto
|
||||
{
|
||||
|
||||
|
||||
class ECKey;
|
||||
@ -64,7 +66,8 @@ public:
|
||||
/// Constructs EVPPKey from a "native" OpenSSL (RSA or EC_KEY),
|
||||
/// or a Poco wrapper (RSAKey, ECKey) key pointer.
|
||||
{
|
||||
if (!_pEVPPKey) throw OpenSSLException();
|
||||
if (!_pEVPPKey)
|
||||
throw OpenSSLException();
|
||||
setKey(pKey);
|
||||
}
|
||||
|
||||
@ -113,13 +116,15 @@ public:
|
||||
/// Works as expected when one key contains only public key,
|
||||
/// while the other one contains private (thus also public) key.
|
||||
|
||||
void save(const std::string& publicKeyFile, const std::string& privateKeyFile = "", const std::string& privateKeyPassphrase = "") const;
|
||||
void save(const std::string & publicKeyFile, const std::string & privateKeyFile = "", const std::string & privateKeyPassphrase = "")
|
||||
const;
|
||||
/// Exports the public and/or private keys to the given files.
|
||||
///
|
||||
/// If an empty filename is specified, the corresponding key
|
||||
/// is not exported.
|
||||
|
||||
void save(std::ostream* pPublicKeyStream, std::ostream* pPrivateKeyStream = 0, const std::string& privateKeyPassphrase = "") const;
|
||||
void
|
||||
save(std::ostream * pPublicKeyStream, std::ostream * pPrivateKeyStream = 0, const std::string & privateKeyPassphrase = "") const;
|
||||
/// Exports the public and/or private key to the given streams.
|
||||
///
|
||||
/// If a null pointer is passed for a stream, the corresponding
|
||||
@ -163,21 +168,20 @@ private:
|
||||
// When used for EVP key loading, getFunc is null (ie. native key is not extracted
|
||||
// from the loaded EVP_PKEY).
|
||||
template <typename K, typename F>
|
||||
static bool loadKey(K** ppKey,
|
||||
PEM_read_FILE_Key_fn readFunc,
|
||||
F getFunc,
|
||||
const std::string& keyFile,
|
||||
const std::string& pass = "")
|
||||
static bool
|
||||
loadKey(K ** ppKey, PEM_read_FILE_Key_fn readFunc, F getFunc, const std::string & keyFile, const std::string & pass = "")
|
||||
{
|
||||
poco_assert_dbg (((typeid(K*) == typeid(RSA*) || typeid(K*) == typeid(EC_KEY*)) && getFunc) ||
|
||||
((typeid(K*) == typeid(EVP_PKEY*)) && !getFunc));
|
||||
poco_assert_dbg(
|
||||
((typeid(K *) == typeid(RSA *) || typeid(K *) == typeid(EC_KEY *)) && getFunc)
|
||||
|| ((typeid(K *) == typeid(EVP_PKEY *)) && !getFunc));
|
||||
poco_check_ptr(ppKey);
|
||||
poco_assert_dbg(!*ppKey);
|
||||
|
||||
FILE * pFile = 0;
|
||||
if (!keyFile.empty())
|
||||
{
|
||||
if (!getFunc) *ppKey = (K*)EVP_PKEY_new();
|
||||
if (!getFunc)
|
||||
*ppKey = (K *)EVP_PKEY_new();
|
||||
EVP_PKEY * pKey = getFunc ? EVP_PKEY_new() : (EVP_PKEY *)*ppKey;
|
||||
if (pKey)
|
||||
{
|
||||
@ -188,7 +192,8 @@ private:
|
||||
void * pPassword = pass.empty() ? (void *)0 : (void *)pass.c_str();
|
||||
if (readFunc(pFile, &pKey, pCB, pPassword))
|
||||
{
|
||||
fclose(pFile); pFile = 0;
|
||||
fclose(pFile);
|
||||
pFile = 0;
|
||||
if (getFunc)
|
||||
{
|
||||
*ppKey = (K *)getFunc(pKey);
|
||||
@ -199,35 +204,36 @@ private:
|
||||
poco_assert_dbg(typeid(K *) == typeid(EVP_PKEY *));
|
||||
*ppKey = (K *)pKey;
|
||||
}
|
||||
if(!*ppKey) goto error;
|
||||
if (!*ppKey)
|
||||
goto error;
|
||||
return true;
|
||||
}
|
||||
goto error;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (getFunc) EVP_PKEY_free(pKey);
|
||||
if (getFunc)
|
||||
EVP_PKEY_free(pKey);
|
||||
throw IOException("ECKeyImpl, cannot open file", keyFile);
|
||||
}
|
||||
}
|
||||
else goto error;
|
||||
else
|
||||
goto error;
|
||||
}
|
||||
return false;
|
||||
|
||||
error:
|
||||
if (pFile) fclose(pFile);
|
||||
if (pFile)
|
||||
fclose(pFile);
|
||||
throw OpenSSLException("EVPKey::loadKey(string)");
|
||||
}
|
||||
|
||||
template <typename K, typename F>
|
||||
static bool loadKey(K** ppKey,
|
||||
PEM_read_BIO_Key_fn readFunc,
|
||||
F getFunc,
|
||||
std::istream* pIstr,
|
||||
const std::string& pass = "")
|
||||
static bool loadKey(K ** ppKey, PEM_read_BIO_Key_fn readFunc, F getFunc, std::istream * pIstr, const std::string & pass = "")
|
||||
{
|
||||
poco_assert_dbg (((typeid(K*) == typeid(RSA*) || typeid(K*) == typeid(EC_KEY*)) && getFunc) ||
|
||||
((typeid(K*) == typeid(EVP_PKEY*)) && !getFunc));
|
||||
poco_assert_dbg(
|
||||
((typeid(K *) == typeid(RSA *) || typeid(K *) == typeid(EC_KEY *)) && getFunc)
|
||||
|| ((typeid(K *) == typeid(EVP_PKEY *)) && !getFunc));
|
||||
poco_check_ptr(ppKey);
|
||||
poco_assert_dbg(!*ppKey);
|
||||
|
||||
@ -240,7 +246,8 @@ private:
|
||||
pBIO = BIO_new_mem_buf(const_cast<char *>(key.data()), static_cast<int>(key.size()));
|
||||
if (pBIO)
|
||||
{
|
||||
if (!getFunc) *ppKey = (K*)EVP_PKEY_new();
|
||||
if (!getFunc)
|
||||
*ppKey = (K *)EVP_PKEY_new();
|
||||
EVP_PKEY * pKey = getFunc ? EVP_PKEY_new() : (EVP_PKEY *)*ppKey;
|
||||
if (pKey)
|
||||
{
|
||||
@ -248,7 +255,8 @@ private:
|
||||
void * pPassword = pass.empty() ? (void *)0 : (void *)pass.c_str();
|
||||
if (readFunc(pBIO, &pKey, pCB, pPassword))
|
||||
{
|
||||
BIO_free(pBIO); pBIO = 0;
|
||||
BIO_free(pBIO);
|
||||
pBIO = 0;
|
||||
if (getFunc)
|
||||
{
|
||||
*ppKey = (K *)getFunc(pKey);
|
||||
@ -259,20 +267,25 @@ private:
|
||||
poco_assert_dbg(typeid(K *) == typeid(EVP_PKEY *));
|
||||
*ppKey = (K *)pKey;
|
||||
}
|
||||
if (!*ppKey) goto error;
|
||||
if (!*ppKey)
|
||||
goto error;
|
||||
return true;
|
||||
}
|
||||
if (getFunc) EVP_PKEY_free(pKey);
|
||||
if (getFunc)
|
||||
EVP_PKEY_free(pKey);
|
||||
goto error;
|
||||
}
|
||||
else goto error;
|
||||
else
|
||||
goto error;
|
||||
}
|
||||
else goto error;
|
||||
else
|
||||
goto error;
|
||||
}
|
||||
return false;
|
||||
|
||||
error:
|
||||
if (pBIO) BIO_free(pBIO);
|
||||
if (pBIO)
|
||||
BIO_free(pBIO);
|
||||
throw OpenSSLException("EVPKey::loadKey(stream)");
|
||||
}
|
||||
|
||||
@ -304,7 +317,8 @@ inline bool EVPPKey::operator != (const EVPPKey& other) const
|
||||
|
||||
inline int EVPPKey::type(const EVP_PKEY * pEVPPKey)
|
||||
{
|
||||
if (!pEVPPKey) return NID_undef;
|
||||
if (!pEVPPKey)
|
||||
return NID_undef;
|
||||
|
||||
return EVP_PKEY_type(EVP_PKEY_id(pEVPPKey));
|
||||
}
|
||||
@ -348,7 +362,8 @@ inline void EVPPKey::setKey(RSA* pKey)
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Crypto
|
||||
}
|
||||
} // namespace Poco::Crypto
|
||||
|
||||
|
||||
#endif // Crypto_EVPPKeyImpl_INCLUDED
|
||||
|
@ -23,8 +23,10 @@
|
||||
#include "Poco/Crypto/KeyPairImpl.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Crypto {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Crypto
|
||||
{
|
||||
|
||||
|
||||
class X509Certificate;
|
||||
@ -54,7 +56,8 @@ public:
|
||||
virtual int size() const;
|
||||
/// Returns the RSA modulus size.
|
||||
|
||||
virtual void save(const std::string& publicKeyPairFile,
|
||||
virtual void save(
|
||||
const std::string & publicKeyPairFile,
|
||||
const std::string & privateKeyPairFile = "",
|
||||
const std::string & privateKeyPairPassphrase = "") const;
|
||||
/// Exports the public and private keys to the given files.
|
||||
@ -62,7 +65,8 @@ public:
|
||||
/// If an empty filename is specified, the corresponding key
|
||||
/// is not exported.
|
||||
|
||||
virtual void save(std::ostream* pPublicKeyPairStream,
|
||||
virtual void save(
|
||||
std::ostream * pPublicKeyPairStream,
|
||||
std::ostream * pPrivateKeyPairStream = 0,
|
||||
const std::string & privateKeyPairPassphrase = "") const;
|
||||
/// Exports the public and private key to the given streams.
|
||||
@ -94,17 +98,15 @@ inline int KeyPair::size() const
|
||||
}
|
||||
|
||||
|
||||
inline void KeyPair::save(const std::string& publicKeyFile,
|
||||
const std::string& privateKeyFile,
|
||||
const std::string& privateKeyPassphrase) const
|
||||
inline void
|
||||
KeyPair::save(const std::string & publicKeyFile, const std::string & privateKeyFile, const std::string & privateKeyPassphrase) const
|
||||
{
|
||||
_pImpl->save(publicKeyFile, privateKeyFile, privateKeyPassphrase);
|
||||
}
|
||||
|
||||
|
||||
inline void KeyPair::save(std::ostream* pPublicKeyStream,
|
||||
std::ostream* pPrivateKeyStream,
|
||||
const std::string& privateKeyPassphrase) const
|
||||
inline void
|
||||
KeyPair::save(std::ostream * pPublicKeyStream, std::ostream * pPrivateKeyStream, const std::string & privateKeyPassphrase) const
|
||||
{
|
||||
_pImpl->save(pPublicKeyStream, pPrivateKeyStream, privateKeyPassphrase);
|
||||
}
|
||||
@ -127,7 +129,8 @@ inline KeyPair::Type KeyPair::type() const
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Crypto
|
||||
}
|
||||
} // namespace Poco::Crypto
|
||||
|
||||
|
||||
#endif // Crypto_KeyPair_INCLUDED
|
||||
|
@ -19,16 +19,18 @@
|
||||
#define Crypto_KeyPairImplImpl_INCLUDED
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "Poco/Crypto/Crypto.h"
|
||||
#include "Poco/Crypto/OpenSSLInitializer.h"
|
||||
#include "Poco/RefCountedObject.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Crypto {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Crypto
|
||||
{
|
||||
|
||||
|
||||
class KeyPairImpl : public Poco::RefCountedObject
|
||||
@ -53,7 +55,8 @@ public:
|
||||
virtual int size() const = 0;
|
||||
/// Returns the key size.
|
||||
|
||||
virtual void save(const std::string& publicKeyFile,
|
||||
virtual void save(
|
||||
const std::string & publicKeyFile,
|
||||
const std::string & privateKeyFile = "",
|
||||
const std::string & privateKeyPassphrase = "") const = 0;
|
||||
/// Exports the public and private keys to the given files.
|
||||
@ -61,9 +64,8 @@ public:
|
||||
/// If an empty filename is specified, the corresponding key
|
||||
/// is not exported.
|
||||
|
||||
virtual void save(std::ostream* pPublicKeyStream,
|
||||
std::ostream* pPrivateKeyStream = 0,
|
||||
const std::string& privateKeyPassphrase = "") const = 0;
|
||||
virtual void save(
|
||||
std::ostream * pPublicKeyStream, std::ostream * pPrivateKeyStream = 0, const std::string & privateKeyPassphrase = "") const = 0;
|
||||
/// Exports the public and private key to the given streams.
|
||||
///
|
||||
/// If a null pointer is passed for a stream, the corresponding
|
||||
@ -101,7 +103,8 @@ inline KeyPairImpl::Type KeyPairImpl::type() const
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Crypto
|
||||
}
|
||||
} // namespace Poco::Crypto
|
||||
|
||||
|
||||
#endif // Crypto_KeyPairImplImpl_INCLUDED
|
||||
|
@ -18,18 +18,17 @@
|
||||
#define Crypto_OpenSSLInitializer_INCLUDED
|
||||
|
||||
|
||||
#include <openssl/crypto.h>
|
||||
#include "Poco/AtomicCounter.h"
|
||||
#include "Poco/Crypto/Crypto.h"
|
||||
#include "Poco/Mutex.h"
|
||||
#include "Poco/AtomicCounter.h"
|
||||
#include <openssl/crypto.h>
|
||||
|
||||
#if defined(OPENSSL_FIPS) && OPENSSL_VERSION_NUMBER < 0x010001000L
|
||||
# include <openssl/fips.h>
|
||||
#endif
|
||||
|
||||
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
struct CRYPTO_dynlock_value
|
||||
{
|
||||
Poco::FastMutex _mutex;
|
||||
@ -37,8 +36,10 @@ extern "C"
|
||||
}
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Crypto {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Crypto
|
||||
{
|
||||
|
||||
|
||||
class Crypto_API OpenSSLInitializer
|
||||
@ -109,7 +110,8 @@ inline void OpenSSLInitializer::enableFIPSMode(bool /*enabled*/)
|
||||
#endif
|
||||
|
||||
|
||||
} } // namespace Poco::Crypto
|
||||
}
|
||||
} // namespace Poco::Crypto
|
||||
|
||||
|
||||
#endif // Crypto_OpenSSLInitializer_INCLUDED
|
||||
|
@ -18,18 +18,20 @@
|
||||
#define Crypto_PKCS12Container_INCLUDED
|
||||
|
||||
|
||||
#include <istream>
|
||||
#include <memory>
|
||||
#include <openssl/pkcs12.h>
|
||||
#include "Poco/Crypto/Crypto.h"
|
||||
#include "Poco/Crypto/EVPPKey.h"
|
||||
#include "Poco/Crypto/OpenSSLInitializer.h"
|
||||
#include "Poco/Crypto/X509Certificate.h"
|
||||
#include "Poco/Crypto/EVPPKey.h"
|
||||
#include "Poco/Path.h"
|
||||
#include <memory>
|
||||
#include <istream>
|
||||
#include <openssl/pkcs12.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Crypto {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Crypto
|
||||
{
|
||||
|
||||
|
||||
class Crypto_API PKCS12Container
|
||||
@ -153,7 +155,8 @@ inline EVPPKey PKCS12Container::getKey() const
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Crypto
|
||||
}
|
||||
} // namespace Poco::Crypto
|
||||
|
||||
|
||||
#endif // Crypto_PKCS12Container_INCLUDED
|
||||
|
@ -18,15 +18,17 @@
|
||||
#define Crypto_RSACipherImpl_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Crypto/Crypto.h"
|
||||
#include "Poco/Crypto/Cipher.h"
|
||||
#include "Poco/Crypto/RSAKey.h"
|
||||
#include "Poco/Crypto/OpenSSLInitializer.h"
|
||||
#include <openssl/evp.h>
|
||||
#include "Poco/Crypto/Cipher.h"
|
||||
#include "Poco/Crypto/Crypto.h"
|
||||
#include "Poco/Crypto/OpenSSLInitializer.h"
|
||||
#include "Poco/Crypto/RSAKey.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Crypto {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Crypto
|
||||
{
|
||||
|
||||
|
||||
class RSACipherImpl : public Cipher
|
||||
@ -71,7 +73,8 @@ inline const std::string& RSACipherImpl::name() const
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Crypto
|
||||
}
|
||||
} // namespace Poco::Crypto
|
||||
|
||||
|
||||
#endif // Crypto_RSACipherImpl_INCLUDED
|
||||
|
@ -18,16 +18,18 @@
|
||||
#define Crypto_RSADigestEngine_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Crypto/Crypto.h"
|
||||
#include "Poco/Crypto/RSAKey.h"
|
||||
#include "Poco/DigestEngine.h"
|
||||
#include "Poco/Crypto/DigestEngine.h"
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
#include "Poco/Crypto/Crypto.h"
|
||||
#include "Poco/Crypto/DigestEngine.h"
|
||||
#include "Poco/Crypto/RSAKey.h"
|
||||
#include "Poco/DigestEngine.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Crypto {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Crypto
|
||||
{
|
||||
|
||||
|
||||
class Crypto_API RSADigestEngine : public Poco::DigestEngine
|
||||
@ -105,7 +107,8 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::Crypto
|
||||
}
|
||||
} // namespace Poco::Crypto
|
||||
|
||||
|
||||
#endif // Crypto_RSADigestEngine_INCLUDED
|
||||
|
@ -23,8 +23,10 @@
|
||||
#include "Poco/Crypto/RSAKeyImpl.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Crypto {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Crypto
|
||||
{
|
||||
|
||||
|
||||
class X509Certificate;
|
||||
@ -68,9 +70,7 @@ public:
|
||||
/// Creates the RSAKey. Creates a new public/private keypair using the given parameters.
|
||||
/// Can be used to sign data and verify signatures.
|
||||
|
||||
RSAKey(const std::string& publicKeyFile,
|
||||
const std::string& privateKeyFile = "",
|
||||
const std::string& privateKeyPassphrase = "");
|
||||
RSAKey(const std::string & publicKeyFile, const std::string & privateKeyFile = "", const std::string & privateKeyPassphrase = "");
|
||||
/// Creates the RSAKey, by reading public and private key from the given files and
|
||||
/// using the given passphrase for the private key.
|
||||
///
|
||||
@ -79,9 +79,7 @@ public:
|
||||
/// If a private key is specified, you don't need to specify a public key file.
|
||||
/// OpenSSL will auto-create the public key from the private key.
|
||||
|
||||
RSAKey(std::istream* pPublicKeyStream,
|
||||
std::istream* pPrivateKeyStream = 0,
|
||||
const std::string& privateKeyPassphrase = "");
|
||||
RSAKey(std::istream * pPublicKeyStream, std::istream * pPrivateKeyStream = 0, const std::string & privateKeyPassphrase = "");
|
||||
/// Creates the RSAKey, by reading public and private key from the given streams and
|
||||
/// using the given passphrase for the private key.
|
||||
///
|
||||
@ -119,7 +117,8 @@ inline RSAKeyImpl::Ptr RSAKey::impl() const
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Crypto
|
||||
}
|
||||
} // namespace Poco::Crypto
|
||||
|
||||
|
||||
#endif // Crypto_RSAKey_INCLUDED
|
@ -18,15 +18,15 @@
|
||||
#define Crypto_RSAKeyImplImpl_INCLUDED
|
||||
|
||||
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
#include <vector>
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "Poco/Crypto/Crypto.h"
|
||||
#include "Poco/Crypto/EVPPKey.h"
|
||||
#include "Poco/Crypto/KeyPairImpl.h"
|
||||
#include "Poco/Crypto/OpenSSLInitializer.h"
|
||||
#include "Poco/RefCountedObject.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
#include <vector>
|
||||
|
||||
|
||||
struct bignum_st;
|
||||
@ -35,8 +35,10 @@ typedef struct bignum_st BIGNUM;
|
||||
typedef struct rsa_st RSA;
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Crypto {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Crypto
|
||||
{
|
||||
|
||||
|
||||
class X509Certificate;
|
||||
@ -94,17 +96,15 @@ public:
|
||||
ByteVec decryptionExponent() const;
|
||||
/// Returns the RSA decryption exponent.
|
||||
|
||||
void save(const std::string& publicKeyFile,
|
||||
const std::string& privateKeyFile = "",
|
||||
const std::string& privateKeyPassphrase = "") const;
|
||||
void save(const std::string & publicKeyFile, const std::string & privateKeyFile = "", const std::string & privateKeyPassphrase = "")
|
||||
const;
|
||||
/// Exports the public and private keys to the given files.
|
||||
///
|
||||
/// If an empty filename is specified, the corresponding key
|
||||
/// is not exported.
|
||||
|
||||
void save(std::ostream* pPublicKeyStream,
|
||||
std::ostream* pPrivateKeyStream = 0,
|
||||
const std::string& privateKeyPassphrase = "") const;
|
||||
void
|
||||
save(std::ostream * pPublicKeyStream, std::ostream * pPrivateKeyStream = 0, const std::string & privateKeyPassphrase = "") const;
|
||||
/// Exports the public and private key to the given streams.
|
||||
///
|
||||
/// If a null pointer is passed for a stream, the corresponding
|
||||
@ -135,7 +135,8 @@ inline const RSA* RSAKeyImpl::getRSA() const
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Crypto
|
||||
}
|
||||
} // namespace Poco::Crypto
|
||||
|
||||
|
||||
#endif // Crypto_RSAKeyImplImpl_INCLUDED
|
@ -18,18 +18,20 @@
|
||||
#define Crypto_X509Certificate_INCLUDED
|
||||
|
||||
|
||||
#include <istream>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
#include <openssl/ssl.h>
|
||||
#include "Poco/Crypto/Crypto.h"
|
||||
#include "Poco/Crypto/OpenSSLInitializer.h"
|
||||
#include "Poco/DateTime.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <istream>
|
||||
#include <openssl/ssl.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Crypto {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Crypto
|
||||
{
|
||||
|
||||
|
||||
class Crypto_API X509Certificate
|
||||
@ -239,7 +241,8 @@ inline X509* X509Certificate::dup() const
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Crypto
|
||||
}
|
||||
} // namespace Poco::Crypto
|
||||
|
||||
|
||||
#endif // Crypto_X509Certificate_INCLUDED
|
||||
|
@ -18,39 +18,42 @@
|
||||
#define Data_ODBC_Binder_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/AbstractBinder.h"
|
||||
#include "Poco/Data/LOB.h"
|
||||
#include "Poco/Data/ODBC/Handle.h"
|
||||
#include "Poco/Data/ODBC/Parameter.h"
|
||||
#include "Poco/Data/ODBC/ODBCMetaColumn.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Data/ODBC/TypeInfo.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include "Poco/Data/AbstractBinder.h"
|
||||
#include "Poco/Data/LOB.h"
|
||||
#include "Poco/Data/ODBC/Handle.h"
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/ODBC/ODBCMetaColumn.h"
|
||||
#include "Poco/Data/ODBC/Parameter.h"
|
||||
#include "Poco/Data/ODBC/TypeInfo.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Exception.h"
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
# include <windows.h>
|
||||
#endif
|
||||
#include <sqlext.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Poco
|
||||
{
|
||||
|
||||
|
||||
class DateTime;
|
||||
|
||||
|
||||
namespace Data {
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class Date;
|
||||
class Time;
|
||||
|
||||
|
||||
namespace ODBC {
|
||||
namespace ODBC
|
||||
{
|
||||
|
||||
|
||||
class ODBC_API Binder : public Poco::Data::AbstractBinder
|
||||
@ -68,7 +71,8 @@ public:
|
||||
PB_AT_EXEC
|
||||
};
|
||||
|
||||
Binder(const StatementHandle& rStmt,
|
||||
Binder(
|
||||
const StatementHandle & rStmt,
|
||||
std::size_t maxFieldSize,
|
||||
ParameterBinding dataBinding = PB_IMMEDIATE,
|
||||
TypeInfo * pDataTypes = 0);
|
||||
@ -392,14 +396,17 @@ private:
|
||||
|
||||
_lengthIndicator.push_back(0);
|
||||
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
if (Utility::isError(SQLBindParameter(
|
||||
_rStmt,
|
||||
(SQLUSMALLINT)pos + 1,
|
||||
toODBCDirection(dir),
|
||||
cDataType,
|
||||
Utility::sqlDataType(cDataType),
|
||||
colSize,
|
||||
decDigits,
|
||||
(SQLPOINTER) &val, 0, 0)))
|
||||
(SQLPOINTER)&val,
|
||||
0,
|
||||
0)))
|
||||
{
|
||||
throw StatementException(_rStmt, "SQLBindParameter()");
|
||||
}
|
||||
@ -424,7 +431,8 @@ private:
|
||||
|
||||
_lengthIndicator.push_back(pLenIn);
|
||||
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
if (Utility::isError(SQLBindParameter(
|
||||
_rStmt,
|
||||
(SQLUSMALLINT)pos + 1,
|
||||
SQL_PARAM_INPUT,
|
||||
SQL_C_BINARY,
|
||||
@ -457,7 +465,8 @@ private:
|
||||
_vecLengthIndicator[pos] = new LengthVec(length);
|
||||
}
|
||||
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
if (Utility::isError(SQLBindParameter(
|
||||
_rStmt,
|
||||
(SQLUSMALLINT)pos + 1,
|
||||
toODBCDirection(dir),
|
||||
cDataType,
|
||||
@ -516,9 +525,11 @@ private:
|
||||
|
||||
typename C::const_iterator it = val.begin();
|
||||
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,
|
||||
toODBCDirection(dir),
|
||||
cDataType,
|
||||
@ -558,7 +569,8 @@ private:
|
||||
{
|
||||
getMinValueSize(val, size);
|
||||
// accommodate for terminating zero
|
||||
if (size != _maxFieldSize) ++size;
|
||||
if (size != _maxFieldSize)
|
||||
++size;
|
||||
}
|
||||
|
||||
if (_vecLengthIndicator.size() <= pos)
|
||||
@ -585,7 +597,8 @@ private:
|
||||
offset += size;
|
||||
}
|
||||
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
if (Utility::isError(SQLBindParameter(
|
||||
_rStmt,
|
||||
(SQLUSMALLINT)pos + 1,
|
||||
toODBCDirection(dir),
|
||||
SQL_C_CHAR,
|
||||
@ -624,7 +637,8 @@ private:
|
||||
{
|
||||
getMinValueSize(val, size);
|
||||
// accommodate for terminating zero
|
||||
if (size != _maxFieldSize) size += sizeof(UTF16Char);
|
||||
if (size != _maxFieldSize)
|
||||
size += sizeof(UTF16Char);
|
||||
}
|
||||
|
||||
if (_vecLengthIndicator.size() <= pos)
|
||||
@ -652,7 +666,8 @@ private:
|
||||
offset += size;
|
||||
}
|
||||
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
if (Utility::isError(SQLBindParameter(
|
||||
_rStmt,
|
||||
(SQLUSMALLINT)pos + 1,
|
||||
toODBCDirection(dir),
|
||||
SQL_C_WCHAR,
|
||||
@ -699,7 +714,8 @@ private:
|
||||
for (; lIt != lEnd; ++lIt, ++cIt)
|
||||
{
|
||||
SQLLEN sz = static_cast<SQLLEN>(cIt->size());
|
||||
if (sz > size) size = static_cast<SQLINTEGER>(sz);
|
||||
if (sz > size)
|
||||
size = static_cast<SQLINTEGER>(sz);
|
||||
*lIt = sz;
|
||||
}
|
||||
|
||||
@ -722,7 +738,8 @@ private:
|
||||
offset += size;
|
||||
}
|
||||
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
if (Utility::isError(SQLBindParameter(
|
||||
_rStmt,
|
||||
(SQLUSMALLINT)pos + 1,
|
||||
SQL_PARAM_INPUT,
|
||||
SQL_C_BINARY,
|
||||
@ -773,7 +790,8 @@ private:
|
||||
SQLSMALLINT decDigits = 0;
|
||||
getColSizeAndPrecision(pos, SQL_TYPE_DATE, colSize, decDigits);
|
||||
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
if (Utility::isError(SQLBindParameter(
|
||||
_rStmt,
|
||||
(SQLUSMALLINT)pos + 1,
|
||||
toODBCDirection(dir),
|
||||
SQL_C_TYPE_DATE,
|
||||
@ -823,7 +841,8 @@ private:
|
||||
SQLSMALLINT decDigits = 0;
|
||||
getColSizeAndPrecision(pos, SQL_TYPE_TIME, colSize, decDigits);
|
||||
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
if (Utility::isError(SQLBindParameter(
|
||||
_rStmt,
|
||||
(SQLUSMALLINT)pos + 1,
|
||||
toODBCDirection(dir),
|
||||
SQL_C_TYPE_TIME,
|
||||
@ -874,7 +893,8 @@ private:
|
||||
SQLSMALLINT decDigits = 0;
|
||||
getColSizeAndPrecision(pos, SQL_TYPE_TIMESTAMP, colSize, decDigits);
|
||||
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
if (Utility::isError(SQLBindParameter(
|
||||
_rStmt,
|
||||
(SQLUSMALLINT)pos + 1,
|
||||
toODBCDirection(dir),
|
||||
SQL_C_TYPE_TIMESTAMP,
|
||||
@ -917,7 +937,8 @@ private:
|
||||
SQLSMALLINT decDigits = 0;
|
||||
getColSizeAndPrecision(pos, SQL_C_STINYINT, colSize, decDigits);
|
||||
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
if (Utility::isError(SQLBindParameter(
|
||||
_rStmt,
|
||||
(SQLUSMALLINT)pos + 1,
|
||||
SQL_PARAM_INPUT,
|
||||
SQL_C_STINYINT,
|
||||
@ -932,11 +953,8 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
void getColSizeAndPrecision(std::size_t pos,
|
||||
SQLSMALLINT cDataType,
|
||||
SQLINTEGER& colSize,
|
||||
SQLSMALLINT& decDigits,
|
||||
std::size_t actualSize = 0);
|
||||
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
|
||||
@ -989,7 +1007,8 @@ private:
|
||||
if (sz < _maxFieldSize && sz > maxSize)
|
||||
maxSize = sz;
|
||||
}
|
||||
if (maxSize) size = static_cast<SQLINTEGER>(maxSize);
|
||||
if (maxSize)
|
||||
size = static_cast<SQLINTEGER>(maxSize);
|
||||
}
|
||||
|
||||
const StatementHandle & _rStmt;
|
||||
@ -1510,7 +1529,9 @@ inline Binder::ParameterBinding Binder::getDataBinding() const
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
}
|
||||
}
|
||||
} // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif // Data_ODBC_Binder_INCLUDED
|
||||
|
@ -18,17 +18,20 @@
|
||||
#define Data_ODBC_ConnectionHandle_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/ODBC/EnvironmentHandle.h"
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
# include <windows.h>
|
||||
#endif
|
||||
#include <sqltypes.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
namespace ODBC
|
||||
{
|
||||
|
||||
|
||||
class ODBC_API ConnectionHandle
|
||||
@ -90,7 +93,9 @@ inline SQLHDBC& ConnectionHandle::handle()
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
}
|
||||
}
|
||||
} // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -18,13 +18,16 @@
|
||||
#define Data_ODBC_Connector_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/Connector.h"
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
namespace ODBC
|
||||
{
|
||||
|
||||
|
||||
class ODBC_API Connector : public Poco::Data::Connector
|
||||
@ -43,8 +46,8 @@ public:
|
||||
const std::string & name() const;
|
||||
/// Returns the name associated with this connector.
|
||||
|
||||
Poco::AutoPtr<Poco::Data::SessionImpl> createSession(const std::string& connectionString,
|
||||
std::size_t timeout = Poco::Data::SessionImpl::LOGIN_TIMEOUT_DEFAULT);
|
||||
Poco::AutoPtr<Poco::Data::SessionImpl>
|
||||
createSession(const std::string & connectionString, std::size_t timeout = Poco::Data::SessionImpl::LOGIN_TIMEOUT_DEFAULT);
|
||||
/// Creates a ODBC SessionImpl object and initializes it with the given connectionString.
|
||||
|
||||
static void registerConnector();
|
||||
@ -90,7 +93,9 @@ inline bool Connector::stringBoundToLongVarChar()
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
}
|
||||
}
|
||||
} // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif // Data_ODBC_Connector_INCLUDED
|
||||
|
@ -18,18 +18,22 @@
|
||||
#define Data_ODBC_Diagnostics_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include <vector>
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
# include <windows.h>
|
||||
#endif
|
||||
#include <sqlext.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
namespace ODBC
|
||||
{
|
||||
|
||||
|
||||
template <typename H, SQLSMALLINT handleType>
|
||||
@ -40,7 +44,6 @@ class Diagnostics
|
||||
/// are populated and the object is ready for querying.
|
||||
{
|
||||
public:
|
||||
|
||||
static const unsigned int SQL_STATE_SIZE = SQL_SQLSTATE_SIZE + 1;
|
||||
static const unsigned int SQL_MESSAGE_LENGTH = SQL_MAX_MESSAGE_LENGTH + 1;
|
||||
static const unsigned int SQL_NAME_LENGTH = 128;
|
||||
@ -121,20 +124,11 @@ public:
|
||||
_fields.clear();
|
||||
}
|
||||
|
||||
const FieldVec& fields() const
|
||||
{
|
||||
return _fields;
|
||||
}
|
||||
const FieldVec & fields() const { return _fields; }
|
||||
|
||||
Iterator begin() const
|
||||
{
|
||||
return _fields.begin();
|
||||
}
|
||||
Iterator begin() const { return _fields.begin(); }
|
||||
|
||||
Iterator end() const
|
||||
{
|
||||
return _fields.end();
|
||||
}
|
||||
Iterator end() const { return _fields.end(); }
|
||||
|
||||
const Diagnostics & diagnostics()
|
||||
{
|
||||
@ -146,21 +140,16 @@ public:
|
||||
|
||||
reset();
|
||||
|
||||
while (!Utility::isError(SQLGetDiagRec(handleType,
|
||||
_handle,
|
||||
count,
|
||||
df._sqlState,
|
||||
&df._nativeError,
|
||||
df._message,
|
||||
SQL_MESSAGE_LENGTH,
|
||||
&messageLength)))
|
||||
while (!Utility::isError(SQLGetDiagRec(
|
||||
handleType, _handle, count, df._sqlState, &df._nativeError, df._message, SQL_MESSAGE_LENGTH, &messageLength)))
|
||||
{
|
||||
if (1 == count)
|
||||
{
|
||||
// success of the following two calls is optional
|
||||
// (they fail if connection has not been established yet
|
||||
// or return empty string if not applicable for the context)
|
||||
if (Utility::isError(SQLGetDiagField(handleType,
|
||||
if (Utility::isError(SQLGetDiagField(
|
||||
handleType,
|
||||
_handle,
|
||||
count,
|
||||
SQL_DIAG_CONNECTION_NAME,
|
||||
@ -168,33 +157,24 @@ public:
|
||||
sizeof(_connectionName),
|
||||
&messageLength)))
|
||||
{
|
||||
std::size_t len = sizeof(_connectionName) > none.length() ?
|
||||
none.length() : sizeof(_connectionName) - 1;
|
||||
std::size_t len = sizeof(_connectionName) > none.length() ? none.length() : sizeof(_connectionName) - 1;
|
||||
std::memcpy(_connectionName, none.c_str(), len);
|
||||
}
|
||||
else if (0 == _connectionName[0])
|
||||
{
|
||||
std::size_t len = sizeof(_connectionName) > na.length() ?
|
||||
na.length() : sizeof(_connectionName) - 1;
|
||||
std::size_t len = sizeof(_connectionName) > na.length() ? na.length() : sizeof(_connectionName) - 1;
|
||||
std::memcpy(_connectionName, na.c_str(), len);
|
||||
}
|
||||
|
||||
if (Utility::isError(SQLGetDiagField(handleType,
|
||||
_handle,
|
||||
count,
|
||||
SQL_DIAG_SERVER_NAME,
|
||||
_serverName,
|
||||
sizeof(_serverName),
|
||||
&messageLength)))
|
||||
if (Utility::isError(SQLGetDiagField(
|
||||
handleType, _handle, count, SQL_DIAG_SERVER_NAME, _serverName, sizeof(_serverName), &messageLength)))
|
||||
{
|
||||
std::size_t len = sizeof(_serverName) > none.length() ?
|
||||
none.length() : sizeof(_serverName) - 1;
|
||||
std::size_t len = sizeof(_serverName) > none.length() ? none.length() : sizeof(_serverName) - 1;
|
||||
std::memcpy(_serverName, none.c_str(), len);
|
||||
}
|
||||
else if (0 == _serverName[0])
|
||||
{
|
||||
std::size_t len = sizeof(_serverName) > na.length() ?
|
||||
na.length() : sizeof(_serverName) - 1;
|
||||
std::size_t len = sizeof(_serverName) > na.length() ? na.length() : sizeof(_serverName) - 1;
|
||||
std::memcpy(_serverName, na.c_str(), len);
|
||||
}
|
||||
}
|
||||
@ -212,7 +192,6 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Diagnostics();
|
||||
|
||||
/// SQLGetDiagField fields
|
||||
@ -233,7 +212,9 @@ typedef Diagnostics<SQLHSTMT, SQL_HANDLE_STMT> StatementDiagnostics;
|
||||
typedef Diagnostics<SQLHDESC, SQL_HANDLE_DESC> DescriptorDiagnostics;
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
}
|
||||
}
|
||||
} // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -25,9 +25,12 @@
|
||||
#include <sqltypes.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
namespace ODBC
|
||||
{
|
||||
|
||||
|
||||
class ODBC_API EnvironmentHandle
|
||||
@ -88,7 +91,9 @@ inline SQLHENV& EnvironmentHandle::handle()
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
}
|
||||
}
|
||||
} // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -18,20 +18,23 @@
|
||||
#define Data_ODBC_Error_INCLUDED
|
||||
|
||||
|
||||
#include <vector>
|
||||
#include "Poco/Data/ODBC/Diagnostics.h"
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Data/ODBC/Diagnostics.h"
|
||||
#include "Poco/Format.h"
|
||||
#include <vector>
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
# include <windows.h>
|
||||
#endif
|
||||
#include <sqlext.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
namespace ODBC
|
||||
{
|
||||
|
||||
|
||||
template <typename H, SQLSMALLINT handleType>
|
||||
@ -70,7 +73,8 @@ public:
|
||||
return str;
|
||||
|
||||
std::string s;
|
||||
Poco::format(s,
|
||||
Poco::format(
|
||||
s,
|
||||
"===========================\n"
|
||||
"ODBC Diagnostic record #%d:\n"
|
||||
"===========================\n"
|
||||
@ -90,10 +94,7 @@ public:
|
||||
{
|
||||
std::string str;
|
||||
|
||||
Poco::format(str,
|
||||
"Connection:%s\nServer:%s\n",
|
||||
_diagnostics.connectionName(),
|
||||
_diagnostics.serverName());
|
||||
Poco::format(str, "Connection:%s\nServer:%s\n", _diagnostics.connectionName(), _diagnostics.serverName());
|
||||
|
||||
std::string s;
|
||||
for (int i = 0; i < count(); ++i)
|
||||
@ -118,7 +119,9 @@ typedef Error<SQLHSTMT, SQL_HANDLE_STMT> StatementError;
|
||||
typedef Error<SQLHSTMT, SQL_HANDLE_DESC> DescriptorError;
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
}
|
||||
}
|
||||
} // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -18,31 +18,34 @@
|
||||
#define Data_ODBC_Extractor_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/Constants.h"
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include <map>
|
||||
#include "Poco/Any.h"
|
||||
#include "Poco/Data/AbstractExtractor.h"
|
||||
#include "Poco/Data/ODBC/Preparator.h"
|
||||
#include "Poco/Data/ODBC/ODBCMetaColumn.h"
|
||||
#include "Poco/Data/ODBC/Error.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Data/Constants.h"
|
||||
#include "Poco/Data/Date.h"
|
||||
#include "Poco/Data/ODBC/Error.h"
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/ODBC/ODBCMetaColumn.h"
|
||||
#include "Poco/Data/ODBC/Preparator.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Data/Time.h"
|
||||
#include "Poco/DateTime.h"
|
||||
#include "Poco/Any.h"
|
||||
#include "Poco/Dynamic/Var.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include "Poco/Nullable.h"
|
||||
#include "Poco/UTFString.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include <map>
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
# include <windows.h>
|
||||
#endif
|
||||
#include <sqltypes.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
namespace ODBC
|
||||
{
|
||||
|
||||
|
||||
class ODBC_API Extractor : public Poco::Data::AbstractExtractor
|
||||
@ -52,8 +55,7 @@ class ODBC_API Extractor: public Poco::Data::AbstractExtractor
|
||||
public:
|
||||
typedef Preparator::Ptr PreparatorPtr;
|
||||
|
||||
Extractor(const StatementHandle& rStmt,
|
||||
Preparator::Ptr pPreparator);
|
||||
Extractor(const StatementHandle & rStmt, Preparator::Ptr pPreparator);
|
||||
/// Creates the Extractor.
|
||||
|
||||
~Extractor();
|
||||
@ -363,7 +365,8 @@ private:
|
||||
template <typename T>
|
||||
bool extractBoundImpl(std::size_t pos, T & val)
|
||||
{
|
||||
if (isNull(pos)) return false;
|
||||
if (isNull(pos))
|
||||
return false;
|
||||
poco_assert_dbg(typeid(T) == _pPreparator->at(pos).type());
|
||||
val = *AnyCast<T>(&_pPreparator->at(pos));
|
||||
return true;
|
||||
@ -417,10 +420,13 @@ private:
|
||||
typename StringType::reverse_iterator sEnd = it->rend();
|
||||
for (; sIt != sEnd; ++sIt)
|
||||
{
|
||||
if (*sIt == '\0') ++trimLen;
|
||||
else break;
|
||||
if (*sIt == '\0')
|
||||
++trimLen;
|
||||
else
|
||||
break;
|
||||
}
|
||||
if (trimLen) it->assign(it->begin(), it->begin() + it->length() - trimLen);
|
||||
if (trimLen)
|
||||
it->assign(it->begin(), it->begin() + it->length() - trimLen);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -448,7 +454,8 @@ private:
|
||||
template <typename T>
|
||||
bool extractBoundImplLOB(std::size_t pos, Poco::Data::LOB<T> & val)
|
||||
{
|
||||
if (isNull(pos)) return false;
|
||||
if (isNull(pos))
|
||||
return false;
|
||||
|
||||
std::size_t dataSize = _pPreparator->actualDataSize(pos);
|
||||
checkDataSize(dataSize);
|
||||
@ -466,7 +473,8 @@ private:
|
||||
|
||||
resizeLengths(pos);
|
||||
|
||||
rc = SQLGetData(_rStmt,
|
||||
rc = SQLGetData(
|
||||
_rStmt,
|
||||
(SQLUSMALLINT)pos + 1,
|
||||
cType, //C data type
|
||||
&value, //returned value
|
||||
@ -513,59 +521,77 @@ private:
|
||||
|
||||
switch (column.type())
|
||||
{
|
||||
case MetaColumn::FDT_INT8:
|
||||
{ return extAny<T, Poco::Int8>(pos, val); }
|
||||
case MetaColumn::FDT_INT8: {
|
||||
return extAny<T, Poco::Int8>(pos, val);
|
||||
}
|
||||
|
||||
case MetaColumn::FDT_UINT8:
|
||||
{ return extAny<T, Poco::UInt8>(pos, val); }
|
||||
case MetaColumn::FDT_UINT8: {
|
||||
return extAny<T, Poco::UInt8>(pos, val);
|
||||
}
|
||||
|
||||
case MetaColumn::FDT_INT16:
|
||||
{ return extAny<T, Poco::Int16>(pos, val); }
|
||||
case MetaColumn::FDT_INT16: {
|
||||
return extAny<T, Poco::Int16>(pos, val);
|
||||
}
|
||||
|
||||
case MetaColumn::FDT_UINT16:
|
||||
{ return extAny<T, Poco::UInt16>(pos, val); }
|
||||
case MetaColumn::FDT_UINT16: {
|
||||
return extAny<T, Poco::UInt16>(pos, val);
|
||||
}
|
||||
|
||||
case MetaColumn::FDT_INT32:
|
||||
{ return extAny<T, Poco::Int32>(pos, val); }
|
||||
case MetaColumn::FDT_INT32: {
|
||||
return extAny<T, Poco::Int32>(pos, val);
|
||||
}
|
||||
|
||||
case MetaColumn::FDT_UINT32:
|
||||
{ return extAny<T, Poco::UInt32>(pos, val); }
|
||||
case MetaColumn::FDT_UINT32: {
|
||||
return extAny<T, Poco::UInt32>(pos, val);
|
||||
}
|
||||
|
||||
case MetaColumn::FDT_INT64:
|
||||
{ return extAny<T, Poco::Int64>(pos, val); }
|
||||
case MetaColumn::FDT_INT64: {
|
||||
return extAny<T, Poco::Int64>(pos, val);
|
||||
}
|
||||
|
||||
case MetaColumn::FDT_UINT64:
|
||||
{ return extAny<T, Poco::UInt64>(pos, val); }
|
||||
case MetaColumn::FDT_UINT64: {
|
||||
return extAny<T, Poco::UInt64>(pos, val);
|
||||
}
|
||||
|
||||
case MetaColumn::FDT_BOOL:
|
||||
{ return extAny<T, bool>(pos, val); }
|
||||
case MetaColumn::FDT_BOOL: {
|
||||
return extAny<T, bool>(pos, val);
|
||||
}
|
||||
|
||||
case MetaColumn::FDT_FLOAT:
|
||||
{ return extAny<T, float>(pos, val); }
|
||||
case MetaColumn::FDT_FLOAT: {
|
||||
return extAny<T, float>(pos, val);
|
||||
}
|
||||
|
||||
case MetaColumn::FDT_DOUBLE:
|
||||
{ return extAny<T, double>(pos, val); }
|
||||
case MetaColumn::FDT_DOUBLE: {
|
||||
return extAny<T, double>(pos, val);
|
||||
}
|
||||
|
||||
case MetaColumn::FDT_STRING:
|
||||
{ return extAny<T, std::string>(pos, val); }
|
||||
case MetaColumn::FDT_STRING: {
|
||||
return extAny<T, std::string>(pos, val);
|
||||
}
|
||||
|
||||
case MetaColumn::FDT_WSTRING:
|
||||
{ return extAny<T, Poco::UTF16String>(pos, val); }
|
||||
case MetaColumn::FDT_WSTRING: {
|
||||
return extAny<T, Poco::UTF16String>(pos, val);
|
||||
}
|
||||
|
||||
case MetaColumn::FDT_BLOB:
|
||||
{ return extAny<T, Poco::Data::BLOB>(pos, val); }
|
||||
case MetaColumn::FDT_BLOB: {
|
||||
return extAny<T, Poco::Data::BLOB>(pos, val);
|
||||
}
|
||||
|
||||
case MetaColumn::FDT_CLOB:
|
||||
{ return extAny<T, Poco::Data::CLOB>(pos, val); }
|
||||
case MetaColumn::FDT_CLOB: {
|
||||
return extAny<T, Poco::Data::CLOB>(pos, val);
|
||||
}
|
||||
|
||||
case MetaColumn::FDT_DATE:
|
||||
{ return extAny<T, Poco::Data::Date>(pos, val); }
|
||||
case MetaColumn::FDT_DATE: {
|
||||
return extAny<T, Poco::Data::Date>(pos, val);
|
||||
}
|
||||
|
||||
case MetaColumn::FDT_TIME:
|
||||
{ return extAny<T, Poco::Data::Time>(pos, val); }
|
||||
case MetaColumn::FDT_TIME: {
|
||||
return extAny<T, Poco::Data::Time>(pos, val);
|
||||
}
|
||||
|
||||
case MetaColumn::FDT_TIMESTAMP:
|
||||
{ return extAny<T, Poco::DateTime>(pos, val); }
|
||||
case MetaColumn::FDT_TIMESTAMP: {
|
||||
return extAny<T, Poco::DateTime>(pos, val);
|
||||
}
|
||||
|
||||
default:
|
||||
throw DataFormatException("Unsupported data type.");
|
||||
@ -640,43 +666,37 @@ inline bool Extractor::extractBoundImplContainer(std::size_t pos, std::list<Poco
|
||||
}
|
||||
|
||||
|
||||
inline bool Extractor::extractBoundImplContainer(std::size_t pos,
|
||||
std::vector<Poco::Data::CLOB>& values)
|
||||
inline bool Extractor::extractBoundImplContainer(std::size_t pos, std::vector<Poco::Data::CLOB> & values)
|
||||
{
|
||||
return extractBoundImplContainerLOB(pos, values);
|
||||
}
|
||||
|
||||
|
||||
inline bool Extractor::extractBoundImplContainer(std::size_t pos,
|
||||
std::deque<Poco::Data::CLOB>& values)
|
||||
inline bool Extractor::extractBoundImplContainer(std::size_t pos, std::deque<Poco::Data::CLOB> & values)
|
||||
{
|
||||
return extractBoundImplContainerLOB(pos, values);
|
||||
}
|
||||
|
||||
|
||||
inline bool Extractor::extractBoundImplContainer(std::size_t pos,
|
||||
std::list<Poco::Data::CLOB>& values)
|
||||
inline bool Extractor::extractBoundImplContainer(std::size_t pos, std::list<Poco::Data::CLOB> & values)
|
||||
{
|
||||
return extractBoundImplContainerLOB(pos, values);
|
||||
}
|
||||
|
||||
|
||||
inline bool Extractor::extractBoundImplContainer(std::size_t pos,
|
||||
std::vector<Poco::Data::BLOB>& values)
|
||||
inline bool Extractor::extractBoundImplContainer(std::size_t pos, std::vector<Poco::Data::BLOB> & values)
|
||||
{
|
||||
return extractBoundImplContainerLOB(pos, values);
|
||||
}
|
||||
|
||||
|
||||
inline bool Extractor::extractBoundImplContainer(std::size_t pos,
|
||||
std::deque<Poco::Data::BLOB>& values)
|
||||
inline bool Extractor::extractBoundImplContainer(std::size_t pos, std::deque<Poco::Data::BLOB> & values)
|
||||
{
|
||||
return extractBoundImplContainerLOB(pos, values);
|
||||
}
|
||||
|
||||
|
||||
inline bool Extractor::extractBoundImplContainer(std::size_t pos,
|
||||
std::list<Poco::Data::BLOB>& values)
|
||||
inline bool Extractor::extractBoundImplContainer(std::size_t pos, std::list<Poco::Data::BLOB> & values)
|
||||
{
|
||||
return extractBoundImplContainerLOB(pos, values);
|
||||
}
|
||||
@ -717,12 +737,15 @@ inline SQLINTEGER Extractor::columnSize(std::size_t pos) const
|
||||
{
|
||||
std::size_t size = ODBCMetaColumn(_rStmt, pos).length();
|
||||
std::size_t maxSize = _pPreparator->maxDataSize(pos);
|
||||
if (size > maxSize) size = maxSize;
|
||||
if (size > maxSize)
|
||||
size = maxSize;
|
||||
return (SQLINTEGER)size;
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
}
|
||||
}
|
||||
} // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif // Data_ODBC_Extractor_INCLUDED
|
||||
|
@ -18,9 +18,9 @@
|
||||
#define Data_ODBC_Handle_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/ODBC/EnvironmentHandle.h"
|
||||
#include "Poco/Data/ODBC/ConnectionHandle.h"
|
||||
#include "Poco/Data/ODBC/EnvironmentHandle.h"
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/ODBC/ODBCException.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
@ -29,9 +29,12 @@
|
||||
#include <sqltypes.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
namespace ODBC
|
||||
{
|
||||
|
||||
|
||||
template <typename H, SQLSMALLINT handleType>
|
||||
@ -39,14 +42,10 @@ class Handle
|
||||
/// ODBC handle class template
|
||||
{
|
||||
public:
|
||||
Handle(const ConnectionHandle& rConnection):
|
||||
_rConnection(rConnection),
|
||||
_handle(0)
|
||||
Handle(const ConnectionHandle & rConnection) : _rConnection(rConnection), _handle(0)
|
||||
/// Creates the Handle.
|
||||
{
|
||||
if (Utility::isError(SQLAllocHandle(handleType,
|
||||
_rConnection,
|
||||
&_handle)))
|
||||
if (Utility::isError(SQLAllocHandle(handleType, _rConnection, &_handle)))
|
||||
{
|
||||
throw ODBCException("Could not allocate statement handle.");
|
||||
}
|
||||
@ -107,7 +106,9 @@ typedef Handle<SQLHSTMT, SQL_HANDLE_STMT> StatementHandle;
|
||||
typedef Handle<SQLHDESC, SQL_HANDLE_DESC> DescriptorHandle;
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
}
|
||||
}
|
||||
} // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -52,7 +52,6 @@
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/Unicode.h"
|
||||
|
||||
|
||||
|
@ -18,17 +18,20 @@
|
||||
#define Data_ODBC_ODBCException_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Data/DataException.h"
|
||||
#include "Poco/Data/ODBC/Diagnostics.h"
|
||||
#include "Poco/Data/ODBC/Error.h"
|
||||
#include "Poco/Data/DataException.h"
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Format.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
namespace ODBC
|
||||
{
|
||||
|
||||
|
||||
POCO_DECLARE_EXCEPTION(ODBC_API, ODBCException, Poco::Data::DataException)
|
||||
@ -47,31 +50,24 @@ public:
|
||||
message(_error.toString());
|
||||
}
|
||||
|
||||
HandleException(const H& handle, const std::string& msg):
|
||||
ODBCException(msg),
|
||||
_error(handle)
|
||||
HandleException(const H & handle, const std::string & msg) : ODBCException(msg), _error(handle)
|
||||
/// Creates HandleException
|
||||
{
|
||||
extendedMessage(_error.toString());
|
||||
}
|
||||
|
||||
HandleException(const H& handle, const std::string& msg, const std::string& arg):
|
||||
ODBCException(msg, arg),
|
||||
_error(handle)
|
||||
HandleException(const H & handle, const std::string & msg, const std::string & arg) : ODBCException(msg, arg), _error(handle)
|
||||
/// Creates HandleException
|
||||
{
|
||||
}
|
||||
|
||||
HandleException(const H& handle, const std::string& msg, const Poco::Exception& exc):
|
||||
ODBCException(msg, exc),
|
||||
_error(handle)
|
||||
HandleException(const H & handle, const std::string & msg, const Poco::Exception & exc)
|
||||
: ODBCException(msg, exc), _error(handle)
|
||||
/// Creates HandleException
|
||||
{
|
||||
}
|
||||
|
||||
HandleException(const HandleException& exc):
|
||||
ODBCException(exc),
|
||||
_error(exc._error)
|
||||
HandleException(const HandleException & exc) : ODBCException(exc), _error(exc._error)
|
||||
/// Creates HandleException
|
||||
{
|
||||
}
|
||||
@ -84,7 +80,8 @@ public:
|
||||
HandleException & operator=(const HandleException & exc)
|
||||
/// Assignment operator
|
||||
{
|
||||
if (&exc != this) _error = exc._error;
|
||||
if (&exc != this)
|
||||
_error = exc._error;
|
||||
|
||||
return *this;
|
||||
}
|
||||
@ -122,9 +119,7 @@ public:
|
||||
std::string toString() const
|
||||
/// Returns the formatted error diagnostics for the handle.
|
||||
{
|
||||
return Poco::format("ODBC Error: %s\n===================\n%s\n",
|
||||
std::string(what()),
|
||||
_error.toString());
|
||||
return Poco::format("ODBC Error: %s\n===================\n%s\n", std::string(what()), _error.toString());
|
||||
}
|
||||
|
||||
static std::string errorString(const H & handle)
|
||||
@ -144,7 +139,9 @@ typedef HandleException<SQLHSTMT, SQL_HANDLE_STMT> StatementException;
|
||||
typedef HandleException<SQLHDESC, SQL_HANDLE_DESC> DescriptorException;
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
}
|
||||
}
|
||||
} // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -18,20 +18,23 @@
|
||||
#define Data_ODBC_ODBCColumn_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/MetaColumn.h"
|
||||
#include "Poco/Data/ODBC/Error.h"
|
||||
#include "Poco/Data/ODBC/Handle.h"
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/ODBC/ODBCException.h"
|
||||
#include "Poco/Data/MetaColumn.h"
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
# include <windows.h>
|
||||
#endif
|
||||
#include <sqlext.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
namespace ODBC
|
||||
{
|
||||
|
||||
|
||||
class ODBC_API ODBCMetaColumn : public MetaColumn
|
||||
@ -86,7 +89,9 @@ inline std::size_t ODBCMetaColumn::dataLength() const
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
}
|
||||
}
|
||||
} // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -18,26 +18,29 @@
|
||||
#define Data_ODBC_ODBCStatementImpl_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/ODBC/SessionImpl.h"
|
||||
#include <sstream>
|
||||
#include "Poco/Data/Column.h"
|
||||
#include "Poco/Data/ODBC/Binder.h"
|
||||
#include "Poco/Data/ODBC/Extractor.h"
|
||||
#include "Poco/Data/ODBC/Preparator.h"
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/ODBC/ODBCMetaColumn.h"
|
||||
#include "Poco/Data/ODBC/Preparator.h"
|
||||
#include "Poco/Data/ODBC/SessionImpl.h"
|
||||
#include "Poco/Data/StatementImpl.h"
|
||||
#include "Poco/Data/Column.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
#include "Poco/Format.h"
|
||||
#include <sstream>
|
||||
#include "Poco/SharedPtr.h"
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
# include <windows.h>
|
||||
#endif
|
||||
#include <sqltypes.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
namespace ODBC
|
||||
{
|
||||
|
||||
|
||||
class ODBC_API ODBCStatementImpl : public Poco::Data::StatementImpl
|
||||
@ -200,7 +203,9 @@ inline bool ODBCStatementImpl::canCompile() const
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
}
|
||||
}
|
||||
} // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif // Data_ODBC_ODBCStatementImpl_INCLUDED
|
||||
|
@ -18,17 +18,20 @@
|
||||
#define Data_ODBC_Parameter_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/ODBC/Handle.h"
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
# include <windows.h>
|
||||
#endif
|
||||
#include <sqlext.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
namespace ODBC
|
||||
{
|
||||
|
||||
|
||||
class ODBC_API Parameter
|
||||
@ -105,7 +108,9 @@ inline bool Parameter::isNullable() const
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
}
|
||||
}
|
||||
} // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -18,34 +18,37 @@
|
||||
#define Data_ODBC_Preparator_INCLUDED
|
||||
|
||||
|
||||
#include <vector>
|
||||
#include "Poco/Any.h"
|
||||
#include "Poco/Data/AbstractPreparator.h"
|
||||
#include "Poco/Data/Constants.h"
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/LOB.h"
|
||||
#include "Poco/Data/ODBC/Handle.h"
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/ODBC/ODBCMetaColumn.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Data/AbstractPreparator.h"
|
||||
#include "Poco/Data/LOB.h"
|
||||
#include "Poco/Any.h"
|
||||
#include "Poco/DynamicAny.h"
|
||||
#include "Poco/DateTime.h"
|
||||
#include "Poco/DynamicAny.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
#include "Poco/UTFString.h"
|
||||
#include <vector>
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
# include <windows.h>
|
||||
#endif
|
||||
#include <sqlext.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class Date;
|
||||
class Time;
|
||||
|
||||
|
||||
namespace ODBC {
|
||||
namespace ODBC
|
||||
{
|
||||
|
||||
|
||||
class ODBC_API Preparator : public AbstractPreparator
|
||||
@ -96,7 +99,8 @@ public:
|
||||
DT_DATETIME
|
||||
};
|
||||
|
||||
Preparator(const StatementHandle& rStmt,
|
||||
Preparator(
|
||||
const StatementHandle & rStmt,
|
||||
const std::string & statement,
|
||||
std::size_t maxFieldSize,
|
||||
DataExtraction dataExtraction = DE_BOUND);
|
||||
@ -503,8 +507,7 @@ private:
|
||||
else
|
||||
return prepareVariableLen<char>(pos, SQL_C_CHAR, maxDataSize(pos), DT_CHAR);
|
||||
|
||||
case MetaColumn::FDT_WSTRING:
|
||||
{
|
||||
case MetaColumn::FDT_WSTRING: {
|
||||
typedef UTF16String::value_type CharType;
|
||||
if (pVal)
|
||||
return prepareCharArray<CharType, DT_WCHAR_ARRAY>(pos, SQL_C_WCHAR, maxDataSize(pos), pVal->size());
|
||||
@ -512,8 +515,7 @@ private:
|
||||
return prepareVariableLen<CharType>(pos, SQL_C_WCHAR, maxDataSize(pos), DT_WCHAR);
|
||||
}
|
||||
|
||||
case MetaColumn::FDT_BLOB:
|
||||
{
|
||||
case MetaColumn::FDT_BLOB: {
|
||||
typedef Poco::Data::BLOB::ValueType CharType;
|
||||
if (pVal)
|
||||
return prepareCharArray<CharType, DT_UCHAR_ARRAY>(pos, SQL_C_BINARY, maxDataSize(pos), pVal->size());
|
||||
@ -521,8 +523,7 @@ private:
|
||||
return prepareVariableLen<CharType>(pos, SQL_C_BINARY, maxDataSize(pos), DT_UCHAR);
|
||||
}
|
||||
|
||||
case MetaColumn::FDT_CLOB:
|
||||
{
|
||||
case MetaColumn::FDT_CLOB: {
|
||||
typedef Poco::Data::CLOB::ValueType CharType;
|
||||
if (pVal)
|
||||
return prepareCharArray<CharType, DT_CHAR_ARRAY>(pos, SQL_C_BINARY, maxDataSize(pos), pVal->size());
|
||||
@ -567,12 +568,8 @@ private:
|
||||
_values[pos] = Poco::Any(T());
|
||||
|
||||
T * pVal = AnyCast<T>(&_values[pos]);
|
||||
if (Utility::isError(SQLBindCol(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
valueType,
|
||||
(SQLPOINTER) pVal,
|
||||
(SQLINTEGER) dataSize,
|
||||
&_lengths[pos])))
|
||||
if (Utility::isError(
|
||||
SQLBindCol(_rStmt, (SQLUSMALLINT)pos + 1, valueType, (SQLPOINTER)pVal, (SQLINTEGER)dataSize, &_lengths[pos])))
|
||||
{
|
||||
throw StatementException(_rStmt, "SQLBindCol()");
|
||||
}
|
||||
@ -596,12 +593,8 @@ private:
|
||||
std::vector<T> & cache = RefAnyCast<std::vector<T>>(_values[pos]);
|
||||
cache.resize(length);
|
||||
|
||||
if (Utility::isError(SQLBindCol(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
valueType,
|
||||
(SQLPOINTER) &cache[0],
|
||||
(SQLINTEGER) dataSize,
|
||||
&_lenLengths[pos][0])))
|
||||
if (Utility::isError(SQLBindCol(
|
||||
_rStmt, (SQLUSMALLINT)pos + 1, valueType, (SQLPOINTER)&cache[0], (SQLINTEGER)dataSize, &_lenLengths[pos][0])))
|
||||
{
|
||||
throw StatementException(_rStmt, "SQLBindCol()");
|
||||
}
|
||||
@ -621,12 +614,8 @@ private:
|
||||
_lengths[pos] = (SQLLEN)size;
|
||||
_varLengthArrays.insert(IndexMap::value_type(pos, dt));
|
||||
|
||||
if (Utility::isError(SQLBindCol(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
valueType,
|
||||
(SQLPOINTER) pCache,
|
||||
(SQLINTEGER) size*sizeof(T),
|
||||
&_lengths[pos])))
|
||||
if (Utility::isError(SQLBindCol(
|
||||
_rStmt, (SQLUSMALLINT)pos + 1, valueType, (SQLPOINTER)pCache, (SQLINTEGER)size * sizeof(T), &_lengths[pos])))
|
||||
{
|
||||
throw StatementException(_rStmt, "SQLBindCol()");
|
||||
}
|
||||
@ -648,12 +637,8 @@ private:
|
||||
_lenLengths[pos].resize(length);
|
||||
_varLengthArrays.insert(IndexMap::value_type(pos, DT));
|
||||
|
||||
if (Utility::isError(SQLBindCol(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
valueType,
|
||||
(SQLPOINTER) pArray,
|
||||
(SQLINTEGER) size,
|
||||
&_lenLengths[pos][0])))
|
||||
if (Utility::isError(
|
||||
SQLBindCol(_rStmt, (SQLUSMALLINT)pos + 1, valueType, (SQLPOINTER)pArray, (SQLINTEGER)size, &_lenLengths[pos][0])))
|
||||
{
|
||||
throw StatementException(_rStmt, "SQLBindCol()");
|
||||
}
|
||||
@ -669,7 +654,8 @@ private:
|
||||
void deleteCachedArray(std::size_t pos) const
|
||||
{
|
||||
T ** p = Poco::AnyCast<T *>(&_values[pos]);
|
||||
if (p) delete [] *p;
|
||||
if (p)
|
||||
delete[] * p;
|
||||
}
|
||||
|
||||
const StatementHandle & _rStmt;
|
||||
@ -1265,7 +1251,9 @@ inline Poco::Any& Preparator::at(std::size_t pos)
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
}
|
||||
}
|
||||
} // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif // Data_ODBC_Preparator_INCLUDED
|
||||
|
@ -18,24 +18,27 @@
|
||||
#define Data_ODBC_SessionImpl_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/ODBC/Connector.h"
|
||||
#include "Poco/Data/ODBC/TypeInfo.h"
|
||||
#include "Poco/Data/ODBC/Binder.h"
|
||||
#include "Poco/Data/ODBC/Handle.h"
|
||||
#include "Poco/Data/ODBC/ODBCException.h"
|
||||
#include "Poco/Data/AbstractSessionImpl.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
#include "Poco/Data/ODBC/Binder.h"
|
||||
#include "Poco/Data/ODBC/Connector.h"
|
||||
#include "Poco/Data/ODBC/Handle.h"
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/ODBC/ODBCException.h"
|
||||
#include "Poco/Data/ODBC/TypeInfo.h"
|
||||
#include "Poco/Mutex.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
# include <windows.h>
|
||||
#endif
|
||||
#include <sqltypes.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
namespace ODBC
|
||||
{
|
||||
|
||||
|
||||
class ODBC_API SessionImpl : public Poco::Data::AbstractSessionImpl<SessionImpl>
|
||||
@ -51,7 +54,8 @@ public:
|
||||
ODBC_TXN_CAPABILITY_TRUE = 1
|
||||
};
|
||||
|
||||
SessionImpl(const std::string& connect,
|
||||
SessionImpl(
|
||||
const std::string & connect,
|
||||
std::size_t loginTimeout,
|
||||
std::size_t maxFieldSize = ODBC_MAX_FIELD_SIZE,
|
||||
bool autoBind = true,
|
||||
@ -60,7 +64,8 @@ public:
|
||||
/// Throws NotConnectedException if connection was not successful.
|
||||
|
||||
//@ deprecated
|
||||
SessionImpl(const std::string& connect,
|
||||
SessionImpl(
|
||||
const std::string & connect,
|
||||
Poco::Any maxFieldSize = ODBC_MAX_FIELD_SIZE,
|
||||
bool enforceCapability = false,
|
||||
bool autoBind = true,
|
||||
@ -284,7 +289,9 @@ inline int SessionImpl::queryTimeout() const
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
}
|
||||
}
|
||||
} // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif // Data_ODBC_SessionImpl_INCLUDED
|
||||
|
@ -18,20 +18,23 @@
|
||||
#define Data_ODBC_DataTypes_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/NamedTuple.h"
|
||||
#include "Poco/DynamicAny.h"
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/DynamicAny.h"
|
||||
#include "Poco/NamedTuple.h"
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
# include <windows.h>
|
||||
#endif
|
||||
#include <sqlext.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
namespace ODBC
|
||||
{
|
||||
|
||||
|
||||
class ODBC_API TypeInfo
|
||||
@ -49,7 +52,8 @@ class ODBC_API TypeInfo
|
||||
public:
|
||||
typedef std::map<int, int> DataTypeMap;
|
||||
typedef DataTypeMap::value_type ValueType;
|
||||
typedef Poco::NamedTuple<std::string,
|
||||
typedef Poco::NamedTuple<
|
||||
std::string,
|
||||
SQLSMALLINT,
|
||||
SQLINTEGER,
|
||||
std::string,
|
||||
@ -67,7 +71,8 @@ public:
|
||||
SQLSMALLINT,
|
||||
SQLSMALLINT,
|
||||
SQLINTEGER,
|
||||
SQLSMALLINT> TypeInfoTup;
|
||||
SQLSMALLINT>
|
||||
TypeInfoTup;
|
||||
typedef std::vector<TypeInfoTup> TypeInfoVec;
|
||||
|
||||
explicit TypeInfo(SQLHDBC * pHDBC = 0);
|
||||
@ -111,7 +116,9 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
}
|
||||
}
|
||||
} // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -18,10 +18,10 @@
|
||||
#define Data_ODBC_Unicode_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/UnicodeConverter.h"
|
||||
#include <cstring>
|
||||
#include "Poco/Buffer.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include <cstring>
|
||||
#include "Poco/UnicodeConverter.h"
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
# include <windows.h>
|
||||
#endif
|
||||
@ -46,19 +46,24 @@
|
||||
#endif
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
namespace ODBC
|
||||
{
|
||||
|
||||
|
||||
#if defined(POCO_PTR_IS_64_BIT) || defined(POCO_OS_FAMILY_UNIX) // mkrivos - POCO_OS_FAMILY_UNIX doesn't compile with SQLPOINTER & SQLColAttribute()
|
||||
#if defined(POCO_PTR_IS_64_BIT) \
|
||||
|| defined(POCO_OS_FAMILY_UNIX) // mkrivos - POCO_OS_FAMILY_UNIX doesn't compile with SQLPOINTER & SQLColAttribute()
|
||||
typedef SQLLEN * NumAttrPtrType;
|
||||
#else
|
||||
typedef SQLPOINTER NumAttrPtrType;
|
||||
#endif
|
||||
|
||||
|
||||
SQLRETURN ODBC_API SQLColAttribute(SQLHSTMT hstmt,
|
||||
SQLRETURN ODBC_API SQLColAttribute(
|
||||
SQLHSTMT hstmt,
|
||||
SQLUSMALLINT iCol,
|
||||
SQLUSMALLINT iField,
|
||||
SQLPOINTER pCharAttr,
|
||||
@ -67,7 +72,8 @@ SQLRETURN ODBC_API SQLColAttribute(SQLHSTMT hstmt,
|
||||
NumAttrPtrType pNumAttr);
|
||||
|
||||
|
||||
SQLRETURN ODBC_API SQLColAttributes(SQLHSTMT hstmt,
|
||||
SQLRETURN ODBC_API SQLColAttributes(
|
||||
SQLHSTMT hstmt,
|
||||
SQLUSMALLINT icol,
|
||||
SQLUSMALLINT fDescType,
|
||||
SQLPOINTER rgbDesc,
|
||||
@ -75,7 +81,8 @@ SQLRETURN ODBC_API SQLColAttributes(SQLHSTMT hstmt,
|
||||
SQLSMALLINT * pcbDesc,
|
||||
SQLLEN * pfDesc);
|
||||
|
||||
SQLRETURN ODBC_API SQLConnect(SQLHDBC hdbc,
|
||||
SQLRETURN ODBC_API SQLConnect(
|
||||
SQLHDBC hdbc,
|
||||
SQLCHAR * szDSN,
|
||||
SQLSMALLINT cbDSN,
|
||||
SQLCHAR * szUID,
|
||||
@ -83,7 +90,8 @@ SQLRETURN ODBC_API SQLConnect(SQLHDBC hdbc,
|
||||
SQLCHAR * szAuthStr,
|
||||
SQLSMALLINT cbAuthStr);
|
||||
|
||||
SQLRETURN ODBC_API SQLDescribeCol(SQLHSTMT hstmt,
|
||||
SQLRETURN ODBC_API SQLDescribeCol(
|
||||
SQLHSTMT hstmt,
|
||||
SQLUSMALLINT icol,
|
||||
SQLCHAR * szColName,
|
||||
SQLSMALLINT cbColNameMax,
|
||||
@ -93,7 +101,8 @@ SQLRETURN ODBC_API SQLDescribeCol(SQLHSTMT hstmt,
|
||||
SQLSMALLINT * pibScale,
|
||||
SQLSMALLINT * pfNullable);
|
||||
|
||||
SQLRETURN ODBC_API SQLError(SQLHENV henv,
|
||||
SQLRETURN ODBC_API SQLError(
|
||||
SQLHENV henv,
|
||||
SQLHDBC hdbc,
|
||||
SQLHSTMT hstmt,
|
||||
SQLCHAR * szSqlState,
|
||||
@ -102,35 +111,21 @@ SQLRETURN ODBC_API SQLError(SQLHENV henv,
|
||||
SQLSMALLINT cbErrorMsgMax,
|
||||
SQLSMALLINT * pcbErrorMsg);
|
||||
|
||||
SQLRETURN ODBC_API SQLExecDirect(SQLHSTMT hstmt,
|
||||
SQLCHAR* szSqlStr,
|
||||
SQLINTEGER cbSqlStr);
|
||||
SQLRETURN ODBC_API SQLExecDirect(SQLHSTMT hstmt, SQLCHAR * szSqlStr, SQLINTEGER cbSqlStr);
|
||||
|
||||
SQLRETURN ODBC_API SQLGetConnectAttr(SQLHDBC hdbc,
|
||||
SQLINTEGER fAttribute,
|
||||
SQLPOINTER rgbValue,
|
||||
SQLINTEGER cbValueMax,
|
||||
SQLINTEGER* pcbValue);
|
||||
SQLRETURN ODBC_API
|
||||
SQLGetConnectAttr(SQLHDBC hdbc, SQLINTEGER fAttribute, SQLPOINTER rgbValue, SQLINTEGER cbValueMax, SQLINTEGER * pcbValue);
|
||||
|
||||
SQLRETURN ODBC_API SQLGetCursorName(SQLHSTMT hstmt,
|
||||
SQLCHAR* szCursor,
|
||||
SQLSMALLINT cbCursorMax,
|
||||
SQLSMALLINT* pcbCursor);
|
||||
SQLRETURN ODBC_API SQLGetCursorName(SQLHSTMT hstmt, SQLCHAR * szCursor, SQLSMALLINT cbCursorMax, SQLSMALLINT * pcbCursor);
|
||||
|
||||
SQLRETURN ODBC_API SQLSetDescField(SQLHDESC DescriptorHandle,
|
||||
SQLSMALLINT RecNumber,
|
||||
SQLSMALLINT FieldIdentifier,
|
||||
SQLPOINTER Value,
|
||||
SQLINTEGER BufferLength);
|
||||
SQLRETURN ODBC_API SQLSetDescField(
|
||||
SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, SQLPOINTER Value, SQLINTEGER BufferLength);
|
||||
|
||||
SQLRETURN ODBC_API SQLGetDescField(SQLHDESC hdesc,
|
||||
SQLSMALLINT iRecord,
|
||||
SQLSMALLINT iField,
|
||||
SQLPOINTER rgbValue,
|
||||
SQLINTEGER cbValueMax,
|
||||
SQLINTEGER* pcbValue);
|
||||
SQLRETURN ODBC_API SQLGetDescField(
|
||||
SQLHDESC hdesc, SQLSMALLINT iRecord, SQLSMALLINT iField, SQLPOINTER rgbValue, SQLINTEGER cbValueMax, SQLINTEGER * pcbValue);
|
||||
|
||||
SQLRETURN ODBC_API SQLGetDescRec(SQLHDESC hdesc,
|
||||
SQLRETURN ODBC_API SQLGetDescRec(
|
||||
SQLHDESC hdesc,
|
||||
SQLSMALLINT iRecord,
|
||||
SQLCHAR * szName,
|
||||
SQLSMALLINT cbNameMax,
|
||||
@ -142,7 +137,8 @@ SQLRETURN ODBC_API SQLGetDescRec(SQLHDESC hdesc,
|
||||
SQLSMALLINT * pScale,
|
||||
SQLSMALLINT * pNullable);
|
||||
|
||||
SQLRETURN ODBC_API SQLGetDiagField(SQLSMALLINT fHandleType,
|
||||
SQLRETURN ODBC_API SQLGetDiagField(
|
||||
SQLSMALLINT fHandleType,
|
||||
SQLHANDLE handle,
|
||||
SQLSMALLINT iRecord,
|
||||
SQLSMALLINT fDiagField,
|
||||
@ -150,7 +146,8 @@ SQLRETURN ODBC_API SQLGetDiagField(SQLSMALLINT fHandleType,
|
||||
SQLSMALLINT cbDiagInfoMax,
|
||||
SQLSMALLINT * pcbDiagInfo);
|
||||
|
||||
SQLRETURN ODBC_API SQLGetDiagRec(SQLSMALLINT fHandleType,
|
||||
SQLRETURN ODBC_API SQLGetDiagRec(
|
||||
SQLSMALLINT fHandleType,
|
||||
SQLHANDLE handle,
|
||||
SQLSMALLINT iRecord,
|
||||
SQLCHAR * szSqlState,
|
||||
@ -159,31 +156,19 @@ SQLRETURN ODBC_API SQLGetDiagRec(SQLSMALLINT fHandleType,
|
||||
SQLSMALLINT cbErrorMsgMax,
|
||||
SQLSMALLINT * pcbErrorMsg);
|
||||
|
||||
SQLRETURN ODBC_API SQLPrepare(SQLHSTMT hstmt,
|
||||
SQLCHAR* szSqlStr,
|
||||
SQLINTEGER cbSqlStr);
|
||||
SQLRETURN ODBC_API SQLPrepare(SQLHSTMT hstmt, SQLCHAR * szSqlStr, SQLINTEGER cbSqlStr);
|
||||
|
||||
SQLRETURN ODBC_API SQLSetConnectAttr(SQLHDBC hdbc,
|
||||
SQLINTEGER fAttribute,
|
||||
SQLPOINTER rgbValue,
|
||||
SQLINTEGER cbValue);
|
||||
SQLRETURN ODBC_API SQLSetConnectAttr(SQLHDBC hdbc, SQLINTEGER fAttribute, SQLPOINTER rgbValue, SQLINTEGER cbValue);
|
||||
|
||||
SQLRETURN ODBC_API SQLSetCursorName(SQLHSTMT hstmt,
|
||||
SQLCHAR* szCursor,
|
||||
SQLSMALLINT cbCursor);
|
||||
SQLRETURN ODBC_API SQLSetCursorName(SQLHSTMT hstmt, SQLCHAR * szCursor, SQLSMALLINT cbCursor);
|
||||
|
||||
SQLRETURN ODBC_API SQLSetStmtAttr(SQLHSTMT hstmt,
|
||||
SQLINTEGER fAttribute,
|
||||
SQLPOINTER rgbValue,
|
||||
SQLINTEGER cbValueMax);
|
||||
SQLRETURN ODBC_API SQLSetStmtAttr(SQLHSTMT hstmt, SQLINTEGER fAttribute, SQLPOINTER rgbValue, SQLINTEGER cbValueMax);
|
||||
|
||||
SQLRETURN ODBC_API SQLGetStmtAttr(SQLHSTMT hstmt,
|
||||
SQLINTEGER fAttribute,
|
||||
SQLPOINTER rgbValue,
|
||||
SQLINTEGER cbValueMax,
|
||||
SQLINTEGER* pcbValue);
|
||||
SQLRETURN ODBC_API
|
||||
SQLGetStmtAttr(SQLHSTMT hstmt, SQLINTEGER fAttribute, SQLPOINTER rgbValue, SQLINTEGER cbValueMax, SQLINTEGER * pcbValue);
|
||||
|
||||
SQLRETURN ODBC_API SQLColumns(SQLHSTMT hstmt,
|
||||
SQLRETURN ODBC_API SQLColumns(
|
||||
SQLHSTMT hstmt,
|
||||
SQLCHAR * szCatalogName,
|
||||
SQLSMALLINT cbCatalogName,
|
||||
SQLCHAR * szSchemaName,
|
||||
@ -193,24 +178,17 @@ SQLRETURN ODBC_API SQLColumns(SQLHSTMT hstmt,
|
||||
SQLCHAR * szColumnName,
|
||||
SQLSMALLINT cbColumnName);
|
||||
|
||||
SQLRETURN ODBC_API SQLGetConnectOption(SQLHDBC hdbc,
|
||||
SQLUSMALLINT fOption,
|
||||
SQLPOINTER pvParam);
|
||||
SQLRETURN ODBC_API SQLGetConnectOption(SQLHDBC hdbc, SQLUSMALLINT fOption, SQLPOINTER pvParam);
|
||||
|
||||
SQLRETURN ODBC_API SQLGetInfo(SQLHDBC hdbc,
|
||||
SQLUSMALLINT fInfoType,
|
||||
SQLPOINTER rgbInfoValue,
|
||||
SQLSMALLINT cbInfoValueMax,
|
||||
SQLSMALLINT* pcbInfoValue);
|
||||
SQLRETURN ODBC_API
|
||||
SQLGetInfo(SQLHDBC hdbc, SQLUSMALLINT fInfoType, SQLPOINTER rgbInfoValue, SQLSMALLINT cbInfoValueMax, SQLSMALLINT * pcbInfoValue);
|
||||
|
||||
SQLRETURN ODBC_API SQLGetTypeInfo(SQLHSTMT StatementHandle,
|
||||
SQLSMALLINT DataType);
|
||||
SQLRETURN ODBC_API SQLGetTypeInfo(SQLHSTMT StatementHandle, SQLSMALLINT DataType);
|
||||
|
||||
SQLRETURN ODBC_API SQLSetConnectOption(SQLHDBC hdbc,
|
||||
SQLUSMALLINT fOption,
|
||||
SQLULEN vParam);
|
||||
SQLRETURN ODBC_API SQLSetConnectOption(SQLHDBC hdbc, SQLUSMALLINT fOption, SQLULEN vParam);
|
||||
|
||||
SQLRETURN ODBC_API SQLSpecialColumns(SQLHSTMT hstmt,
|
||||
SQLRETURN ODBC_API SQLSpecialColumns(
|
||||
SQLHSTMT hstmt,
|
||||
SQLUSMALLINT fColType,
|
||||
SQLCHAR * szCatalogName,
|
||||
SQLSMALLINT cbCatalogName,
|
||||
@ -221,7 +199,8 @@ SQLRETURN ODBC_API SQLSpecialColumns(SQLHSTMT hstmt,
|
||||
SQLUSMALLINT fScope,
|
||||
SQLUSMALLINT fNullable);
|
||||
|
||||
SQLRETURN ODBC_API SQLStatistics(SQLHSTMT hstmt,
|
||||
SQLRETURN ODBC_API SQLStatistics(
|
||||
SQLHSTMT hstmt,
|
||||
SQLCHAR * szCatalogName,
|
||||
SQLSMALLINT cbCatalogName,
|
||||
SQLCHAR * szSchemaName,
|
||||
@ -231,7 +210,8 @@ SQLRETURN ODBC_API SQLStatistics(SQLHSTMT hstmt,
|
||||
SQLUSMALLINT fUnique,
|
||||
SQLUSMALLINT fAccuracy);
|
||||
|
||||
SQLRETURN ODBC_API SQLTables(SQLHSTMT hstmt,
|
||||
SQLRETURN ODBC_API SQLTables(
|
||||
SQLHSTMT hstmt,
|
||||
SQLCHAR * szCatalogName,
|
||||
SQLSMALLINT cbCatalogName,
|
||||
SQLCHAR * szSchemaName,
|
||||
@ -241,7 +221,8 @@ SQLRETURN ODBC_API SQLTables(SQLHSTMT hstmt,
|
||||
SQLCHAR * szTableType,
|
||||
SQLSMALLINT cbTableType);
|
||||
|
||||
SQLRETURN ODBC_API SQLDataSources(SQLHENV henv,
|
||||
SQLRETURN ODBC_API SQLDataSources(
|
||||
SQLHENV henv,
|
||||
SQLUSMALLINT fDirection,
|
||||
SQLCHAR * szDSN,
|
||||
SQLSMALLINT cbDSNMax,
|
||||
@ -250,7 +231,8 @@ SQLRETURN ODBC_API SQLDataSources(SQLHENV henv,
|
||||
SQLSMALLINT cbDescriptionMax,
|
||||
SQLSMALLINT * pcbDescription);
|
||||
|
||||
SQLRETURN ODBC_API SQLDriverConnect(SQLHDBC hdbc,
|
||||
SQLRETURN ODBC_API SQLDriverConnect(
|
||||
SQLHDBC hdbc,
|
||||
SQLHWND hwnd,
|
||||
SQLCHAR * szConnStrIn,
|
||||
SQLSMALLINT cbConnStrIn,
|
||||
@ -259,14 +241,16 @@ SQLRETURN ODBC_API SQLDriverConnect(SQLHDBC hdbc,
|
||||
SQLSMALLINT * pcbConnStrOut,
|
||||
SQLUSMALLINT fDriverCompletion);
|
||||
|
||||
SQLRETURN ODBC_API SQLBrowseConnect(SQLHDBC hdbc,
|
||||
SQLRETURN ODBC_API SQLBrowseConnect(
|
||||
SQLHDBC hdbc,
|
||||
SQLCHAR * szConnStrIn,
|
||||
SQLSMALLINT cbConnStrIn,
|
||||
SQLCHAR * szConnStrOut,
|
||||
SQLSMALLINT cbConnStrOutMax,
|
||||
SQLSMALLINT * pcbConnStrOut);
|
||||
|
||||
SQLRETURN ODBC_API SQLColumnPrivileges(SQLHSTMT hstmt,
|
||||
SQLRETURN ODBC_API SQLColumnPrivileges(
|
||||
SQLHSTMT hstmt,
|
||||
SQLCHAR * szCatalogName,
|
||||
SQLSMALLINT cbCatalogName,
|
||||
SQLCHAR * szSchemaName,
|
||||
@ -276,7 +260,8 @@ SQLRETURN ODBC_API SQLColumnPrivileges(SQLHSTMT hstmt,
|
||||
SQLCHAR * szColumnName,
|
||||
SQLSMALLINT cbColumnName);
|
||||
|
||||
SQLRETURN ODBC_API SQLForeignKeys(SQLHSTMT hstmt,
|
||||
SQLRETURN ODBC_API SQLForeignKeys(
|
||||
SQLHSTMT hstmt,
|
||||
SQLCHAR * szPkCatalogName,
|
||||
SQLSMALLINT cbPkCatalogName,
|
||||
SQLCHAR * szPkSchemaName,
|
||||
@ -290,14 +275,11 @@ SQLRETURN ODBC_API SQLForeignKeys(SQLHSTMT hstmt,
|
||||
SQLCHAR * szFkTableName,
|
||||
SQLSMALLINT cbFkTableName);
|
||||
|
||||
SQLRETURN ODBC_API SQLNativeSql(SQLHDBC hdbc,
|
||||
SQLCHAR* szSqlStrIn,
|
||||
SQLINTEGER cbSqlStrIn,
|
||||
SQLCHAR* szSqlStr,
|
||||
SQLINTEGER cbSqlStrMax,
|
||||
SQLINTEGER* pcbSqlStr);
|
||||
SQLRETURN ODBC_API SQLNativeSql(
|
||||
SQLHDBC hdbc, SQLCHAR * szSqlStrIn, SQLINTEGER cbSqlStrIn, SQLCHAR * szSqlStr, SQLINTEGER cbSqlStrMax, SQLINTEGER * pcbSqlStr);
|
||||
|
||||
SQLRETURN ODBC_API SQLPrimaryKeys(SQLHSTMT hstmt,
|
||||
SQLRETURN ODBC_API SQLPrimaryKeys(
|
||||
SQLHSTMT hstmt,
|
||||
SQLCHAR * szCatalogName,
|
||||
SQLSMALLINT cbCatalogName,
|
||||
SQLCHAR * szSchemaName,
|
||||
@ -305,7 +287,8 @@ SQLRETURN ODBC_API SQLPrimaryKeys(SQLHSTMT hstmt,
|
||||
SQLCHAR * szTableName,
|
||||
SQLSMALLINT cbTableName);
|
||||
|
||||
SQLRETURN ODBC_API SQLProcedureColumns(SQLHSTMT hstmt,
|
||||
SQLRETURN ODBC_API SQLProcedureColumns(
|
||||
SQLHSTMT hstmt,
|
||||
SQLCHAR * szCatalogName,
|
||||
SQLSMALLINT cbCatalogName,
|
||||
SQLCHAR * szSchemaName,
|
||||
@ -315,7 +298,8 @@ SQLRETURN ODBC_API SQLProcedureColumns(SQLHSTMT hstmt,
|
||||
SQLCHAR * szColumnName,
|
||||
SQLSMALLINT cbColumnName);
|
||||
|
||||
SQLRETURN ODBC_API SQLProcedures(SQLHSTMT hstmt,
|
||||
SQLRETURN ODBC_API SQLProcedures(
|
||||
SQLHSTMT hstmt,
|
||||
SQLCHAR * szCatalogName,
|
||||
SQLSMALLINT cbCatalogName,
|
||||
SQLCHAR * szSchemaName,
|
||||
@ -323,7 +307,8 @@ SQLRETURN ODBC_API SQLProcedures(SQLHSTMT hstmt,
|
||||
SQLCHAR * szProcName,
|
||||
SQLSMALLINT cbProcName);
|
||||
|
||||
SQLRETURN ODBC_API SQLTablePrivileges(SQLHSTMT hstmt,
|
||||
SQLRETURN ODBC_API SQLTablePrivileges(
|
||||
SQLHSTMT hstmt,
|
||||
SQLCHAR * szCatalogName,
|
||||
SQLSMALLINT cbCatalogName,
|
||||
SQLCHAR * szSchemaName,
|
||||
@ -331,7 +316,8 @@ SQLRETURN ODBC_API SQLTablePrivileges(SQLHSTMT hstmt,
|
||||
SQLCHAR * szTableName,
|
||||
SQLSMALLINT cbTableName);
|
||||
|
||||
SQLRETURN ODBC_API SQLDrivers(SQLHENV henv,
|
||||
SQLRETURN ODBC_API SQLDrivers(
|
||||
SQLHENV henv,
|
||||
SQLUSMALLINT fDirection,
|
||||
SQLCHAR * szDriverDesc,
|
||||
SQLSMALLINT cbDriverDescMax,
|
||||
@ -353,7 +339,8 @@ inline bool isString(SQLPOINTER pValue, SQLINTEGER length)
|
||||
|
||||
inline SQLINTEGER stringLength(SQLPOINTER pValue, SQLINTEGER length)
|
||||
{
|
||||
if (SQL_NTS != length) return length;
|
||||
if (SQL_NTS != length)
|
||||
return length;
|
||||
|
||||
return (SQLINTEGER)std::strlen((const char *)pValue);
|
||||
}
|
||||
@ -366,7 +353,8 @@ inline SQLINTEGER stringLength(SQLPOINTER pValue, SQLINTEGER length)
|
||||
/// inlines
|
||||
///
|
||||
|
||||
inline SQLRETURN SQLColAttribute(SQLHSTMT hstmt,
|
||||
inline SQLRETURN SQLColAttribute(
|
||||
SQLHSTMT hstmt,
|
||||
SQLUSMALLINT iCol,
|
||||
SQLUSMALLINT iField,
|
||||
SQLPOINTER pCharAttr,
|
||||
@ -374,17 +362,12 @@ inline SQLRETURN SQLColAttribute(SQLHSTMT hstmt,
|
||||
SQLSMALLINT * pcbCharAttr,
|
||||
NumAttrPtrType pNumAttr)
|
||||
{
|
||||
return ::SQLColAttributeA(hstmt,
|
||||
iCol,
|
||||
iField,
|
||||
pCharAttr,
|
||||
cbCharAttrMax,
|
||||
pcbCharAttr,
|
||||
pNumAttr);
|
||||
return ::SQLColAttributeA(hstmt, iCol, iField, pCharAttr, cbCharAttrMax, pcbCharAttr, pNumAttr);
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLColAttributes(SQLHSTMT hstmt,
|
||||
inline SQLRETURN SQLColAttributes(
|
||||
SQLHSTMT hstmt,
|
||||
SQLUSMALLINT icol,
|
||||
SQLUSMALLINT fDescType,
|
||||
SQLPOINTER rgbDesc,
|
||||
@ -392,17 +375,12 @@ inline SQLRETURN SQLColAttributes(SQLHSTMT hstmt,
|
||||
SQLSMALLINT * pcbDesc,
|
||||
SQLLEN * pfDesc)
|
||||
{
|
||||
return ::SQLColAttributesA(hstmt,
|
||||
icol,
|
||||
fDescType,
|
||||
rgbDesc,
|
||||
cbDescMax,
|
||||
pcbDesc,
|
||||
pfDesc);
|
||||
return ::SQLColAttributesA(hstmt, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc);
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLConnect(SQLHDBC hdbc,
|
||||
inline SQLRETURN SQLConnect(
|
||||
SQLHDBC hdbc,
|
||||
SQLCHAR * szDSN,
|
||||
SQLSMALLINT cbDSN,
|
||||
SQLCHAR * szUID,
|
||||
@ -410,17 +388,12 @@ inline SQLRETURN SQLConnect(SQLHDBC hdbc,
|
||||
SQLCHAR * szAuthStr,
|
||||
SQLSMALLINT cbAuthStr)
|
||||
{
|
||||
return ::SQLConnectA(hdbc,
|
||||
szDSN,
|
||||
cbDSN,
|
||||
szUID,
|
||||
cbUID,
|
||||
szAuthStr,
|
||||
cbAuthStr);
|
||||
return ::SQLConnectA(hdbc, szDSN, cbDSN, szUID, cbUID, szAuthStr, cbAuthStr);
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLDescribeCol(SQLHSTMT hstmt,
|
||||
inline SQLRETURN SQLDescribeCol(
|
||||
SQLHSTMT hstmt,
|
||||
SQLUSMALLINT icol,
|
||||
SQLCHAR * szColName,
|
||||
SQLSMALLINT cbColNameMax,
|
||||
@ -430,19 +403,12 @@ inline SQLRETURN SQLDescribeCol(SQLHSTMT hstmt,
|
||||
SQLSMALLINT * pibScale,
|
||||
SQLSMALLINT * pfNullable)
|
||||
{
|
||||
return ::SQLDescribeColA(hstmt,
|
||||
icol,
|
||||
szColName,
|
||||
cbColNameMax,
|
||||
pcbColName,
|
||||
pfSqlType,
|
||||
pcbColDef,
|
||||
pibScale,
|
||||
pfNullable);
|
||||
return ::SQLDescribeColA(hstmt, icol, szColName, cbColNameMax, pcbColName, pfSqlType, pcbColDef, pibScale, pfNullable);
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLError(SQLHENV henv,
|
||||
inline SQLRETURN SQLError(
|
||||
SQLHENV henv,
|
||||
SQLHDBC hdbc,
|
||||
SQLHSTMT hstmt,
|
||||
SQLCHAR * szSqlState,
|
||||
@ -456,68 +422,41 @@ inline SQLRETURN SQLError(SQLHENV henv,
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLExecDirect(SQLHSTMT hstmt,
|
||||
SQLCHAR* szSqlStr,
|
||||
SQLINTEGER cbSqlStr)
|
||||
inline SQLRETURN SQLExecDirect(SQLHSTMT hstmt, SQLCHAR * szSqlStr, SQLINTEGER cbSqlStr)
|
||||
{
|
||||
return ::SQLExecDirectA(hstmt, szSqlStr, cbSqlStr);
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLGetConnectAttr(SQLHDBC hdbc,
|
||||
SQLINTEGER fAttribute,
|
||||
SQLPOINTER rgbValue,
|
||||
SQLINTEGER cbValueMax,
|
||||
SQLINTEGER* pcbValue)
|
||||
inline SQLRETURN
|
||||
SQLGetConnectAttr(SQLHDBC hdbc, SQLINTEGER fAttribute, SQLPOINTER rgbValue, SQLINTEGER cbValueMax, SQLINTEGER * pcbValue)
|
||||
{
|
||||
return ::SQLGetConnectAttrA(hdbc,
|
||||
fAttribute,
|
||||
rgbValue,
|
||||
cbValueMax,
|
||||
pcbValue);
|
||||
return ::SQLGetConnectAttrA(hdbc, fAttribute, rgbValue, cbValueMax, pcbValue);
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLGetCursorName(SQLHSTMT hstmt,
|
||||
SQLCHAR* szCursor,
|
||||
SQLSMALLINT cbCursorMax,
|
||||
SQLSMALLINT* pcbCursor)
|
||||
inline SQLRETURN SQLGetCursorName(SQLHSTMT hstmt, SQLCHAR * szCursor, SQLSMALLINT cbCursorMax, SQLSMALLINT * pcbCursor)
|
||||
{
|
||||
throw Poco::NotImplementedException("Not implemented");
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLSetDescField(SQLHDESC DescriptorHandle,
|
||||
SQLSMALLINT RecNumber,
|
||||
SQLSMALLINT FieldIdentifier,
|
||||
SQLPOINTER Value,
|
||||
SQLINTEGER BufferLength)
|
||||
inline SQLRETURN SQLSetDescField(
|
||||
SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, SQLPOINTER Value, SQLINTEGER BufferLength)
|
||||
{
|
||||
return ::SQLSetDescField(DescriptorHandle,
|
||||
RecNumber,
|
||||
FieldIdentifier,
|
||||
Value,
|
||||
BufferLength);
|
||||
return ::SQLSetDescField(DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength);
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLGetDescField(SQLHDESC hdesc,
|
||||
SQLSMALLINT iRecord,
|
||||
SQLSMALLINT iField,
|
||||
SQLPOINTER rgbValue,
|
||||
SQLINTEGER cbValueMax,
|
||||
SQLINTEGER* pcbValue)
|
||||
inline SQLRETURN SQLGetDescField(
|
||||
SQLHDESC hdesc, SQLSMALLINT iRecord, SQLSMALLINT iField, SQLPOINTER rgbValue, SQLINTEGER cbValueMax, SQLINTEGER * pcbValue)
|
||||
{
|
||||
return ::SQLGetDescFieldA(hdesc,
|
||||
iRecord,
|
||||
iField,
|
||||
rgbValue,
|
||||
cbValueMax,
|
||||
pcbValue);
|
||||
return ::SQLGetDescFieldA(hdesc, iRecord, iField, rgbValue, cbValueMax, pcbValue);
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLGetDescRec(SQLHDESC hdesc,
|
||||
inline SQLRETURN SQLGetDescRec(
|
||||
SQLHDESC hdesc,
|
||||
SQLSMALLINT iRecord,
|
||||
SQLCHAR * szName,
|
||||
SQLSMALLINT cbNameMax,
|
||||
@ -529,21 +468,12 @@ inline SQLRETURN SQLGetDescRec(SQLHDESC hdesc,
|
||||
SQLSMALLINT * pScale,
|
||||
SQLSMALLINT * pNullable)
|
||||
{
|
||||
return ::SQLGetDescRecA(hdesc,
|
||||
iRecord,
|
||||
szName,
|
||||
cbNameMax,
|
||||
pcbName,
|
||||
pfType,
|
||||
pfSubType,
|
||||
pLength,
|
||||
pPrecision,
|
||||
pScale,
|
||||
pNullable);
|
||||
return ::SQLGetDescRecA(hdesc, iRecord, szName, cbNameMax, pcbName, pfType, pfSubType, pLength, pPrecision, pScale, pNullable);
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLGetDiagField(SQLSMALLINT fHandleType,
|
||||
inline SQLRETURN SQLGetDiagField(
|
||||
SQLSMALLINT fHandleType,
|
||||
SQLHANDLE handle,
|
||||
SQLSMALLINT iRecord,
|
||||
SQLSMALLINT fDiagField,
|
||||
@ -551,17 +481,12 @@ inline SQLRETURN SQLGetDiagField(SQLSMALLINT fHandleType,
|
||||
SQLSMALLINT cbDiagInfoMax,
|
||||
SQLSMALLINT * pcbDiagInfo)
|
||||
{
|
||||
return ::SQLGetDiagFieldA(fHandleType,
|
||||
handle,
|
||||
iRecord,
|
||||
fDiagField,
|
||||
rgbDiagInfo,
|
||||
cbDiagInfoMax,
|
||||
pcbDiagInfo);
|
||||
return ::SQLGetDiagFieldA(fHandleType, handle, iRecord, fDiagField, rgbDiagInfo, cbDiagInfoMax, pcbDiagInfo);
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLGetDiagRec(SQLSMALLINT fHandleType,
|
||||
inline SQLRETURN SQLGetDiagRec(
|
||||
SQLSMALLINT fHandleType,
|
||||
SQLHANDLE handle,
|
||||
SQLSMALLINT iRecord,
|
||||
SQLCHAR * szSqlState,
|
||||
@ -570,66 +495,43 @@ inline SQLRETURN SQLGetDiagRec(SQLSMALLINT fHandleType,
|
||||
SQLSMALLINT cbErrorMsgMax,
|
||||
SQLSMALLINT * pcbErrorMsg)
|
||||
{
|
||||
return ::SQLGetDiagRecA(fHandleType,
|
||||
handle,
|
||||
iRecord,
|
||||
szSqlState,
|
||||
pfNativeError,
|
||||
szErrorMsg,
|
||||
cbErrorMsgMax,
|
||||
pcbErrorMsg);
|
||||
return ::SQLGetDiagRecA(fHandleType, handle, iRecord, szSqlState, pfNativeError, szErrorMsg, cbErrorMsgMax, pcbErrorMsg);
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLPrepare(SQLHSTMT hstmt,
|
||||
SQLCHAR* szSqlStr,
|
||||
SQLINTEGER cbSqlStr)
|
||||
inline SQLRETURN SQLPrepare(SQLHSTMT hstmt, SQLCHAR * szSqlStr, SQLINTEGER cbSqlStr)
|
||||
{
|
||||
return ::SQLPrepareA(hstmt, szSqlStr, cbSqlStr);
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLSetConnectAttr(SQLHDBC hdbc,
|
||||
SQLINTEGER fAttribute,
|
||||
SQLPOINTER rgbValue,
|
||||
SQLINTEGER cbValue)
|
||||
inline SQLRETURN SQLSetConnectAttr(SQLHDBC hdbc, SQLINTEGER fAttribute, SQLPOINTER rgbValue, SQLINTEGER cbValue)
|
||||
{
|
||||
return ::SQLSetConnectAttrA(hdbc, fAttribute, rgbValue, cbValue);
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLSetCursorName(SQLHSTMT hstmt,
|
||||
SQLCHAR* szCursor,
|
||||
SQLSMALLINT cbCursor)
|
||||
inline SQLRETURN SQLSetCursorName(SQLHSTMT hstmt, SQLCHAR * szCursor, SQLSMALLINT cbCursor)
|
||||
{
|
||||
throw Poco::NotImplementedException("Not implemented");
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLSetStmtAttr(SQLHSTMT hstmt,
|
||||
SQLINTEGER fAttribute,
|
||||
SQLPOINTER rgbValue,
|
||||
SQLINTEGER cbValueMax)
|
||||
inline SQLRETURN SQLSetStmtAttr(SQLHSTMT hstmt, SQLINTEGER fAttribute, SQLPOINTER rgbValue, SQLINTEGER cbValueMax)
|
||||
{
|
||||
return ::SQLSetStmtAttr(hstmt, fAttribute, rgbValue, cbValueMax);
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLGetStmtAttr(SQLHSTMT hstmt,
|
||||
SQLINTEGER fAttribute,
|
||||
SQLPOINTER rgbValue,
|
||||
SQLINTEGER cbValueMax,
|
||||
SQLINTEGER* pcbValue)
|
||||
inline SQLRETURN
|
||||
SQLGetStmtAttr(SQLHSTMT hstmt, SQLINTEGER fAttribute, SQLPOINTER rgbValue, SQLINTEGER cbValueMax, SQLINTEGER * pcbValue)
|
||||
{
|
||||
return ::SQLGetStmtAttrA(hstmt,
|
||||
fAttribute,
|
||||
rgbValue,
|
||||
cbValueMax,
|
||||
pcbValue);
|
||||
return ::SQLGetStmtAttrA(hstmt, fAttribute, rgbValue, cbValueMax, pcbValue);
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLColumns(SQLHSTMT hstmt,
|
||||
inline SQLRETURN SQLColumns(
|
||||
SQLHSTMT hstmt,
|
||||
SQLCHAR * szCatalogName,
|
||||
SQLSMALLINT cbCatalogName,
|
||||
SQLCHAR * szSchemaName,
|
||||
@ -639,56 +541,38 @@ inline SQLRETURN SQLColumns(SQLHSTMT hstmt,
|
||||
SQLCHAR * szColumnName,
|
||||
SQLSMALLINT cbColumnName)
|
||||
{
|
||||
return ::SQLColumnsA(hstmt,
|
||||
szCatalogName,
|
||||
cbCatalogName,
|
||||
szSchemaName,
|
||||
cbSchemaName,
|
||||
szTableName,
|
||||
cbTableName,
|
||||
szColumnName,
|
||||
cbColumnName);
|
||||
return ::SQLColumnsA(
|
||||
hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName, szColumnName, cbColumnName);
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLGetConnectOption(SQLHDBC hdbc,
|
||||
SQLUSMALLINT fOption,
|
||||
SQLPOINTER pvParam)
|
||||
inline SQLRETURN SQLGetConnectOption(SQLHDBC hdbc, SQLUSMALLINT fOption, SQLPOINTER pvParam)
|
||||
{
|
||||
return ::SQLGetConnectOptionA(hdbc, fOption, pvParam);
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLGetInfo(SQLHDBC hdbc,
|
||||
SQLUSMALLINT fInfoType,
|
||||
SQLPOINTER rgbInfoValue,
|
||||
SQLSMALLINT cbInfoValueMax,
|
||||
SQLSMALLINT* pcbInfoValue)
|
||||
inline SQLRETURN
|
||||
SQLGetInfo(SQLHDBC hdbc, SQLUSMALLINT fInfoType, SQLPOINTER rgbInfoValue, SQLSMALLINT cbInfoValueMax, SQLSMALLINT * pcbInfoValue)
|
||||
{
|
||||
return ::SQLGetInfoA(hdbc,
|
||||
fInfoType,
|
||||
rgbInfoValue,
|
||||
cbInfoValueMax,
|
||||
pcbInfoValue);
|
||||
return ::SQLGetInfoA(hdbc, fInfoType, rgbInfoValue, cbInfoValueMax, pcbInfoValue);
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLGetTypeInfo(SQLHSTMT StatementHandle,
|
||||
SQLSMALLINT DataType)
|
||||
inline SQLRETURN SQLGetTypeInfo(SQLHSTMT StatementHandle, SQLSMALLINT DataType)
|
||||
{
|
||||
return ::SQLGetTypeInfoA(StatementHandle, DataType);
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLSetConnectOption(SQLHDBC hdbc,
|
||||
SQLUSMALLINT fOption,
|
||||
SQLULEN vParam)
|
||||
inline SQLRETURN SQLSetConnectOption(SQLHDBC hdbc, SQLUSMALLINT fOption, SQLULEN vParam)
|
||||
{
|
||||
return ::SQLSetConnectOptionA(hdbc, fOption, vParam);
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLSpecialColumns(SQLHSTMT hstmt,
|
||||
inline SQLRETURN SQLSpecialColumns(
|
||||
SQLHSTMT hstmt,
|
||||
SQLUSMALLINT fColType,
|
||||
SQLCHAR * szCatalogName,
|
||||
SQLSMALLINT cbCatalogName,
|
||||
@ -699,20 +583,13 @@ inline SQLRETURN SQLSpecialColumns(SQLHSTMT hstmt,
|
||||
SQLUSMALLINT fScope,
|
||||
SQLUSMALLINT fNullable)
|
||||
{
|
||||
return ::SQLSpecialColumnsA(hstmt,
|
||||
fColType,
|
||||
szCatalogName,
|
||||
cbCatalogName,
|
||||
szSchemaName,
|
||||
cbSchemaName,
|
||||
szTableName,
|
||||
cbTableName,
|
||||
fScope,
|
||||
fNullable);
|
||||
return ::SQLSpecialColumnsA(
|
||||
hstmt, fColType, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName, fScope, fNullable);
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLStatistics(SQLHSTMT hstmt,
|
||||
inline SQLRETURN SQLStatistics(
|
||||
SQLHSTMT hstmt,
|
||||
SQLCHAR * szCatalogName,
|
||||
SQLSMALLINT cbCatalogName,
|
||||
SQLCHAR * szSchemaName,
|
||||
@ -722,19 +599,13 @@ inline SQLRETURN SQLStatistics(SQLHSTMT hstmt,
|
||||
SQLUSMALLINT fUnique,
|
||||
SQLUSMALLINT fAccuracy)
|
||||
{
|
||||
return ::SQLStatisticsA(hstmt,
|
||||
szCatalogName,
|
||||
cbCatalogName,
|
||||
szSchemaName,
|
||||
cbSchemaName,
|
||||
szTableName,
|
||||
cbTableName,
|
||||
fUnique,
|
||||
fAccuracy);
|
||||
return ::SQLStatisticsA(
|
||||
hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName, fUnique, fAccuracy);
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLTables(SQLHSTMT hstmt,
|
||||
inline SQLRETURN SQLTables(
|
||||
SQLHSTMT hstmt,
|
||||
SQLCHAR * szCatalogName,
|
||||
SQLSMALLINT cbCatalogName,
|
||||
SQLCHAR * szSchemaName,
|
||||
@ -744,19 +615,13 @@ inline SQLRETURN SQLTables(SQLHSTMT hstmt,
|
||||
SQLCHAR * szTableType,
|
||||
SQLSMALLINT cbTableType)
|
||||
{
|
||||
return ::SQLTablesA(hstmt,
|
||||
szCatalogName,
|
||||
cbCatalogName,
|
||||
szSchemaName,
|
||||
cbSchemaName,
|
||||
szTableName,
|
||||
cbTableName,
|
||||
szTableType,
|
||||
cbTableType);
|
||||
return ::SQLTablesA(
|
||||
hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName, szTableType, cbTableType);
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLDataSources(SQLHENV henv,
|
||||
inline SQLRETURN SQLDataSources(
|
||||
SQLHENV henv,
|
||||
SQLUSMALLINT fDirection,
|
||||
SQLCHAR * szDSN,
|
||||
SQLSMALLINT cbDSNMax,
|
||||
@ -765,18 +630,12 @@ inline SQLRETURN SQLDataSources(SQLHENV henv,
|
||||
SQLSMALLINT cbDescriptionMax,
|
||||
SQLSMALLINT * pcbDescription)
|
||||
{
|
||||
return ::SQLDataSourcesA(henv,
|
||||
fDirection,
|
||||
szDSN,
|
||||
cbDSNMax,
|
||||
pcbDSN,
|
||||
szDescription,
|
||||
cbDescriptionMax,
|
||||
pcbDescription);
|
||||
return ::SQLDataSourcesA(henv, fDirection, szDSN, cbDSNMax, pcbDSN, szDescription, cbDescriptionMax, pcbDescription);
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLDriverConnect(SQLHDBC hdbc,
|
||||
inline SQLRETURN SQLDriverConnect(
|
||||
SQLHDBC hdbc,
|
||||
SQLHWND hwnd,
|
||||
SQLCHAR * szConnStrIn,
|
||||
SQLSMALLINT cbConnStrIn,
|
||||
@ -785,34 +644,25 @@ inline SQLRETURN SQLDriverConnect(SQLHDBC hdbc,
|
||||
SQLSMALLINT * pcbConnStrOut,
|
||||
SQLUSMALLINT fDriverCompletion)
|
||||
{
|
||||
return ::SQLDriverConnectA(hdbc,
|
||||
hwnd,
|
||||
szConnStrIn,
|
||||
cbConnStrIn,
|
||||
szConnStrOut,
|
||||
cbConnStrOutMax,
|
||||
pcbConnStrOut,
|
||||
fDriverCompletion);
|
||||
return ::SQLDriverConnectA(
|
||||
hdbc, hwnd, szConnStrIn, cbConnStrIn, szConnStrOut, cbConnStrOutMax, pcbConnStrOut, fDriverCompletion);
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLBrowseConnect(SQLHDBC hdbc,
|
||||
inline SQLRETURN SQLBrowseConnect(
|
||||
SQLHDBC hdbc,
|
||||
SQLCHAR * szConnStrIn,
|
||||
SQLSMALLINT cbConnStrIn,
|
||||
SQLCHAR * szConnStrOut,
|
||||
SQLSMALLINT cbConnStrOutMax,
|
||||
SQLSMALLINT * pcbConnStrOut)
|
||||
{
|
||||
return ::SQLBrowseConnectA(hdbc,
|
||||
szConnStrIn,
|
||||
cbConnStrIn,
|
||||
szConnStrOut,
|
||||
cbConnStrOutMax,
|
||||
pcbConnStrOut);
|
||||
return ::SQLBrowseConnectA(hdbc, szConnStrIn, cbConnStrIn, szConnStrOut, cbConnStrOutMax, pcbConnStrOut);
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLColumnPrivileges(SQLHSTMT hstmt,
|
||||
inline SQLRETURN SQLColumnPrivileges(
|
||||
SQLHSTMT hstmt,
|
||||
SQLCHAR * szCatalogName,
|
||||
SQLSMALLINT cbCatalogName,
|
||||
SQLCHAR * szSchemaName,
|
||||
@ -822,19 +672,13 @@ inline SQLRETURN SQLColumnPrivileges(SQLHSTMT hstmt,
|
||||
SQLCHAR * szColumnName,
|
||||
SQLSMALLINT cbColumnName)
|
||||
{
|
||||
return ::SQLColumnPrivilegesA(hstmt,
|
||||
szCatalogName,
|
||||
cbCatalogName,
|
||||
szSchemaName,
|
||||
cbSchemaName,
|
||||
szTableName,
|
||||
cbTableName,
|
||||
szColumnName,
|
||||
cbColumnName);
|
||||
return ::SQLColumnPrivilegesA(
|
||||
hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName, szColumnName, cbColumnName);
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLForeignKeys(SQLHSTMT hstmt,
|
||||
inline SQLRETURN SQLForeignKeys(
|
||||
SQLHSTMT hstmt,
|
||||
SQLCHAR * szPkCatalogName,
|
||||
SQLSMALLINT cbPkCatalogName,
|
||||
SQLCHAR * szPkSchemaName,
|
||||
@ -848,7 +692,8 @@ inline SQLRETURN SQLForeignKeys(SQLHSTMT hstmt,
|
||||
SQLCHAR * szFkTableName,
|
||||
SQLSMALLINT cbFkTableName)
|
||||
{
|
||||
return ::SQLForeignKeysA(hstmt,
|
||||
return ::SQLForeignKeysA(
|
||||
hstmt,
|
||||
szPkCatalogName,
|
||||
cbPkCatalogName,
|
||||
szPkSchemaName,
|
||||
@ -864,23 +709,15 @@ inline SQLRETURN SQLForeignKeys(SQLHSTMT hstmt,
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLNativeSql(SQLHDBC hdbc,
|
||||
SQLCHAR* szSqlStrIn,
|
||||
SQLINTEGER cbSqlStrIn,
|
||||
SQLCHAR* szSqlStr,
|
||||
SQLINTEGER cbSqlStrMax,
|
||||
SQLINTEGER* pcbSqlStr)
|
||||
inline SQLRETURN SQLNativeSql(
|
||||
SQLHDBC hdbc, SQLCHAR * szSqlStrIn, SQLINTEGER cbSqlStrIn, SQLCHAR * szSqlStr, SQLINTEGER cbSqlStrMax, SQLINTEGER * pcbSqlStr)
|
||||
{
|
||||
return ::SQLNativeSqlA(hdbc,
|
||||
szSqlStrIn,
|
||||
cbSqlStrIn,
|
||||
szSqlStr,
|
||||
cbSqlStrMax,
|
||||
pcbSqlStr);
|
||||
return ::SQLNativeSqlA(hdbc, szSqlStrIn, cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr);
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLPrimaryKeys(SQLHSTMT hstmt,
|
||||
inline SQLRETURN SQLPrimaryKeys(
|
||||
SQLHSTMT hstmt,
|
||||
SQLCHAR * szCatalogName,
|
||||
SQLSMALLINT cbCatalogName,
|
||||
SQLCHAR * szSchemaName,
|
||||
@ -888,17 +725,12 @@ inline SQLRETURN SQLPrimaryKeys(SQLHSTMT hstmt,
|
||||
SQLCHAR * szTableName,
|
||||
SQLSMALLINT cbTableName)
|
||||
{
|
||||
return ::SQLPrimaryKeysA(hstmt,
|
||||
szCatalogName,
|
||||
cbCatalogName,
|
||||
szSchemaName,
|
||||
cbSchemaName,
|
||||
szTableName,
|
||||
cbTableName);
|
||||
return ::SQLPrimaryKeysA(hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName);
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLProcedureColumns(SQLHSTMT hstmt,
|
||||
inline SQLRETURN SQLProcedureColumns(
|
||||
SQLHSTMT hstmt,
|
||||
SQLCHAR * szCatalogName,
|
||||
SQLSMALLINT cbCatalogName,
|
||||
SQLCHAR * szSchemaName,
|
||||
@ -908,19 +740,13 @@ inline SQLRETURN SQLProcedureColumns(SQLHSTMT hstmt,
|
||||
SQLCHAR * szColumnName,
|
||||
SQLSMALLINT cbColumnName)
|
||||
{
|
||||
return ::SQLProcedureColumnsA(hstmt,
|
||||
szCatalogName,
|
||||
cbCatalogName,
|
||||
szSchemaName,
|
||||
cbSchemaName,
|
||||
szProcName,
|
||||
cbProcName,
|
||||
szColumnName,
|
||||
cbColumnName);
|
||||
return ::SQLProcedureColumnsA(
|
||||
hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szProcName, cbProcName, szColumnName, cbColumnName);
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLProcedures(SQLHSTMT hstmt,
|
||||
inline SQLRETURN SQLProcedures(
|
||||
SQLHSTMT hstmt,
|
||||
SQLCHAR * szCatalogName,
|
||||
SQLSMALLINT cbCatalogName,
|
||||
SQLCHAR * szSchemaName,
|
||||
@ -928,17 +754,12 @@ inline SQLRETURN SQLProcedures(SQLHSTMT hstmt,
|
||||
SQLCHAR * szProcName,
|
||||
SQLSMALLINT cbProcName)
|
||||
{
|
||||
return ::SQLProceduresA(hstmt,
|
||||
szCatalogName,
|
||||
cbCatalogName,
|
||||
szSchemaName,
|
||||
cbSchemaName,
|
||||
szProcName,
|
||||
cbProcName);
|
||||
return ::SQLProceduresA(hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szProcName, cbProcName);
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLTablePrivileges(SQLHSTMT hstmt,
|
||||
inline SQLRETURN SQLTablePrivileges(
|
||||
SQLHSTMT hstmt,
|
||||
SQLCHAR * szCatalogName,
|
||||
SQLSMALLINT cbCatalogName,
|
||||
SQLCHAR * szSchemaName,
|
||||
@ -946,17 +767,12 @@ inline SQLRETURN SQLTablePrivileges(SQLHSTMT hstmt,
|
||||
SQLCHAR * szTableName,
|
||||
SQLSMALLINT cbTableName)
|
||||
{
|
||||
return ::SQLTablePrivilegesA(hstmt,
|
||||
szCatalogName,
|
||||
cbCatalogName,
|
||||
szSchemaName,
|
||||
cbSchemaName,
|
||||
szTableName,
|
||||
cbTableName);
|
||||
return ::SQLTablePrivilegesA(hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName);
|
||||
}
|
||||
|
||||
|
||||
inline SQLRETURN SQLDrivers(SQLHENV henv,
|
||||
inline SQLRETURN SQLDrivers(
|
||||
SQLHENV henv,
|
||||
SQLUSMALLINT fDirection,
|
||||
SQLCHAR * szDriverDesc,
|
||||
SQLSMALLINT cbDriverDescMax,
|
||||
@ -965,21 +781,17 @@ inline SQLRETURN SQLDrivers(SQLHENV henv,
|
||||
SQLSMALLINT cbDrvrAttrMax,
|
||||
SQLSMALLINT * pcbDrvrAttr)
|
||||
{
|
||||
return ::SQLDriversA(henv,
|
||||
fDirection,
|
||||
szDriverDesc,
|
||||
cbDriverDescMax,
|
||||
pcbDriverDesc,
|
||||
szDriverAttributes,
|
||||
cbDrvrAttrMax,
|
||||
pcbDrvrAttr);
|
||||
return ::SQLDriversA(
|
||||
henv, fDirection, szDriverDesc, cbDriverDescMax, pcbDriverDesc, szDriverAttributes, cbDrvrAttrMax, pcbDrvrAttr);
|
||||
}
|
||||
|
||||
|
||||
#endif // POCO_ODBC_UNICODE
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
}
|
||||
}
|
||||
} // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif // ODBC_Unicode_INCLUDED
|
||||
|
@ -18,9 +18,12 @@
|
||||
#define Data_ODBC_Unicode_UNIX_INCLUDED
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
namespace ODBC
|
||||
{
|
||||
|
||||
|
||||
void makeUTF16(SQLCHAR * pSQLChar, SQLINTEGER length, std::string & target);
|
||||
@ -45,7 +48,9 @@ inline void makeUTF8(Poco::Buffer<SQLWCHAR>& buffer, int length, SQLPOINTER pTar
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
}
|
||||
}
|
||||
} // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif // Data_ODBC_Unicode_UNIX_INCLUDED
|
||||
|
@ -18,9 +18,12 @@
|
||||
#define Data_ODBC_Unicode_WIN32_INCLUDED
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
namespace ODBC
|
||||
{
|
||||
|
||||
|
||||
inline void makeUTF16(SQLCHAR * pSQLChar, SQLINTEGER length, std::wstring & target)
|
||||
@ -51,7 +54,9 @@ inline void makeUTF8(Poco::Buffer<wchar_t>& buffer, SQLINTEGER length, SQLPOINTE
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
}
|
||||
}
|
||||
} // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif // Data_ODBC_Unicode_WIN32_INCLUDED
|
||||
|
@ -18,19 +18,22 @@
|
||||
#define Data_ODBC_Utility_INCLUDED
|
||||
|
||||
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
#include <sqltypes.h>
|
||||
#include "Poco/Data/Date.h"
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/ODBC/TypeInfo.h"
|
||||
#include "Poco/Data/Date.h"
|
||||
#include "Poco/Data/Time.h"
|
||||
#include "Poco/DateTime.h"
|
||||
#include <sstream>
|
||||
#include <map>
|
||||
#include <sqltypes.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
namespace ODBC
|
||||
{
|
||||
|
||||
|
||||
class ODBC_API Utility
|
||||
@ -80,11 +83,13 @@ public:
|
||||
/// Transfers data from ODBC SQL_DATE_STRUCT container to Poco::DateTime container.
|
||||
{
|
||||
std::size_t size = ds.size();
|
||||
if (d.size() != size) d.resize(size);
|
||||
if (d.size() != size)
|
||||
d.resize(size);
|
||||
typename T::iterator dIt = d.begin();
|
||||
typename F::const_iterator it = ds.begin();
|
||||
typename F::const_iterator end = ds.end();
|
||||
for (; it != end; ++it, ++dIt) dateSync(*dIt, *it);
|
||||
for (; it != end; ++it, ++dIt)
|
||||
dateSync(*dIt, *it);
|
||||
}
|
||||
|
||||
static void timeSync(Time & dt, const SQL_TIME_STRUCT & ts);
|
||||
@ -95,11 +100,13 @@ public:
|
||||
/// Transfers data from ODBC SQL_TIME_STRUCT container to Poco::DateTime container.
|
||||
{
|
||||
std::size_t size = ts.size();
|
||||
if (t.size() != size) t.resize(size);
|
||||
if (t.size() != size)
|
||||
t.resize(size);
|
||||
typename T::iterator dIt = t.begin();
|
||||
typename F::const_iterator it = ts.begin();
|
||||
typename F::const_iterator end = ts.end();
|
||||
for (; it != end; ++it, ++dIt) timeSync(*dIt, *it);
|
||||
for (; it != end; ++it, ++dIt)
|
||||
timeSync(*dIt, *it);
|
||||
}
|
||||
|
||||
static void dateTimeSync(Poco::DateTime & dt, const SQL_TIMESTAMP_STRUCT & ts);
|
||||
@ -110,11 +117,13 @@ public:
|
||||
/// Transfers data from ODBC SQL_TIMESTAMP_STRUCT container to Poco::DateTime container.
|
||||
{
|
||||
std::size_t size = ts.size();
|
||||
if (dt.size() != size) dt.resize(size);
|
||||
if (dt.size() != size)
|
||||
dt.resize(size);
|
||||
typename T::iterator dIt = dt.begin();
|
||||
typename F::const_iterator it = ts.begin();
|
||||
typename F::const_iterator end = ts.end();
|
||||
for (; it != end; ++it, ++dIt) dateTimeSync(*dIt, *it);
|
||||
for (; it != end; ++it, ++dIt)
|
||||
dateTimeSync(*dIt, *it);
|
||||
}
|
||||
|
||||
static void dateSync(SQL_DATE_STRUCT & ts, const Date & dt);
|
||||
@ -125,11 +134,13 @@ public:
|
||||
/// Transfers data from Poco::Data::Date vector to ODBC SQL_DATE_STRUCT container.
|
||||
{
|
||||
std::size_t size = d.size();
|
||||
if (ds.size() != size) ds.resize(size);
|
||||
if (ds.size() != size)
|
||||
ds.resize(size);
|
||||
std::vector<SQL_DATE_STRUCT>::iterator dIt = ds.begin();
|
||||
typename C::const_iterator it = d.begin();
|
||||
typename C::const_iterator end = d.end();
|
||||
for (; it != end; ++it, ++dIt) dateSync(*dIt, *it);
|
||||
for (; it != end; ++it, ++dIt)
|
||||
dateSync(*dIt, *it);
|
||||
}
|
||||
|
||||
static void timeSync(SQL_TIME_STRUCT & ts, const Time & dt);
|
||||
@ -140,11 +151,13 @@ public:
|
||||
/// Transfers data from Poco::Data::Time container to ODBC SQL_TIME_STRUCT vector.
|
||||
{
|
||||
std::size_t size = t.size();
|
||||
if (ts.size() != size) ts.resize(size);
|
||||
if (ts.size() != size)
|
||||
ts.resize(size);
|
||||
std::vector<SQL_TIME_STRUCT>::iterator tIt = ts.begin();
|
||||
typename C::const_iterator it = t.begin();
|
||||
typename C::const_iterator end = t.end();
|
||||
for (; it != end; ++it, ++tIt) timeSync(*tIt, *it);
|
||||
for (; it != end; ++it, ++tIt)
|
||||
timeSync(*tIt, *it);
|
||||
}
|
||||
|
||||
static void dateTimeSync(SQL_TIMESTAMP_STRUCT & ts, const Poco::DateTime & dt);
|
||||
@ -155,11 +168,13 @@ public:
|
||||
/// Transfers data from Poco::DateTime to ODBC SQL_TIMESTAMP_STRUCT.
|
||||
{
|
||||
std::size_t size = dt.size();
|
||||
if (ts.size() != size) ts.resize(size);
|
||||
if (ts.size() != size)
|
||||
ts.resize(size);
|
||||
std::vector<SQL_TIMESTAMP_STRUCT>::iterator tIt = ts.begin();
|
||||
typename C::const_iterator it = dt.begin();
|
||||
typename C::const_iterator end = dt.end();
|
||||
for (; it != end; ++it, ++tIt) dateTimeSync(*tIt, *it);
|
||||
for (; it != end; ++it, ++tIt)
|
||||
dateTimeSync(*tIt, *it);
|
||||
}
|
||||
|
||||
private:
|
||||
@ -201,7 +216,9 @@ inline void Utility::timeSync(Time& t, const SQL_TIME_STRUCT& ts)
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
}
|
||||
}
|
||||
} // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -18,29 +18,32 @@
|
||||
#define Data_AbstractBinder_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/Date.h"
|
||||
#include "Poco/Data/Time.h"
|
||||
#include "Poco/Data/LOB.h"
|
||||
#include "Poco/DateTime.h"
|
||||
#include "Poco/Nullable.h"
|
||||
#include "Poco/Any.h"
|
||||
#include "Poco/Dynamic/Var.h"
|
||||
#include "Poco/UTFString.h"
|
||||
#include <vector>
|
||||
#include <cstddef>
|
||||
#include <deque>
|
||||
#include <list>
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
#include "Poco/Any.h"
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/Date.h"
|
||||
#include "Poco/Data/LOB.h"
|
||||
#include "Poco/Data/Time.h"
|
||||
#include "Poco/DateTime.h"
|
||||
#include "Poco/Dynamic/Var.h"
|
||||
#include "Poco/Nullable.h"
|
||||
#include "Poco/UTFString.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
typedef NullType NullData;
|
||||
|
||||
|
||||
namespace Keywords {
|
||||
namespace Keywords
|
||||
{
|
||||
|
||||
|
||||
static const NullData null = NULL_GENERIC;
|
||||
@ -367,7 +370,8 @@ inline bool AbstractBinder::isInBound(Direction dir)
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_AbstractBinder_INCLUDED
|
||||
|
@ -18,19 +18,21 @@
|
||||
#define Data_AbstractBinding_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/AbstractBinder.h"
|
||||
#include "Poco/Any.h"
|
||||
#include "Poco/RefCountedObject.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <deque>
|
||||
#include <cstddef>
|
||||
#include <deque>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include "Poco/Any.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "Poco/Data/AbstractBinder.h"
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/RefCountedObject.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class Data_API AbstractBinding
|
||||
@ -138,7 +140,8 @@ inline Poco::UInt32 AbstractBinding::bulkSize() const
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_AbstractBinding_INCLUDED
|
||||
|
@ -18,21 +18,23 @@
|
||||
#define Data_AbstractExtraction_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/Data.h"
|
||||
#include <cstddef>
|
||||
#include <deque>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "Poco/Data/AbstractExtractor.h"
|
||||
#include "Poco/Data/AbstractPreparation.h"
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/Limit.h"
|
||||
#include "Poco/RefCountedObject.h"
|
||||
#include "Poco/UTFString.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <list>
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class AbstractPreparator;
|
||||
@ -47,8 +49,7 @@ public:
|
||||
typedef SharedPtr<AbstractExtractor> ExtractorPtr;
|
||||
typedef SharedPtr<AbstractPreparator> PreparatorPtr;
|
||||
|
||||
AbstractExtraction(Poco::UInt32 limit = Limit::LIMIT_UNLIMITED,
|
||||
Poco::UInt32 position = 0, bool bulk = false);
|
||||
AbstractExtraction(Poco::UInt32 limit = Limit::LIMIT_UNLIMITED, Poco::UInt32 position = 0, bool bulk = false);
|
||||
/// Creates the AbstractExtraction. A limit value equal to EXTRACT_UNLIMITED (0xffffffffu)
|
||||
/// means that we extract as much data as possible during one execute.
|
||||
/// Otherwise the limit value is used to partition data extracting to a limited amount of rows.
|
||||
@ -155,7 +156,8 @@ private:
|
||||
template <typename S>
|
||||
bool isStringNull(const S & str, bool deflt)
|
||||
{
|
||||
if (getForceEmptyString()) return false;
|
||||
if (getForceEmptyString())
|
||||
return false;
|
||||
|
||||
if (getEmptyStringIsNull() && str.empty())
|
||||
return true;
|
||||
@ -272,7 +274,8 @@ inline bool AbstractExtraction::isValueNull(const Poco::UTF16String& str, bool d
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_AbstractExtraction_INCLUDED
|
||||
|
@ -18,28 +18,31 @@
|
||||
#define Data_AbstractExtractor_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/Constants.h"
|
||||
#include "Poco/Data/LOB.h"
|
||||
#include "Poco/UTFString.h"
|
||||
#include <vector>
|
||||
#include <cstddef>
|
||||
#include <deque>
|
||||
#include <list>
|
||||
#include <string>
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
#include "Poco/Data/Constants.h"
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/LOB.h"
|
||||
#include "Poco/UTFString.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Poco
|
||||
{
|
||||
|
||||
|
||||
class DateTime;
|
||||
class Any;
|
||||
|
||||
namespace Dynamic {
|
||||
namespace Dynamic
|
||||
{
|
||||
class Var;
|
||||
}
|
||||
|
||||
namespace Data {
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class Date;
|
||||
@ -345,7 +348,8 @@ inline void AbstractExtractor::reset()
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_AbstractExtractor_INCLUDED
|
||||
|
@ -18,14 +18,16 @@
|
||||
#define Data_AbstractPreparation_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/AbstractPreparator.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
#include <cstddef>
|
||||
#include "Poco/Data/AbstractPreparator.h"
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class Data_API AbstractPreparation
|
||||
@ -65,7 +67,8 @@ inline AbstractPreparation::PreparatorPtr AbstractPreparation::preparation()
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_AbstractPreparation_INCLUDED
|
||||
|
@ -18,28 +18,31 @@
|
||||
#define Data_AbstractPreparator_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/RefCountedObject.h"
|
||||
#include "Poco/Data/LOB.h"
|
||||
#include "Poco/UTFString.h"
|
||||
#include <vector>
|
||||
#include <cstddef>
|
||||
#include <deque>
|
||||
#include <list>
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/LOB.h"
|
||||
#include "Poco/RefCountedObject.h"
|
||||
#include "Poco/UTFString.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Poco
|
||||
{
|
||||
|
||||
|
||||
class DateTime;
|
||||
class Any;
|
||||
|
||||
namespace Dynamic {
|
||||
namespace Dynamic
|
||||
{
|
||||
class Var;
|
||||
}
|
||||
|
||||
|
||||
namespace Data {
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class Date;
|
||||
@ -382,7 +385,8 @@ inline bool AbstractPreparator::isBulk() const
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_AbstractPreparator_INCLUDED
|
||||
|
@ -18,14 +18,16 @@
|
||||
#define Data_AbstractSessionImpl_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/SessionImpl.h"
|
||||
#include "Poco/Data/DataException.h"
|
||||
#include <map>
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/DataException.h"
|
||||
#include "Poco/Data/SessionImpl.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
template <class C>
|
||||
@ -50,12 +52,12 @@ public:
|
||||
typedef Poco::Any (C::*PropertyGetter)(const std::string &);
|
||||
/// The getter method for a property.
|
||||
|
||||
AbstractSessionImpl(const std::string& connectionString,
|
||||
std::size_t timeout = LOGIN_TIMEOUT_DEFAULT): SessionImpl(connectionString, timeout),
|
||||
_storage(std::string("deque")),
|
||||
_bulk(false),
|
||||
_emptyStringIsNull(false),
|
||||
_forceEmptyString(false)
|
||||
AbstractSessionImpl(const std::string & connectionString, std::size_t timeout = LOGIN_TIMEOUT_DEFAULT)
|
||||
: SessionImpl(connectionString, timeout)
|
||||
, _storage(std::string("deque"))
|
||||
, _bulk(false)
|
||||
, _emptyStringIsNull(false)
|
||||
, _forceEmptyString(false)
|
||||
/// Creates the AbstractSessionImpl.
|
||||
///
|
||||
/// Adds "storage" property and sets the default internal storage container
|
||||
@ -89,25 +91,15 @@ public:
|
||||
/// resulting in default underlying database behavior.
|
||||
///
|
||||
{
|
||||
addProperty("storage",
|
||||
&AbstractSessionImpl<C>::setStorage,
|
||||
&AbstractSessionImpl<C>::getStorage);
|
||||
addProperty("storage", &AbstractSessionImpl<C>::setStorage, &AbstractSessionImpl<C>::getStorage);
|
||||
|
||||
addProperty("handle",
|
||||
&AbstractSessionImpl<C>::setHandle,
|
||||
&AbstractSessionImpl<C>::getHandle);
|
||||
addProperty("handle", &AbstractSessionImpl<C>::setHandle, &AbstractSessionImpl<C>::getHandle);
|
||||
|
||||
addFeature("bulk",
|
||||
&AbstractSessionImpl<C>::setBulk,
|
||||
&AbstractSessionImpl<C>::getBulk);
|
||||
addFeature("bulk", &AbstractSessionImpl<C>::setBulk, &AbstractSessionImpl<C>::getBulk);
|
||||
|
||||
addFeature("emptyStringIsNull",
|
||||
&AbstractSessionImpl<C>::setEmptyStringIsNull,
|
||||
&AbstractSessionImpl<C>::getEmptyStringIsNull);
|
||||
addFeature("emptyStringIsNull", &AbstractSessionImpl<C>::setEmptyStringIsNull, &AbstractSessionImpl<C>::getEmptyStringIsNull);
|
||||
|
||||
addFeature("forceEmptyString",
|
||||
&AbstractSessionImpl<C>::setForceEmptyString,
|
||||
&AbstractSessionImpl<C>::getForceEmptyString);
|
||||
addFeature("forceEmptyString", &AbstractSessionImpl<C>::setForceEmptyString, &AbstractSessionImpl<C>::getForceEmptyString);
|
||||
}
|
||||
|
||||
~AbstractSessionImpl()
|
||||
@ -127,7 +119,8 @@ public:
|
||||
else
|
||||
throw NotImplementedException("set", name);
|
||||
}
|
||||
else throw NotSupportedException(name);
|
||||
else
|
||||
throw NotSupportedException(name);
|
||||
}
|
||||
|
||||
bool getFeature(const std::string & name)
|
||||
@ -142,7 +135,8 @@ public:
|
||||
else
|
||||
throw NotImplementedException("get", name);
|
||||
}
|
||||
else throw NotSupportedException(name);
|
||||
else
|
||||
throw NotSupportedException(name);
|
||||
}
|
||||
|
||||
void setProperty(const std::string & name, const Poco::Any & value)
|
||||
@ -157,7 +151,8 @@ public:
|
||||
else
|
||||
throw NotImplementedException("set", name);
|
||||
}
|
||||
else throw NotSupportedException(name);
|
||||
else
|
||||
throw NotSupportedException(name);
|
||||
}
|
||||
|
||||
Poco::Any getProperty(const std::string & name)
|
||||
@ -172,7 +167,8 @@ public:
|
||||
else
|
||||
throw NotImplementedException("set", name);
|
||||
}
|
||||
else throw NotSupportedException(name);
|
||||
else
|
||||
throw NotSupportedException(name);
|
||||
}
|
||||
|
||||
void setStorage(const std::string & value)
|
||||
@ -309,7 +305,8 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_AbstractSessionImpl_INCLUDED
|
||||
|
@ -21,13 +21,15 @@
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/Session.h"
|
||||
#include "Poco/DateTime.h"
|
||||
#include "Poco/Timespan.h"
|
||||
#include "Poco/Dynamic/Var.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
#include "Poco/Timespan.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class Data_API ArchiveStrategy
|
||||
@ -36,7 +38,8 @@ class Data_API ArchiveStrategy
|
||||
public:
|
||||
static const std::string DEFAULT_ARCHIVE_DESTINATION;
|
||||
|
||||
ArchiveStrategy(const std::string& connector,
|
||||
ArchiveStrategy(
|
||||
const std::string & connector,
|
||||
const std::string & connect,
|
||||
const std::string & source,
|
||||
const std::string & destination = DEFAULT_ARCHIVE_DESTINATION);
|
||||
@ -82,8 +85,8 @@ protected:
|
||||
Statement & getCopyStatement();
|
||||
Statement & getDeleteStatement();
|
||||
Statement & getCountStatement();
|
||||
private:
|
||||
|
||||
private:
|
||||
ArchiveStrategy();
|
||||
ArchiveStrategy(const ArchiveStrategy &);
|
||||
ArchiveStrategy & operator=(const ArchiveStrategy &);
|
||||
@ -169,7 +172,6 @@ inline Statement& ArchiveStrategy::getCountStatement()
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// ArchiveByAgeStrategy
|
||||
//
|
||||
@ -177,7 +179,8 @@ class Data_API ArchiveByAgeStrategy: public ArchiveStrategy
|
||||
/// Archives rows scheduled for archiving.
|
||||
{
|
||||
public:
|
||||
ArchiveByAgeStrategy(const std::string& connector,
|
||||
ArchiveByAgeStrategy(
|
||||
const std::string & connector,
|
||||
const std::string & connect,
|
||||
const std::string & sourceTable,
|
||||
const std::string & destinationTable = DEFAULT_ARCHIVE_DESTINATION);
|
||||
@ -216,7 +219,8 @@ inline const std::string& ArchiveByAgeStrategy::getThreshold() const
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_ArchiveStrategy_INCLUDED
|
||||
|
@ -14,7 +14,6 @@
|
||||
//
|
||||
|
||||
|
||||
|
||||
#ifndef Data_AutoTransaction_INCLUDED
|
||||
#define Data_AutoTransaction_INCLUDED
|
||||
|
||||
@ -22,14 +21,17 @@
|
||||
#include "Poco/Data/Transaction.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
typedef Transaction AutoTransaction;
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_AutoTransaction_INCLUDED
|
||||
|
@ -18,23 +18,25 @@
|
||||
#define Data_Binding_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/Data.h"
|
||||
#include <cstddef>
|
||||
#include <deque>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
#include "Poco/Bugcheck.h"
|
||||
#include "Poco/Data/AbstractBinding.h"
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/DataException.h"
|
||||
#include "Poco/Data/TypeHandler.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
#include "Poco/MetaProgramming.h"
|
||||
#include "Poco/Bugcheck.h"
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <deque>
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <cstddef>
|
||||
#include "Poco/SharedPtr.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
template <class T>
|
||||
@ -56,12 +58,8 @@ public:
|
||||
typedef Binding<ValType> Type;
|
||||
typedef SharedPtr<Type> Ptr;
|
||||
|
||||
explicit Binding(T& val,
|
||||
const std::string& name = "",
|
||||
Direction direction = PD_IN):
|
||||
AbstractBinding(name, direction),
|
||||
_val(val),
|
||||
_bound(false)
|
||||
explicit Binding(T & val, const std::string & name = "", Direction direction = PD_IN)
|
||||
: AbstractBinding(name, direction), _val(val), _bound(false)
|
||||
/// Creates the Binding using the passed reference as bound value.
|
||||
/// If copy is true, a copy of the value referred to is created.
|
||||
{
|
||||
@ -72,20 +70,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::size_t numOfColumnsHandled() const
|
||||
{
|
||||
return TypeHandler<T>::size();
|
||||
}
|
||||
std::size_t numOfColumnsHandled() const { return TypeHandler<T>::size(); }
|
||||
|
||||
std::size_t numOfRowsHandled() const
|
||||
{
|
||||
return 1u;
|
||||
}
|
||||
std::size_t numOfRowsHandled() const { return 1u; }
|
||||
|
||||
bool canBind() const
|
||||
{
|
||||
return !_bound;
|
||||
}
|
||||
bool canBind() const { return !_bound; }
|
||||
|
||||
void bind(std::size_t pos)
|
||||
{
|
||||
@ -108,7 +97,6 @@ private:
|
||||
};
|
||||
|
||||
|
||||
|
||||
template <class T>
|
||||
class CopyBinding : public AbstractBinding
|
||||
/// Binding maps a value or multiple values (see Binding specializations for STL containers as
|
||||
@ -126,12 +114,8 @@ public:
|
||||
typedef CopyBinding<ValType> Type;
|
||||
typedef SharedPtr<Type> Ptr;
|
||||
|
||||
explicit CopyBinding(T& val,
|
||||
const std::string& name = "",
|
||||
Direction direction = PD_IN):
|
||||
AbstractBinding(name, direction),
|
||||
_pVal(new T(val)),
|
||||
_bound(false)
|
||||
explicit CopyBinding(T & val, const std::string & name = "", Direction direction = PD_IN)
|
||||
: AbstractBinding(name, direction), _pVal(new T(val)), _bound(false)
|
||||
/// Creates the Binding using the passed reference as bound value.
|
||||
/// If copy is true, a copy of the value referred to is created.
|
||||
{
|
||||
@ -142,20 +126,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::size_t numOfColumnsHandled() const
|
||||
{
|
||||
return TypeHandler<T>::size();
|
||||
}
|
||||
std::size_t numOfColumnsHandled() const { return TypeHandler<T>::size(); }
|
||||
|
||||
std::size_t numOfRowsHandled() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
std::size_t numOfRowsHandled() const { return 1; }
|
||||
|
||||
bool canBind() const
|
||||
{
|
||||
return !_bound;
|
||||
}
|
||||
bool canBind() const { return !_bound; }
|
||||
|
||||
void bind(std::size_t pos)
|
||||
{
|
||||
@ -189,12 +164,8 @@ public:
|
||||
typedef Binding<const char *> Type;
|
||||
typedef SharedPtr<Type> Ptr;
|
||||
|
||||
explicit Binding(const char* pVal,
|
||||
const std::string& name = "",
|
||||
Direction direction = PD_IN):
|
||||
AbstractBinding(name, direction),
|
||||
_val(pVal ? pVal : throw NullPointerException() ),
|
||||
_bound(false)
|
||||
explicit Binding(const char * pVal, const std::string & name = "", Direction direction = PD_IN)
|
||||
: AbstractBinding(name, direction), _val(pVal ? pVal : throw NullPointerException()), _bound(false)
|
||||
/// Creates the Binding by copying the passed string.
|
||||
{
|
||||
}
|
||||
@ -204,20 +175,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::size_t numOfColumnsHandled() const
|
||||
{
|
||||
return 1u;
|
||||
}
|
||||
std::size_t numOfColumnsHandled() const { return 1u; }
|
||||
|
||||
std::size_t numOfRowsHandled() const
|
||||
{
|
||||
return 1u;
|
||||
}
|
||||
std::size_t numOfRowsHandled() const { return 1u; }
|
||||
|
||||
bool canBind() const
|
||||
{
|
||||
return !_bound;
|
||||
}
|
||||
bool canBind() const { return !_bound; }
|
||||
|
||||
void bind(std::size_t pos)
|
||||
{
|
||||
@ -240,7 +202,6 @@ private:
|
||||
};
|
||||
|
||||
|
||||
|
||||
template <>
|
||||
class CopyBinding<const char *> : public AbstractBinding
|
||||
/// Binding const char* specialization wraps char pointer into string.
|
||||
@ -251,12 +212,8 @@ public:
|
||||
typedef CopyBinding<const char *> Type;
|
||||
typedef SharedPtr<Type> Ptr;
|
||||
|
||||
explicit CopyBinding(const char* pVal,
|
||||
const std::string& name = "",
|
||||
Direction direction = PD_IN):
|
||||
AbstractBinding(name, direction),
|
||||
_val(pVal ? pVal : throw NullPointerException() ),
|
||||
_bound(false)
|
||||
explicit CopyBinding(const char * pVal, const std::string & name = "", Direction direction = PD_IN)
|
||||
: AbstractBinding(name, direction), _val(pVal ? pVal : throw NullPointerException()), _bound(false)
|
||||
/// Creates the Binding by copying the passed string.
|
||||
{
|
||||
}
|
||||
@ -266,20 +223,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::size_t numOfColumnsHandled() const
|
||||
{
|
||||
return 1u;
|
||||
}
|
||||
std::size_t numOfColumnsHandled() const { return 1u; }
|
||||
|
||||
std::size_t numOfRowsHandled() const
|
||||
{
|
||||
return 1u;
|
||||
}
|
||||
std::size_t numOfRowsHandled() const { return 1u; }
|
||||
|
||||
bool canBind() const
|
||||
{
|
||||
return !_bound;
|
||||
}
|
||||
bool canBind() const { return !_bound; }
|
||||
|
||||
void bind(std::size_t pos)
|
||||
{
|
||||
@ -312,13 +260,8 @@ public:
|
||||
typedef SharedPtr<Binding<ValType>> Ptr;
|
||||
typedef typename ValType::const_iterator Iterator;
|
||||
|
||||
explicit Binding(std::vector<T>& val,
|
||||
const std::string& name = "",
|
||||
Direction direction = PD_IN):
|
||||
AbstractBinding(name, direction),
|
||||
_val(val),
|
||||
_begin(),
|
||||
_end()
|
||||
explicit Binding(std::vector<T> & val, const std::string & name = "", Direction direction = PD_IN)
|
||||
: AbstractBinding(name, direction), _val(val), _begin(), _end()
|
||||
/// Creates the Binding.
|
||||
{
|
||||
if (PD_IN == direction && numOfRowsHandled() == 0)
|
||||
@ -331,20 +274,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::size_t numOfColumnsHandled() const
|
||||
{
|
||||
return TypeHandler<T>::size();
|
||||
}
|
||||
std::size_t numOfColumnsHandled() const { return TypeHandler<T>::size(); }
|
||||
|
||||
std::size_t numOfRowsHandled() const
|
||||
{
|
||||
return static_cast<std::size_t>(_val.size());
|
||||
}
|
||||
std::size_t numOfRowsHandled() const { return static_cast<std::size_t>(_val.size()); }
|
||||
|
||||
bool canBind() const
|
||||
{
|
||||
return _begin != _end;
|
||||
}
|
||||
bool canBind() const { return _begin != _end; }
|
||||
|
||||
void bind(std::size_t pos)
|
||||
{
|
||||
@ -373,19 +307,13 @@ class CopyBinding<std::vector<T> >: public AbstractBinding
|
||||
/// Specialization for std::vector.
|
||||
{
|
||||
public:
|
||||
|
||||
typedef std::vector<T> ValType;
|
||||
typedef SharedPtr<ValType> ValPtr;
|
||||
typedef SharedPtr<CopyBinding<ValType>> Ptr;
|
||||
typedef typename ValType::const_iterator Iterator;
|
||||
|
||||
explicit CopyBinding(std::vector<T>& val,
|
||||
const std::string& name = "",
|
||||
Direction direction = PD_IN):
|
||||
AbstractBinding(name, direction),
|
||||
_pVal(new std::vector<T>(val)),
|
||||
_begin(),
|
||||
_end()
|
||||
explicit CopyBinding(std::vector<T> & val, const std::string & name = "", Direction direction = PD_IN)
|
||||
: AbstractBinding(name, direction), _pVal(new std::vector<T>(val)), _begin(), _end()
|
||||
/// Creates the Binding.
|
||||
{
|
||||
if (PD_IN == direction && numOfRowsHandled() == 0)
|
||||
@ -398,20 +326,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::size_t numOfColumnsHandled() const
|
||||
{
|
||||
return TypeHandler<T>::size();
|
||||
}
|
||||
std::size_t numOfColumnsHandled() const { return TypeHandler<T>::size(); }
|
||||
|
||||
std::size_t numOfRowsHandled() const
|
||||
{
|
||||
return _pVal->size();
|
||||
}
|
||||
std::size_t numOfRowsHandled() const { return _pVal->size(); }
|
||||
|
||||
bool canBind() const
|
||||
{
|
||||
return _begin != _end;
|
||||
}
|
||||
bool canBind() const { return _begin != _end; }
|
||||
|
||||
void bind(std::size_t pos)
|
||||
{
|
||||
@ -456,14 +375,8 @@ public:
|
||||
typedef SharedPtr<Binding<ValType>> Ptr;
|
||||
typedef ValType::const_iterator Iterator;
|
||||
|
||||
explicit Binding(const std::vector<bool>& val,
|
||||
const std::string& name = "",
|
||||
Direction direction = PD_IN):
|
||||
AbstractBinding(name, direction),
|
||||
_val(val),
|
||||
_deq(_val.begin(), _val.end()),
|
||||
_begin(),
|
||||
_end()
|
||||
explicit Binding(const std::vector<bool> & val, const std::string & name = "", Direction direction = PD_IN)
|
||||
: AbstractBinding(name, direction), _val(val), _deq(_val.begin(), _val.end()), _begin(), _end()
|
||||
/// Creates the Binding.
|
||||
{
|
||||
if (PD_IN != direction)
|
||||
@ -479,20 +392,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::size_t numOfColumnsHandled() const
|
||||
{
|
||||
return 1u;
|
||||
}
|
||||
std::size_t numOfColumnsHandled() const { return 1u; }
|
||||
|
||||
std::size_t numOfRowsHandled() const
|
||||
{
|
||||
return static_cast<std::size_t>(_val.size());
|
||||
}
|
||||
std::size_t numOfRowsHandled() const { return static_cast<std::size_t>(_val.size()); }
|
||||
|
||||
bool canBind() const
|
||||
{
|
||||
return _begin != _end;
|
||||
}
|
||||
bool canBind() const { return _begin != _end; }
|
||||
|
||||
void bind(std::size_t pos)
|
||||
{
|
||||
@ -500,7 +404,6 @@ public:
|
||||
poco_assert_dbg(canBind());
|
||||
TypeHandler<bool>::bind(pos, *_begin, getBinder(), getDirection());
|
||||
++_begin;
|
||||
|
||||
}
|
||||
|
||||
void reset()
|
||||
@ -538,13 +441,8 @@ public:
|
||||
typedef SharedPtr<CopyBinding<ValType>> Ptr;
|
||||
typedef ValType::const_iterator Iterator;
|
||||
|
||||
explicit CopyBinding(const std::vector<bool>& val,
|
||||
const std::string& name = "",
|
||||
Direction direction = PD_IN):
|
||||
AbstractBinding(name, direction),
|
||||
_deq(val.begin(), val.end()),
|
||||
_begin(),
|
||||
_end()
|
||||
explicit CopyBinding(const std::vector<bool> & val, const std::string & name = "", Direction direction = PD_IN)
|
||||
: AbstractBinding(name, direction), _deq(val.begin(), val.end()), _begin(), _end()
|
||||
/// Creates the Binding.
|
||||
{
|
||||
if (PD_IN != direction)
|
||||
@ -561,20 +459,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::size_t numOfColumnsHandled() const
|
||||
{
|
||||
return 1u;
|
||||
}
|
||||
std::size_t numOfColumnsHandled() const { return 1u; }
|
||||
|
||||
std::size_t numOfRowsHandled() const
|
||||
{
|
||||
return static_cast<std::size_t>(_deq.size());
|
||||
}
|
||||
std::size_t numOfRowsHandled() const { return static_cast<std::size_t>(_deq.size()); }
|
||||
|
||||
bool canBind() const
|
||||
{
|
||||
return _begin != _end;
|
||||
}
|
||||
bool canBind() const { return _begin != _end; }
|
||||
|
||||
void bind(std::size_t pos)
|
||||
{
|
||||
@ -607,13 +496,8 @@ public:
|
||||
typedef SharedPtr<Binding<ValType>> Ptr;
|
||||
typedef typename ValType::const_iterator Iterator;
|
||||
|
||||
explicit Binding(std::list<T>& val,
|
||||
const std::string& name = "",
|
||||
Direction direction = PD_IN):
|
||||
AbstractBinding(name, direction),
|
||||
_val(val),
|
||||
_begin(),
|
||||
_end()
|
||||
explicit Binding(std::list<T> & val, const std::string & name = "", Direction direction = PD_IN)
|
||||
: AbstractBinding(name, direction), _val(val), _begin(), _end()
|
||||
/// Creates the Binding.
|
||||
{
|
||||
if (PD_IN == direction && numOfRowsHandled() == 0)
|
||||
@ -626,20 +510,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::size_t numOfColumnsHandled() const
|
||||
{
|
||||
return TypeHandler<T>::size();
|
||||
}
|
||||
std::size_t numOfColumnsHandled() const { return TypeHandler<T>::size(); }
|
||||
|
||||
std::size_t numOfRowsHandled() const
|
||||
{
|
||||
return _val.size();
|
||||
}
|
||||
std::size_t numOfRowsHandled() const { return _val.size(); }
|
||||
|
||||
bool canBind() const
|
||||
{
|
||||
return _begin != _end;
|
||||
}
|
||||
bool canBind() const { return _begin != _end; }
|
||||
|
||||
void bind(std::size_t pos)
|
||||
{
|
||||
@ -672,13 +547,8 @@ public:
|
||||
typedef SharedPtr<CopyBinding<ValType>> Ptr;
|
||||
typedef typename ValType::const_iterator Iterator;
|
||||
|
||||
explicit CopyBinding(ValType& val,
|
||||
const std::string& name = "",
|
||||
Direction direction = PD_IN):
|
||||
AbstractBinding(name, direction),
|
||||
_pVal(new std::list<T>(val)),
|
||||
_begin(),
|
||||
_end()
|
||||
explicit CopyBinding(ValType & val, const std::string & name = "", Direction direction = PD_IN)
|
||||
: AbstractBinding(name, direction), _pVal(new std::list<T>(val)), _begin(), _end()
|
||||
/// Creates the Binding.
|
||||
{
|
||||
if (PD_IN == direction && numOfRowsHandled() == 0)
|
||||
@ -691,20 +561,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::size_t numOfColumnsHandled() const
|
||||
{
|
||||
return TypeHandler<T>::size();
|
||||
}
|
||||
std::size_t numOfColumnsHandled() const { return TypeHandler<T>::size(); }
|
||||
|
||||
std::size_t numOfRowsHandled() const
|
||||
{
|
||||
return _pVal->size();
|
||||
}
|
||||
std::size_t numOfRowsHandled() const { return _pVal->size(); }
|
||||
|
||||
bool canBind() const
|
||||
{
|
||||
return _begin != _end;
|
||||
}
|
||||
bool canBind() const { return _begin != _end; }
|
||||
|
||||
void bind(std::size_t pos)
|
||||
{
|
||||
@ -737,13 +598,8 @@ public:
|
||||
typedef SharedPtr<Binding<ValType>> Ptr;
|
||||
typedef typename ValType::const_iterator Iterator;
|
||||
|
||||
explicit Binding(std::deque<T>& val,
|
||||
const std::string& name = "",
|
||||
Direction direction = PD_IN):
|
||||
AbstractBinding(name, direction),
|
||||
_val(val),
|
||||
_begin(),
|
||||
_end()
|
||||
explicit Binding(std::deque<T> & val, const std::string & name = "", Direction direction = PD_IN)
|
||||
: AbstractBinding(name, direction), _val(val), _begin(), _end()
|
||||
/// Creates the Binding.
|
||||
{
|
||||
if (PD_IN == direction && numOfRowsHandled() == 0)
|
||||
@ -756,20 +612,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::size_t numOfColumnsHandled() const
|
||||
{
|
||||
return TypeHandler<T>::size();
|
||||
}
|
||||
std::size_t numOfColumnsHandled() const { return TypeHandler<T>::size(); }
|
||||
|
||||
std::size_t numOfRowsHandled() const
|
||||
{
|
||||
return _val.size();
|
||||
}
|
||||
std::size_t numOfRowsHandled() const { return _val.size(); }
|
||||
|
||||
bool canBind() const
|
||||
{
|
||||
return _begin != _end;
|
||||
}
|
||||
bool canBind() const { return _begin != _end; }
|
||||
|
||||
void bind(std::size_t pos)
|
||||
{
|
||||
@ -802,13 +649,8 @@ public:
|
||||
typedef SharedPtr<CopyBinding<ValType>> Ptr;
|
||||
typedef typename ValType::const_iterator Iterator;
|
||||
|
||||
explicit CopyBinding(std::deque<T>& val,
|
||||
const std::string& name = "",
|
||||
Direction direction = PD_IN):
|
||||
AbstractBinding(name, direction),
|
||||
_pVal(new std::deque<T>(val)),
|
||||
_begin(),
|
||||
_end()
|
||||
explicit CopyBinding(std::deque<T> & val, const std::string & name = "", Direction direction = PD_IN)
|
||||
: AbstractBinding(name, direction), _pVal(new std::deque<T>(val)), _begin(), _end()
|
||||
/// Creates the Binding.
|
||||
{
|
||||
if (PD_IN == direction && numOfRowsHandled() == 0)
|
||||
@ -821,20 +663,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::size_t numOfColumnsHandled() const
|
||||
{
|
||||
return TypeHandler<T>::size();
|
||||
}
|
||||
std::size_t numOfColumnsHandled() const { return TypeHandler<T>::size(); }
|
||||
|
||||
std::size_t numOfRowsHandled() const
|
||||
{
|
||||
return _pVal->size();
|
||||
}
|
||||
std::size_t numOfRowsHandled() const { return _pVal->size(); }
|
||||
|
||||
bool canBind() const
|
||||
{
|
||||
return _begin != _end;
|
||||
}
|
||||
bool canBind() const { return _begin != _end; }
|
||||
|
||||
void bind(std::size_t pos)
|
||||
{
|
||||
@ -867,13 +700,8 @@ public:
|
||||
typedef SharedPtr<Binding<ValType>> Ptr;
|
||||
typedef typename ValType::const_iterator Iterator;
|
||||
|
||||
explicit Binding(std::set<T>& val,
|
||||
const std::string& name = "",
|
||||
Direction direction = PD_IN):
|
||||
AbstractBinding(name, direction),
|
||||
_val(val),
|
||||
_begin(),
|
||||
_end()
|
||||
explicit Binding(std::set<T> & val, const std::string & name = "", Direction direction = PD_IN)
|
||||
: AbstractBinding(name, direction), _val(val), _begin(), _end()
|
||||
/// Creates the Binding.
|
||||
{
|
||||
if (PD_IN == direction && numOfRowsHandled() == 0)
|
||||
@ -886,20 +714,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::size_t numOfColumnsHandled() const
|
||||
{
|
||||
return TypeHandler<T>::size();
|
||||
}
|
||||
std::size_t numOfColumnsHandled() const { return TypeHandler<T>::size(); }
|
||||
|
||||
std::size_t numOfRowsHandled() const
|
||||
{
|
||||
return static_cast<std::size_t>(_val.size());
|
||||
}
|
||||
std::size_t numOfRowsHandled() const { return static_cast<std::size_t>(_val.size()); }
|
||||
|
||||
bool canBind() const
|
||||
{
|
||||
return _begin != _end;
|
||||
}
|
||||
bool canBind() const { return _begin != _end; }
|
||||
|
||||
void bind(std::size_t pos)
|
||||
{
|
||||
@ -932,13 +751,8 @@ public:
|
||||
typedef SharedPtr<CopyBinding<ValType>> Ptr;
|
||||
typedef typename ValType::const_iterator Iterator;
|
||||
|
||||
explicit CopyBinding(std::set<T>& val,
|
||||
const std::string& name = "",
|
||||
Direction direction = PD_IN):
|
||||
AbstractBinding(name, direction),
|
||||
_pVal(new std::set<T>(val)),
|
||||
_begin(),
|
||||
_end()
|
||||
explicit CopyBinding(std::set<T> & val, const std::string & name = "", Direction direction = PD_IN)
|
||||
: AbstractBinding(name, direction), _pVal(new std::set<T>(val)), _begin(), _end()
|
||||
/// Creates the Binding.
|
||||
{
|
||||
if (PD_IN == direction && numOfRowsHandled() == 0)
|
||||
@ -951,20 +765,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::size_t numOfColumnsHandled() const
|
||||
{
|
||||
return TypeHandler<T>::size();
|
||||
}
|
||||
std::size_t numOfColumnsHandled() const { return TypeHandler<T>::size(); }
|
||||
|
||||
std::size_t numOfRowsHandled() const
|
||||
{
|
||||
return _pVal->size();
|
||||
}
|
||||
std::size_t numOfRowsHandled() const { return _pVal->size(); }
|
||||
|
||||
bool canBind() const
|
||||
{
|
||||
return _begin != _end;
|
||||
}
|
||||
bool canBind() const { return _begin != _end; }
|
||||
|
||||
void bind(std::size_t pos)
|
||||
{
|
||||
@ -997,13 +802,8 @@ public:
|
||||
typedef SharedPtr<Binding<ValType>> Ptr;
|
||||
typedef typename ValType::const_iterator Iterator;
|
||||
|
||||
explicit Binding(std::multiset<T>& val,
|
||||
const std::string& name = "",
|
||||
Direction direction = PD_IN):
|
||||
AbstractBinding(name, direction),
|
||||
_val(val),
|
||||
_begin(),
|
||||
_end()
|
||||
explicit Binding(std::multiset<T> & val, const std::string & name = "", Direction direction = PD_IN)
|
||||
: AbstractBinding(name, direction), _val(val), _begin(), _end()
|
||||
/// Creates the Binding.
|
||||
{
|
||||
if (PD_IN == direction && numOfRowsHandled() == 0)
|
||||
@ -1016,20 +816,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::size_t numOfColumnsHandled() const
|
||||
{
|
||||
return TypeHandler<T>::size();
|
||||
}
|
||||
std::size_t numOfColumnsHandled() const { return TypeHandler<T>::size(); }
|
||||
|
||||
std::size_t numOfRowsHandled() const
|
||||
{
|
||||
return static_cast<std::size_t>(_val.size());
|
||||
}
|
||||
std::size_t numOfRowsHandled() const { return static_cast<std::size_t>(_val.size()); }
|
||||
|
||||
bool canBind() const
|
||||
{
|
||||
return _begin != _end;
|
||||
}
|
||||
bool canBind() const { return _begin != _end; }
|
||||
|
||||
void bind(std::size_t pos)
|
||||
{
|
||||
@ -1062,13 +853,8 @@ public:
|
||||
typedef SharedPtr<CopyBinding<ValType>> Ptr;
|
||||
typedef typename ValType::const_iterator Iterator;
|
||||
|
||||
explicit CopyBinding(std::multiset<T>& val,
|
||||
const std::string& name = "",
|
||||
Direction direction = PD_IN):
|
||||
AbstractBinding(name, direction),
|
||||
_pVal(new std::multiset<T>(val)),
|
||||
_begin(),
|
||||
_end()
|
||||
explicit CopyBinding(std::multiset<T> & val, const std::string & name = "", Direction direction = PD_IN)
|
||||
: AbstractBinding(name, direction), _pVal(new std::multiset<T>(val)), _begin(), _end()
|
||||
/// Creates the Binding.
|
||||
{
|
||||
if (PD_IN == direction && numOfRowsHandled() == 0)
|
||||
@ -1081,20 +867,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::size_t numOfColumnsHandled() const
|
||||
{
|
||||
return TypeHandler<T>::size();
|
||||
}
|
||||
std::size_t numOfColumnsHandled() const { return TypeHandler<T>::size(); }
|
||||
|
||||
std::size_t numOfRowsHandled() const
|
||||
{
|
||||
return _pVal->size();
|
||||
}
|
||||
std::size_t numOfRowsHandled() const { return _pVal->size(); }
|
||||
|
||||
bool canBind() const
|
||||
{
|
||||
return _begin != _end;
|
||||
}
|
||||
bool canBind() const { return _begin != _end; }
|
||||
|
||||
void bind(std::size_t pos)
|
||||
{
|
||||
@ -1127,13 +904,8 @@ public:
|
||||
typedef SharedPtr<Binding<ValType>> Ptr;
|
||||
typedef typename ValType::const_iterator Iterator;
|
||||
|
||||
explicit Binding(std::map<K, V>& val,
|
||||
const std::string& name = "",
|
||||
Direction direction = PD_IN):
|
||||
AbstractBinding(name, direction),
|
||||
_val(val),
|
||||
_begin(),
|
||||
_end()
|
||||
explicit Binding(std::map<K, V> & val, const std::string & name = "", Direction direction = PD_IN)
|
||||
: AbstractBinding(name, direction), _val(val), _begin(), _end()
|
||||
/// Creates the Binding.
|
||||
{
|
||||
if (PD_IN == direction && numOfRowsHandled() == 0)
|
||||
@ -1146,20 +918,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::size_t numOfColumnsHandled() const
|
||||
{
|
||||
return TypeHandler<V>::size();
|
||||
}
|
||||
std::size_t numOfColumnsHandled() const { return TypeHandler<V>::size(); }
|
||||
|
||||
std::size_t numOfRowsHandled() const
|
||||
{
|
||||
return static_cast<std::size_t>(_val.size());
|
||||
}
|
||||
std::size_t numOfRowsHandled() const { return static_cast<std::size_t>(_val.size()); }
|
||||
|
||||
bool canBind() const
|
||||
{
|
||||
return _begin != _end;
|
||||
}
|
||||
bool canBind() const { return _begin != _end; }
|
||||
|
||||
void bind(std::size_t pos)
|
||||
{
|
||||
@ -1192,13 +955,8 @@ public:
|
||||
typedef SharedPtr<CopyBinding<ValType>> Ptr;
|
||||
typedef typename ValType::const_iterator Iterator;
|
||||
|
||||
explicit CopyBinding(std::map<K, V>& val,
|
||||
const std::string& name = "",
|
||||
Direction direction = PD_IN):
|
||||
AbstractBinding(name, direction),
|
||||
_pVal(new std::map<K, V>(val)),
|
||||
_begin(),
|
||||
_end()
|
||||
explicit CopyBinding(std::map<K, V> & val, const std::string & name = "", Direction direction = PD_IN)
|
||||
: AbstractBinding(name, direction), _pVal(new std::map<K, V>(val)), _begin(), _end()
|
||||
/// Creates the Binding.
|
||||
{
|
||||
if (PD_IN == direction && numOfRowsHandled() == 0)
|
||||
@ -1211,20 +969,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::size_t numOfColumnsHandled() const
|
||||
{
|
||||
return TypeHandler<V>::size();
|
||||
}
|
||||
std::size_t numOfColumnsHandled() const { return TypeHandler<V>::size(); }
|
||||
|
||||
std::size_t numOfRowsHandled() const
|
||||
{
|
||||
return _pVal->size();
|
||||
}
|
||||
std::size_t numOfRowsHandled() const { return _pVal->size(); }
|
||||
|
||||
bool canBind() const
|
||||
{
|
||||
return _begin != _end;
|
||||
}
|
||||
bool canBind() const { return _begin != _end; }
|
||||
|
||||
void bind(std::size_t pos)
|
||||
{
|
||||
@ -1257,13 +1006,8 @@ public:
|
||||
typedef SharedPtr<Binding<ValType>> Ptr;
|
||||
typedef typename ValType::const_iterator Iterator;
|
||||
|
||||
explicit Binding(std::multimap<K, V>& val,
|
||||
const std::string& name = "",
|
||||
Direction direction = PD_IN):
|
||||
AbstractBinding(name, direction),
|
||||
_val(val),
|
||||
_begin(),
|
||||
_end()
|
||||
explicit Binding(std::multimap<K, V> & val, const std::string & name = "", Direction direction = PD_IN)
|
||||
: AbstractBinding(name, direction), _val(val), _begin(), _end()
|
||||
/// Creates the Binding.
|
||||
{
|
||||
if (PD_IN == direction && numOfRowsHandled() == 0)
|
||||
@ -1276,20 +1020,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::size_t numOfColumnsHandled() const
|
||||
{
|
||||
return TypeHandler<V>::size();
|
||||
}
|
||||
std::size_t numOfColumnsHandled() const { return TypeHandler<V>::size(); }
|
||||
|
||||
std::size_t numOfRowsHandled() const
|
||||
{
|
||||
return static_cast<std::size_t>(_val.size());
|
||||
}
|
||||
std::size_t numOfRowsHandled() const { return static_cast<std::size_t>(_val.size()); }
|
||||
|
||||
bool canBind() const
|
||||
{
|
||||
return _begin != _end;
|
||||
}
|
||||
bool canBind() const { return _begin != _end; }
|
||||
|
||||
void bind(std::size_t pos)
|
||||
{
|
||||
@ -1322,13 +1057,8 @@ public:
|
||||
typedef SharedPtr<CopyBinding<ValType>> Ptr;
|
||||
typedef typename ValType::const_iterator Iterator;
|
||||
|
||||
explicit CopyBinding(std::multimap<K, V>& val,
|
||||
const std::string& name = "",
|
||||
Direction direction = PD_IN):
|
||||
AbstractBinding(name, direction),
|
||||
_pVal(new std::multimap<K, V>(val)),
|
||||
_begin(),
|
||||
_end()
|
||||
explicit CopyBinding(std::multimap<K, V> & val, const std::string & name = "", Direction direction = PD_IN)
|
||||
: AbstractBinding(name, direction), _pVal(new std::multimap<K, V>(val)), _begin(), _end()
|
||||
/// Creates the Binding.
|
||||
{
|
||||
if (PD_IN == direction && numOfRowsHandled() == 0)
|
||||
@ -1341,20 +1071,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::size_t numOfColumnsHandled() const
|
||||
{
|
||||
return TypeHandler<V>::size();
|
||||
}
|
||||
std::size_t numOfColumnsHandled() const { return TypeHandler<V>::size(); }
|
||||
|
||||
std::size_t numOfRowsHandled() const
|
||||
{
|
||||
return _pVal->size();
|
||||
}
|
||||
std::size_t numOfRowsHandled() const { return _pVal->size(); }
|
||||
|
||||
bool canBind() const
|
||||
{
|
||||
return _begin != _end;
|
||||
}
|
||||
bool canBind() const { return _begin != _end; }
|
||||
|
||||
void bind(std::size_t pos)
|
||||
{
|
||||
@ -1377,7 +1098,8 @@ private:
|
||||
};
|
||||
|
||||
|
||||
namespace Keywords {
|
||||
namespace Keywords
|
||||
{
|
||||
|
||||
|
||||
template <typename T>
|
||||
@ -1490,7 +1212,8 @@ inline AbstractBinding::Ptr bind(T t)
|
||||
} // namespace Keywords
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_Binding_INCLUDED
|
||||
|
@ -18,12 +18,14 @@
|
||||
#define Data_Bulk_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Void.h"
|
||||
#include "Poco/Data/Limit.h"
|
||||
#include "Poco/Void.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class Data_API Bulk
|
||||
@ -67,7 +69,8 @@ inline Poco::UInt32 Bulk::size() const
|
||||
}
|
||||
|
||||
|
||||
namespace Keywords {
|
||||
namespace Keywords
|
||||
{
|
||||
|
||||
|
||||
inline Bulk bulk(const Limit & limit = Limit(Limit::LIMIT_UNLIMITED, false, false))
|
||||
@ -90,7 +93,8 @@ inline void bulk(Void)
|
||||
typedef void (*BulkFnType)(Void);
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_Bulk_INCLUDED
|
||||
|
@ -18,19 +18,21 @@
|
||||
#define Data_BulkBinding_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/AbstractBinding.h"
|
||||
#include "Poco/Data/DataException.h"
|
||||
#include "Poco/Data/TypeHandler.h"
|
||||
#include "Poco/Data/Bulk.h"
|
||||
#include <vector>
|
||||
#include <cstddef>
|
||||
#include <deque>
|
||||
#include <list>
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
#include "Poco/Data/AbstractBinding.h"
|
||||
#include "Poco/Data/Bulk.h"
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/DataException.h"
|
||||
#include "Poco/Data/TypeHandler.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
template <class T>
|
||||
@ -39,10 +41,8 @@ class BulkBinding: public AbstractBinding
|
||||
/// Bulk binding support is provided only for std::vector.
|
||||
{
|
||||
public:
|
||||
BulkBinding(const T& val, Poco::UInt32 bulkSize, const std::string& name = "", Direction direction = PD_IN):
|
||||
AbstractBinding(name, direction, bulkSize),
|
||||
_val(val),
|
||||
_bound(false)
|
||||
BulkBinding(const T & val, Poco::UInt32 bulkSize, const std::string & name = "", Direction direction = PD_IN)
|
||||
: AbstractBinding(name, direction, bulkSize), _val(val), _bound(false)
|
||||
/// Creates the BulkBinding.
|
||||
{
|
||||
if (0 == _val.size())
|
||||
@ -54,20 +54,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::size_t numOfColumnsHandled() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
std::size_t numOfColumnsHandled() const { return 1; }
|
||||
|
||||
std::size_t numOfRowsHandled() const
|
||||
{
|
||||
return _val.size();
|
||||
}
|
||||
std::size_t numOfRowsHandled() const { return _val.size(); }
|
||||
|
||||
bool canBind() const
|
||||
{
|
||||
return !_bound;
|
||||
}
|
||||
bool canBind() const { return !_bound; }
|
||||
|
||||
void bind(std::size_t pos)
|
||||
{
|
||||
@ -88,7 +79,8 @@ private:
|
||||
};
|
||||
|
||||
|
||||
namespace Keywords {
|
||||
namespace Keywords
|
||||
{
|
||||
|
||||
|
||||
template <typename T>
|
||||
@ -142,7 +134,8 @@ AbstractBinding::Ptr in(const std::list<T>& t, BulkFnType, const std::string& na
|
||||
} // namespace Keywords
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_BulkBinding_INCLUDED
|
||||
|
@ -18,15 +18,19 @@
|
||||
#define Data_BulkExtraction_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/Data.h"
|
||||
#include <vector>
|
||||
#include "Poco/Data/AbstractExtraction.h"
|
||||
#include "Poco/Data/Bulk.h"
|
||||
#include "Poco/Data/Column.h"
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/Position.h"
|
||||
#include "Poco/Data/Preparation.h"
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
template <class C>
|
||||
@ -44,42 +48,27 @@ public:
|
||||
typedef BulkExtraction<ValType> Type;
|
||||
typedef SharedPtr<Type> Ptr;
|
||||
|
||||
BulkExtraction(C& result, Poco::UInt32 limit, const Position& pos = Position(0)):
|
||||
AbstractExtraction(limit, pos.value(), true),
|
||||
_rResult(result),
|
||||
_default()
|
||||
BulkExtraction(C & result, Poco::UInt32 limit, const Position & pos = Position(0))
|
||||
: AbstractExtraction(limit, pos.value(), true), _rResult(result), _default()
|
||||
{
|
||||
if (static_cast<Poco::UInt32>(result.size()) != limit)
|
||||
result.resize(limit);
|
||||
}
|
||||
|
||||
BulkExtraction(C& result, const CValType& def, Poco::UInt32 limit, const Position& pos = Position(0)):
|
||||
AbstractExtraction(limit, pos.value(), true),
|
||||
_rResult(result),
|
||||
_default(def)
|
||||
BulkExtraction(C & result, const CValType & def, Poco::UInt32 limit, const Position & pos = Position(0))
|
||||
: AbstractExtraction(limit, pos.value(), true), _rResult(result), _default(def)
|
||||
{
|
||||
if (static_cast<Poco::UInt32>(result.size()) != limit)
|
||||
result.resize(limit);
|
||||
}
|
||||
|
||||
virtual ~BulkExtraction()
|
||||
{
|
||||
}
|
||||
virtual ~BulkExtraction() { }
|
||||
|
||||
std::size_t numOfColumnsHandled() const
|
||||
{
|
||||
return TypeHandler<C>::size();
|
||||
}
|
||||
std::size_t numOfColumnsHandled() const { return TypeHandler<C>::size(); }
|
||||
|
||||
std::size_t numOfRowsHandled() const
|
||||
{
|
||||
return _rResult.size();
|
||||
}
|
||||
std::size_t numOfRowsHandled() const { return _rResult.size(); }
|
||||
|
||||
std::size_t numOfRowsAllowed() const
|
||||
{
|
||||
return getLimit();
|
||||
}
|
||||
std::size_t numOfRowsAllowed() const { return getLimit(); }
|
||||
|
||||
bool isNull(std::size_t row) const
|
||||
{
|
||||
@ -107,24 +96,20 @@ public:
|
||||
return _rResult.size();
|
||||
}
|
||||
|
||||
virtual void reset()
|
||||
{
|
||||
}
|
||||
virtual void reset() { }
|
||||
|
||||
AbstractPreparation::Ptr createPreparation(AbstractPreparator::Ptr & pPrep, std::size_t col)
|
||||
{
|
||||
Poco::UInt32 limit = getLimit();
|
||||
if (limit != _rResult.size()) _rResult.resize(limit);
|
||||
if (limit != _rResult.size())
|
||||
_rResult.resize(limit);
|
||||
pPrep->setLength(limit);
|
||||
pPrep->setBulk(true);
|
||||
return new Preparation<C>(pPrep, col, _rResult);
|
||||
}
|
||||
|
||||
protected:
|
||||
const C& result() const
|
||||
{
|
||||
return _rResult;
|
||||
}
|
||||
const C & result() const { return _rResult; }
|
||||
|
||||
private:
|
||||
C & _rResult;
|
||||
@ -152,12 +137,8 @@ public:
|
||||
typedef InternalBulkExtraction<ValType> Type;
|
||||
typedef SharedPtr<Type> Ptr;
|
||||
|
||||
InternalBulkExtraction(C& result,
|
||||
Column<C>* pColumn,
|
||||
Poco::UInt32 limit,
|
||||
const Position& pos = Position(0)):
|
||||
BulkExtraction<C>(result, CValType(), limit, pos),
|
||||
_pColumn(pColumn)
|
||||
InternalBulkExtraction(C & result, Column<C> * pColumn, Poco::UInt32 limit, const Position & pos = Position(0))
|
||||
: BulkExtraction<C>(result, CValType(), limit, pos), _pColumn(pColumn)
|
||||
/// Creates InternalBulkExtraction.
|
||||
{
|
||||
}
|
||||
@ -168,10 +149,7 @@ public:
|
||||
delete _pColumn;
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
_pColumn->reset();
|
||||
}
|
||||
void reset() { _pColumn->reset(); }
|
||||
|
||||
const CValType & value(int index) const
|
||||
{
|
||||
@ -185,15 +163,9 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
bool isNull(std::size_t row) const
|
||||
{
|
||||
return BulkExtraction<C>::isNull(row);
|
||||
}
|
||||
bool isNull(std::size_t row) const { return BulkExtraction<C>::isNull(row); }
|
||||
|
||||
const Column<C>& column() const
|
||||
{
|
||||
return *_pColumn;
|
||||
}
|
||||
const Column<C> & column() const { return *_pColumn; }
|
||||
|
||||
private:
|
||||
InternalBulkExtraction();
|
||||
@ -204,7 +176,8 @@ private:
|
||||
};
|
||||
|
||||
|
||||
namespace Keywords {
|
||||
namespace Keywords
|
||||
{
|
||||
|
||||
|
||||
template <typename T>
|
||||
@ -222,7 +195,8 @@ AbstractExtraction::Ptr into(std::vector<T>& t, BulkFnType, const Position& pos
|
||||
/// with std::vector bulk extraction support.
|
||||
{
|
||||
Poco::UInt32 size = static_cast<Poco::UInt32>(t.size());
|
||||
if (0 == size) throw InvalidArgumentException("Zero length not allowed.");
|
||||
if (0 == size)
|
||||
throw InvalidArgumentException("Zero length not allowed.");
|
||||
return new BulkExtraction<std::vector<T>>(t, size, pos);
|
||||
}
|
||||
|
||||
@ -242,7 +216,8 @@ AbstractExtraction::Ptr into(std::deque<T>& t, BulkFnType, const Position& pos =
|
||||
/// with std::deque bulk extraction support.
|
||||
{
|
||||
Poco::UInt32 size = static_cast<Poco::UInt32>(t.size());
|
||||
if (0 == size) throw InvalidArgumentException("Zero length not allowed.");
|
||||
if (0 == size)
|
||||
throw InvalidArgumentException("Zero length not allowed.");
|
||||
return new BulkExtraction<std::deque<T>>(t, size, pos);
|
||||
}
|
||||
|
||||
@ -262,7 +237,8 @@ AbstractExtraction::Ptr into(std::list<T>& t, BulkFnType, const Position& pos =
|
||||
/// with std::list bulk extraction support.
|
||||
{
|
||||
Poco::UInt32 size = static_cast<Poco::UInt32>(t.size());
|
||||
if (0 == size) throw InvalidArgumentException("Zero length not allowed.");
|
||||
if (0 == size)
|
||||
throw InvalidArgumentException("Zero length not allowed.");
|
||||
return new BulkExtraction<std::list<T>>(t, size, pos);
|
||||
}
|
||||
|
||||
@ -270,7 +246,8 @@ AbstractExtraction::Ptr into(std::list<T>& t, BulkFnType, const Position& pos =
|
||||
} // namespace Keywords
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_BulkExtraction_INCLUDED
|
||||
|
@ -18,17 +18,19 @@
|
||||
#define Data_Column_INCLUDED
|
||||
|
||||
|
||||
#include <deque>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/MetaColumn.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
#include "Poco/RefCountedObject.h"
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <deque>
|
||||
#include "Poco/SharedPtr.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
template <class C>
|
||||
@ -46,18 +48,14 @@ public:
|
||||
typedef typename C::size_type Size;
|
||||
typedef typename C::value_type Type;
|
||||
|
||||
Column(const MetaColumn& metaColumn, Container* pData):
|
||||
_metaColumn(metaColumn),
|
||||
_pData(pData)
|
||||
Column(const MetaColumn & metaColumn, Container * pData) : _metaColumn(metaColumn), _pData(pData)
|
||||
/// Creates the Column.
|
||||
{
|
||||
if (!_pData)
|
||||
throw NullPointerException("Container pointer must point to valid storage.");
|
||||
}
|
||||
|
||||
Column(const Column& col):
|
||||
_metaColumn(col._metaColumn),
|
||||
_pData(col._pData)
|
||||
Column(const Column & col) : _metaColumn(col._metaColumn), _pData(col._pData)
|
||||
/// Creates the Column.
|
||||
{
|
||||
}
|
||||
@ -192,18 +190,14 @@ public:
|
||||
typedef Container::const_reverse_iterator RIterator;
|
||||
typedef Container::size_type Size;
|
||||
|
||||
Column(const MetaColumn& metaColumn, Container* pData):
|
||||
_metaColumn(metaColumn),
|
||||
_pData(pData)
|
||||
Column(const MetaColumn & metaColumn, Container * pData) : _metaColumn(metaColumn), _pData(pData)
|
||||
/// Creates the Column.
|
||||
{
|
||||
poco_check_ptr(_pData);
|
||||
_deque.assign(_pData->begin(), _pData->end());
|
||||
}
|
||||
|
||||
Column(const Column& col):
|
||||
_metaColumn(col._metaColumn),
|
||||
_pData(col._pData)
|
||||
Column(const Column & col) : _metaColumn(col._metaColumn), _pData(col._pData)
|
||||
/// Creates the Column.
|
||||
{
|
||||
_deque.assign(_pData->begin(), _pData->end());
|
||||
@ -335,17 +329,13 @@ public:
|
||||
typedef typename Container::const_reverse_iterator RIterator;
|
||||
typedef typename Container::size_type Size;
|
||||
|
||||
Column(const MetaColumn& metaColumn, std::list<T>* pData):
|
||||
_metaColumn(metaColumn),
|
||||
_pData(pData)
|
||||
Column(const MetaColumn & metaColumn, std::list<T> * pData) : _metaColumn(metaColumn), _pData(pData)
|
||||
/// Creates the Column.
|
||||
{
|
||||
poco_check_ptr(_pData);
|
||||
}
|
||||
|
||||
Column(const Column& col):
|
||||
_metaColumn(col._metaColumn),
|
||||
_pData(col._pData)
|
||||
Column(const Column & col) : _metaColumn(col._metaColumn), _pData(col._pData)
|
||||
/// Creates the Column.
|
||||
{
|
||||
}
|
||||
@ -393,7 +383,8 @@ public:
|
||||
Iterator it = _pData->begin();
|
||||
Iterator end = _pData->end();
|
||||
for (int i = 0; it != end; ++it, ++i)
|
||||
if (i == row) return *it;
|
||||
if (i == row)
|
||||
return *it;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -401,7 +392,8 @@ public:
|
||||
RIterator it = _pData->rbegin();
|
||||
RIterator end = _pData->rend();
|
||||
for (int i = 1; it != end; ++it, ++i)
|
||||
if (i == row) return *it;
|
||||
if (i == row)
|
||||
return *it;
|
||||
}
|
||||
|
||||
throw RangeException("Invalid row number.");
|
||||
@ -483,8 +475,8 @@ inline void swap(Column<C>& c1, Column<C>& c2)
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_Column_INCLUDED
|
||||
|
||||
|
@ -18,13 +18,15 @@
|
||||
#define Data_Connector_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/SessionImpl.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class Data_API Connector
|
||||
@ -44,13 +46,14 @@ public:
|
||||
virtual const std::string & name() const = 0;
|
||||
/// Returns the name associated with this connector.
|
||||
|
||||
virtual Poco::AutoPtr<SessionImpl> createSession(const std::string& connectionString,
|
||||
std::size_t timeout = SessionImpl::LOGIN_TIMEOUT_DEFAULT) = 0;
|
||||
virtual Poco::AutoPtr<SessionImpl>
|
||||
createSession(const std::string & connectionString, std::size_t timeout = SessionImpl::LOGIN_TIMEOUT_DEFAULT) = 0;
|
||||
/// Create a SessionImpl object and initialize it with the given connectionString.
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_Connector_INCLUDED
|
||||
|
@ -19,18 +19,21 @@
|
||||
|
||||
|
||||
#undef max
|
||||
#include <limits>
|
||||
#include <cstddef>
|
||||
#include <limits>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
static const std::size_t POCO_DATA_INVALID_ROW = std::numeric_limits<std::size_t>::max();
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_Constants_INCLUDED
|
||||
|
@ -22,8 +22,10 @@
|
||||
#include "Poco/Exception.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
POCO_DECLARE_EXCEPTION(Data_API, DataException, Poco::IOException)
|
||||
@ -44,7 +46,8 @@ POCO_DECLARE_EXCEPTION(Data_API, ConnectionFailedException, DataException)
|
||||
POCO_DECLARE_EXCEPTION(Data_API, NotConnectedException, DataException)
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_DataException_INCLUDED
|
||||
|
@ -23,17 +23,20 @@
|
||||
#include "Poco/Exception.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Poco
|
||||
{
|
||||
|
||||
class DateTime;
|
||||
|
||||
namespace Dynamic {
|
||||
namespace Dynamic
|
||||
{
|
||||
|
||||
class Var;
|
||||
|
||||
}
|
||||
|
||||
namespace Data {
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class Time;
|
||||
@ -133,9 +136,7 @@ inline Date& Date::operator = (const DateTime& dt)
|
||||
|
||||
inline bool Date::operator==(const Date & date) const
|
||||
{
|
||||
return _year == date.year() &&
|
||||
_month == date.month() &&
|
||||
_day == date.day();
|
||||
return _year == date.year() && _month == date.month() && _day == date.day();
|
||||
}
|
||||
|
||||
|
||||
@ -151,7 +152,8 @@ inline bool Date::operator > (const Date& date) const
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
//
|
||||
@ -159,26 +161,21 @@ inline bool Date::operator > (const Date& date) const
|
||||
//
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Dynamic {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Dynamic
|
||||
{
|
||||
|
||||
|
||||
template <>
|
||||
class VarHolderImpl<Poco::Data::Date> : public VarHolder
|
||||
{
|
||||
public:
|
||||
VarHolderImpl(const Poco::Data::Date& val): _val(val)
|
||||
{
|
||||
}
|
||||
VarHolderImpl(const Poco::Data::Date & val) : _val(val) { }
|
||||
|
||||
~VarHolderImpl()
|
||||
{
|
||||
}
|
||||
~VarHolderImpl() { }
|
||||
|
||||
const std::type_info& type() const
|
||||
{
|
||||
return typeid(Poco::Data::Date);
|
||||
}
|
||||
const std::type_info & type() const { return typeid(Poco::Data::Date); }
|
||||
|
||||
void convert(Poco::Timestamp & val) const
|
||||
{
|
||||
@ -187,15 +184,9 @@ public:
|
||||
val = dt.timestamp();
|
||||
}
|
||||
|
||||
void convert(Poco::DateTime& val) const
|
||||
{
|
||||
val.assign(_val.year(), _val.month(), _val.day());
|
||||
}
|
||||
void convert(Poco::DateTime & val) const { val.assign(_val.year(), _val.month(), _val.day()); }
|
||||
|
||||
void convert(Poco::LocalDateTime& val) const
|
||||
{
|
||||
val.assign(_val.year(), _val.month(), _val.day());
|
||||
}
|
||||
void convert(Poco::LocalDateTime & val) const { val.assign(_val.year(), _val.month(), _val.day()); }
|
||||
|
||||
void convert(std::string & val) const
|
||||
{
|
||||
@ -203,15 +194,9 @@ public:
|
||||
val = DateTimeFormatter::format(dt, "%Y/%m/%d");
|
||||
}
|
||||
|
||||
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
|
||||
{
|
||||
return cloneHolder(pVarHolder, _val);
|
||||
}
|
||||
VarHolder * clone(Placeholder<VarHolder> * pVarHolder = 0) const { return cloneHolder(pVarHolder, _val); }
|
||||
|
||||
const Poco::Data::Date& value() const
|
||||
{
|
||||
return _val;
|
||||
}
|
||||
const Poco::Data::Date & value() const { return _val; }
|
||||
|
||||
private:
|
||||
VarHolderImpl();
|
||||
@ -219,7 +204,8 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::Dynamic
|
||||
}
|
||||
} // namespace Poco::Dynamic
|
||||
|
||||
|
||||
#endif // Data_Date_INCLUDED
|
||||
|
@ -24,24 +24,32 @@
|
||||
#include "Poco/Dynamic/Var.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
class Date;
|
||||
class Time;
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Dynamic {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Dynamic
|
||||
{
|
||||
|
||||
|
||||
template <> Data_API Var::operator Poco::Data::Date () const;
|
||||
template <> Data_API Var::operator Poco::Data::Time () const;
|
||||
template <>
|
||||
Data_API Var::operator Poco::Data::Date() const;
|
||||
template <>
|
||||
Data_API Var::operator Poco::Data::Time() const;
|
||||
|
||||
|
||||
} } // namespace Poco::Dynamic
|
||||
}
|
||||
} // namespace Poco::Dynamic
|
||||
|
||||
|
||||
#endif // Data_DynamicDateTime_INCLUDED
|
||||
|
@ -23,23 +23,32 @@
|
||||
#include "Poco/Dynamic/Var.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
template <typename T> class LOB;
|
||||
template <typename T>
|
||||
class LOB;
|
||||
typedef LOB<unsigned char> BLOB;
|
||||
typedef LOB<char> CLOB;
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Dynamic {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Dynamic
|
||||
{
|
||||
|
||||
template <> Data_API Var::operator Poco::Data::CLOB () const;
|
||||
template <> Data_API Var::operator Poco::Data::BLOB () const;
|
||||
template <>
|
||||
Data_API Var::operator Poco::Data::CLOB() const;
|
||||
template <>
|
||||
Data_API Var::operator Poco::Data::BLOB() const;
|
||||
|
||||
} } // namespace Poco::Dynamic
|
||||
}
|
||||
} // namespace Poco::Dynamic
|
||||
|
||||
|
||||
#endif // Data_DynamicLOB_INCLUDED
|
||||
|
@ -18,23 +18,25 @@
|
||||
#define Data_Extraction_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/AbstractExtraction.h"
|
||||
#include "Poco/Data/Preparation.h"
|
||||
#include "Poco/Data/TypeHandler.h"
|
||||
#include "Poco/Data/Column.h"
|
||||
#include "Poco/Data/Position.h"
|
||||
#include "Poco/Data/DataException.h"
|
||||
#include <cstddef>
|
||||
#include <deque>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <deque>
|
||||
#include <map>
|
||||
#include <cstddef>
|
||||
#include "Poco/Data/AbstractExtraction.h"
|
||||
#include "Poco/Data/Column.h"
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/DataException.h"
|
||||
#include "Poco/Data/Position.h"
|
||||
#include "Poco/Data/Preparation.h"
|
||||
#include "Poco/Data/TypeHandler.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
template <class T>
|
||||
@ -47,23 +49,15 @@ public:
|
||||
typedef Extraction<ValType> Type;
|
||||
typedef SharedPtr<Type> Ptr;
|
||||
|
||||
Extraction(T& result, const Position& pos = Position(0)):
|
||||
AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()),
|
||||
_rResult(result),
|
||||
_default(),
|
||||
_extracted(false),
|
||||
_null(false)
|
||||
Extraction(T & result, const Position & pos = Position(0))
|
||||
: AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), _rResult(result), _default(), _extracted(false), _null(false)
|
||||
/// Creates an Extraction object at specified position.
|
||||
/// Uses an empty object T as default value.
|
||||
{
|
||||
}
|
||||
|
||||
Extraction(T& result, const T& def, const Position& pos = Position(0)):
|
||||
AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()),
|
||||
_rResult(result),
|
||||
_default(def),
|
||||
_extracted(false),
|
||||
_null(false)
|
||||
Extraction(T & result, const T & def, const Position & pos = Position(0))
|
||||
: AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), _rResult(result), _default(def), _extracted(false), _null(false)
|
||||
/// Creates an Extraction object at specified position.
|
||||
/// Uses the provided def object as default value.
|
||||
{
|
||||
@ -74,29 +68,18 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::size_t numOfColumnsHandled() const
|
||||
{
|
||||
return TypeHandler<T>::size();
|
||||
}
|
||||
std::size_t numOfColumnsHandled() const { return TypeHandler<T>::size(); }
|
||||
|
||||
std::size_t numOfRowsHandled() const
|
||||
{
|
||||
return _extracted ? 1u : 0;
|
||||
}
|
||||
std::size_t numOfRowsHandled() const { return _extracted ? 1u : 0; }
|
||||
|
||||
std::size_t numOfRowsAllowed() const
|
||||
{
|
||||
return 1u;
|
||||
}
|
||||
std::size_t numOfRowsAllowed() const { return 1u; }
|
||||
|
||||
bool isNull(std::size_t row = 0) const
|
||||
{
|
||||
return _null;
|
||||
}
|
||||
bool isNull(std::size_t row = 0) const { return _null; }
|
||||
|
||||
std::size_t extract(std::size_t pos)
|
||||
{
|
||||
if (_extracted) throw ExtractException("value already extracted");
|
||||
if (_extracted)
|
||||
throw ExtractException("value already extracted");
|
||||
_extracted = true;
|
||||
AbstractExtractor::Ptr pExt = getExtractor();
|
||||
TypeHandler<T>::extract(pos, _rResult, _default, pExt);
|
||||
@ -105,15 +88,9 @@ public:
|
||||
return 1u;
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
_extracted = false;
|
||||
}
|
||||
void reset() { _extracted = false; }
|
||||
|
||||
bool canExtract() const
|
||||
{
|
||||
return !_extracted;
|
||||
}
|
||||
bool canExtract() const { return !_extracted; }
|
||||
|
||||
AbstractPreparation::Ptr createPreparation(AbstractPreparator::Ptr & pPrep, std::size_t pos)
|
||||
{
|
||||
@ -133,46 +110,30 @@ class Extraction<std::vector<T> >: public AbstractExtraction
|
||||
/// Vector Data Type specialization for extraction of values from a query result set.
|
||||
{
|
||||
public:
|
||||
|
||||
typedef std::vector<T> ValType;
|
||||
typedef SharedPtr<ValType> ValPtr;
|
||||
typedef Extraction<ValType> Type;
|
||||
typedef SharedPtr<Type> Ptr;
|
||||
|
||||
Extraction(std::vector<T>& result, const Position& pos = Position(0)):
|
||||
AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()),
|
||||
_rResult(result),
|
||||
_default()
|
||||
Extraction(std::vector<T> & result, const Position & pos = Position(0))
|
||||
: AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), _rResult(result), _default()
|
||||
{
|
||||
_rResult.clear();
|
||||
}
|
||||
|
||||
Extraction(std::vector<T>& result, const T& def, const Position& pos = Position(0)):
|
||||
AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()),
|
||||
_rResult(result),
|
||||
_default(def)
|
||||
Extraction(std::vector<T> & result, const T & def, const Position & pos = Position(0))
|
||||
: AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), _rResult(result), _default(def)
|
||||
{
|
||||
_rResult.clear();
|
||||
}
|
||||
|
||||
virtual ~Extraction()
|
||||
{
|
||||
}
|
||||
virtual ~Extraction() { }
|
||||
|
||||
std::size_t numOfColumnsHandled() const
|
||||
{
|
||||
return TypeHandler<T>::size();
|
||||
}
|
||||
std::size_t numOfColumnsHandled() const { return TypeHandler<T>::size(); }
|
||||
|
||||
std::size_t numOfRowsHandled() const
|
||||
{
|
||||
return static_cast<std::size_t>(_rResult.size());
|
||||
}
|
||||
std::size_t numOfRowsHandled() const { return static_cast<std::size_t>(_rResult.size()); }
|
||||
|
||||
std::size_t numOfRowsAllowed() const
|
||||
{
|
||||
return getLimit();
|
||||
}
|
||||
std::size_t numOfRowsAllowed() const { return getLimit(); }
|
||||
|
||||
bool isNull(std::size_t row) const
|
||||
{
|
||||
@ -200,17 +161,10 @@ public:
|
||||
return new Preparation<T>(pPrep, pos, _default);
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
_nulls.clear();
|
||||
}
|
||||
void reset() { _nulls.clear(); }
|
||||
|
||||
protected:
|
||||
|
||||
const std::vector<T>& result() const
|
||||
{
|
||||
return _rResult;
|
||||
}
|
||||
const std::vector<T> & result() const { return _rResult; }
|
||||
|
||||
private:
|
||||
std::vector<T> & _rResult;
|
||||
@ -229,40 +183,25 @@ public:
|
||||
typedef Extraction<ValType> Type;
|
||||
typedef SharedPtr<Type> Ptr;
|
||||
|
||||
Extraction(std::vector<bool>& result, const Position& pos = Position(0)):
|
||||
AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()),
|
||||
_rResult(result),
|
||||
_default()
|
||||
Extraction(std::vector<bool> & result, const Position & pos = Position(0))
|
||||
: AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), _rResult(result), _default()
|
||||
{
|
||||
_rResult.clear();
|
||||
}
|
||||
|
||||
Extraction(std::vector<bool>& result, const bool& def, const Position& pos = Position(0)):
|
||||
AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()),
|
||||
_rResult(result),
|
||||
_default(def)
|
||||
Extraction(std::vector<bool> & result, const bool & def, const Position & pos = Position(0))
|
||||
: AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), _rResult(result), _default(def)
|
||||
{
|
||||
_rResult.clear();
|
||||
}
|
||||
|
||||
virtual ~Extraction()
|
||||
{
|
||||
}
|
||||
virtual ~Extraction() { }
|
||||
|
||||
std::size_t numOfColumnsHandled() const
|
||||
{
|
||||
return TypeHandler<bool>::size();
|
||||
}
|
||||
std::size_t numOfColumnsHandled() const { return TypeHandler<bool>::size(); }
|
||||
|
||||
std::size_t numOfRowsHandled() const
|
||||
{
|
||||
return static_cast<std::size_t>(_rResult.size());
|
||||
}
|
||||
std::size_t numOfRowsHandled() const { return static_cast<std::size_t>(_rResult.size()); }
|
||||
|
||||
std::size_t numOfRowsAllowed() const
|
||||
{
|
||||
return getLimit();
|
||||
}
|
||||
std::size_t numOfRowsAllowed() const { return getLimit(); }
|
||||
|
||||
bool isNull(std::size_t row) const
|
||||
{
|
||||
@ -292,17 +231,10 @@ public:
|
||||
return new Preparation<bool>(pPrep, pos, _default);
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
_nulls.clear();
|
||||
}
|
||||
void reset() { _nulls.clear(); }
|
||||
|
||||
protected:
|
||||
|
||||
const std::vector<bool>& result() const
|
||||
{
|
||||
return _rResult;
|
||||
}
|
||||
const std::vector<bool> & result() const { return _rResult; }
|
||||
|
||||
private:
|
||||
std::vector<bool> & _rResult;
|
||||
@ -321,40 +253,25 @@ public:
|
||||
typedef Extraction<ValType> Type;
|
||||
typedef SharedPtr<Type> Ptr;
|
||||
|
||||
Extraction(std::list<T>& result, const Position& pos = Position(0)):
|
||||
AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()),
|
||||
_rResult(result),
|
||||
_default()
|
||||
Extraction(std::list<T> & result, const Position & pos = Position(0))
|
||||
: AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), _rResult(result), _default()
|
||||
{
|
||||
_rResult.clear();
|
||||
}
|
||||
|
||||
Extraction(std::list<T>& result, const T& def, const Position& pos = Position(0)):
|
||||
AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()),
|
||||
_rResult(result),
|
||||
_default(def)
|
||||
Extraction(std::list<T> & result, const T & def, const Position & pos = Position(0))
|
||||
: AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), _rResult(result), _default(def)
|
||||
{
|
||||
_rResult.clear();
|
||||
}
|
||||
|
||||
virtual ~Extraction()
|
||||
{
|
||||
}
|
||||
virtual ~Extraction() { }
|
||||
|
||||
std::size_t numOfColumnsHandled() const
|
||||
{
|
||||
return TypeHandler<T>::size();
|
||||
}
|
||||
std::size_t numOfColumnsHandled() const { return TypeHandler<T>::size(); }
|
||||
|
||||
std::size_t numOfRowsHandled() const
|
||||
{
|
||||
return _rResult.size();
|
||||
}
|
||||
std::size_t numOfRowsHandled() const { return _rResult.size(); }
|
||||
|
||||
std::size_t numOfRowsAllowed() const
|
||||
{
|
||||
return getLimit();
|
||||
}
|
||||
std::size_t numOfRowsAllowed() const { return getLimit(); }
|
||||
|
||||
bool isNull(std::size_t row) const
|
||||
{
|
||||
@ -382,17 +299,10 @@ public:
|
||||
return new Preparation<T>(pPrep, pos, _default);
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
_nulls.clear();
|
||||
}
|
||||
void reset() { _nulls.clear(); }
|
||||
|
||||
protected:
|
||||
|
||||
const std::list<T>& result() const
|
||||
{
|
||||
return _rResult;
|
||||
}
|
||||
const std::list<T> & result() const { return _rResult; }
|
||||
|
||||
private:
|
||||
std::list<T> & _rResult;
|
||||
@ -411,40 +321,25 @@ public:
|
||||
typedef Extraction<ValType> Type;
|
||||
typedef SharedPtr<Type> Ptr;
|
||||
|
||||
Extraction(std::deque<T>& result, const Position& pos = Position(0)):
|
||||
AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()),
|
||||
_rResult(result),
|
||||
_default()
|
||||
Extraction(std::deque<T> & result, const Position & pos = Position(0))
|
||||
: AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), _rResult(result), _default()
|
||||
{
|
||||
_rResult.clear();
|
||||
}
|
||||
|
||||
Extraction(std::deque<T>& result, const T& def, const Position& pos = Position(0)):
|
||||
AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()),
|
||||
_rResult(result),
|
||||
_default(def)
|
||||
Extraction(std::deque<T> & result, const T & def, const Position & pos = Position(0))
|
||||
: AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), _rResult(result), _default(def)
|
||||
{
|
||||
_rResult.clear();
|
||||
}
|
||||
|
||||
virtual ~Extraction()
|
||||
{
|
||||
}
|
||||
virtual ~Extraction() { }
|
||||
|
||||
std::size_t numOfColumnsHandled() const
|
||||
{
|
||||
return TypeHandler<T>::size();
|
||||
}
|
||||
std::size_t numOfColumnsHandled() const { return TypeHandler<T>::size(); }
|
||||
|
||||
std::size_t numOfRowsHandled() const
|
||||
{
|
||||
return _rResult.size();
|
||||
}
|
||||
std::size_t numOfRowsHandled() const { return _rResult.size(); }
|
||||
|
||||
std::size_t numOfRowsAllowed() const
|
||||
{
|
||||
return getLimit();
|
||||
}
|
||||
std::size_t numOfRowsAllowed() const { return getLimit(); }
|
||||
|
||||
bool isNull(std::size_t row) const
|
||||
{
|
||||
@ -472,17 +367,10 @@ public:
|
||||
return new Preparation<T>(pPrep, pos, _default);
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
_nulls.clear();
|
||||
}
|
||||
void reset() { _nulls.clear(); }
|
||||
|
||||
protected:
|
||||
|
||||
const std::deque<T>& result() const
|
||||
{
|
||||
return _rResult;
|
||||
}
|
||||
const std::deque<T> & result() const { return _rResult; }
|
||||
|
||||
private:
|
||||
std::deque<T> & _rResult;
|
||||
@ -510,9 +398,8 @@ public:
|
||||
typedef SharedPtr<Type> Ptr;
|
||||
|
||||
|
||||
InternalExtraction(C& result, Column<C>* pColumn, const Position& pos = Position(0)):
|
||||
Extraction<C>(result, ValType(), pos),
|
||||
_pColumn(pColumn)
|
||||
InternalExtraction(C & result, Column<C> * pColumn, const Position & pos = Position(0))
|
||||
: Extraction<C>(result, ValType(), pos), _pColumn(pColumn)
|
||||
/// Creates InternalExtraction.
|
||||
{
|
||||
}
|
||||
@ -541,15 +428,9 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
bool isNull(std::size_t row) const
|
||||
{
|
||||
return Extraction<C>::isNull(row);
|
||||
}
|
||||
bool isNull(std::size_t row) const { return Extraction<C>::isNull(row); }
|
||||
|
||||
const Column<C>& column() const
|
||||
{
|
||||
return *_pColumn;
|
||||
}
|
||||
const Column<C> & column() const { return *_pColumn; }
|
||||
|
||||
private:
|
||||
InternalExtraction();
|
||||
@ -571,40 +452,25 @@ public:
|
||||
typedef SharedPtr<Type> Ptr;
|
||||
typedef typename ValType::iterator Iterator;
|
||||
|
||||
Extraction(std::set<T>& result, const Position& pos = Position(0)):
|
||||
AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()),
|
||||
_rResult(result),
|
||||
_default()
|
||||
Extraction(std::set<T> & result, const Position & pos = Position(0))
|
||||
: AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), _rResult(result), _default()
|
||||
{
|
||||
_rResult.clear();
|
||||
}
|
||||
|
||||
Extraction(std::set<T>& result, const T& def, const Position& pos = Position(0)):
|
||||
AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()),
|
||||
_rResult(result),
|
||||
_default(def)
|
||||
Extraction(std::set<T> & result, const T & def, const Position & pos = Position(0))
|
||||
: AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), _rResult(result), _default(def)
|
||||
{
|
||||
_rResult.clear();
|
||||
}
|
||||
|
||||
~Extraction()
|
||||
{
|
||||
}
|
||||
~Extraction() { }
|
||||
|
||||
std::size_t numOfColumnsHandled() const
|
||||
{
|
||||
return TypeHandler<T>::size();
|
||||
}
|
||||
std::size_t numOfColumnsHandled() const { return TypeHandler<T>::size(); }
|
||||
|
||||
std::size_t numOfRowsHandled() const
|
||||
{
|
||||
return static_cast<std::size_t>(_rResult.size());
|
||||
}
|
||||
std::size_t numOfRowsHandled() const { return static_cast<std::size_t>(_rResult.size()); }
|
||||
|
||||
std::size_t numOfRowsAllowed() const
|
||||
{
|
||||
return getLimit();
|
||||
}
|
||||
std::size_t numOfRowsAllowed() const { return getLimit(); }
|
||||
|
||||
std::size_t extract(std::size_t pos)
|
||||
{
|
||||
@ -635,40 +501,25 @@ public:
|
||||
typedef Extraction<ValType> Type;
|
||||
typedef SharedPtr<Type> Ptr;
|
||||
|
||||
Extraction(std::multiset<T>& result, const Position& pos = Position(0)):
|
||||
AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()),
|
||||
_rResult(result),
|
||||
_default()
|
||||
Extraction(std::multiset<T> & result, const Position & pos = Position(0))
|
||||
: AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), _rResult(result), _default()
|
||||
{
|
||||
_rResult.clear();
|
||||
}
|
||||
|
||||
Extraction(std::multiset<T>& result, const T& def, const Position& pos = Position(0)):
|
||||
AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()),
|
||||
_rResult(result),
|
||||
_default(def)
|
||||
Extraction(std::multiset<T> & result, const T & def, const Position & pos = Position(0))
|
||||
: AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), _rResult(result), _default(def)
|
||||
{
|
||||
_rResult.clear();
|
||||
}
|
||||
|
||||
~Extraction()
|
||||
{
|
||||
}
|
||||
~Extraction() { }
|
||||
|
||||
std::size_t numOfColumnsHandled() const
|
||||
{
|
||||
return TypeHandler<T>::size();
|
||||
}
|
||||
std::size_t numOfColumnsHandled() const { return TypeHandler<T>::size(); }
|
||||
|
||||
std::size_t numOfRowsHandled() const
|
||||
{
|
||||
return static_cast<std::size_t>(_rResult.size());
|
||||
}
|
||||
std::size_t numOfRowsHandled() const { return static_cast<std::size_t>(_rResult.size()); }
|
||||
|
||||
std::size_t numOfRowsAllowed() const
|
||||
{
|
||||
return getLimit();
|
||||
}
|
||||
std::size_t numOfRowsAllowed() const { return getLimit(); }
|
||||
|
||||
std::size_t extract(std::size_t pos)
|
||||
{
|
||||
@ -699,40 +550,25 @@ public:
|
||||
typedef Extraction<ValType> Type;
|
||||
typedef SharedPtr<Type> Ptr;
|
||||
|
||||
Extraction(std::map<K, V>& result, const Position& pos = Position(0)):
|
||||
AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()),
|
||||
_rResult(result),
|
||||
_default()
|
||||
Extraction(std::map<K, V> & result, const Position & pos = Position(0))
|
||||
: AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), _rResult(result), _default()
|
||||
{
|
||||
_rResult.clear();
|
||||
}
|
||||
|
||||
Extraction(std::map<K, V>& result, const V& def, const Position& pos = Position(0)):
|
||||
AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()),
|
||||
_rResult(result),
|
||||
_default(def)
|
||||
Extraction(std::map<K, V> & result, const V & def, const Position & pos = Position(0))
|
||||
: AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), _rResult(result), _default(def)
|
||||
{
|
||||
_rResult.clear();
|
||||
}
|
||||
|
||||
~Extraction()
|
||||
{
|
||||
}
|
||||
~Extraction() { }
|
||||
|
||||
std::size_t numOfColumnsHandled() const
|
||||
{
|
||||
return TypeHandler<V>::size();
|
||||
}
|
||||
std::size_t numOfColumnsHandled() const { return TypeHandler<V>::size(); }
|
||||
|
||||
std::size_t numOfRowsHandled() const
|
||||
{
|
||||
return static_cast<std::size_t>(_rResult.size());
|
||||
}
|
||||
std::size_t numOfRowsHandled() const { return static_cast<std::size_t>(_rResult.size()); }
|
||||
|
||||
std::size_t numOfRowsAllowed() const
|
||||
{
|
||||
return getLimit();
|
||||
}
|
||||
std::size_t numOfRowsAllowed() const { return getLimit(); }
|
||||
|
||||
std::size_t extract(std::size_t pos)
|
||||
{
|
||||
@ -763,40 +599,25 @@ public:
|
||||
typedef Extraction<ValType> Type;
|
||||
typedef SharedPtr<Type> Ptr;
|
||||
|
||||
Extraction(std::multimap<K, V>& result, const Position& pos = Position(0)):
|
||||
AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()),
|
||||
_rResult(result),
|
||||
_default()
|
||||
Extraction(std::multimap<K, V> & result, const Position & pos = Position(0))
|
||||
: AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), _rResult(result), _default()
|
||||
{
|
||||
_rResult.clear();
|
||||
}
|
||||
|
||||
Extraction(std::multimap<K, V>& result, const V& def, const Position& pos = Position(0)):
|
||||
AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()),
|
||||
_rResult(result),
|
||||
_default(def)
|
||||
Extraction(std::multimap<K, V> & result, const V & def, const Position & pos = Position(0))
|
||||
: AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), _rResult(result), _default(def)
|
||||
{
|
||||
_rResult.clear();
|
||||
}
|
||||
|
||||
~Extraction()
|
||||
{
|
||||
}
|
||||
~Extraction() { }
|
||||
|
||||
std::size_t numOfColumnsHandled() const
|
||||
{
|
||||
return TypeHandler<V>::size();
|
||||
}
|
||||
std::size_t numOfColumnsHandled() const { return TypeHandler<V>::size(); }
|
||||
|
||||
std::size_t numOfRowsHandled() const
|
||||
{
|
||||
return static_cast<std::size_t>(_rResult.size());
|
||||
}
|
||||
std::size_t numOfRowsHandled() const { return static_cast<std::size_t>(_rResult.size()); }
|
||||
|
||||
std::size_t numOfRowsAllowed() const
|
||||
{
|
||||
return getLimit();
|
||||
}
|
||||
std::size_t numOfRowsAllowed() const { return getLimit(); }
|
||||
|
||||
std::size_t extract(std::size_t pos)
|
||||
{
|
||||
@ -817,7 +638,8 @@ private:
|
||||
};
|
||||
|
||||
|
||||
namespace Keywords {
|
||||
namespace Keywords
|
||||
{
|
||||
|
||||
|
||||
template <typename T>
|
||||
@ -863,7 +685,8 @@ inline AbstractExtractionVec& into(AbstractExtractionVec& ev)
|
||||
} // namespace Keywords
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_Extraction_INCLUDED
|
||||
|
@ -18,16 +18,18 @@
|
||||
#define Data_LOB_INCLUDED
|
||||
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
#include "Poco/Dynamic/VarHolder.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include "Poco/SharedPtr.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
template <typename T>
|
||||
@ -51,20 +53,17 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
LOB(const std::vector<T>& content):
|
||||
_pContent(new std::vector<T>(content))
|
||||
LOB(const std::vector<T> & content) : _pContent(new std::vector<T>(content))
|
||||
/// Creates the LOB, content is deep-copied.
|
||||
{
|
||||
}
|
||||
|
||||
LOB(const T* const pContent, std::size_t size):
|
||||
_pContent(new std::vector<T>(pContent, pContent + size))
|
||||
LOB(const T * const pContent, std::size_t size) : _pContent(new std::vector<T>(pContent, pContent + size))
|
||||
/// Creates the LOB by deep-copying pContent.
|
||||
{
|
||||
}
|
||||
|
||||
LOB(const std::basic_string<T>& content):
|
||||
_pContent(new std::vector<T>(content.begin(), content.end()))
|
||||
LOB(const std::basic_string<T> & content) : _pContent(new std::vector<T>(content.begin(), content.end()))
|
||||
/// Creates a LOB from a string.
|
||||
{
|
||||
}
|
||||
@ -150,7 +149,8 @@ public:
|
||||
/// If doCompact is true, trims the excess capacity.
|
||||
{
|
||||
_pContent->clear();
|
||||
if (doCompact) compact();
|
||||
if (doCompact)
|
||||
compact();
|
||||
}
|
||||
|
||||
void compact()
|
||||
@ -159,15 +159,9 @@ public:
|
||||
std::vector<T>(*_pContent).swap(*_pContent);
|
||||
}
|
||||
|
||||
Iterator begin() const
|
||||
{
|
||||
return _pContent->begin();
|
||||
}
|
||||
Iterator begin() const { return _pContent->begin(); }
|
||||
|
||||
Iterator end() const
|
||||
{
|
||||
return _pContent->end();
|
||||
}
|
||||
Iterator end() const { return _pContent->end(); }
|
||||
|
||||
std::size_t size() const
|
||||
/// Returns the size of the LOB in bytes.
|
||||
@ -195,22 +189,21 @@ inline void swap(LOB<T>& b1, LOB<T>& b2)
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <>
|
||||
inline void swap<Poco::Data::BLOB>(Poco::Data::BLOB& b1,
|
||||
Poco::Data::BLOB& b2)
|
||||
inline void swap<Poco::Data::BLOB>(Poco::Data::BLOB & b1, Poco::Data::BLOB & b2)
|
||||
/// Full template specalization of std:::swap for BLOB
|
||||
{
|
||||
b1.swap(b2);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline void swap<Poco::Data::CLOB>(Poco::Data::CLOB& c1,
|
||||
Poco::Data::CLOB& c2)
|
||||
inline void swap<Poco::Data::CLOB>(Poco::Data::CLOB & c1, Poco::Data::CLOB & c2)
|
||||
/// Full template specalization of std:::swap for CLOB
|
||||
{
|
||||
c1.swap(c2);
|
||||
@ -223,41 +216,27 @@ namespace std
|
||||
//
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Dynamic {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Dynamic
|
||||
{
|
||||
|
||||
|
||||
template <>
|
||||
class VarHolderImpl<Poco::Data::BLOB> : public VarHolder
|
||||
{
|
||||
public:
|
||||
VarHolderImpl(const Poco::Data::BLOB& val): _val(val)
|
||||
{
|
||||
}
|
||||
VarHolderImpl(const Poco::Data::BLOB & val) : _val(val) { }
|
||||
|
||||
~VarHolderImpl()
|
||||
{
|
||||
}
|
||||
~VarHolderImpl() { }
|
||||
|
||||
const std::type_info& type() const
|
||||
{
|
||||
return typeid(Poco::Data::BLOB);
|
||||
}
|
||||
const std::type_info & type() const { return typeid(Poco::Data::BLOB); }
|
||||
|
||||
void convert(std::string& val) const
|
||||
{
|
||||
val.assign(_val.begin(), _val.end());
|
||||
}
|
||||
void convert(std::string & val) const { val.assign(_val.begin(), _val.end()); }
|
||||
|
||||
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
|
||||
{
|
||||
return cloneHolder(pVarHolder, _val);
|
||||
}
|
||||
VarHolder * clone(Placeholder<VarHolder> * pVarHolder = 0) const { return cloneHolder(pVarHolder, _val); }
|
||||
|
||||
const Poco::Data::BLOB& value() const
|
||||
{
|
||||
return _val;
|
||||
}
|
||||
const Poco::Data::BLOB & value() const { return _val; }
|
||||
|
||||
private:
|
||||
VarHolderImpl();
|
||||
@ -269,33 +248,17 @@ template <>
|
||||
class VarHolderImpl<Poco::Data::CLOB> : public VarHolder
|
||||
{
|
||||
public:
|
||||
VarHolderImpl(const Poco::Data::CLOB& val): _val(val)
|
||||
{
|
||||
}
|
||||
VarHolderImpl(const Poco::Data::CLOB & val) : _val(val) { }
|
||||
|
||||
~VarHolderImpl()
|
||||
{
|
||||
}
|
||||
~VarHolderImpl() { }
|
||||
|
||||
const std::type_info& type() const
|
||||
{
|
||||
return typeid(Poco::Data::CLOB);
|
||||
}
|
||||
const std::type_info & type() const { return typeid(Poco::Data::CLOB); }
|
||||
|
||||
void convert(std::string& val) const
|
||||
{
|
||||
val.assign(_val.begin(), _val.end());
|
||||
}
|
||||
void convert(std::string & val) const { val.assign(_val.begin(), _val.end()); }
|
||||
|
||||
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
|
||||
{
|
||||
return cloneHolder(pVarHolder, _val);
|
||||
}
|
||||
VarHolder * clone(Placeholder<VarHolder> * pVarHolder = 0) const { return cloneHolder(pVarHolder, _val); }
|
||||
|
||||
const Poco::Data::CLOB& value() const
|
||||
{
|
||||
return _val;
|
||||
}
|
||||
const Poco::Data::CLOB & value() const { return _val; }
|
||||
|
||||
private:
|
||||
VarHolderImpl();
|
||||
@ -303,7 +266,8 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::Dynamic
|
||||
}
|
||||
} // namespace Poco::Dynamic
|
||||
|
||||
|
||||
#endif // Data_LOB_INCLUDED
|
||||
|
@ -18,15 +18,17 @@
|
||||
#define Data_LOBStream_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
#include "Poco/UnbufferedStreamBuf.h"
|
||||
#include "Poco/Data/LOB.h"
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
#include "Poco/Data/LOB.h"
|
||||
#include "Poco/Foundation.h"
|
||||
#include "Poco/UnbufferedStreamBuf.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
template <typename T>
|
||||
@ -105,9 +107,7 @@ class LOBOutputStream: public LOBIOS<T>, public std::basic_ostream<T, std::char_
|
||||
/// An output stream for writing to a LOB.
|
||||
{
|
||||
public:
|
||||
LOBOutputStream(LOB<T>& lob):
|
||||
LOBIOS<T>(lob, std::ios::out),
|
||||
std::ostream(LOBIOS<T>::rdbuf())
|
||||
LOBOutputStream(LOB<T> & lob) : LOBIOS<T>(lob, std::ios::out), std::ostream(LOBIOS<T>::rdbuf())
|
||||
/// Creates the LOBOutputStream with the given LOB.
|
||||
{
|
||||
}
|
||||
@ -124,9 +124,7 @@ class LOBInputStream: public LOBIOS<T>, public std::basic_istream<T, std::char_t
|
||||
/// An input stream for reading from a LOB.
|
||||
{
|
||||
public:
|
||||
LOBInputStream(LOB<T>& lob):
|
||||
LOBIOS<T>(lob, std::ios::in),
|
||||
std::istream(LOBIOS<T>::rdbuf())
|
||||
LOBInputStream(LOB<T> & lob) : LOBIOS<T>(lob, std::ios::in), std::istream(LOBIOS<T>::rdbuf())
|
||||
/// Creates the LOBInputStream with the given LOB.
|
||||
{
|
||||
}
|
||||
@ -144,7 +142,8 @@ typedef LOBOutputStream<char> CLOBOutputStream;
|
||||
typedef LOBInputStream<unsigned char> BLOBInputStream;
|
||||
typedef LOBInputStream<char> CLOBInputStream;
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_LOBStream_INCLUDED
|
||||
|
@ -21,8 +21,10 @@
|
||||
#include "Poco/Data/Data.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class Data_API Limit
|
||||
@ -93,21 +95,18 @@ inline bool Limit::isLowerLimit() const
|
||||
|
||||
inline bool Limit::operator==(const Limit & other) const
|
||||
{
|
||||
return other._value == _value &&
|
||||
other._hardLimit == _hardLimit &&
|
||||
other._isLowerLimit == _isLowerLimit;
|
||||
return other._value == _value && other._hardLimit == _hardLimit && other._isLowerLimit == _isLowerLimit;
|
||||
}
|
||||
|
||||
|
||||
inline bool Limit::operator!=(const Limit & other) const
|
||||
{
|
||||
return other._value != _value ||
|
||||
other._hardLimit != _hardLimit ||
|
||||
other._isLowerLimit != _isLowerLimit;
|
||||
return other._value != _value || other._hardLimit != _hardLimit || other._isLowerLimit != _isLowerLimit;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_Limit_INCLUDED
|
||||
|
@ -18,12 +18,14 @@
|
||||
#define Data_MetaColumn_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/Data.h"
|
||||
#include <cstddef>
|
||||
#include "Poco/Data/Data.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class Data_API MetaColumn
|
||||
@ -56,7 +58,8 @@ public:
|
||||
MetaColumn();
|
||||
/// Creates the MetaColumn.
|
||||
|
||||
explicit MetaColumn(std::size_t position,
|
||||
explicit MetaColumn(
|
||||
std::size_t position,
|
||||
const std::string & name = "",
|
||||
ColumnDataType type = FDT_UNKNOWN,
|
||||
std::size_t length = 0,
|
||||
@ -182,7 +185,8 @@ inline void MetaColumn::setNullable(bool nullable)
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_MetaColumn_INCLUDED
|
||||
|
@ -18,15 +18,17 @@
|
||||
#define Data_PooledSessionHolder_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/SessionImpl.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "Poco/Timestamp.h"
|
||||
#include "Poco/Mutex.h"
|
||||
#include "Poco/Timestamp.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class SessionPool;
|
||||
@ -93,7 +95,8 @@ inline int PooledSessionHolder::idle() const
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_PooledSessionHolder_INCLUDED
|
||||
|
@ -18,14 +18,16 @@
|
||||
#define Data_PooledSessionImpl_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/SessionImpl.h"
|
||||
#include "Poco/Data/PooledSessionHolder.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/PooledSessionHolder.h"
|
||||
#include "Poco/Data/SessionImpl.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class SessionPool;
|
||||
@ -91,7 +93,8 @@ inline SessionImpl* PooledSessionImpl::impl() const
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_PooledSessionImpl_INCLUDED
|
||||
|
@ -21,8 +21,10 @@
|
||||
#include "Poco/Data/Limit.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class Data_API Position
|
||||
@ -55,7 +57,8 @@ inline Poco::UInt32 Position::value() const
|
||||
}
|
||||
|
||||
|
||||
namespace Keywords {
|
||||
namespace Keywords
|
||||
{
|
||||
|
||||
|
||||
template <typename T>
|
||||
@ -69,7 +72,8 @@ inline Position from(const T& value)
|
||||
} // namespace Keywords
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_Position_INCLUDED
|
||||
|
@ -18,15 +18,17 @@
|
||||
#define Data_Preparation_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/AbstractPreparation.h"
|
||||
#include "Poco/Data/TypeHandler.h"
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
#include "Poco/Data/AbstractPreparation.h"
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/TypeHandler.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
template <typename T>
|
||||
@ -34,10 +36,8 @@ class Preparation: public AbstractPreparation
|
||||
/// Class for calling the appropriate AbstractPreparator method.
|
||||
{
|
||||
public:
|
||||
Preparation(AbstractPreparator::Ptr& pPreparator, std::size_t pos, T& val):
|
||||
AbstractPreparation(pPreparator),
|
||||
_pos(pos),
|
||||
_val(val)
|
||||
Preparation(AbstractPreparator::Ptr & pPreparator, std::size_t pos, T & val)
|
||||
: AbstractPreparation(pPreparator), _pos(pos), _val(val)
|
||||
/// Creates the Preparation.
|
||||
{
|
||||
}
|
||||
@ -66,10 +66,8 @@ class Preparation<std::vector<T> >: public AbstractPreparation
|
||||
/// the whole vector preparation, rather than only individual contained values.
|
||||
{
|
||||
public:
|
||||
Preparation(AbstractPreparator::Ptr pPreparator, std::size_t pos, std::vector<T>& val = std::vector<T>()):
|
||||
AbstractPreparation(pPreparator),
|
||||
_pos(pos),
|
||||
_val(val)
|
||||
Preparation(AbstractPreparator::Ptr pPreparator, std::size_t pos, std::vector<T> & val = std::vector<T>())
|
||||
: AbstractPreparation(pPreparator), _pos(pos), _val(val)
|
||||
/// Creates the Preparation.
|
||||
{
|
||||
}
|
||||
@ -98,10 +96,8 @@ class Preparation<std::deque<T> >: public AbstractPreparation
|
||||
/// the whole deque preparation, rather than only individual contained values.
|
||||
{
|
||||
public:
|
||||
Preparation(AbstractPreparator::Ptr pPreparator, std::size_t pos, std::deque<T>& val = std::deque<T>()):
|
||||
AbstractPreparation(pPreparator),
|
||||
_pos(pos),
|
||||
_val(val)
|
||||
Preparation(AbstractPreparator::Ptr pPreparator, std::size_t pos, std::deque<T> & val = std::deque<T>())
|
||||
: AbstractPreparation(pPreparator), _pos(pos), _val(val)
|
||||
/// Creates the Preparation.
|
||||
{
|
||||
}
|
||||
@ -130,10 +126,8 @@ class Preparation<std::list<T> >: public AbstractPreparation
|
||||
/// the whole list preparation, rather than only individual contained values.
|
||||
{
|
||||
public:
|
||||
Preparation(AbstractPreparator::Ptr pPreparator, std::size_t pos, std::list<T>& val = std::list<T>()):
|
||||
AbstractPreparation(pPreparator),
|
||||
_pos(pos),
|
||||
_val(val)
|
||||
Preparation(AbstractPreparator::Ptr pPreparator, std::size_t pos, std::list<T> & val = std::list<T>())
|
||||
: AbstractPreparation(pPreparator), _pos(pos), _val(val)
|
||||
/// Creates the Preparation.
|
||||
{
|
||||
}
|
||||
@ -155,7 +149,8 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_Preparation_INCLUDED
|
||||
|
@ -22,8 +22,10 @@
|
||||
#include "Poco/Data/Limit.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class Data_API Range
|
||||
@ -63,7 +65,8 @@ inline const Limit& Range::upper() const
|
||||
}
|
||||
|
||||
|
||||
namespace Keywords {
|
||||
namespace Keywords
|
||||
{
|
||||
|
||||
|
||||
template <typename T>
|
||||
@ -98,7 +101,8 @@ Range range(T low, T upp, bool hard = false)
|
||||
} // namespace Keywords
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_Range_INCLUDED
|
||||
|
@ -18,24 +18,26 @@
|
||||
#define Data_RecordSet_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/Session.h"
|
||||
#include "Poco/Data/Extraction.h"
|
||||
#include <limits>
|
||||
#include <ostream>
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "Poco/Data/BulkExtraction.h"
|
||||
#include "Poco/Data/Statement.h"
|
||||
#include "Poco/Data/RowIterator.h"
|
||||
#include "Poco/Data/RowFilter.h"
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/Extraction.h"
|
||||
#include "Poco/Data/LOB.h"
|
||||
#include "Poco/String.h"
|
||||
#include "Poco/Data/RowFilter.h"
|
||||
#include "Poco/Data/RowIterator.h"
|
||||
#include "Poco/Data/Session.h"
|
||||
#include "Poco/Data/Statement.h"
|
||||
#include "Poco/Dynamic/Var.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include <ostream>
|
||||
#include <limits>
|
||||
#include "Poco/String.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class RowFilter;
|
||||
@ -78,27 +80,22 @@ public:
|
||||
|
||||
static const std::size_t UNKNOWN_TOTAL_ROW_COUNT;
|
||||
|
||||
explicit RecordSet(const Statement& rStatement,
|
||||
RowFormatter::Ptr pRowFormatter = 0);
|
||||
explicit RecordSet(const Statement & rStatement, RowFormatter::Ptr pRowFormatter = 0);
|
||||
/// Creates the RecordSet.
|
||||
|
||||
RecordSet(Session& rSession,
|
||||
const std::string& query,
|
||||
RowFormatter::Ptr pRowFormatter = 0);
|
||||
RecordSet(Session & rSession, const std::string & query, RowFormatter::Ptr pRowFormatter = 0);
|
||||
/// Creates the RecordSet.
|
||||
|
||||
RecordSet(Session& rSession,
|
||||
const std::string& query,
|
||||
const RowFormatter& rowFormatter);
|
||||
RecordSet(Session & rSession, const std::string & query, const RowFormatter & rowFormatter);
|
||||
/// Creates the RecordSet.
|
||||
|
||||
template <class RF>
|
||||
RecordSet(Session& rSession, const std::string& query, const RF& rowFormatter):
|
||||
Statement((rSession << query, Keywords::now)),
|
||||
_currentRow(0),
|
||||
_pBegin(new RowIterator(this, 0 == rowsExtracted())),
|
||||
_pEnd(new RowIterator(this, true)),
|
||||
_totalRowCount(UNKNOWN_TOTAL_ROW_COUNT)
|
||||
RecordSet(Session & rSession, const std::string & query, const RF & rowFormatter)
|
||||
: Statement((rSession << query, Keywords::now))
|
||||
, _currentRow(0)
|
||||
, _pBegin(new RowIterator(this, 0 == rowsExtracted()))
|
||||
, _pEnd(new RowIterator(this, true))
|
||||
, _totalRowCount(UNKNOWN_TOTAL_ROW_COUNT)
|
||||
/// Creates the RecordSet.
|
||||
{
|
||||
setRowFormatter(Keywords::format(rowFormatter));
|
||||
@ -198,19 +195,16 @@ public:
|
||||
|
||||
switch (storage())
|
||||
{
|
||||
case STORAGE_VECTOR:
|
||||
{
|
||||
case STORAGE_VECTOR: {
|
||||
typedef typename std::vector<T> C;
|
||||
return column<C>(col).value(row);
|
||||
}
|
||||
case STORAGE_LIST:
|
||||
{
|
||||
case STORAGE_LIST: {
|
||||
typedef typename std::list<T> C;
|
||||
return column<C>(col).value(row);
|
||||
}
|
||||
case STORAGE_DEQUE:
|
||||
case STORAGE_UNKNOWN:
|
||||
{
|
||||
case STORAGE_UNKNOWN: {
|
||||
typedef typename std::deque<T> C;
|
||||
return column<C>(col).value(row);
|
||||
}
|
||||
@ -228,19 +222,16 @@ public:
|
||||
|
||||
switch (storage())
|
||||
{
|
||||
case STORAGE_VECTOR:
|
||||
{
|
||||
case STORAGE_VECTOR: {
|
||||
typedef typename std::vector<T> C;
|
||||
return column<C>(name).value(row);
|
||||
}
|
||||
case STORAGE_LIST:
|
||||
{
|
||||
case STORAGE_LIST: {
|
||||
typedef typename std::list<T> C;
|
||||
return column<C>(name).value(row);
|
||||
}
|
||||
case STORAGE_DEQUE:
|
||||
case STORAGE_UNKNOWN:
|
||||
{
|
||||
case STORAGE_UNKNOWN: {
|
||||
typedef typename std::deque<T> C;
|
||||
return column<C>(name).value(row);
|
||||
}
|
||||
@ -369,9 +360,7 @@ public:
|
||||
void formatNames() const;
|
||||
/// Formats names using the current RowFormatter.
|
||||
|
||||
std::ostream& copyValues(std::ostream& os,
|
||||
std::size_t offset = 0,
|
||||
std::size_t length = RowIterator::POSITION_END) const;
|
||||
std::ostream & copyValues(std::ostream & os, std::size_t offset = 0, std::size_t length = RowIterator::POSITION_END) const;
|
||||
/// Copies the data values to the supplied output stream.
|
||||
/// The data set to be copied is starting at the specified offset
|
||||
/// from the recordset beginning. The number of rows to be copied
|
||||
@ -388,9 +377,7 @@ public:
|
||||
/// An invalid combination of offset/length arguments shall
|
||||
/// cause RangeException to be thrown.
|
||||
|
||||
std::ostream& copy(std::ostream& os,
|
||||
std::size_t offset = 0,
|
||||
std::size_t length = RowIterator::POSITION_END) const;
|
||||
std::ostream & copy(std::ostream & os, std::size_t offset = 0, std::size_t length = RowIterator::POSITION_END) const;
|
||||
/// Copies the column names and values to the target output stream.
|
||||
/// Copied strings are formatted by the current RowFormatter.
|
||||
|
||||
@ -460,9 +447,8 @@ private:
|
||||
}
|
||||
else
|
||||
{
|
||||
throw Poco::BadCastException(Poco::format("Type cast failed!\nColumn: %z\nTarget type:\t%s",
|
||||
pos,
|
||||
std::string(typeid(T).name())));
|
||||
throw Poco::BadCastException(
|
||||
Poco::format("Type cast failed!\nColumn: %z\nTarget type:\t%s", pos, std::string(typeid(T).name())));
|
||||
}
|
||||
}
|
||||
|
||||
@ -647,7 +633,8 @@ inline void RecordSet::formatNames() const
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_RecordSet_INCLUDED
|
||||
|
@ -18,18 +18,20 @@
|
||||
#define Data_Row_INCLUDED
|
||||
|
||||
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/RowFormatter.h"
|
||||
#include "Poco/Dynamic/Var.h"
|
||||
#include "Poco/Tuple.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <ostream>
|
||||
#include "Poco/Tuple.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class RecordSet;
|
||||
@ -81,13 +83,10 @@ public:
|
||||
Row();
|
||||
/// Creates the Row.
|
||||
|
||||
Row(NameVecPtr pNames,
|
||||
const RowFormatter::Ptr& pFormatter = 0);
|
||||
Row(NameVecPtr pNames, const RowFormatter::Ptr & pFormatter = 0);
|
||||
/// Creates the Row.
|
||||
|
||||
Row(NameVecPtr pNames,
|
||||
const SortMapPtr& pSortMap,
|
||||
const RowFormatter::Ptr& pFormatter = 0);
|
||||
Row(NameVecPtr pNames, const SortMapPtr & pSortMap, const RowFormatter::Ptr & pFormatter = 0);
|
||||
/// Creates the Row.
|
||||
|
||||
~Row();
|
||||
@ -106,10 +105,12 @@ public:
|
||||
void append(const std::string & name, const T & val)
|
||||
/// Appends the value to the row.
|
||||
{
|
||||
if (!_pNames) _pNames = new NameVec;
|
||||
if (!_pNames)
|
||||
_pNames = new NameVec;
|
||||
_values.push_back(val);
|
||||
_pNames->push_back(name);
|
||||
if (1 == _values.size()) addSortField(0);
|
||||
if (1 == _values.size())
|
||||
addSortField(0);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -306,7 +307,8 @@ inline void Row::formatValues() const
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_Row_INCLUDED
|
||||
|
@ -18,19 +18,21 @@
|
||||
#define Data_RowFilter_INCLUDED
|
||||
|
||||
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <utility>
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Dynamic/Var.h"
|
||||
#include "Poco/Tuple.h"
|
||||
#include "Poco/String.h"
|
||||
#include "Poco/RefCountedObject.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include <map>
|
||||
#include <list>
|
||||
#include <utility>
|
||||
#include "Poco/String.h"
|
||||
#include "Poco/Tuple.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class RecordSet;
|
||||
@ -97,8 +99,7 @@ public:
|
||||
/// Adds value to the filter.
|
||||
{
|
||||
rewindRecordSet();
|
||||
_comparisonMap.insert(ComparisonMap::value_type(toUpper(name),
|
||||
ComparisonEntry(value, comparison, op)));
|
||||
_comparisonMap.insert(ComparisonMap::value_type(toUpper(name), ComparisonEntry(value, comparison, op)));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -159,10 +160,7 @@ private:
|
||||
static bool logicalOr(const Poco::Dynamic::Var & p1, const Poco::Dynamic::Var & p2);
|
||||
static bool isNull(const Poco::Dynamic::Var & p1, const Poco::Dynamic::Var &);
|
||||
|
||||
static void doCompare(Poco::Dynamic::Var& ret,
|
||||
Poco::Dynamic::Var& val,
|
||||
CompT comp,
|
||||
const ComparisonEntry& ce);
|
||||
static void doCompare(Poco::Dynamic::Var & ret, Poco::Dynamic::Var & val, CompT comp, const ComparisonEntry & ce);
|
||||
|
||||
RecordSet & recordSet() const;
|
||||
|
||||
@ -270,7 +268,8 @@ inline bool RowFilter::isNull(const Poco::Dynamic::Var& p1, const Poco::Dynamic:
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_RowFilter_INCLUDED
|
||||
|
@ -18,16 +18,18 @@
|
||||
#define Data_RowFormatter_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
#include "Poco/RefCountedObject.h"
|
||||
#include "Poco/Dynamic/Var.h"
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Dynamic/Var.h"
|
||||
#include "Poco/RefCountedObject.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class Data_API RowFormatter
|
||||
@ -81,9 +83,7 @@ public:
|
||||
FORMAT_BULK
|
||||
};
|
||||
|
||||
RowFormatter(const std::string& prefix = "",
|
||||
const std::string& postfix = "",
|
||||
Mode mode = FORMAT_PROGRESSIVE);
|
||||
RowFormatter(const std::string & prefix = "", const std::string & postfix = "", Mode mode = FORMAT_PROGRESSIVE);
|
||||
/// Creates the RowFormatter and sets the prefix and postfix to specified values.
|
||||
|
||||
virtual ~RowFormatter();
|
||||
@ -138,7 +138,6 @@ public:
|
||||
/// Sets the fromatter mode.
|
||||
|
||||
protected:
|
||||
|
||||
void setPrefix(const std::string & prefix);
|
||||
/// Sets the prefix for the formatter.
|
||||
|
||||
@ -146,7 +145,6 @@ protected:
|
||||
/// Sets the postfix for the formatter
|
||||
|
||||
private:
|
||||
|
||||
mutable std::string _prefix;
|
||||
mutable std::string _postfix;
|
||||
Mode _mode;
|
||||
@ -211,7 +209,8 @@ inline void RowFormatter::setMode(Mode mode)
|
||||
}
|
||||
|
||||
|
||||
namespace Keywords {
|
||||
namespace Keywords
|
||||
{
|
||||
|
||||
|
||||
template <typename T>
|
||||
@ -225,7 +224,8 @@ inline RowFormatter::Ptr format(const T& formatter)
|
||||
} // namespace Keywords
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_RowFormatter_INCLUDED
|
||||
|
@ -18,15 +18,17 @@
|
||||
#define Data_RowIterator_INCLUDED
|
||||
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/Row.h"
|
||||
#include "Poco/Dynamic/Var.h"
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class RecordSet;
|
||||
@ -132,14 +134,14 @@ inline bool RowIterator::operator != (const RowIterator& other) const
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <>
|
||||
inline void swap<Poco::Data::RowIterator>(Poco::Data::RowIterator& s1,
|
||||
Poco::Data::RowIterator& s2)
|
||||
inline void swap<Poco::Data::RowIterator>(Poco::Data::RowIterator & s1, Poco::Data::RowIterator & s2)
|
||||
/// Full template specalization of std:::swap for RowIterator
|
||||
{
|
||||
s1.swap(s2);
|
||||
|
@ -18,19 +18,21 @@
|
||||
#define Data_SQLChannel_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "Poco/Channel.h"
|
||||
#include "Poco/Data/ArchiveStrategy.h"
|
||||
#include "Poco/Data/Connector.h"
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/Session.h"
|
||||
#include "Poco/Data/Statement.h"
|
||||
#include "Poco/Data/ArchiveStrategy.h"
|
||||
#include "Poco/Channel.h"
|
||||
#include "Poco/Message.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "Poco/String.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class Data_API SQLChannel : public Poco::Channel
|
||||
@ -64,9 +66,7 @@ public:
|
||||
SQLChannel();
|
||||
/// Creates SQLChannel.
|
||||
|
||||
SQLChannel(const std::string& connector,
|
||||
const std::string& connect,
|
||||
const std::string& name = "-");
|
||||
SQLChannel(const std::string & connector, const std::string & connect, const std::string & name = "-");
|
||||
/// Creates a SQLChannel with the given connector, connect string, timeout, table and name.
|
||||
/// The connector must be already registered.
|
||||
|
||||
@ -204,14 +204,13 @@ inline std::size_t SQLChannel::wait()
|
||||
|
||||
inline bool SQLChannel::isTrue(const std::string & value) const
|
||||
{
|
||||
return ((0 == icompare(value, "true")) ||
|
||||
(0 == icompare(value, "t")) ||
|
||||
(0 == icompare(value, "yes")) ||
|
||||
(0 == icompare(value, "y")));
|
||||
return (
|
||||
(0 == icompare(value, "true")) || (0 == icompare(value, "t")) || (0 == icompare(value, "yes")) || (0 == icompare(value, "y")));
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_SQLChannel_INCLUDED
|
||||
|
@ -18,18 +18,20 @@
|
||||
#define Data_Session_INCLUDED
|
||||
|
||||
|
||||
#include <algorithm>
|
||||
#include "Poco/Any.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "Poco/Data/Binding.h"
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/SessionImpl.h"
|
||||
#include "Poco/Data/Statement.h"
|
||||
#include "Poco/Data/StatementCreator.h"
|
||||
#include "Poco/Data/Binding.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "Poco/Any.h"
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class StatementImpl;
|
||||
@ -161,14 +163,11 @@ public:
|
||||
Session(Poco::AutoPtr<SessionImpl> ptrImpl);
|
||||
/// Creates the Session.
|
||||
|
||||
Session(const std::string& connector,
|
||||
const std::string& connectionString,
|
||||
std::size_t timeout = LOGIN_TIMEOUT_DEFAULT);
|
||||
Session(const std::string & connector, const std::string & connectionString, std::size_t timeout = LOGIN_TIMEOUT_DEFAULT);
|
||||
/// Creates a new session, using the given connector (which must have
|
||||
/// been registered), and connectionString.
|
||||
|
||||
Session(const std::string& connection,
|
||||
std::size_t timeout = LOGIN_TIMEOUT_DEFAULT);
|
||||
Session(const std::string & connection, std::size_t timeout = LOGIN_TIMEOUT_DEFAULT);
|
||||
/// Creates a new session, using the given connection (must be in
|
||||
/// "connection:///connectionString" format).
|
||||
|
||||
@ -258,8 +257,7 @@ public:
|
||||
std::string uri() const;
|
||||
/// Returns the URI for this session.
|
||||
|
||||
static std::string uri(const std::string& connector,
|
||||
const std::string& connectionString);
|
||||
static std::string uri(const std::string & connector, const std::string & connectionString);
|
||||
/// Utility function that teturns the URI formatted from supplied
|
||||
/// arguments as "connector:///connectionString".
|
||||
|
||||
@ -427,8 +425,7 @@ inline std::string Session::connector() const
|
||||
}
|
||||
|
||||
|
||||
inline std::string Session::uri(const std::string& connector,
|
||||
const std::string& connectionString)
|
||||
inline std::string Session::uri(const std::string & connector, const std::string & connectionString)
|
||||
{
|
||||
return SessionImpl::uri(connector, connectionString);
|
||||
}
|
||||
@ -476,14 +473,14 @@ inline void swap(Session& s1, Session& s2)
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <>
|
||||
inline void swap<Poco::Data::Session>(Poco::Data::Session& s1,
|
||||
Poco::Data::Session& s2)
|
||||
inline void swap<Poco::Data::Session>(Poco::Data::Session & s1, Poco::Data::Session & s2)
|
||||
/// Full template specalization of std:::swap for Session
|
||||
{
|
||||
s1.swap(s2);
|
||||
|
@ -18,17 +18,19 @@
|
||||
#define Data_SessionFactory_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/Data.h"
|
||||
#include <map>
|
||||
#include "Poco/Data/Connector.h"
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/Session.h"
|
||||
#include "Poco/Mutex.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
#include "Poco/String.h"
|
||||
#include <map>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class Data_API SessionFactory
|
||||
@ -50,7 +52,6 @@ class Data_API SessionFactory
|
||||
/// Session ses("SQLite", "dummy.db");
|
||||
{
|
||||
public:
|
||||
|
||||
static SessionFactory & instance();
|
||||
/// returns the static instance of the singleton.
|
||||
|
||||
@ -63,14 +64,11 @@ public:
|
||||
/// Lowers the reference count for the Connector registered under that key. If the count reaches zero,
|
||||
/// the object is removed.
|
||||
|
||||
Session create(const std::string& key,
|
||||
const std::string& connectionString,
|
||||
std::size_t timeout = Session::LOGIN_TIMEOUT_DEFAULT);
|
||||
Session create(const std::string & key, const std::string & connectionString, std::size_t timeout = Session::LOGIN_TIMEOUT_DEFAULT);
|
||||
/// Creates a Session for the given key with the connectionString. Throws an Poco:Data::UnknownDataBaseException
|
||||
/// if no Connector is registered for that key.
|
||||
|
||||
Session create(const std::string& uri,
|
||||
std::size_t timeout = Session::LOGIN_TIMEOUT_DEFAULT);
|
||||
Session create(const std::string & uri, std::size_t timeout = Session::LOGIN_TIMEOUT_DEFAULT);
|
||||
/// Creates a Session for the given URI (must be in key:///connectionString format).
|
||||
/// Throws a Poco:Data::UnknownDataBaseException if no Connector is registered for the key.
|
||||
|
||||
@ -93,7 +91,8 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_SessionFactory_INCLUDED
|
||||
|
@ -18,15 +18,17 @@
|
||||
#define Data_SessionImpl_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Any.h"
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Format.h"
|
||||
#include "Poco/RefCountedObject.h"
|
||||
#include "Poco/String.h"
|
||||
#include "Poco/Format.h"
|
||||
#include "Poco/Any.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class StatementImpl;
|
||||
@ -49,8 +51,7 @@ public:
|
||||
static const std::size_t CONNECTION_TIMEOUT_DEFAULT = CONNECTION_TIMEOUT_INFINITE;
|
||||
/// Default connection/login timeout in seconds.
|
||||
|
||||
SessionImpl(const std::string& connectionString,
|
||||
std::size_t timeout = LOGIN_TIMEOUT_DEFAULT);
|
||||
SessionImpl(const std::string & connectionString, std::size_t timeout = LOGIN_TIMEOUT_DEFAULT);
|
||||
/// Creates the SessionImpl.
|
||||
|
||||
virtual ~SessionImpl();
|
||||
@ -202,8 +203,7 @@ inline std::size_t SessionImpl::getLoginTimeout() const
|
||||
}
|
||||
|
||||
|
||||
inline std::string SessionImpl::uri(const std::string& connector,
|
||||
const std::string& connectionString)
|
||||
inline std::string SessionImpl::uri(const std::string & connector, const std::string & connectionString)
|
||||
{
|
||||
return format("%s:///%s", connector, connectionString);
|
||||
}
|
||||
@ -215,7 +215,8 @@ inline std::string SessionImpl::uri() const
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_SessionImpl_INCLUDED
|
||||
|
@ -18,19 +18,21 @@
|
||||
#define Data_SessionPool_INCLUDED
|
||||
|
||||
|
||||
#include <list>
|
||||
#include "Poco/Any.h"
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/PooledSessionHolder.h"
|
||||
#include "Poco/Data/PooledSessionImpl.h"
|
||||
#include "Poco/Data/Session.h"
|
||||
#include "Poco/HashMap.h"
|
||||
#include "Poco/Any.h"
|
||||
#include "Poco/Timer.h"
|
||||
#include "Poco/Mutex.h"
|
||||
#include <list>
|
||||
#include "Poco/Timer.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class Data_API SessionPool : public RefCountedObject
|
||||
@ -67,7 +69,8 @@ class Data_API SessionPool: public RefCountedObject
|
||||
/// ...
|
||||
{
|
||||
public:
|
||||
SessionPool(const std::string& connector,
|
||||
SessionPool(
|
||||
const std::string & connector,
|
||||
const std::string & connectionString,
|
||||
int minSessions = 1,
|
||||
int maxSessions = 32,
|
||||
@ -101,8 +104,7 @@ public:
|
||||
/// value when the session is reclaimed by the pool.
|
||||
{
|
||||
Session s = get();
|
||||
_addPropertyMap.insert(AddPropertyMap::value_type(s.impl(),
|
||||
std::make_pair(name, s.getProperty(name))));
|
||||
_addPropertyMap.insert(AddPropertyMap::value_type(s.impl(), std::make_pair(name, s.getProperty(name))));
|
||||
s.setProperty(name, value);
|
||||
|
||||
return s;
|
||||
@ -135,8 +137,7 @@ public:
|
||||
std::string name() const;
|
||||
/// Returns the name for this pool.
|
||||
|
||||
static std::string name(const std::string& connector,
|
||||
const std::string& connectionString);
|
||||
static std::string name(const std::string & connector, const std::string & connectionString);
|
||||
/// Returns the name formatted from supplied arguments as "connector:///connectionString".
|
||||
|
||||
void setFeature(const std::string & name, bool state);
|
||||
@ -201,15 +202,13 @@ private:
|
||||
bool _shutdown;
|
||||
AddPropertyMap _addPropertyMap;
|
||||
AddFeatureMap _addFeatureMap;
|
||||
mutable
|
||||
Poco::Mutex _mutex;
|
||||
mutable Poco::Mutex _mutex;
|
||||
|
||||
friend class PooledSessionImpl;
|
||||
};
|
||||
|
||||
|
||||
inline std::string SessionPool::name(const std::string& connector,
|
||||
const std::string& connectionString)
|
||||
inline std::string SessionPool::name(const std::string & connector, const std::string & connectionString)
|
||||
{
|
||||
return Session::uri(connector, connectionString);
|
||||
}
|
||||
@ -227,7 +226,8 @@ inline bool SessionPool::isActive() const
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_SessionPool_INCLUDED
|
||||
|
@ -21,12 +21,14 @@
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/Session.h"
|
||||
#include "Poco/Data/SessionPool.h"
|
||||
#include "Poco/String.h"
|
||||
#include "Poco/Mutex.h"
|
||||
#include "Poco/String.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class Data_API SessionPoolContainer
|
||||
@ -43,7 +45,8 @@ public:
|
||||
/// Adds existing session pool to the container.
|
||||
/// Throws SessionPoolExistsException if pool already exists.
|
||||
|
||||
Session add(const std::string& sessionKey,
|
||||
Session
|
||||
add(const std::string & sessionKey,
|
||||
const std::string & connectionString,
|
||||
int minSessions = 1,
|
||||
int maxSessions = 32,
|
||||
@ -55,8 +58,7 @@ public:
|
||||
bool has(const std::string & name) const;
|
||||
/// Returns true if the requested name exists, false otherwise.
|
||||
|
||||
bool isActive(const std::string& sessionKey,
|
||||
const std::string& connectionString = "") const;
|
||||
bool isActive(const std::string & sessionKey, const std::string & connectionString = "") const;
|
||||
/// Returns true if the session is active (i.e. not shut down).
|
||||
/// If connectionString is empty string, sessionKey must be a
|
||||
/// fully qualified session name as registered with the pool
|
||||
@ -108,7 +110,8 @@ inline int SessionPoolContainer::count() const
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_SessionPoolContainer_INCLUDED
|
||||
|
@ -22,8 +22,10 @@
|
||||
#include "Poco/Data/RowFormatter.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class Data_API SimpleRowFormatter : public RowFormatter
|
||||
@ -104,14 +106,14 @@ inline std::streamsize SimpleRowFormatter::getSpacing() const
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <>
|
||||
inline void swap<Poco::Data::SimpleRowFormatter>(Poco::Data::SimpleRowFormatter& s1,
|
||||
Poco::Data::SimpleRowFormatter& s2)
|
||||
inline void swap<Poco::Data::SimpleRowFormatter>(Poco::Data::SimpleRowFormatter & s1, Poco::Data::SimpleRowFormatter & s2)
|
||||
/// Full template specalization of std:::swap for SimpleRowFormatter
|
||||
{
|
||||
s1.swap(s2);
|
||||
|
@ -18,23 +18,25 @@
|
||||
#define Data_Statement_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/StatementImpl.h"
|
||||
#include "Poco/Data/Binding.h"
|
||||
#include "Poco/Data/Range.h"
|
||||
#include "Poco/Data/Bulk.h"
|
||||
#include "Poco/Data/Row.h"
|
||||
#include "Poco/Data/SimpleRowFormatter.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
#include "Poco/Mutex.h"
|
||||
#include <algorithm>
|
||||
#include "Poco/ActiveMethod.h"
|
||||
#include "Poco/ActiveResult.h"
|
||||
#include "Poco/Data/Binding.h"
|
||||
#include "Poco/Data/Bulk.h"
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/Range.h"
|
||||
#include "Poco/Data/Row.h"
|
||||
#include "Poco/Data/SimpleRowFormatter.h"
|
||||
#include "Poco/Data/StatementImpl.h"
|
||||
#include "Poco/Format.h"
|
||||
#include <algorithm>
|
||||
#include "Poco/Mutex.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class AbstractBinding;
|
||||
@ -148,10 +150,12 @@ public:
|
||||
Statement & addBinding(C & bindingCont, bool reset)
|
||||
/// Registers binding container with the Statement.
|
||||
{
|
||||
if (reset) _pImpl->resetBinding();
|
||||
if (reset)
|
||||
_pImpl->resetBinding();
|
||||
typename C::iterator itAB = bindingCont.begin();
|
||||
typename C::iterator itABEnd = bindingCont.end();
|
||||
for (; itAB != itABEnd; ++itAB) addBind(*itAB);
|
||||
for (; itAB != itABEnd; ++itAB)
|
||||
addBind(*itAB);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -181,10 +185,12 @@ public:
|
||||
Statement & addExtraction(C & val, bool reset)
|
||||
/// Registers extraction container with the Statement.
|
||||
{
|
||||
if (reset) _pImpl->resetExtraction();
|
||||
if (reset)
|
||||
_pImpl->resetExtraction();
|
||||
typename C::iterator itAE = val.begin();
|
||||
typename C::iterator itAEEnd = val.end();
|
||||
for (; itAE != itAEEnd; ++itAE) addExtract(*itAE);
|
||||
for (; itAE != itAEEnd; ++itAE)
|
||||
addExtract(*itAE);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -195,7 +201,8 @@ public:
|
||||
_pImpl->resetExtraction();
|
||||
typename C::iterator itAEV = val.begin();
|
||||
typename C::iterator itAEVEnd = val.end();
|
||||
for (; itAEV != itAEVEnd; ++itAEV) addExtraction(*itAEV, false);
|
||||
for (; itAEV != itAEVEnd; ++itAEV)
|
||||
addExtraction(*itAEV, false);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -406,7 +413,6 @@ protected:
|
||||
/// Returns the underlying session.
|
||||
|
||||
private:
|
||||
|
||||
const Result & doAsyncExec(bool reset = true);
|
||||
/// Asynchronously executes the statement.
|
||||
|
||||
@ -438,7 +444,8 @@ inline std::size_t Statement::subTotalRowCount(int dataSet) const
|
||||
}
|
||||
|
||||
|
||||
namespace Keywords {
|
||||
namespace Keywords
|
||||
{
|
||||
|
||||
|
||||
//
|
||||
@ -793,7 +800,8 @@ inline void Statement::setRowFormatter(RowFormatter::Ptr pRowFormatter)
|
||||
|
||||
inline const RowFormatter::Ptr & Statement::getRowFormatter()
|
||||
{
|
||||
if (!_pRowFormatter) _pRowFormatter = new SimpleRowFormatter;
|
||||
if (!_pRowFormatter)
|
||||
_pRowFormatter = new SimpleRowFormatter;
|
||||
return _pRowFormatter;
|
||||
}
|
||||
|
||||
@ -804,14 +812,14 @@ inline void swap(Statement& s1, Statement& s2)
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <>
|
||||
inline void swap<Poco::Data::Statement>(Poco::Data::Statement& s1,
|
||||
Poco::Data::Statement& s2)
|
||||
inline void swap<Poco::Data::Statement>(Poco::Data::Statement & s1, Poco::Data::Statement & s2)
|
||||
/// Full template specalization of std:::swap for Statement
|
||||
{
|
||||
s1.swap(s2);
|
||||
|
@ -18,14 +18,16 @@
|
||||
#define Data_StatementCreator_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/SessionImpl.h"
|
||||
#include "Poco/Data/Statement.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class Data_API StatementCreator
|
||||
@ -67,7 +69,8 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_StatementCreator_INCLUDED
|
||||
|
@ -18,28 +18,30 @@
|
||||
#define Data_StatementImpl_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/Data.h"
|
||||
#include <deque>
|
||||
#include <list>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "Poco/Data/AbstractBinding.h"
|
||||
#include "Poco/Data/AbstractExtraction.h"
|
||||
#include "Poco/Data/Range.h"
|
||||
#include "Poco/Data/Bulk.h"
|
||||
#include "Poco/Data/Column.h"
|
||||
#include "Poco/Data/Extraction.h"
|
||||
#include "Poco/Data/BulkExtraction.h"
|
||||
#include "Poco/Data/Column.h"
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/Extraction.h"
|
||||
#include "Poco/Data/Range.h"
|
||||
#include "Poco/Data/SessionImpl.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include "Poco/Format.h"
|
||||
#include "Poco/RefCountedObject.h"
|
||||
#include "Poco/String.h"
|
||||
#include "Poco/Format.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <deque>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class Data_API StatementImpl
|
||||
@ -329,10 +331,8 @@ private:
|
||||
{
|
||||
C * pData = new C;
|
||||
Column<C> * pCol = new Column<C>(mc, pData);
|
||||
return new InternalBulkExtraction<C>(*pData,
|
||||
pCol,
|
||||
static_cast<Poco::UInt32>(getExtractionLimit()),
|
||||
Position(static_cast<Poco::UInt32>(currentDataSet())));
|
||||
return new InternalBulkExtraction<C>(
|
||||
*pData, pCol, static_cast<Poco::UInt32>(getExtractionLimit()), Position(static_cast<Poco::UInt32>(currentDataSet())));
|
||||
}
|
||||
|
||||
template <class T>
|
||||
@ -353,17 +353,21 @@ private:
|
||||
switch (_storage)
|
||||
{
|
||||
case STORAGE_DEQUE_IMPL:
|
||||
storage = DEQUE; break;
|
||||
storage = DEQUE;
|
||||
break;
|
||||
case STORAGE_VECTOR_IMPL:
|
||||
storage = VECTOR; break;
|
||||
storage = VECTOR;
|
||||
break;
|
||||
case STORAGE_LIST_IMPL:
|
||||
storage = LIST; break;
|
||||
storage = LIST;
|
||||
break;
|
||||
case STORAGE_UNKNOWN_IMPL:
|
||||
storage = AnyCast<std::string>(session().getProperty("storage"));
|
||||
break;
|
||||
}
|
||||
|
||||
if (storage.empty()) storage = DEQUE;
|
||||
if (storage.empty())
|
||||
storage = DEQUE;
|
||||
|
||||
if (0 == icompare(DEQUE, storage))
|
||||
{
|
||||
@ -582,15 +586,13 @@ inline void StatementImpl::setBulkBinding()
|
||||
|
||||
inline bool StatementImpl::bulkBindingAllowed() const
|
||||
{
|
||||
return BULK_UNDEFINED == _bulkBinding ||
|
||||
BULK_BINDING == _bulkBinding;
|
||||
return BULK_UNDEFINED == _bulkBinding || BULK_BINDING == _bulkBinding;
|
||||
}
|
||||
|
||||
|
||||
inline bool StatementImpl::bulkExtractionAllowed() const
|
||||
{
|
||||
return BULK_UNDEFINED == _bulkExtraction ||
|
||||
BULK_EXTRACTION == _bulkExtraction;
|
||||
return BULK_UNDEFINED == _bulkExtraction || BULK_EXTRACTION == _bulkExtraction;
|
||||
}
|
||||
|
||||
|
||||
@ -609,7 +611,7 @@ inline bool StatementImpl::isBulkExtraction() const
|
||||
inline void StatementImpl::resetBulk()
|
||||
{
|
||||
_bulkExtraction = BULK_UNDEFINED;
|
||||
_bulkBinding = BULK_UNDEFINED;\
|
||||
_bulkBinding = BULK_UNDEFINED;
|
||||
setExtractionLimit(Limit(Limit::LIMIT_UNLIMITED, false, false));
|
||||
}
|
||||
|
||||
@ -626,7 +628,8 @@ inline bool StatementImpl::hasMoreDataSets() const
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_StatementImpl_INCLUDED
|
||||
|
@ -23,9 +23,11 @@
|
||||
#include "Poco/Exception.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Poco
|
||||
{
|
||||
|
||||
namespace Dynamic {
|
||||
namespace Dynamic
|
||||
{
|
||||
|
||||
class Var;
|
||||
|
||||
@ -33,7 +35,8 @@ class Var;
|
||||
|
||||
class DateTime;
|
||||
|
||||
namespace Data {
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class Date;
|
||||
@ -133,9 +136,7 @@ inline Time& Time::operator = (const DateTime& dt)
|
||||
|
||||
inline bool Time::operator==(const Time & time) const
|
||||
{
|
||||
return _hour == time.hour() &&
|
||||
_minute == time.minute() &&
|
||||
_second == time.second();
|
||||
return _hour == time.hour() && _minute == time.minute() && _second == time.second();
|
||||
}
|
||||
|
||||
|
||||
@ -151,7 +152,8 @@ inline bool Time::operator > (const Time& time) const
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
//
|
||||
@ -159,26 +161,21 @@ inline bool Time::operator > (const Time& time) const
|
||||
//
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Dynamic {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Dynamic
|
||||
{
|
||||
|
||||
|
||||
template <>
|
||||
class VarHolderImpl<Poco::Data::Time> : public VarHolder
|
||||
{
|
||||
public:
|
||||
VarHolderImpl(const Poco::Data::Time& val): _val(val)
|
||||
{
|
||||
}
|
||||
VarHolderImpl(const Poco::Data::Time & val) : _val(val) { }
|
||||
|
||||
~VarHolderImpl()
|
||||
{
|
||||
}
|
||||
~VarHolderImpl() { }
|
||||
|
||||
const std::type_info& type() const
|
||||
{
|
||||
return typeid(Poco::Data::Time);
|
||||
}
|
||||
const std::type_info & type() const { return typeid(Poco::Data::Time); }
|
||||
|
||||
void convert(Poco::Timestamp & val) const
|
||||
{
|
||||
@ -207,15 +204,9 @@ public:
|
||||
val = DateTimeFormatter::format(dt, "%H:%M:%S");
|
||||
}
|
||||
|
||||
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
|
||||
{
|
||||
return cloneHolder(pVarHolder, _val);
|
||||
}
|
||||
VarHolder * clone(Placeholder<VarHolder> * pVarHolder = 0) const { return cloneHolder(pVarHolder, _val); }
|
||||
|
||||
const Poco::Data::Time& value() const
|
||||
{
|
||||
return _val;
|
||||
}
|
||||
const Poco::Data::Time & value() const { return _val; }
|
||||
|
||||
private:
|
||||
VarHolderImpl();
|
||||
@ -223,7 +214,8 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::Dynamic
|
||||
}
|
||||
} // namespace Poco::Dynamic
|
||||
|
||||
|
||||
#endif // Data_Time_INCLUDED
|
||||
|
@ -14,7 +14,6 @@
|
||||
//
|
||||
|
||||
|
||||
|
||||
#ifndef Data_Transaction_INCLUDED
|
||||
#define Data_Transaction_INCLUDED
|
||||
|
||||
@ -24,8 +23,10 @@
|
||||
#include "Poco/Logger.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class Data_API Transaction
|
||||
@ -46,9 +47,7 @@ public:
|
||||
/// to start the transaction.
|
||||
|
||||
template <typename T>
|
||||
Transaction(Poco::Data::Session& rSession, T& t, Poco::Logger* pLogger = 0):
|
||||
_rSession(rSession),
|
||||
_pLogger(pLogger)
|
||||
Transaction(Poco::Data::Session & rSession, T & t, Poco::Logger * pLogger = 0) : _rSession(rSession), _pLogger(pLogger)
|
||||
/// Creates the Transaction, using the given database session, transactor and logger.
|
||||
/// The transactor type must provide operator () overload taking non-const Session
|
||||
/// reference as an argument.
|
||||
@ -71,10 +70,14 @@ public:
|
||||
/// Transactor tr;
|
||||
/// Transaction tn(session, tr);
|
||||
{
|
||||
try { transact(t); }
|
||||
try
|
||||
{
|
||||
transact(t);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
if (_pLogger) _pLogger->error("Error executing transaction.");
|
||||
if (_pLogger)
|
||||
_pLogger->error("Error executing transaction.");
|
||||
rollback();
|
||||
throw;
|
||||
}
|
||||
@ -119,7 +122,8 @@ public:
|
||||
/// Executes the transactor and, unless transactor throws an exception,
|
||||
/// commits the transaction.
|
||||
{
|
||||
if (!isActive()) begin();
|
||||
if (!isActive())
|
||||
begin();
|
||||
t(_rSession);
|
||||
commit();
|
||||
}
|
||||
@ -188,7 +192,8 @@ inline void Transaction::setLogger(Poco::Logger* pLogger)
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_Transaction_INCLUDED
|
||||
|
@ -18,19 +18,21 @@
|
||||
#define Data_TypeHandler_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/Data.h"
|
||||
#include <cstddef>
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "Poco/Data/AbstractBinder.h"
|
||||
#include "Poco/Data/AbstractExtractor.h"
|
||||
#include "Poco/Data/AbstractPreparator.h"
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Nullable.h"
|
||||
#include "Poco/Tuple.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
#include <cstddef>
|
||||
#include "Poco/Tuple.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Poco
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
|
||||
|
||||
class AbstractTypeHandler
|
||||
@ -121,15 +123,13 @@ public:
|
||||
pBinder->bind(pos, obj, dir);
|
||||
}
|
||||
|
||||
static std::size_t size()
|
||||
{
|
||||
return 1u;
|
||||
}
|
||||
static std::size_t size() { return 1u; }
|
||||
|
||||
static void extract(std::size_t pos, T & obj, const T & defVal, AbstractExtractor::Ptr pExt)
|
||||
{
|
||||
poco_assert_dbg(!pExt.isNull());
|
||||
if (!pExt->extract(pos, obj)) obj = defVal;
|
||||
if (!pExt->extract(pos, obj))
|
||||
obj = defVal;
|
||||
}
|
||||
|
||||
static void prepare(std::size_t pos, const T & obj, AbstractPreparator::Ptr pPreparator)
|
||||
@ -155,10 +155,7 @@ public:
|
||||
pBinder->bind(pos, obj, dir);
|
||||
}
|
||||
|
||||
static std::size_t size()
|
||||
{
|
||||
return 1u;
|
||||
}
|
||||
static std::size_t size() { return 1u; }
|
||||
|
||||
static void extract(std::size_t pos, std::deque<T> & obj, const T & defVal, AbstractExtractor::Ptr pExt)
|
||||
{
|
||||
@ -190,10 +187,7 @@ public:
|
||||
pBinder->bind(pos, obj, dir);
|
||||
}
|
||||
|
||||
static std::size_t size()
|
||||
{
|
||||
return 1u;
|
||||
}
|
||||
static std::size_t size() { return 1u; }
|
||||
|
||||
static void extract(std::size_t pos, std::vector<T> & obj, const T & defVal, AbstractExtractor::Ptr pExt)
|
||||
{
|
||||
@ -225,10 +219,7 @@ public:
|
||||
pBinder->bind(pos, obj, dir);
|
||||
}
|
||||
|
||||
static std::size_t size()
|
||||
{
|
||||
return 1u;
|
||||
}
|
||||
static std::size_t size() { return 1u; }
|
||||
|
||||
static void extract(std::size_t pos, std::list<T> & obj, const T & defVal, AbstractExtractor::Ptr pExt)
|
||||
{
|
||||
@ -253,7 +244,6 @@ class TypeHandler<Nullable<T> >
|
||||
/// Specialization of type handler for Nullable.
|
||||
{
|
||||
public:
|
||||
|
||||
static void bind(std::size_t pos, const Nullable<T> & obj, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
|
||||
{
|
||||
poco_assert_dbg(!pBinder.isNull());
|
||||
@ -280,10 +270,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
static std::size_t size()
|
||||
{
|
||||
return 1u;
|
||||
}
|
||||
static std::size_t size() { return 1u; }
|
||||
|
||||
static void extract(std::size_t pos, Nullable<T> & obj, const Nullable<T> &, AbstractExtractor::Ptr pExt)
|
||||
{
|
||||
@ -301,7 +288,6 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
TypeHandler();
|
||||
~TypeHandler();
|
||||
TypeHandler(const TypeHandler &);
|
||||
@ -316,8 +302,8 @@ private:
|
||||
|
||||
|
||||
template <typename TupleType, typename Type, int N>
|
||||
POCO_TUPLE_TYPE_HANDLER_INLINE
|
||||
void tupleBind(std::size_t& pos, TupleType tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
|
||||
POCO_TUPLE_TYPE_HANDLER_INLINE void
|
||||
tupleBind(std::size_t & pos, TupleType tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
|
||||
{
|
||||
TypeHandler<Type>::bind(pos, tuple.template get<N>(), pBinder, dir);
|
||||
pos += TypeHandler<Type>::size();
|
||||
@ -325,8 +311,7 @@ void tupleBind(std::size_t& pos, TupleType tuple, AbstractBinder::Ptr pBinder, A
|
||||
|
||||
|
||||
template <typename TupleType, typename Type, int N>
|
||||
POCO_TUPLE_TYPE_HANDLER_INLINE
|
||||
void tuplePrepare(std::size_t& pos, TupleType tuple, AbstractPreparator::Ptr pPreparator)
|
||||
POCO_TUPLE_TYPE_HANDLER_INLINE void tuplePrepare(std::size_t & pos, TupleType tuple, AbstractPreparator::Ptr pPreparator)
|
||||
{
|
||||
TypeHandler<Type>::prepare(pos, tuple.template get<N>(), pPreparator);
|
||||
pos += TypeHandler<Type>::size();
|
||||
@ -334,16 +319,15 @@ void tuplePrepare(std::size_t& pos, TupleType tuple, AbstractPreparator::Ptr pPr
|
||||
|
||||
|
||||
template <typename TupleType, typename DefValType, typename Type, int N>
|
||||
POCO_TUPLE_TYPE_HANDLER_INLINE
|
||||
void tupleExtract(std::size_t& pos, TupleType tuple, DefValType defVal, AbstractExtractor::Ptr pExt)
|
||||
POCO_TUPLE_TYPE_HANDLER_INLINE void tupleExtract(std::size_t & pos, TupleType tuple, DefValType defVal, AbstractExtractor::Ptr pExt)
|
||||
{
|
||||
Poco::Data::TypeHandler<Type>::extract(pos, tuple.template get<N>(),
|
||||
defVal.template get<N>(), pExt);
|
||||
Poco::Data::TypeHandler<Type>::extract(pos, tuple.template get<N>(), defVal.template get<N>(), pExt);
|
||||
pos += TypeHandler<Type>::size();
|
||||
}
|
||||
|
||||
|
||||
template <class T0,
|
||||
template <
|
||||
class T0,
|
||||
class T1,
|
||||
class T2,
|
||||
class T3,
|
||||
@ -366,8 +350,11 @@ template <class T0,
|
||||
class TypeHandler<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19>>
|
||||
{
|
||||
public:
|
||||
typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19> >::CONSTREFTYPE TupleConstRef;
|
||||
typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19> >::REFTYPE TupleRef;
|
||||
typedef typename Poco::TypeWrapper<
|
||||
Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19>>::CONSTREFTYPE
|
||||
TupleConstRef;
|
||||
typedef typename Poco::TypeWrapper<
|
||||
Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19>>::REFTYPE TupleRef;
|
||||
|
||||
static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
|
||||
{
|
||||
@ -421,26 +408,11 @@ public:
|
||||
|
||||
static std::size_t size()
|
||||
{
|
||||
return TypeHandler<T0>::size() +
|
||||
TypeHandler<T1>::size() +
|
||||
TypeHandler<T2>::size() +
|
||||
TypeHandler<T3>::size() +
|
||||
TypeHandler<T4>::size() +
|
||||
TypeHandler<T5>::size() +
|
||||
TypeHandler<T6>::size() +
|
||||
TypeHandler<T7>::size() +
|
||||
TypeHandler<T8>::size() +
|
||||
TypeHandler<T9>::size() +
|
||||
TypeHandler<T10>::size() +
|
||||
TypeHandler<T11>::size() +
|
||||
TypeHandler<T12>::size() +
|
||||
TypeHandler<T13>::size() +
|
||||
TypeHandler<T14>::size() +
|
||||
TypeHandler<T15>::size() +
|
||||
TypeHandler<T16>::size() +
|
||||
TypeHandler<T17>::size() +
|
||||
TypeHandler<T18>::size() +
|
||||
TypeHandler<T19>::size();
|
||||
return TypeHandler<T0>::size() + TypeHandler<T1>::size() + TypeHandler<T2>::size() + TypeHandler<T3>::size()
|
||||
+ TypeHandler<T4>::size() + TypeHandler<T5>::size() + TypeHandler<T6>::size() + TypeHandler<T7>::size()
|
||||
+ TypeHandler<T8>::size() + TypeHandler<T9>::size() + TypeHandler<T10>::size() + TypeHandler<T11>::size()
|
||||
+ TypeHandler<T12>::size() + TypeHandler<T13>::size() + TypeHandler<T14>::size() + TypeHandler<T15>::size()
|
||||
+ TypeHandler<T16>::size() + TypeHandler<T17>::size() + TypeHandler<T18>::size() + TypeHandler<T19>::size();
|
||||
}
|
||||
|
||||
static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt)
|
||||
@ -474,7 +446,8 @@ private:
|
||||
};
|
||||
|
||||
|
||||
template <class T0,
|
||||
template <
|
||||
class T0,
|
||||
class T1,
|
||||
class T2,
|
||||
class T3,
|
||||
@ -496,8 +469,10 @@ template <class T0,
|
||||
class TypeHandler<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18>>
|
||||
{
|
||||
public:
|
||||
typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18> >::CONSTREFTYPE TupleConstRef;
|
||||
typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18> >::REFTYPE TupleRef;
|
||||
typedef typename Poco::TypeWrapper<
|
||||
Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18>>::CONSTREFTYPE TupleConstRef;
|
||||
typedef typename Poco::TypeWrapper<
|
||||
Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18>>::REFTYPE TupleRef;
|
||||
|
||||
static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
|
||||
{
|
||||
@ -549,25 +524,11 @@ public:
|
||||
|
||||
static std::size_t size()
|
||||
{
|
||||
return TypeHandler<T0>::size() +
|
||||
TypeHandler<T1>::size() +
|
||||
TypeHandler<T2>::size() +
|
||||
TypeHandler<T3>::size() +
|
||||
TypeHandler<T4>::size() +
|
||||
TypeHandler<T5>::size() +
|
||||
TypeHandler<T6>::size() +
|
||||
TypeHandler<T7>::size() +
|
||||
TypeHandler<T8>::size() +
|
||||
TypeHandler<T9>::size() +
|
||||
TypeHandler<T10>::size() +
|
||||
TypeHandler<T11>::size() +
|
||||
TypeHandler<T12>::size() +
|
||||
TypeHandler<T13>::size() +
|
||||
TypeHandler<T14>::size() +
|
||||
TypeHandler<T15>::size() +
|
||||
TypeHandler<T16>::size() +
|
||||
TypeHandler<T17>::size() +
|
||||
TypeHandler<T18>::size();
|
||||
return TypeHandler<T0>::size() + TypeHandler<T1>::size() + TypeHandler<T2>::size() + TypeHandler<T3>::size()
|
||||
+ TypeHandler<T4>::size() + TypeHandler<T5>::size() + TypeHandler<T6>::size() + TypeHandler<T7>::size()
|
||||
+ TypeHandler<T8>::size() + TypeHandler<T9>::size() + TypeHandler<T10>::size() + TypeHandler<T11>::size()
|
||||
+ TypeHandler<T12>::size() + TypeHandler<T13>::size() + TypeHandler<T14>::size() + TypeHandler<T15>::size()
|
||||
+ TypeHandler<T16>::size() + TypeHandler<T17>::size() + TypeHandler<T18>::size();
|
||||
}
|
||||
|
||||
static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt)
|
||||
@ -600,7 +561,8 @@ private:
|
||||
};
|
||||
|
||||
|
||||
template <class T0,
|
||||
template <
|
||||
class T0,
|
||||
class T1,
|
||||
class T2,
|
||||
class T3,
|
||||
@ -621,8 +583,11 @@ template <class T0,
|
||||
class TypeHandler<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17>>
|
||||
{
|
||||
public:
|
||||
typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17> >::CONSTREFTYPE TupleConstRef;
|
||||
typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17> >::REFTYPE TupleRef;
|
||||
typedef typename Poco::TypeWrapper<
|
||||
Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17>>::CONSTREFTYPE TupleConstRef;
|
||||
typedef
|
||||
typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17>>::REFTYPE
|
||||
TupleRef;
|
||||
|
||||
static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
|
||||
{
|
||||
@ -672,24 +637,11 @@ public:
|
||||
|
||||
static std::size_t size()
|
||||
{
|
||||
return TypeHandler<T0>::size() +
|
||||
TypeHandler<T1>::size() +
|
||||
TypeHandler<T2>::size() +
|
||||
TypeHandler<T3>::size() +
|
||||
TypeHandler<T4>::size() +
|
||||
TypeHandler<T5>::size() +
|
||||
TypeHandler<T6>::size() +
|
||||
TypeHandler<T7>::size() +
|
||||
TypeHandler<T8>::size() +
|
||||
TypeHandler<T9>::size() +
|
||||
TypeHandler<T10>::size() +
|
||||
TypeHandler<T11>::size() +
|
||||
TypeHandler<T12>::size() +
|
||||
TypeHandler<T13>::size() +
|
||||
TypeHandler<T14>::size() +
|
||||
TypeHandler<T15>::size() +
|
||||
TypeHandler<T16>::size() +
|
||||
TypeHandler<T17>::size();
|
||||
return TypeHandler<T0>::size() + TypeHandler<T1>::size() + TypeHandler<T2>::size() + TypeHandler<T3>::size()
|
||||
+ TypeHandler<T4>::size() + TypeHandler<T5>::size() + TypeHandler<T6>::size() + TypeHandler<T7>::size()
|
||||
+ TypeHandler<T8>::size() + TypeHandler<T9>::size() + TypeHandler<T10>::size() + TypeHandler<T11>::size()
|
||||
+ TypeHandler<T12>::size() + TypeHandler<T13>::size() + TypeHandler<T14>::size() + TypeHandler<T15>::size()
|
||||
+ TypeHandler<T16>::size() + TypeHandler<T17>::size();
|
||||
}
|
||||
|
||||
static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt)
|
||||
@ -721,7 +673,8 @@ private:
|
||||
};
|
||||
|
||||
|
||||
template <class T0,
|
||||
template <
|
||||
class T0,
|
||||
class T1,
|
||||
class T2,
|
||||
class T3,
|
||||
@ -741,8 +694,11 @@ template <class T0,
|
||||
class TypeHandler<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>>
|
||||
{
|
||||
public:
|
||||
typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16> >::CONSTREFTYPE TupleConstRef;
|
||||
typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16> >::REFTYPE TupleRef;
|
||||
typedef
|
||||
typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>>::CONSTREFTYPE
|
||||
TupleConstRef;
|
||||
typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>>::REFTYPE
|
||||
TupleRef;
|
||||
|
||||
static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
|
||||
{
|
||||
@ -790,23 +746,11 @@ public:
|
||||
|
||||
static std::size_t size()
|
||||
{
|
||||
return TypeHandler<T0>::size() +
|
||||
TypeHandler<T1>::size() +
|
||||
TypeHandler<T2>::size() +
|
||||
TypeHandler<T3>::size() +
|
||||
TypeHandler<T4>::size() +
|
||||
TypeHandler<T5>::size() +
|
||||
TypeHandler<T6>::size() +
|
||||
TypeHandler<T7>::size() +
|
||||
TypeHandler<T8>::size() +
|
||||
TypeHandler<T9>::size() +
|
||||
TypeHandler<T10>::size() +
|
||||
TypeHandler<T11>::size() +
|
||||
TypeHandler<T12>::size() +
|
||||
TypeHandler<T13>::size() +
|
||||
TypeHandler<T14>::size() +
|
||||
TypeHandler<T15>::size() +
|
||||
TypeHandler<T16>::size();
|
||||
return TypeHandler<T0>::size() + TypeHandler<T1>::size() + TypeHandler<T2>::size() + TypeHandler<T3>::size()
|
||||
+ TypeHandler<T4>::size() + TypeHandler<T5>::size() + TypeHandler<T6>::size() + TypeHandler<T7>::size()
|
||||
+ TypeHandler<T8>::size() + TypeHandler<T9>::size() + TypeHandler<T10>::size() + TypeHandler<T11>::size()
|
||||
+ TypeHandler<T12>::size() + TypeHandler<T13>::size() + TypeHandler<T14>::size() + TypeHandler<T15>::size()
|
||||
+ TypeHandler<T16>::size();
|
||||
}
|
||||
|
||||
static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt)
|
||||
@ -837,7 +781,8 @@ private:
|
||||
};
|
||||
|
||||
|
||||
template <class T0,
|
||||
template <
|
||||
class T0,
|
||||
class T1,
|
||||
class T2,
|
||||
class T3,
|
||||
@ -856,8 +801,10 @@ template <class T0,
|
||||
class TypeHandler<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>>
|
||||
{
|
||||
public:
|
||||
typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15> >::CONSTREFTYPE TupleConstRef;
|
||||
typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15> >::REFTYPE TupleRef;
|
||||
typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>>::CONSTREFTYPE
|
||||
TupleConstRef;
|
||||
typedef
|
||||
typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>>::REFTYPE TupleRef;
|
||||
|
||||
static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
|
||||
{
|
||||
@ -903,22 +850,10 @@ public:
|
||||
|
||||
static std::size_t size()
|
||||
{
|
||||
return TypeHandler<T0>::size() +
|
||||
TypeHandler<T1>::size() +
|
||||
TypeHandler<T2>::size() +
|
||||
TypeHandler<T3>::size() +
|
||||
TypeHandler<T4>::size() +
|
||||
TypeHandler<T5>::size() +
|
||||
TypeHandler<T6>::size() +
|
||||
TypeHandler<T7>::size() +
|
||||
TypeHandler<T8>::size() +
|
||||
TypeHandler<T9>::size() +
|
||||
TypeHandler<T10>::size() +
|
||||
TypeHandler<T11>::size() +
|
||||
TypeHandler<T12>::size() +
|
||||
TypeHandler<T13>::size() +
|
||||
TypeHandler<T14>::size() +
|
||||
TypeHandler<T15>::size();
|
||||
return TypeHandler<T0>::size() + TypeHandler<T1>::size() + TypeHandler<T2>::size() + TypeHandler<T3>::size()
|
||||
+ TypeHandler<T4>::size() + TypeHandler<T5>::size() + TypeHandler<T6>::size() + TypeHandler<T7>::size()
|
||||
+ TypeHandler<T8>::size() + TypeHandler<T9>::size() + TypeHandler<T10>::size() + TypeHandler<T11>::size()
|
||||
+ TypeHandler<T12>::size() + TypeHandler<T13>::size() + TypeHandler<T14>::size() + TypeHandler<T15>::size();
|
||||
}
|
||||
|
||||
static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt)
|
||||
@ -948,7 +883,8 @@ private:
|
||||
};
|
||||
|
||||
|
||||
template <class T0,
|
||||
template <
|
||||
class T0,
|
||||
class T1,
|
||||
class T2,
|
||||
class T3,
|
||||
@ -966,7 +902,8 @@ template <class T0,
|
||||
class TypeHandler<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>>
|
||||
{
|
||||
public:
|
||||
typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14> >::CONSTREFTYPE TupleConstRef;
|
||||
typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>>::CONSTREFTYPE
|
||||
TupleConstRef;
|
||||
typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>>::REFTYPE TupleRef;
|
||||
|
||||
static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
|
||||
@ -1011,21 +948,10 @@ public:
|
||||
|
||||
static std::size_t size()
|
||||
{
|
||||
return TypeHandler<T0>::size() +
|
||||
TypeHandler<T1>::size() +
|
||||
TypeHandler<T2>::size() +
|
||||
TypeHandler<T3>::size() +
|
||||
TypeHandler<T4>::size() +
|
||||
TypeHandler<T5>::size() +
|
||||
TypeHandler<T6>::size() +
|
||||
TypeHandler<T7>::size() +
|
||||
TypeHandler<T8>::size() +
|
||||
TypeHandler<T9>::size() +
|
||||
TypeHandler<T10>::size() +
|
||||
TypeHandler<T11>::size() +
|
||||
TypeHandler<T12>::size() +
|
||||
TypeHandler<T13>::size() +
|
||||
TypeHandler<T14>::size();
|
||||
return TypeHandler<T0>::size() + TypeHandler<T1>::size() + TypeHandler<T2>::size() + TypeHandler<T3>::size()
|
||||
+ TypeHandler<T4>::size() + TypeHandler<T5>::size() + TypeHandler<T6>::size() + TypeHandler<T7>::size()
|
||||
+ TypeHandler<T8>::size() + TypeHandler<T9>::size() + TypeHandler<T10>::size() + TypeHandler<T11>::size()
|
||||
+ TypeHandler<T12>::size() + TypeHandler<T13>::size() + TypeHandler<T14>::size();
|
||||
}
|
||||
|
||||
static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt)
|
||||
@ -1054,7 +980,8 @@ private:
|
||||
};
|
||||
|
||||
|
||||
template <class T0,
|
||||
template <
|
||||
class T0,
|
||||
class T1,
|
||||
class T2,
|
||||
class T3,
|
||||
@ -1071,7 +998,8 @@ template <class T0,
|
||||
class TypeHandler<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>>
|
||||
{
|
||||
public:
|
||||
typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13> >::CONSTREFTYPE TupleConstRef;
|
||||
typedef
|
||||
typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>>::CONSTREFTYPE TupleConstRef;
|
||||
typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>>::REFTYPE TupleRef;
|
||||
|
||||
static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
|
||||
@ -1114,20 +1042,10 @@ public:
|
||||
|
||||
static std::size_t size()
|
||||
{
|
||||
return TypeHandler<T0>::size() +
|
||||
TypeHandler<T1>::size() +
|
||||
TypeHandler<T2>::size() +
|
||||
TypeHandler<T3>::size() +
|
||||
TypeHandler<T4>::size() +
|
||||
TypeHandler<T5>::size() +
|
||||
TypeHandler<T6>::size() +
|
||||
TypeHandler<T7>::size() +
|
||||
TypeHandler<T8>::size() +
|
||||
TypeHandler<T9>::size() +
|
||||
TypeHandler<T10>::size() +
|
||||
TypeHandler<T11>::size() +
|
||||
TypeHandler<T12>::size() +
|
||||
TypeHandler<T13>::size();
|
||||
return TypeHandler<T0>::size() + TypeHandler<T1>::size() + TypeHandler<T2>::size() + TypeHandler<T3>::size()
|
||||
+ TypeHandler<T4>::size() + TypeHandler<T5>::size() + TypeHandler<T6>::size() + TypeHandler<T7>::size()
|
||||
+ TypeHandler<T8>::size() + TypeHandler<T9>::size() + TypeHandler<T10>::size() + TypeHandler<T11>::size()
|
||||
+ TypeHandler<T12>::size() + TypeHandler<T13>::size();
|
||||
}
|
||||
|
||||
static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt)
|
||||
@ -1155,7 +1073,8 @@ private:
|
||||
};
|
||||
|
||||
|
||||
template <class T0,
|
||||
template <
|
||||
class T0,
|
||||
class T1,
|
||||
class T2,
|
||||
class T3,
|
||||
@ -1212,19 +1131,10 @@ public:
|
||||
|
||||
static std::size_t size()
|
||||
{
|
||||
return TypeHandler<T0>::size() +
|
||||
TypeHandler<T1>::size() +
|
||||
TypeHandler<T2>::size() +
|
||||
TypeHandler<T3>::size() +
|
||||
TypeHandler<T4>::size() +
|
||||
TypeHandler<T5>::size() +
|
||||
TypeHandler<T6>::size() +
|
||||
TypeHandler<T7>::size() +
|
||||
TypeHandler<T8>::size() +
|
||||
TypeHandler<T9>::size() +
|
||||
TypeHandler<T10>::size() +
|
||||
TypeHandler<T11>::size() +
|
||||
TypeHandler<T12>::size();
|
||||
return TypeHandler<T0>::size() + TypeHandler<T1>::size() + TypeHandler<T2>::size() + TypeHandler<T3>::size()
|
||||
+ TypeHandler<T4>::size() + TypeHandler<T5>::size() + TypeHandler<T6>::size() + TypeHandler<T7>::size()
|
||||
+ TypeHandler<T8>::size() + TypeHandler<T9>::size() + TypeHandler<T10>::size() + TypeHandler<T11>::size()
|
||||
+ TypeHandler<T12>::size();
|
||||
}
|
||||
|
||||
static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt)
|
||||
@ -1251,18 +1161,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
template <class T0,
|
||||
class T1,
|
||||
class T2,
|
||||
class T3,
|
||||
class T4,
|
||||
class T5,
|
||||
class T6,
|
||||
class T7,
|
||||
class T8,
|
||||
class T9,
|
||||
class T10,
|
||||
class T11>
|
||||
template <class T0, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8, class T9, class T10, class T11>
|
||||
class TypeHandler<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>>
|
||||
{
|
||||
public:
|
||||
@ -1305,18 +1204,9 @@ public:
|
||||
|
||||
static std::size_t size()
|
||||
{
|
||||
return TypeHandler<T0>::size() +
|
||||
TypeHandler<T1>::size() +
|
||||
TypeHandler<T2>::size() +
|
||||
TypeHandler<T3>::size() +
|
||||
TypeHandler<T4>::size() +
|
||||
TypeHandler<T5>::size() +
|
||||
TypeHandler<T6>::size() +
|
||||
TypeHandler<T7>::size() +
|
||||
TypeHandler<T8>::size() +
|
||||
TypeHandler<T9>::size() +
|
||||
TypeHandler<T10>::size() +
|
||||
TypeHandler<T11>::size();
|
||||
return TypeHandler<T0>::size() + TypeHandler<T1>::size() + TypeHandler<T2>::size() + TypeHandler<T3>::size()
|
||||
+ TypeHandler<T4>::size() + TypeHandler<T5>::size() + TypeHandler<T6>::size() + TypeHandler<T7>::size()
|
||||
+ TypeHandler<T8>::size() + TypeHandler<T9>::size() + TypeHandler<T10>::size() + TypeHandler<T11>::size();
|
||||
}
|
||||
|
||||
static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt)
|
||||
@ -1342,17 +1232,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
template <class T0,
|
||||
class T1,
|
||||
class T2,
|
||||
class T3,
|
||||
class T4,
|
||||
class T5,
|
||||
class T6,
|
||||
class T7,
|
||||
class T8,
|
||||
class T9,
|
||||
class T10>
|
||||
template <class T0, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8, class T9, class T10>
|
||||
class TypeHandler<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>>
|
||||
{
|
||||
public:
|
||||
@ -1393,17 +1273,9 @@ public:
|
||||
|
||||
static std::size_t size()
|
||||
{
|
||||
return TypeHandler<T0>::size() +
|
||||
TypeHandler<T1>::size() +
|
||||
TypeHandler<T2>::size() +
|
||||
TypeHandler<T3>::size() +
|
||||
TypeHandler<T4>::size() +
|
||||
TypeHandler<T5>::size() +
|
||||
TypeHandler<T6>::size() +
|
||||
TypeHandler<T7>::size() +
|
||||
TypeHandler<T8>::size() +
|
||||
TypeHandler<T9>::size() +
|
||||
TypeHandler<T10>::size();
|
||||
return TypeHandler<T0>::size() + TypeHandler<T1>::size() + TypeHandler<T2>::size() + TypeHandler<T3>::size()
|
||||
+ TypeHandler<T4>::size() + TypeHandler<T5>::size() + TypeHandler<T6>::size() + TypeHandler<T7>::size()
|
||||
+ TypeHandler<T8>::size() + TypeHandler<T9>::size() + TypeHandler<T10>::size();
|
||||
}
|
||||
|
||||
static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt)
|
||||
@ -1467,16 +1339,9 @@ public:
|
||||
|
||||
static std::size_t size()
|
||||
{
|
||||
return TypeHandler<T0>::size() +
|
||||
TypeHandler<T1>::size() +
|
||||
TypeHandler<T2>::size() +
|
||||
TypeHandler<T3>::size() +
|
||||
TypeHandler<T4>::size() +
|
||||
TypeHandler<T5>::size() +
|
||||
TypeHandler<T6>::size() +
|
||||
TypeHandler<T7>::size() +
|
||||
TypeHandler<T8>::size() +
|
||||
TypeHandler<T9>::size();
|
||||
return TypeHandler<T0>::size() + TypeHandler<T1>::size() + TypeHandler<T2>::size() + TypeHandler<T3>::size()
|
||||
+ TypeHandler<T4>::size() + TypeHandler<T5>::size() + TypeHandler<T6>::size() + TypeHandler<T7>::size()
|
||||
+ TypeHandler<T8>::size() + TypeHandler<T9>::size();
|
||||
}
|
||||
|
||||
static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt)
|
||||
@ -1537,15 +1402,9 @@ public:
|
||||
|
||||
static std::size_t size()
|
||||
{
|
||||
return TypeHandler<T0>::size() +
|
||||
TypeHandler<T1>::size() +
|
||||
TypeHandler<T2>::size() +
|
||||
TypeHandler<T3>::size() +
|
||||
TypeHandler<T4>::size() +
|
||||
TypeHandler<T5>::size() +
|
||||
TypeHandler<T6>::size() +
|
||||
TypeHandler<T7>::size() +
|
||||
TypeHandler<T8>::size();
|
||||
return TypeHandler<T0>::size() + TypeHandler<T1>::size() + TypeHandler<T2>::size() + TypeHandler<T3>::size()
|
||||
+ TypeHandler<T4>::size() + TypeHandler<T5>::size() + TypeHandler<T6>::size() + TypeHandler<T7>::size()
|
||||
+ TypeHandler<T8>::size();
|
||||
}
|
||||
|
||||
static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt)
|
||||
@ -1603,14 +1462,8 @@ public:
|
||||
|
||||
static std::size_t size()
|
||||
{
|
||||
return TypeHandler<T0>::size() +
|
||||
TypeHandler<T1>::size() +
|
||||
TypeHandler<T2>::size() +
|
||||
TypeHandler<T3>::size() +
|
||||
TypeHandler<T4>::size() +
|
||||
TypeHandler<T5>::size() +
|
||||
TypeHandler<T6>::size() +
|
||||
TypeHandler<T7>::size();
|
||||
return TypeHandler<T0>::size() + TypeHandler<T1>::size() + TypeHandler<T2>::size() + TypeHandler<T3>::size()
|
||||
+ TypeHandler<T4>::size() + TypeHandler<T5>::size() + TypeHandler<T6>::size() + TypeHandler<T7>::size();
|
||||
}
|
||||
|
||||
static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt)
|
||||
@ -1665,13 +1518,8 @@ public:
|
||||
|
||||
static std::size_t size()
|
||||
{
|
||||
return TypeHandler<T0>::size() +
|
||||
TypeHandler<T1>::size() +
|
||||
TypeHandler<T2>::size() +
|
||||
TypeHandler<T3>::size() +
|
||||
TypeHandler<T4>::size() +
|
||||
TypeHandler<T5>::size() +
|
||||
TypeHandler<T6>::size();
|
||||
return TypeHandler<T0>::size() + TypeHandler<T1>::size() + TypeHandler<T2>::size() + TypeHandler<T3>::size()
|
||||
+ TypeHandler<T4>::size() + TypeHandler<T5>::size() + TypeHandler<T6>::size();
|
||||
}
|
||||
|
||||
static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt)
|
||||
@ -1723,12 +1571,8 @@ public:
|
||||
|
||||
static std::size_t size()
|
||||
{
|
||||
return TypeHandler<T0>::size() +
|
||||
TypeHandler<T1>::size() +
|
||||
TypeHandler<T2>::size() +
|
||||
TypeHandler<T3>::size() +
|
||||
TypeHandler<T4>::size() +
|
||||
TypeHandler<T5>::size();
|
||||
return TypeHandler<T0>::size() + TypeHandler<T1>::size() + TypeHandler<T2>::size() + TypeHandler<T3>::size()
|
||||
+ TypeHandler<T4>::size() + TypeHandler<T5>::size();
|
||||
}
|
||||
|
||||
static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt)
|
||||
@ -1777,11 +1621,8 @@ public:
|
||||
|
||||
static std::size_t size()
|
||||
{
|
||||
return TypeHandler<T0>::size() +
|
||||
TypeHandler<T1>::size() +
|
||||
TypeHandler<T2>::size() +
|
||||
TypeHandler<T3>::size() +
|
||||
TypeHandler<T4>::size();
|
||||
return TypeHandler<T0>::size() + TypeHandler<T1>::size() + TypeHandler<T2>::size() + TypeHandler<T3>::size()
|
||||
+ TypeHandler<T4>::size();
|
||||
}
|
||||
|
||||
static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt)
|
||||
@ -1827,10 +1668,7 @@ public:
|
||||
|
||||
static std::size_t size()
|
||||
{
|
||||
return TypeHandler<T0>::size() +
|
||||
TypeHandler<T1>::size() +
|
||||
TypeHandler<T2>::size() +
|
||||
TypeHandler<T3>::size();
|
||||
return TypeHandler<T0>::size() + TypeHandler<T1>::size() + TypeHandler<T2>::size() + TypeHandler<T3>::size();
|
||||
}
|
||||
|
||||
static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt)
|
||||
@ -1871,12 +1709,7 @@ public:
|
||||
tuplePrepare<TupleConstRef, T2, 2>(pos, tuple, pPreparator);
|
||||
}
|
||||
|
||||
static std::size_t size()
|
||||
{
|
||||
return TypeHandler<T0>::size() +
|
||||
TypeHandler<T1>::size() +
|
||||
TypeHandler<T2>::size();
|
||||
}
|
||||
static std::size_t size() { return TypeHandler<T0>::size() + TypeHandler<T1>::size() + TypeHandler<T2>::size(); }
|
||||
|
||||
static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt)
|
||||
{
|
||||
@ -1913,11 +1746,7 @@ public:
|
||||
tuplePrepare<TupleConstRef, T1, 1>(pos, tuple, pPreparator);
|
||||
}
|
||||
|
||||
static std::size_t size()
|
||||
{
|
||||
return TypeHandler<T0>::size() +
|
||||
TypeHandler<T1>::size();
|
||||
}
|
||||
static std::size_t size() { return TypeHandler<T0>::size() + TypeHandler<T1>::size(); }
|
||||
|
||||
static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt)
|
||||
{
|
||||
@ -1951,13 +1780,9 @@ public:
|
||||
tuplePrepare<TupleConstRef, T0, 0>(pos, tuple, pPreparator);
|
||||
}
|
||||
|
||||
static std::size_t size()
|
||||
{
|
||||
return TypeHandler<T0>::size();
|
||||
}
|
||||
static std::size_t size() { return TypeHandler<T0>::size(); }
|
||||
|
||||
static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal,
|
||||
AbstractExtractor::Ptr pExt)
|
||||
static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt)
|
||||
{
|
||||
poco_assert_dbg(!pExt.isNull());
|
||||
tupleExtract<TupleRef, TupleConstRef, T0, 0>(pos, tuple, defVal, pExt);
|
||||
@ -1980,10 +1805,7 @@ public:
|
||||
TypeHandler<V>::bind(pos, obj.second, pBinder, dir);
|
||||
}
|
||||
|
||||
static std::size_t size()
|
||||
{
|
||||
return static_cast<std::size_t>(TypeHandler<K>::size() + TypeHandler<V>::size());
|
||||
}
|
||||
static std::size_t size() { return static_cast<std::size_t>(TypeHandler<K>::size() + TypeHandler<V>::size()); }
|
||||
|
||||
static void extract(std::size_t pos, std::pair<K, V> & obj, const std::pair<K, V> & defVal, AbstractExtractor::Ptr pExt)
|
||||
{
|
||||
@ -2016,10 +1838,7 @@ public:
|
||||
TypeHandler<T>::bind(pos, *obj, pBinder, dir);
|
||||
}
|
||||
|
||||
static std::size_t size()
|
||||
{
|
||||
return static_cast<std::size_t>(TypeHandler<T>::size());
|
||||
}
|
||||
static std::size_t size() { return static_cast<std::size_t>(TypeHandler<T>::size()); }
|
||||
|
||||
static void extract(std::size_t pos, Poco::AutoPtr<T> & obj, const Poco::AutoPtr<T> & defVal, AbstractExtractor::Ptr pExt)
|
||||
{
|
||||
@ -2044,7 +1863,6 @@ private:
|
||||
};
|
||||
|
||||
|
||||
|
||||
template <class T>
|
||||
class TypeHandler<Poco::SharedPtr<T>> : public AbstractTypeHandler
|
||||
/// Specialization of type handler for Poco::SharedPtr
|
||||
@ -2056,10 +1874,7 @@ public:
|
||||
TypeHandler<T>::bind(pos, *obj, pBinder, dir);
|
||||
}
|
||||
|
||||
static std::size_t size()
|
||||
{
|
||||
return static_cast<std::size_t>(TypeHandler<T>::size());
|
||||
}
|
||||
static std::size_t size() { return static_cast<std::size_t>(TypeHandler<T>::size()); }
|
||||
|
||||
static void extract(std::size_t pos, Poco::SharedPtr<T> & obj, const Poco::SharedPtr<T> & defVal, AbstractExtractor::Ptr pExt)
|
||||
{
|
||||
@ -2084,7 +1899,8 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
}
|
||||
} // namespace Poco::Data
|
||||
|
||||
|
||||
#endif // Data_TypeHandler_INCLUDED
|
||||
|
@ -22,7 +22,8 @@
|
||||
#include "Poco/TextEncoding.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Poco
|
||||
{
|
||||
|
||||
|
||||
class Foundation_API ASCIIEncoding : public TextEncoding
|
||||
|
@ -18,20 +18,21 @@
|
||||
#define Foundation_AbstractCache_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/KeyValueArgs.h"
|
||||
#include "Poco/ValidArgs.h"
|
||||
#include "Poco/Mutex.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include "Poco/FIFOEvent.h"
|
||||
#include "Poco/EventArgs.h"
|
||||
#include "Poco/Delegate.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
#include <cstddef>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <cstddef>
|
||||
#include "Poco/Delegate.h"
|
||||
#include "Poco/EventArgs.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include "Poco/FIFOEvent.h"
|
||||
#include "Poco/KeyValueArgs.h"
|
||||
#include "Poco/Mutex.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
#include "Poco/ValidArgs.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Poco
|
||||
{
|
||||
|
||||
|
||||
template <class TKey, class TValue, class TStrategy, class TMutex = FastMutex, class TEventMutex = FastMutex>
|
||||
@ -50,16 +51,9 @@ public:
|
||||
typedef typename DataHolder::const_iterator ConstIterator;
|
||||
typedef std::set<TKey> KeySet;
|
||||
|
||||
AbstractCache()
|
||||
{
|
||||
initialize();
|
||||
}
|
||||
AbstractCache() { initialize(); }
|
||||
|
||||
AbstractCache(const TStrategy & strategy)
|
||||
: _strategy(strategy)
|
||||
{
|
||||
initialize();
|
||||
}
|
||||
AbstractCache(const TStrategy & strategy) : _strategy(strategy) { initialize(); }
|
||||
|
||||
virtual ~AbstractCache()
|
||||
{
|
||||
|
@ -21,7 +21,8 @@
|
||||
#include "Poco/Foundation.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Poco
|
||||
{
|
||||
|
||||
|
||||
template <class TArgs>
|
||||
@ -29,17 +30,11 @@ class AbstractDelegate
|
||||
/// Base class for Delegate and Expire.
|
||||
{
|
||||
public:
|
||||
AbstractDelegate()
|
||||
{
|
||||
}
|
||||
AbstractDelegate() { }
|
||||
|
||||
AbstractDelegate(const AbstractDelegate& /*del*/)
|
||||
{
|
||||
}
|
||||
AbstractDelegate(const AbstractDelegate & /*del*/) { }
|
||||
|
||||
virtual ~AbstractDelegate()
|
||||
{
|
||||
}
|
||||
virtual ~AbstractDelegate() { }
|
||||
|
||||
virtual bool notify(const void * sender, TArgs & arguments) = 0;
|
||||
/// Invokes the delegate's callback function.
|
||||
@ -69,17 +64,11 @@ class AbstractDelegate<void>
|
||||
/// Base class for Delegate and Expire.
|
||||
{
|
||||
public:
|
||||
AbstractDelegate()
|
||||
{
|
||||
}
|
||||
AbstractDelegate() { }
|
||||
|
||||
AbstractDelegate(const AbstractDelegate&)
|
||||
{
|
||||
}
|
||||
AbstractDelegate(const AbstractDelegate &) { }
|
||||
|
||||
virtual ~AbstractDelegate()
|
||||
{
|
||||
}
|
||||
virtual ~AbstractDelegate() { }
|
||||
|
||||
virtual bool notify(const void * sender) = 0;
|
||||
/// Invokes the delegate's callback function.
|
||||
|
@ -18,15 +18,16 @@
|
||||
#define Foundation_AbstractFoundation_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
#include "Poco/SingletonHolder.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
#include "Poco/ActiveResult.h"
|
||||
#include "Poco/ActiveMethod.h"
|
||||
#include "Poco/ActiveResult.h"
|
||||
#include "Poco/Foundation.h"
|
||||
#include "Poco/Mutex.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
#include "Poco/SingletonHolder.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Poco
|
||||
{
|
||||
|
||||
|
||||
template <class TArgs, class TStrategy, class TDelegate, class TMutex = FastMutex>
|
||||
@ -152,22 +153,13 @@ public:
|
||||
typedef TDelegate * DelegateHandle;
|
||||
typedef TArgs Args;
|
||||
|
||||
AbstractEvent():
|
||||
_executeAsync(this, &AbstractEvent::executeAsyncImpl),
|
||||
_enabled(true)
|
||||
AbstractEvent() : _executeAsync(this, &AbstractEvent::executeAsyncImpl), _enabled(true) { }
|
||||
|
||||
AbstractEvent(const TStrategy & strategy) : _executeAsync(this, &AbstractEvent::executeAsyncImpl), _strategy(strategy), _enabled(true)
|
||||
{
|
||||
}
|
||||
|
||||
AbstractEvent(const TStrategy& strategy):
|
||||
_executeAsync(this, &AbstractEvent::executeAsyncImpl),
|
||||
_strategy(strategy),
|
||||
_enabled(true)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~AbstractEvent()
|
||||
{
|
||||
}
|
||||
virtual ~AbstractEvent() { }
|
||||
|
||||
void operator+=(const TDelegate & aDelegate)
|
||||
/// Adds a delegate to the event.
|
||||
@ -234,7 +226,8 @@ public:
|
||||
{
|
||||
Poco::ScopedLockWithUnlock<TMutex> lock(_mutex);
|
||||
|
||||
if (!_enabled) return;
|
||||
if (!_enabled)
|
||||
return;
|
||||
|
||||
// thread-safeness:
|
||||
// copy should be faster and safer than blocking until
|
||||
@ -244,9 +237,7 @@ public:
|
||||
strategy.notify(pSender, args);
|
||||
}
|
||||
|
||||
bool hasDelegates() const {
|
||||
return !empty();
|
||||
}
|
||||
bool hasDelegates() const { return !empty(); }
|
||||
|
||||
ActiveResult<TArgs> notifyAsync(const void * pSender, const TArgs & args)
|
||||
/// Sends a notification to all registered delegates. The order is
|
||||
@ -358,22 +349,13 @@ class AbstractEvent<void, TStrategy, TDelegate, TMutex>
|
||||
public:
|
||||
typedef TDelegate * DelegateHandle;
|
||||
|
||||
AbstractEvent():
|
||||
_executeAsync(this, &AbstractEvent::executeAsyncImpl),
|
||||
_enabled(true)
|
||||
AbstractEvent() : _executeAsync(this, &AbstractEvent::executeAsyncImpl), _enabled(true) { }
|
||||
|
||||
AbstractEvent(const TStrategy & strategy) : _executeAsync(this, &AbstractEvent::executeAsyncImpl), _strategy(strategy), _enabled(true)
|
||||
{
|
||||
}
|
||||
|
||||
AbstractEvent(const TStrategy& strategy):
|
||||
_executeAsync(this, &AbstractEvent::executeAsyncImpl),
|
||||
_strategy(strategy),
|
||||
_enabled(true)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~AbstractEvent()
|
||||
{
|
||||
}
|
||||
virtual ~AbstractEvent() { }
|
||||
|
||||
void operator+=(const TDelegate & aDelegate)
|
||||
/// Adds a delegate to the event.
|
||||
@ -440,7 +422,8 @@ public:
|
||||
{
|
||||
Poco::ScopedLockWithUnlock<TMutex> lock(_mutex);
|
||||
|
||||
if (!_enabled) return;
|
||||
if (!_enabled)
|
||||
return;
|
||||
|
||||
// thread-safeness:
|
||||
// copy should be faster and safer than blocking until
|
||||
|
@ -22,7 +22,8 @@
|
||||
#include "Poco/Notification.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Poco
|
||||
{
|
||||
|
||||
|
||||
class Foundation_API AbstractObserver
|
||||
|
@ -18,11 +18,12 @@
|
||||
#define Foundation_AbstractPriorityDelegate_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
#include "Poco/AbstractDelegate.h"
|
||||
#include "Poco/Foundation.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Poco
|
||||
{
|
||||
|
||||
|
||||
template <class TArgs>
|
||||
@ -32,25 +33,13 @@ class AbstractPriorityDelegate: public AbstractDelegate<TArgs>
|
||||
/// Extends AbstractDelegate with a priority value.
|
||||
{
|
||||
public:
|
||||
AbstractPriorityDelegate(int prio):
|
||||
_priority(prio)
|
||||
{
|
||||
}
|
||||
AbstractPriorityDelegate(int prio) : _priority(prio) { }
|
||||
|
||||
AbstractPriorityDelegate(const AbstractPriorityDelegate& del):
|
||||
AbstractDelegate<TArgs>(del),
|
||||
_priority(del._priority)
|
||||
{
|
||||
}
|
||||
AbstractPriorityDelegate(const AbstractPriorityDelegate & del) : AbstractDelegate<TArgs>(del), _priority(del._priority) { }
|
||||
|
||||
virtual ~AbstractPriorityDelegate()
|
||||
{
|
||||
}
|
||||
virtual ~AbstractPriorityDelegate() { }
|
||||
|
||||
int priority() const
|
||||
{
|
||||
return _priority;
|
||||
}
|
||||
int priority() const { return _priority; }
|
||||
|
||||
protected:
|
||||
int _priority;
|
||||
|
@ -18,13 +18,14 @@
|
||||
#define Foundation_AbstractStrategy_INCLUDED
|
||||
|
||||
|
||||
#include <set>
|
||||
#include "Poco/EventArgs.h"
|
||||
#include "Poco/KeyValueArgs.h"
|
||||
#include "Poco/ValidArgs.h"
|
||||
#include "Poco/EventArgs.h"
|
||||
#include <set>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Poco
|
||||
{
|
||||
|
||||
|
||||
template <class TKey, class TValue>
|
||||
@ -32,13 +33,9 @@ class AbstractStrategy
|
||||
/// An AbstractStrategy is the interface for all strategies.
|
||||
{
|
||||
public:
|
||||
AbstractStrategy()
|
||||
{
|
||||
}
|
||||
AbstractStrategy() { }
|
||||
|
||||
virtual ~AbstractStrategy()
|
||||
{
|
||||
}
|
||||
virtual ~AbstractStrategy() { }
|
||||
|
||||
virtual void onUpdate(const void * pSender, const KeyValueArgs<TKey, TValue> & args)
|
||||
/// Updates an existing entry.
|
||||
|
@ -18,11 +18,12 @@
|
||||
#define Foundation_AccessExpirationDecorator_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Timestamp.h"
|
||||
#include "Poco/Timespan.h"
|
||||
#include "Poco/Timestamp.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Poco
|
||||
{
|
||||
|
||||
|
||||
template <typename TArgs>
|
||||
@ -31,45 +32,30 @@ class AccessExpirationDecorator
|
||||
/// with the UniqueAccessExpireCache
|
||||
{
|
||||
public:
|
||||
AccessExpirationDecorator():
|
||||
_value(),
|
||||
_span()
|
||||
AccessExpirationDecorator() : _value(), _span() { }
|
||||
|
||||
AccessExpirationDecorator(const TArgs & p, const Poco::Timespan::TimeDiff & diffInMs)
|
||||
: /// Creates an element that will expire in diff milliseconds
|
||||
_value(p)
|
||||
, _span(diffInMs * 1000)
|
||||
{
|
||||
}
|
||||
|
||||
AccessExpirationDecorator(const TArgs& p, const Poco::Timespan::TimeDiff& diffInMs):
|
||||
/// Creates an element that will expire in diff milliseconds
|
||||
_value(p),
|
||||
_span(diffInMs*1000)
|
||||
{
|
||||
}
|
||||
|
||||
AccessExpirationDecorator(const TArgs& p, const Poco::Timespan& timeSpan):
|
||||
/// Creates an element that will expire after the given timeSpan
|
||||
_value(p),
|
||||
_span(timeSpan)
|
||||
AccessExpirationDecorator(const TArgs & p, const Poco::Timespan & timeSpan)
|
||||
: /// Creates an element that will expire after the given timeSpan
|
||||
_value(p)
|
||||
, _span(timeSpan)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
~AccessExpirationDecorator()
|
||||
{
|
||||
}
|
||||
~AccessExpirationDecorator() { }
|
||||
|
||||
const Poco::Timespan& getTimeout() const
|
||||
{
|
||||
return _span;
|
||||
}
|
||||
const Poco::Timespan & getTimeout() const { return _span; }
|
||||
|
||||
const TArgs& value() const
|
||||
{
|
||||
return _value;
|
||||
}
|
||||
const TArgs & value() const { return _value; }
|
||||
|
||||
TArgs& value()
|
||||
{
|
||||
return _value;
|
||||
}
|
||||
TArgs & value() { return _value; }
|
||||
|
||||
private:
|
||||
TArgs _value;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user