mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-12 10:13:51 +01:00
Remove trailing whitespace (#3668)
This commit is contained in:
parent
0af9524e16
commit
0e6e16645c
@ -12,5 +12,5 @@ vc.project.compiler.defines =
|
||||
vc.project.compiler.defines.shared =
|
||||
vc.project.compiler.defines.debug_shared = ${vc.project.compiler.defines.shared}
|
||||
vc.project.compiler.defines.release_shared = ${vc.project.compiler.defines.shared}
|
||||
vc.project.linker.dependencies =
|
||||
vc.project.linker.dependencies =
|
||||
vc.solution.create = true
|
||||
|
@ -16,7 +16,7 @@ file (usually <[httpd.conf]>):
|
||||
|
||||
LoadModule poco_module modules/mod_pocod.so
|
||||
----
|
||||
|
||||
|
||||
!!!Configuring ApacheConnector
|
||||
ApacheConnector must be able to find shared libraries containing request handler, as well
|
||||
as optional configuration files. ApacheConnector provides an Poco::Util::Application class
|
||||
@ -30,7 +30,7 @@ is used in the Apache configuration file:
|
||||
|
||||
AddPocoRequestHandler <FactoryClass> <SharedLibrary> <Path>...
|
||||
----
|
||||
|
||||
|
||||
The first argument specifies the name of the request handler factory class. The second argument
|
||||
contains the path of the shared library containing the request handler.
|
||||
The third (and optionally following) argument(s) specify the URI paths handled by the
|
||||
@ -38,7 +38,7 @@ request handler. For example:
|
||||
|
||||
AddPocoRequestHandler TimeRequestHandlerFactory p:/Poco/ApacheConnector/samples/TimeServer/bin/TimeServerd.dll /time
|
||||
----
|
||||
|
||||
|
||||
loads the TimeRequestHandlerFactory from TimeServerd.dll. Whenever a request for a URI starting with "/time"
|
||||
is sent by a client, this request will be handled by the TimeRequestHandler.
|
||||
|
||||
@ -76,8 +76,8 @@ Following is a sample for a request handler implementation. The complete sample
|
||||
#include "Poco/DateTimeFormatter.h"
|
||||
#include "Poco/DateTimeFormat.h"
|
||||
#include "Poco/ClassLibrary.h"
|
||||
|
||||
|
||||
|
||||
|
||||
using Poco::Net::HTTPRequestHandler;
|
||||
using Poco::Net::HTTPRequestHandlerFactory;
|
||||
using Poco::Net::HTTPServerRequest;
|
||||
@ -85,24 +85,24 @@ Following is a sample for a request handler implementation. The complete sample
|
||||
using Poco::Timestamp;
|
||||
using Poco::DateTimeFormatter;
|
||||
using Poco::DateTimeFormat;
|
||||
|
||||
|
||||
|
||||
|
||||
class TimeRequestHandler: public HTTPRequestHandler
|
||||
/// Return a HTML document with the current date and time.
|
||||
{
|
||||
public:
|
||||
TimeRequestHandler()
|
||||
TimeRequestHandler()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response)
|
||||
{
|
||||
Timestamp now;
|
||||
std::string dt(DateTimeFormatter::format(now, DateTimeFormat::SORTABLE_FORMAT));
|
||||
|
||||
|
||||
response.setChunkedTransferEncoding(true);
|
||||
response.setContentType("text/html");
|
||||
|
||||
|
||||
std::ostream& ostr = response.send();
|
||||
ostr << "<html><head><title>TimeServer powered by POCO ApacheConnector</title>";
|
||||
ostr << "<meta http-equiv=\"refresh\" content=\"1\"></head>";
|
||||
@ -111,22 +111,22 @@ Following is a sample for a request handler implementation. The complete sample
|
||||
ostr << "</p></body></html>";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class TimeRequestHandlerFactory: public HTTPRequestHandlerFactory
|
||||
{
|
||||
public:
|
||||
TimeRequestHandlerFactory()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
HTTPRequestHandler* createRequestHandler(const HTTPServerRequest& request)
|
||||
{
|
||||
return new TimeRequestHandler;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
POCO_BEGIN_MANIFEST(HTTPRequestHandlerFactory)
|
||||
POCO_EXPORT_CLASS(TimeRequestHandlerFactory)
|
||||
POCO_END_MANIFEST
|
||||
|
@ -25,7 +25,7 @@ class ApacheRequestRec
|
||||
public:
|
||||
ApacheRequestRec(request_rec* _pRec);
|
||||
/// Creates the ApacheRequestRec;
|
||||
|
||||
|
||||
bool haveRequestBody();
|
||||
/// Returns true if the request contains a body.
|
||||
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
|
||||
private:
|
||||
typedef std::map<std::string, Poco::Net::HTTPRequestHandlerFactory*> RequestHandlerFactories;
|
||||
|
||||
|
||||
RequestHandlerFactories _requestHandlers;
|
||||
Poco::ClassLoader<Poco::Net::HTTPRequestHandlerFactory> _loader;
|
||||
Poco::FastMutex _mutex;
|
||||
|
@ -25,10 +25,10 @@ class ApacheServerRequest: public Poco::Net::HTTPServerRequest
|
||||
{
|
||||
public:
|
||||
ApacheServerRequest(
|
||||
ApacheRequestRec* pApacheRequest,
|
||||
const char* serverName,
|
||||
int serverPort,
|
||||
const char* clientName,
|
||||
ApacheRequestRec* pApacheRequest,
|
||||
const char* serverName,
|
||||
int serverPort,
|
||||
const char* clientName,
|
||||
int clientPort);
|
||||
/// Creates a new ApacheServerRequest.
|
||||
|
||||
@ -73,7 +73,7 @@ private:
|
||||
ApacheInputStream* _pStream;
|
||||
Poco::Net::SocketAddress _serverAddress;
|
||||
Poco::Net::SocketAddress _clientAddress;
|
||||
|
||||
|
||||
friend class ApacheServerResponse;
|
||||
};
|
||||
|
||||
@ -84,7 +84,7 @@ private:
|
||||
inline std::istream& ApacheServerRequest::stream()
|
||||
{
|
||||
poco_check_ptr (_pStream);
|
||||
|
||||
|
||||
return *_pStream;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
void sendContinue();
|
||||
/// Sends a 100 Continue response to the
|
||||
/// client.
|
||||
|
||||
|
||||
void sendErrorResponse(int status);
|
||||
/// Sends an error response with the given
|
||||
/// status back to the client.
|
||||
@ -55,20 +55,20 @@ public:
|
||||
/// The returned stream is valid until the response
|
||||
/// object is destroyed.
|
||||
///
|
||||
/// Must not be called after sendFile(), sendBuffer()
|
||||
/// Must not be called after sendFile(), sendBuffer()
|
||||
/// or redirect() has been called.
|
||||
|
||||
|
||||
void sendFile(const std::string& path, const std::string& mediaType);
|
||||
/// Sends the response header to the client, followed
|
||||
/// by the content of the given file.
|
||||
///
|
||||
/// Must not be called after send(), sendBuffer()
|
||||
/// Must not be called after send(), sendBuffer()
|
||||
/// or redirect() has been called.
|
||||
///
|
||||
/// Throws a FileNotFoundException if the file
|
||||
/// cannot be found, or an OpenFileException if
|
||||
/// the file cannot be opened.
|
||||
|
||||
|
||||
void sendBuffer(const void* pBuffer, std::size_t length);
|
||||
/// Sends the response header to the client, followed
|
||||
/// by the contents of the given buffer.
|
||||
@ -77,12 +77,12 @@ public:
|
||||
/// to length and chunked transfer encoding is disabled.
|
||||
///
|
||||
/// If both the HTTP message header and body (from the
|
||||
/// given buffer) fit into one single network packet, the
|
||||
/// given buffer) fit into one single network packet, the
|
||||
/// complete response can be sent in one network packet.
|
||||
///
|
||||
/// Must not be called after send(), sendFile()
|
||||
/// Must not be called after send(), sendFile()
|
||||
/// or redirect() has been called.
|
||||
|
||||
|
||||
void redirect(const std::string& uri, Poco::Net::HTTPResponse::HTTPStatus status);
|
||||
/// Sets the status code, which must be one of
|
||||
/// HTTP_MOVED_PERMANENTLY (301), HTTP_FOUND (302),
|
||||
@ -92,12 +92,12 @@ public:
|
||||
/// the HTTP specification, must be absolute.
|
||||
///
|
||||
/// Must not be called after send() has been called.
|
||||
|
||||
|
||||
void requireAuthentication(const std::string& realm);
|
||||
/// Sets the status code to 401 (Unauthorized)
|
||||
/// and sets the "WWW-Authenticate" header field
|
||||
/// according to the given realm.
|
||||
|
||||
|
||||
bool sent() const;
|
||||
/// Returns true if the response (header) has been sent.
|
||||
|
||||
|
@ -33,7 +33,7 @@ protected:
|
||||
int writeToDevice(const char* buffer, std::streamsize length);
|
||||
|
||||
private:
|
||||
enum
|
||||
enum
|
||||
{
|
||||
STREAM_BUFFER_SIZE = 1024
|
||||
};
|
||||
@ -53,15 +53,15 @@ class ApacheIOS: public virtual std::ios
|
||||
public:
|
||||
ApacheIOS(ApacheRequestRec* pApacheRequest, bool haveData = false);
|
||||
/// Creates the ApacheIOS with the given socket.
|
||||
|
||||
|
||||
~ApacheIOS();
|
||||
/// Destroys the ApacheIOS.
|
||||
///
|
||||
/// Flushes the buffer, but does not close the socket.
|
||||
|
||||
|
||||
ApacheStreamBuf* rdbuf();
|
||||
/// Returns a pointer to the internal ApacheStreamBuf.
|
||||
|
||||
|
||||
void close();
|
||||
/// Flushes the stream.
|
||||
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
_length(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void handlePart(const MessageHeader& header, std::istream& stream)
|
||||
{
|
||||
_type = header.get("Content-Type", "(unspecified)");
|
||||
@ -52,18 +52,18 @@ public:
|
||||
_name = params.get("name", "(unnamed)");
|
||||
_fileName = params.get("filename", "(unnamed)");
|
||||
}
|
||||
|
||||
|
||||
CountingInputStream istr(stream);
|
||||
NullOutputStream ostr;
|
||||
StreamCopier::copyStream(istr, ostr);
|
||||
_length = istr.chars();
|
||||
}
|
||||
|
||||
|
||||
int length() const
|
||||
{
|
||||
return _length;
|
||||
}
|
||||
|
||||
|
||||
const std::string& name() const
|
||||
{
|
||||
return _name;
|
||||
@ -73,12 +73,12 @@ public:
|
||||
{
|
||||
return _fileName;
|
||||
}
|
||||
|
||||
|
||||
const std::string& contentType() const
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
int _length;
|
||||
std::string _type;
|
||||
@ -91,10 +91,10 @@ class FormRequestHandler: public HTTPRequestHandler
|
||||
/// Return a HTML document with the current date and time.
|
||||
{
|
||||
public:
|
||||
FormRequestHandler()
|
||||
FormRequestHandler()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response)
|
||||
{
|
||||
MyPartHandler partHandler;
|
||||
@ -104,7 +104,7 @@ public:
|
||||
response.setContentType("text/html");
|
||||
|
||||
std::ostream& ostr = response.send();
|
||||
|
||||
|
||||
ostr <<
|
||||
"<html>\n"
|
||||
"<head>\n"
|
||||
@ -127,7 +127,7 @@ public:
|
||||
"<input type=\"file\" name=\"file\" size=\"31\"> \n"
|
||||
"<input type=\"submit\" value=\"Upload\">\n"
|
||||
"</form>\n";
|
||||
|
||||
|
||||
ostr << "<h2>Request</h2><p>\n";
|
||||
ostr << "Method: " << request.getMethod() << "<br>\n";
|
||||
ostr << "URI: " << request.getURI() << "<br>\n";
|
||||
@ -150,7 +150,7 @@ public:
|
||||
}
|
||||
ostr << "</p>";
|
||||
}
|
||||
|
||||
|
||||
if (!partHandler.name().empty())
|
||||
{
|
||||
ostr << "<h2>Upload</h2><p>\n";
|
||||
|
@ -32,10 +32,10 @@ class TimeRequestHandler: public HTTPRequestHandler
|
||||
/// Return a HTML document with the current date and time.
|
||||
{
|
||||
public:
|
||||
TimeRequestHandler()
|
||||
TimeRequestHandler()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response)
|
||||
{
|
||||
Timestamp now;
|
||||
|
@ -35,7 +35,7 @@ ApacheApplication::~ApacheApplication()
|
||||
void ApacheApplication::setup()
|
||||
{
|
||||
FastMutex::ScopedLock lock(_mutex);
|
||||
|
||||
|
||||
if (!_ready)
|
||||
{
|
||||
std::vector<std::string> cmdLine;
|
||||
|
@ -34,7 +34,7 @@ ApacheRequestHandlerFactory::~ApacheRequestHandlerFactory()
|
||||
Poco::Net::HTTPRequestHandler* ApacheRequestHandlerFactory::createRequestHandler(const Poco::Net::HTTPServerRequest& request)
|
||||
{
|
||||
FastMutex::ScopedLock lock(_mutex);
|
||||
|
||||
|
||||
// only if the given uri is found in _uris we are
|
||||
// handling this request.
|
||||
RequestHandlerFactories::iterator it = _requestHandlers.begin();
|
||||
@ -75,7 +75,7 @@ void ApacheRequestHandlerFactory::handleURIs(const std::string& uris)
|
||||
|
||||
|
||||
void ApacheRequestHandlerFactory::addRequestHandlerFactory(const std::string& dllPath, const std::string& factoryName, const std::string& uri)
|
||||
{
|
||||
{
|
||||
try
|
||||
{
|
||||
_loader.loadLibrary(dllPath);
|
||||
|
@ -16,10 +16,10 @@
|
||||
|
||||
|
||||
ApacheServerRequest::ApacheServerRequest(
|
||||
ApacheRequestRec* pApacheRequest,
|
||||
const char* serverName,
|
||||
int serverPort,
|
||||
const char* clientName,
|
||||
ApacheRequestRec* pApacheRequest,
|
||||
const char* serverName,
|
||||
int serverPort,
|
||||
const char* clientName,
|
||||
int clientPort):
|
||||
_pApacheRequest(pApacheRequest),
|
||||
_pResponse(0),
|
||||
|
@ -52,7 +52,7 @@ void ApacheServerResponse::initApacheOutputStream()
|
||||
|
||||
std::vector<HTTPCookie> cookies;
|
||||
getCookies(cookies);
|
||||
|
||||
|
||||
std::size_t cnt = cookies.size();
|
||||
for (int c = 0; c < cnt; c++)
|
||||
{
|
||||
@ -77,7 +77,7 @@ void ApacheServerResponse::sendContinue()
|
||||
std::ostream& ApacheServerResponse::send()
|
||||
{
|
||||
poco_assert (!_pStream);
|
||||
|
||||
|
||||
initApacheOutputStream();
|
||||
|
||||
return *_pStream;
|
||||
@ -124,7 +124,7 @@ void ApacheServerResponse::redirect(const std::string& uri, HTTPStatus status)
|
||||
|
||||
|
||||
void ApacheServerResponse::sendErrorResponse(int status)
|
||||
{
|
||||
{
|
||||
initApacheOutputStream();
|
||||
|
||||
_pApacheRequest->sendErrorResponse(status);
|
||||
|
@ -21,7 +21,7 @@ using Poco::BufferedStreamBuf;
|
||||
//
|
||||
|
||||
|
||||
ApacheStreamBuf::ApacheStreamBuf(ApacheRequestRec* pApacheRequest, bool haveData):
|
||||
ApacheStreamBuf::ApacheStreamBuf(ApacheRequestRec* pApacheRequest, bool haveData):
|
||||
BufferedStreamBuf(STREAM_BUFFER_SIZE, std::ios::in | std::ios::out),
|
||||
_pApacheRequest(pApacheRequest),
|
||||
_haveData(haveData)
|
||||
|
@ -34,7 +34,7 @@ class CppParser_API Attributes
|
||||
public:
|
||||
typedef std::map<std::string, std::string> AttrMap;
|
||||
typedef AttrMap::const_iterator Iterator;
|
||||
|
||||
|
||||
Attributes();
|
||||
/// Creates the Attributes object.
|
||||
|
||||
@ -46,15 +46,15 @@ public:
|
||||
|
||||
Attributes& operator = (const Attributes& attrs);
|
||||
/// Assignment operator.
|
||||
|
||||
|
||||
bool has(const std::string& name) const;
|
||||
/// Returns true if an attribute with the given name exists.
|
||||
|
||||
|
||||
std::string getString(const std::string& name) const;
|
||||
/// Returns the attribute's value as a string.
|
||||
///
|
||||
/// Throws a Poco::NotFoundException if the attribute does not exist.
|
||||
|
||||
|
||||
std::string getString(const std::string& name, const std::string& defaultValue) const;
|
||||
/// Returns the attribute's value as a string, if it exists.
|
||||
/// Returns the defaultValue if the attribute does not exist.
|
||||
@ -64,7 +64,7 @@ public:
|
||||
///
|
||||
/// Throws a Poco::NotFoundException if the attribute does not exist.
|
||||
/// Throws a Poco::SyntaxException if the stored value is not an integer.
|
||||
|
||||
|
||||
int getInt(const std::string& name, int defaultValue) const;
|
||||
/// Returns the attribute's value as an integer, if it exists.
|
||||
/// Returns the defaultValue if the attribute does not exist.
|
||||
@ -74,7 +74,7 @@ public:
|
||||
bool getBool(const std::string& name) const;
|
||||
/// Returns the attribute's value as a boolean.
|
||||
/// The returned value is 'true', iff the stored value is not "false".
|
||||
///
|
||||
///
|
||||
/// Throws a Poco::NotFoundException if the attribute does not exist.
|
||||
|
||||
bool getBool(const std::string& name, bool defaultValue) const;
|
||||
@ -83,17 +83,17 @@ public:
|
||||
|
||||
void set(const std::string& name, const std::string& value);
|
||||
/// Sets the value of an attribute.
|
||||
|
||||
|
||||
void remove(const std::string& name);
|
||||
/// Removes the attribute with the given name.
|
||||
/// Does nothing if the attribute does not exist.
|
||||
|
||||
|
||||
const std::string& operator [] (const std::string& name) const;
|
||||
std::string& operator [] (const std::string& name);
|
||||
|
||||
std::string& operator [] (const std::string& name);
|
||||
|
||||
Iterator begin() const;
|
||||
Iterator end() const;
|
||||
|
||||
|
||||
void clear();
|
||||
/// Clears all attributes.
|
||||
|
||||
|
@ -34,13 +34,13 @@ class CppParser_API AttributesParser
|
||||
/// structs/classes, functions, types, etc. can be annotated
|
||||
/// with attributes.
|
||||
///
|
||||
/// Attributes always come immediately before the symbol that
|
||||
/// Attributes always come immediately before the symbol that
|
||||
/// is being annotated, and are written inside special comments
|
||||
/// with the syntax:
|
||||
/// //@ <attrDecl>[,<attrDec>...]
|
||||
/// where <attrDecl> is
|
||||
/// <name>[=<value>]
|
||||
/// <name> is a valid C++ identifier, or two identifiers separated by
|
||||
/// <name> is a valid C++ identifier, or two identifiers separated by
|
||||
/// a period (struct accessor notation).
|
||||
/// <value> is a string, integer, identifier, bool literal, or a complex value
|
||||
/// in the form
|
||||
@ -67,7 +67,7 @@ protected:
|
||||
static bool isOperator(const Poco::Token* pToken, int kind);
|
||||
static bool isLiteral(const Poco::Token* pToken);
|
||||
static bool isEOF(const Poco::Token* pToken);
|
||||
|
||||
|
||||
private:
|
||||
Attributes& _attrs;
|
||||
Tokenizer _tokenizer;
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
FN_DEFAULT = 512, /// The function is default.
|
||||
FN_DELETE = 1024 /// The function has been deleted.
|
||||
};
|
||||
|
||||
|
||||
typedef std::vector<Parameter*> Parameters;
|
||||
typedef Parameters::const_iterator Iterator;
|
||||
|
||||
@ -68,51 +68,51 @@ public:
|
||||
|
||||
Iterator end() const;
|
||||
/// Returns an iterator for iterating over the Function's Parameter's.
|
||||
|
||||
|
||||
void makeInline();
|
||||
/// Sets the FN_INLINE flag.
|
||||
|
||||
|
||||
void makeConst();
|
||||
/// Sets the FN_CONST flag.
|
||||
|
||||
|
||||
void makePureVirtual();
|
||||
/// Sets the FN_PURE_VIRTUAL flag.
|
||||
|
||||
|
||||
void makeFinal();
|
||||
/// Sets the FN_FINAL flag.
|
||||
|
||||
|
||||
void makeOverride();
|
||||
/// Sets the FN_OVERRIDE flag.
|
||||
|
||||
|
||||
void makeNoexcept();
|
||||
/// Sets the FN_NOEXCEPT flag.
|
||||
|
||||
void makeDefault();
|
||||
/// Sets the FN_DEFAULT flag.
|
||||
|
||||
|
||||
void makeDelete();
|
||||
/// Sets the FN_DELETE flag.
|
||||
|
||||
|
||||
int flags() const;
|
||||
/// Returns the function's flags.
|
||||
|
||||
|
||||
bool isConstructor() const;
|
||||
/// Returns true iff the function is a constructor.
|
||||
|
||||
|
||||
bool isDestructor() const;
|
||||
/// Returns true iff the function is a destructor.
|
||||
|
||||
bool isMethod() const;
|
||||
/// Returns true iff the function is a method (it's part of
|
||||
/// a Struct and it's neither a constructor nor a destructor).
|
||||
|
||||
|
||||
bool isFunction() const;
|
||||
/// Returns true iff the function is not a member of a class
|
||||
/// (a freestanding function).
|
||||
|
||||
bool isConst() const;
|
||||
/// Returns true iff the method is const.
|
||||
|
||||
|
||||
bool isDefault() const;
|
||||
/// Returns true iff the method has a default implementation.
|
||||
|
||||
@ -121,20 +121,20 @@ public:
|
||||
|
||||
int countParameters() const;
|
||||
/// Returns the number of parameters.
|
||||
|
||||
|
||||
std::string signature() const;
|
||||
/// Returns the signature of the function.
|
||||
|
||||
|
||||
bool isVirtual() const;
|
||||
/// Returns true if the method is virtual. Also examines base
|
||||
/// classes to check for a virtual function with the same
|
||||
/// signature.
|
||||
|
||||
|
||||
Function* getOverridden() const;
|
||||
/// If the function is virtual and overrides a function in a
|
||||
/// base class, the base class function is returned.
|
||||
/// Otherwise, null is returned.
|
||||
|
||||
|
||||
Symbol::Kind kind() const;
|
||||
std::string toString() const;
|
||||
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
typedef SymbolTable::const_iterator Iterator;
|
||||
typedef std::map<std::string, std::string> AliasMap;
|
||||
typedef std::vector<std::string> NameSpaceVec;
|
||||
|
||||
|
||||
NameSpace();
|
||||
/// Creates the NameSpace.
|
||||
|
||||
@ -46,56 +46,56 @@ public:
|
||||
|
||||
~NameSpace();
|
||||
/// Destroys the NameSpace.
|
||||
|
||||
|
||||
void addSymbol(Symbol* pSymbol);
|
||||
/// Adds a symbol to the namespace.
|
||||
|
||||
|
||||
void importSymbol(const std::string& fullName);
|
||||
/// Imports a symbol from another namespace (using <symbol>).
|
||||
|
||||
|
||||
void importNameSpace(const std::string& nameSpace);
|
||||
/// Imports a namespace (using namespace <namespace>).
|
||||
|
||||
|
||||
Iterator begin() const;
|
||||
/// Returns an iterator for iterating over the NameSpace's Symbol's.
|
||||
|
||||
Iterator end() const;
|
||||
/// Returns an iterator for iterating over the NameSpace's Symbol's.
|
||||
|
||||
|
||||
Symbol* lookup(const std::string& name) const;
|
||||
/// Looks up the given name in the symbol table
|
||||
/// and returns the corresponding symbol, or null
|
||||
/// if no symbol can be found. The name can include
|
||||
/// a namespace.
|
||||
|
||||
|
||||
static NameSpace* root();
|
||||
/// Returns the root namespace. Never delete this one!
|
||||
|
||||
|
||||
void nameSpaces(SymbolTable& table) const;
|
||||
/// Fills the symbol table with all namespaces.
|
||||
|
||||
|
||||
void typeDefs(SymbolTable& table) const;
|
||||
/// Fills the symbol table with all type definitions.
|
||||
|
||||
|
||||
void typeAliases(SymbolTable& table) const;
|
||||
/// Fills the symbol table with all type alias (using) definitions.
|
||||
|
||||
void enums(SymbolTable& table) const;
|
||||
/// Fills the symbol table with all enums.
|
||||
|
||||
|
||||
void classes(SymbolTable& table) const;
|
||||
/// Fills the symbol table with all classes and structs.
|
||||
|
||||
|
||||
void functions(SymbolTable& table) const;
|
||||
/// Fills the symbol table with all functions.
|
||||
|
||||
|
||||
void variables(SymbolTable& table) const;
|
||||
/// Fills the symbol table with all variables.
|
||||
|
||||
|
||||
const AliasMap& importedSymbols() const;
|
||||
/// Returns a const reference to a SymbolTable containing all
|
||||
/// imported symbols.
|
||||
|
||||
|
||||
const NameSpaceVec& importedNameSpaces() const;
|
||||
/// Returns a vector containing all imported namespaces.
|
||||
|
||||
@ -128,7 +128,7 @@ inline const NameSpace::AliasMap& NameSpace::importedSymbols() const
|
||||
return _importedSymbols;
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline const NameSpace::NameSpaceVec& NameSpace::importedNameSpaces() const
|
||||
{
|
||||
return _importedNameSpaces;
|
||||
|
@ -82,7 +82,7 @@ protected:
|
||||
const Poco::Token* parseClassMembers(const Poco::Token* pNext, Struct* pClass);
|
||||
const Poco::Token* parseAccess(const Poco::Token* pNext);
|
||||
const Poco::Token* parseIdentifier(const Poco::Token* pNext, std::string& id);
|
||||
|
||||
|
||||
void addSymbol(Symbol* pSymbol, int lineNumber, bool addGST = true);
|
||||
void pushNameSpace(NameSpace* pNameSpace, int lineNumber, bool addGST = true);
|
||||
void popNameSpace();
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
FN_TEMPLATE_SPECIALIZATION = 4,
|
||||
FN_FINAL = 8
|
||||
};
|
||||
|
||||
|
||||
struct Base
|
||||
{
|
||||
Symbol::Access access;
|
||||
@ -50,7 +50,7 @@ public:
|
||||
std::string name;
|
||||
Struct* pClass;
|
||||
};
|
||||
|
||||
|
||||
typedef std::vector<Base> BaseClasses;
|
||||
typedef BaseClasses::const_iterator BaseIterator;
|
||||
typedef std::vector<Struct*> StructVec;
|
||||
@ -67,13 +67,13 @@ public:
|
||||
|
||||
void addBase(const std::string&, Symbol::Access access, bool isVirtual);
|
||||
/// Adds a base class.
|
||||
|
||||
|
||||
BaseIterator baseBegin() const;
|
||||
/// Returns an iterator for iterating over all base classes.
|
||||
|
||||
|
||||
BaseIterator baseEnd() const;
|
||||
/// Returns an iterator for iterating over all base classes.
|
||||
|
||||
|
||||
void fixupBases();
|
||||
/// Adds pointers for all base classes.
|
||||
|
||||
@ -88,13 +88,13 @@ public:
|
||||
|
||||
const std::string& declaration() const;
|
||||
/// Returns the declaration.
|
||||
|
||||
|
||||
int flags() const;
|
||||
/// Returns the struct's flags.
|
||||
|
||||
void makeInline();
|
||||
/// Changes the class to a inline class, i.e. definition and implementation are hidden in a cpp file.
|
||||
|
||||
|
||||
void makeFinal();
|
||||
/// Makes the class final.
|
||||
|
||||
@ -106,39 +106,39 @@ public:
|
||||
|
||||
void constructors(Functions& functions) const;
|
||||
/// Returns all constructors, sorted by their parameter count.
|
||||
|
||||
|
||||
Function* destructor() const;
|
||||
/// Returns the destructor, or NULL if no
|
||||
/// destructor is defined.
|
||||
|
||||
void methods(Symbol::Access access, Functions& functions) const;
|
||||
/// Returns all functions with the given access.
|
||||
|
||||
|
||||
void inheritedMethods(FunctionSet& functions) const;
|
||||
/// Returns all inherited methods.
|
||||
|
||||
|
||||
void bases(std::set<std::string>& bases) const;
|
||||
/// Returns all base classes.
|
||||
|
||||
|
||||
void derived(StructSet& derived) const;
|
||||
/// Returns all derived classes.
|
||||
|
||||
/// Returns all derived classes.
|
||||
|
||||
Function* findFunction(const std::string& signature) const;
|
||||
/// Finds a function with the given signature.
|
||||
|
||||
|
||||
bool hasVirtualDestructor() const;
|
||||
/// Returns true if the class CppParser_API or one if its base classes
|
||||
/// has a virtual destructor.
|
||||
|
||||
bool isClass() const;
|
||||
/// Returns true iff the struct was declared as class.
|
||||
|
||||
|
||||
bool isDerived() const;
|
||||
/// Returns true iff the struct or class is derived from another struct or class.
|
||||
|
||||
Symbol::Kind kind() const;
|
||||
std::string toString() const;
|
||||
|
||||
|
||||
private:
|
||||
std::string _decl;
|
||||
BaseClasses _bases;
|
||||
|
@ -37,9 +37,9 @@ public:
|
||||
public:
|
||||
std::string beginNameSpaceDecl; // contains either $(NS)_BEGIN or the namespace x { decl
|
||||
std::string endNameSpaceDecl; // contains either $(NS)_END or the closing brackets }
|
||||
std::vector<std::string> classDecls; // contains strings of the form "class X;"
|
||||
std::vector<std::string> classDecls; // contains strings of the form "class X;"
|
||||
};
|
||||
|
||||
|
||||
static void parse(const std::string& file, NameSpace::SymbolTable& st, const std::string& exec, const std::string& options, const std::string& path);
|
||||
/// Preprocesses and parses the file. The resulting symboltable has base class references already fixed,
|
||||
|
||||
|
@ -37,13 +37,13 @@ public:
|
||||
VAR_VOLATILE = 4, /// The variable is volatile.
|
||||
VAR_CONST = 8 /// The variable is const.
|
||||
};
|
||||
|
||||
|
||||
Variable(const std::string& decl, NameSpace* pNameSpace);
|
||||
/// Creates the Variable.
|
||||
|
||||
~Variable();
|
||||
/// Destroys the Variable.
|
||||
|
||||
|
||||
int flags() const;
|
||||
/// Returns the variable's flags.
|
||||
|
||||
@ -57,7 +57,7 @@ public:
|
||||
///
|
||||
/// Example: a type const std::string& -> std::string, a type const std::string* returns std::string
|
||||
|
||||
|
||||
|
||||
private:
|
||||
int _flags;
|
||||
bool _isPointer;
|
||||
|
@ -48,13 +48,13 @@ Attributes& Attributes::operator = (const Attributes& attrs)
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Attributes::has(const std::string& name) const
|
||||
{
|
||||
return _map.find(name) != _map.end();
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::string Attributes::getString(const std::string& name) const
|
||||
{
|
||||
AttrMap::const_iterator it = _map.find(name);
|
||||
@ -64,7 +64,7 @@ std::string Attributes::getString(const std::string& name) const
|
||||
throw Poco::NotFoundException(name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::string Attributes::getString(const std::string& name, const std::string& defaultValue) const
|
||||
{
|
||||
AttrMap::const_iterator it = _map.find(name);
|
||||
@ -84,7 +84,7 @@ int Attributes::getInt(const std::string& name) const
|
||||
throw Poco::NotFoundException(name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int Attributes::getInt(const std::string& name, int defaultValue) const
|
||||
{
|
||||
AttrMap::const_iterator it = _map.find(name);
|
||||
|
@ -88,7 +88,7 @@ const Token* AttributesParser::parseAttribute(const Token* pNext)
|
||||
const Token* AttributesParser::parseComplexAttribute(const Token* pNext, const std::string& id)
|
||||
{
|
||||
poco_assert_dbg (isOperator(pNext, OperatorToken::OP_OPENBRACE));
|
||||
|
||||
|
||||
pNext = next();
|
||||
std::string oldId(_id);
|
||||
if (!_id.empty())
|
||||
@ -103,7 +103,7 @@ const Token* AttributesParser::parseComplexAttribute(const Token* pNext, const s
|
||||
pNext = next();
|
||||
else
|
||||
throw SyntaxException("bad attribute declaration");
|
||||
|
||||
|
||||
return pNext;
|
||||
}
|
||||
|
||||
|
@ -111,13 +111,13 @@ void Function::makeFinal()
|
||||
_flags |= FN_FINAL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Function::makeOverride()
|
||||
{
|
||||
_flags |= FN_OVERRIDE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Function::makeNoexcept()
|
||||
{
|
||||
_flags |= FN_NOEXCEPT;
|
||||
@ -141,7 +141,7 @@ bool Function::isConstructor() const
|
||||
return name() == nameSpace()->name();
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Function::isDestructor() const
|
||||
{
|
||||
return name()[0] == '~';
|
||||
@ -201,7 +201,7 @@ std::string Function::signature() const
|
||||
return signature;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Function::isVirtual() const
|
||||
{
|
||||
if (_flags & FN_VIRTUAL)
|
||||
|
@ -49,7 +49,7 @@ NameSpace::~NameSpace()
|
||||
void NameSpace::addSymbol(Symbol* pSymbol)
|
||||
{
|
||||
poco_check_ptr (pSymbol);
|
||||
|
||||
|
||||
_symbols.insert(SymbolTable::value_type(pSymbol->name(), pSymbol));
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ void NameSpace::importSymbol(const std::string& fullName)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void NameSpace::importNameSpace(const std::string& nameSpace)
|
||||
{
|
||||
_importedNameSpaces.push_back(nameSpace);
|
||||
@ -94,7 +94,7 @@ Symbol* NameSpace::lookup(const std::string& name) const
|
||||
Symbol* NameSpace::lookup(const std::string& name, std::set<const NameSpace*>& alreadyVisited) const
|
||||
{
|
||||
Symbol* pSymbol = 0;
|
||||
|
||||
|
||||
if (name.empty())
|
||||
return pSymbol;
|
||||
|
||||
@ -103,12 +103,12 @@ Symbol* NameSpace::lookup(const std::string& name, std::set<const NameSpace*>& a
|
||||
std::string head;
|
||||
std::string tail;
|
||||
splitName(name, head, tail);
|
||||
|
||||
|
||||
alreadyVisited.insert(this);
|
||||
bool currentNSInserted = true;
|
||||
|
||||
|
||||
if (head.empty())
|
||||
|
||||
if (head.empty())
|
||||
{
|
||||
alreadyVisited.insert(this);
|
||||
return root()->lookup(tail, alreadyVisited);
|
||||
@ -161,13 +161,13 @@ void NameSpace::nameSpaces(SymbolTable& table) const
|
||||
extract(Symbol::SYM_NAMESPACE, table);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void NameSpace::typeDefs(SymbolTable& table) const
|
||||
{
|
||||
extract(Symbol::SYM_TYPEDEF, table);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void NameSpace::typeAliases(SymbolTable& table) const
|
||||
{
|
||||
extract(Symbol::SYM_TYPEALIAS, table);
|
||||
@ -179,19 +179,19 @@ void NameSpace::enums(SymbolTable& table) const
|
||||
extract(Symbol::SYM_ENUM, table);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void NameSpace::classes(SymbolTable& table) const
|
||||
{
|
||||
extract(Symbol::SYM_STRUCT, table);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void NameSpace::functions(SymbolTable& table) const
|
||||
{
|
||||
extract(Symbol::SYM_FUNCTION, table);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void NameSpace::variables(SymbolTable& table) const
|
||||
{
|
||||
extract(Symbol::SYM_VARIABLE, table);
|
||||
@ -226,7 +226,7 @@ void NameSpace::splitName(const std::string& name, std::string& head, std::strin
|
||||
head.assign(name, 0, pos);
|
||||
pos += 2;
|
||||
poco_assert (pos < name.length());
|
||||
tail.assign(name, pos, name.length() - pos);
|
||||
tail.assign(name, pos, name.length() - pos);
|
||||
}
|
||||
else head = name;
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ void Struct::addBase(const std::string& name, Symbol::Access access, bool isVirt
|
||||
_bases.push_back(base);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Struct::BaseIterator Struct::baseBegin() const
|
||||
{
|
||||
return _bases.begin();
|
||||
@ -78,7 +78,7 @@ Struct::BaseIterator Struct::baseEnd() const
|
||||
void Struct::addDerived(Struct* pClass)
|
||||
{
|
||||
poco_check_ptr (pClass);
|
||||
|
||||
|
||||
_derived.push_back(pClass);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace CppParser {
|
||||
|
||||
|
||||
Tokenizer::Tokenizer(std::istream& istr):
|
||||
StreamTokenizer(istr)
|
||||
StreamTokenizer(istr)
|
||||
{
|
||||
addToken(new OperatorToken);
|
||||
addToken(new IdentifierToken);
|
||||
|
@ -195,14 +195,14 @@ std::string Utility::preprocessFile(const std::string& file, const std::string&
|
||||
newPath += path;
|
||||
Environment::set("PATH", path);
|
||||
}
|
||||
|
||||
ProcessHandle proc = Process::launch(exec, args);
|
||||
|
||||
ProcessHandle proc = Process::launch(exec, args);
|
||||
int rc = Process::wait(proc);
|
||||
if (rc != 0)
|
||||
{
|
||||
throw Poco::RuntimeException("Failed to process file");
|
||||
}
|
||||
|
||||
|
||||
return pp.getFileName();
|
||||
}
|
||||
|
||||
@ -293,7 +293,7 @@ std::string replace(const std::string& input, const std::string& oldToken, const
|
||||
start = pos + oldToken.length();
|
||||
}
|
||||
while (pos != std::string::npos);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -39,10 +39,10 @@ Variable::Variable(const std::string& decl, NameSpace* pNameSpace):
|
||||
std::size_t pos = decl.rfind(name());
|
||||
std::string tmp = decl.substr(0, pos);
|
||||
tmp = Poco::trim(tmp);
|
||||
|
||||
|
||||
pos = tmp.rfind("*");
|
||||
_isPointer = (pos == (tmp.size()-1));
|
||||
|
||||
|
||||
Poco::replaceInPlace(tmp, "static ", "");
|
||||
Poco::replaceInPlace(tmp, "mutable ", "");
|
||||
Poco::replaceInPlace(tmp, "volatile ", "");
|
||||
@ -53,7 +53,7 @@ Variable::Variable(const std::string& decl, NameSpace* pNameSpace):
|
||||
tmp = tmp.substr(6);
|
||||
if (tmp.find("const\t") == 0)
|
||||
tmp = tmp.substr(6);
|
||||
|
||||
|
||||
std::size_t rightCut = tmp.size();
|
||||
while (rightCut > 0 && (tmp[rightCut-1] == '&' || tmp[rightCut-1] == '*' || tmp[rightCut-1] == '\t' || tmp[rightCut-1] == ' '))
|
||||
--rightCut;
|
||||
|
@ -15,14 +15,14 @@
|
||||
<P>CppUnit is a simple unit test framework for C++. It is a port from JUnit, a testing framework for Java, developed by Kent Beck and Erich Gamma. </P>
|
||||
<H3>Contents</H3>
|
||||
<PRE>README.html this file
|
||||
|
||||
|
||||
test the source code
|
||||
framework the testing framework
|
||||
		extensions	some framework extension classes
|
||||
textui a command line interface to run tests
|
||||
		extensions	some framework extension classes
|
||||
textui a command line interface to run tests
|
||||
ms code for a Microsoft specific TestRunner
|
||||
samples some example test cases and extensions to the framework
|
||||
multicaster a sample illustrating a publish/subscribe
|
||||
multicaster a sample illustrating a publish/subscribe
|
||||
				multicaster under test
|
||||
doc documentation</PRE>
|
||||
<H3>Installation</H3>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<P>Subclass the TestCase class. Override the method "runTest ()". When you want to check a value, call "assert (bool)" and pass in an expression that is true if the test succeeds. </P>
|
||||
<P>For example, to test the equality comparison for a Complex number class, write:</P>
|
||||
<TT><PRE>	class ComplexNumberTest : public TestCase {
|
||||
	public:
|
||||
	public:
|
||||
ComplexNumberTest (string name) : TestCase (name) {}
|
||||
void runTest () {
|
||||
assert (Complex (10, 1) == Complex (10, 1));
|
||||
@ -59,7 +59,7 @@
|
||||
	void		setUp () {
|
||||
			 m_10_1 = new Complex (10, 1);
|
||||
			 m_1_1 = new Complex (1, 1);
|
||||
			 m_11_2 = new Complex (11, 2);
|
||||
			 m_11_2 = new Complex (11, 2);
|
||||
}
|
||||
	void		tearDown () {
|
||||
			 delete m_10_1, delete m_1_1, delete m_11_2;
|
||||
@ -83,7 +83,7 @@
|
||||
	void		setUp () {
|
||||
			 m_10_1 = new Complex (10, 1);
|
||||
			 m_1_1 = new Complex (1, 1);
|
||||
			 m_11_2 = new Complex (11, 2);
|
||||
			 m_11_2 = new Complex (11, 2);
|
||||
}
|
||||
	void		tearDown () {
|
||||
			 delete m_10_1, delete m_1_1, delete m_11_2;
|
||||
|
@ -20,8 +20,8 @@ class CppUnit_API CppUnitException: public std::exception
|
||||
/// descriptive strings through its what() method
|
||||
{
|
||||
public:
|
||||
CppUnitException(const std::string& message = "",
|
||||
long lineNumber = CPPUNIT_UNKNOWNLINENUMBER,
|
||||
CppUnitException(const std::string& message = "",
|
||||
long lineNumber = CPPUNIT_UNKNOWNLINENUMBER,
|
||||
const std::string& fileName = CPPUNIT_UNKNOWNFILENAME);
|
||||
CppUnitException(const std::string& message,
|
||||
long lineNumber,
|
||||
@ -110,26 +110,26 @@ inline const char* CppUnitException::what() const throw ()
|
||||
|
||||
inline long CppUnitException::lineNumber() const
|
||||
{
|
||||
return _lineNumber;
|
||||
return _lineNumber;
|
||||
}
|
||||
|
||||
|
||||
inline long CppUnitException::data1LineNumber() const
|
||||
{
|
||||
return _data1lineNumber;
|
||||
return _data1lineNumber;
|
||||
}
|
||||
|
||||
|
||||
inline long CppUnitException::data2LineNumber() const
|
||||
{
|
||||
return _data2lineNumber;
|
||||
return _data2lineNumber;
|
||||
}
|
||||
|
||||
|
||||
// The file in which the error occurred
|
||||
inline const std::string& CppUnitException::fileName() const
|
||||
{
|
||||
return _fileName;
|
||||
return _fileName;
|
||||
}
|
||||
|
||||
|
||||
|
@ -45,11 +45,11 @@ namespace CppUnit {
|
||||
*
|
||||
* see TestSuite
|
||||
*/
|
||||
template <class ClassUnderTest>
|
||||
template <class ClassUnderTest>
|
||||
class Orthodox: public TestCase
|
||||
{
|
||||
public:
|
||||
Orthodox(): TestCase("Orthodox")
|
||||
Orthodox(): TestCase("Orthodox")
|
||||
{
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ protected:
|
||||
|
||||
|
||||
// Run an orthodoxy test
|
||||
template <class ClassUnderTest>
|
||||
template <class ClassUnderTest>
|
||||
void Orthodox<ClassUnderTest>::runTest()
|
||||
{
|
||||
// make sure we have a default constructor
|
||||
@ -90,7 +90,7 @@ void Orthodox<ClassUnderTest>::runTest()
|
||||
|
||||
|
||||
// Exercise a call
|
||||
template <class ClassUnderTest>
|
||||
template <class ClassUnderTest>
|
||||
ClassUnderTest Orthodox<ClassUnderTest>::call(ClassUnderTest object)
|
||||
{
|
||||
return object;
|
||||
|
@ -29,7 +29,7 @@ class CppUnit_API RepeatedTest: public TestDecorator
|
||||
REFERENCEOBJECT (RepeatedTest)
|
||||
|
||||
public:
|
||||
RepeatedTest(Test* test, int timesRepeat): TestDecorator (test), _timesRepeat (timesRepeat)
|
||||
RepeatedTest(Test* test, int timesRepeat): TestDecorator (test), _timesRepeat (timesRepeat)
|
||||
{
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ inline std::string RepeatedTest::toString()
|
||||
// Runs a repeated test
|
||||
inline void RepeatedTest::run(TestResult *result)
|
||||
{
|
||||
for (int n = 0; n < _timesRepeat; n++)
|
||||
for (int n = 0; n < _timesRepeat; n++)
|
||||
{
|
||||
if (result->shouldStop())
|
||||
break;
|
||||
|
@ -64,7 +64,7 @@ inline void Test::run(TestResult *result, const Callback& callback)
|
||||
// Counts the number of test cases that will be run by this test.
|
||||
inline int Test::countTestCases() const
|
||||
{
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -57,7 +57,7 @@ inline TestFailure::TestFailure(Test* failedTest, CppUnitException* thrownExcept
|
||||
|
||||
// Deletes the owned exception.
|
||||
inline TestFailure::~TestFailure()
|
||||
{
|
||||
{
|
||||
delete _thrownException;
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ public:
|
||||
SynchronizationObject()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual ~SynchronizationObject()
|
||||
{
|
||||
}
|
||||
@ -75,7 +75,7 @@ public:
|
||||
virtual void lock()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual void unlock()
|
||||
{
|
||||
}
|
||||
@ -112,7 +112,7 @@ protected:
|
||||
// Construct a TestResult
|
||||
inline TestResult::TestResult(): _syncObject(new SynchronizationObject())
|
||||
{
|
||||
_runTests = 0;
|
||||
_runTests = 0;
|
||||
_stop = false;
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ inline TestResult::TestResult(): _syncObject(new SynchronizationObject())
|
||||
// caused the error
|
||||
inline void TestResult::addError(Test* test, CppUnitException* e)
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
ExclusiveZone zone(_syncObject);
|
||||
_errors.push_back(new TestFailure(test, e));
|
||||
}
|
||||
|
||||
@ -130,7 +130,7 @@ inline void TestResult::addError(Test* test, CppUnitException* e)
|
||||
// caused the failure.
|
||||
inline void TestResult::addFailure(Test* test, CppUnitException* e)
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
ExclusiveZone zone(_syncObject);
|
||||
_failures.push_back(new TestFailure(test, e));
|
||||
}
|
||||
|
||||
@ -138,7 +138,7 @@ inline void TestResult::addFailure(Test* test, CppUnitException* e)
|
||||
// Informs the result that a test will be started.
|
||||
inline void TestResult::startTest(Test* test)
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
ExclusiveZone zone(_syncObject);
|
||||
_runTests++;
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ inline void TestResult::endTest(Test* test)
|
||||
// Gets the number of run tests.
|
||||
inline int TestResult::runTests()
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
ExclusiveZone zone(_syncObject);
|
||||
return _runTests;
|
||||
}
|
||||
|
||||
@ -161,7 +161,7 @@ inline int TestResult::runTests()
|
||||
// Gets the number of detected errors.
|
||||
inline int TestResult::testErrors()
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
ExclusiveZone zone(_syncObject);
|
||||
return (int) _errors.size();
|
||||
}
|
||||
|
||||
@ -169,7 +169,7 @@ inline int TestResult::testErrors()
|
||||
// Gets the number of detected failures.
|
||||
inline int TestResult::testFailures()
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
ExclusiveZone zone(_syncObject);
|
||||
return (int) _failures.size();
|
||||
}
|
||||
|
||||
@ -177,15 +177,15 @@ inline int TestResult::testFailures()
|
||||
// Returns whether the entire test was successful or not.
|
||||
inline bool TestResult::wasSuccessful()
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
return _failures.size() == 0 && _errors.size () == 0;
|
||||
ExclusiveZone zone(_syncObject);
|
||||
return _failures.size() == 0 && _errors.size () == 0;
|
||||
}
|
||||
|
||||
|
||||
// Returns a std::vector of the errors.
|
||||
inline std::vector<TestFailure*>& TestResult::errors()
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
ExclusiveZone zone(_syncObject);
|
||||
return _errors;
|
||||
}
|
||||
|
||||
@ -193,7 +193,7 @@ inline std::vector<TestFailure*>& TestResult::errors()
|
||||
// Returns a std::vector of the failures.
|
||||
inline std::vector<TestFailure*>& TestResult::failures()
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
ExclusiveZone zone(_syncObject);
|
||||
return _failures;
|
||||
}
|
||||
|
||||
@ -201,7 +201,7 @@ inline std::vector<TestFailure*>& TestResult::failures()
|
||||
// Returns whether testing should be stopped
|
||||
inline bool TestResult::shouldStop()
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
ExclusiveZone zone(_syncObject);
|
||||
return _stop;
|
||||
}
|
||||
|
||||
@ -209,7 +209,7 @@ inline bool TestResult::shouldStop()
|
||||
// Stop testing
|
||||
inline void TestResult::stop()
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
ExclusiveZone zone(_syncObject);
|
||||
_stop = true;
|
||||
}
|
||||
|
||||
@ -218,7 +218,7 @@ inline void TestResult::stop()
|
||||
// TestResult assumes ownership of the object
|
||||
inline void TestResult::setSynchronizationObject(SynchronizationObject* syncObject)
|
||||
{
|
||||
delete _syncObject;
|
||||
delete _syncObject;
|
||||
_syncObject = syncObject;
|
||||
}
|
||||
|
||||
|
@ -24,17 +24,17 @@ class CppUnit_API TestSetup: public TestDecorator
|
||||
REFERENCEOBJECT (TestSetup)
|
||||
|
||||
public:
|
||||
TestSetup(Test* test): TestDecorator(test)
|
||||
TestSetup(Test* test): TestDecorator(test)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void run(TestResult* result);
|
||||
|
||||
protected:
|
||||
void setUp()
|
||||
void setUp()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void tearDown()
|
||||
{
|
||||
}
|
||||
@ -44,7 +44,7 @@ protected:
|
||||
inline void TestSetup::run(TestResult* result)
|
||||
{
|
||||
setUp();
|
||||
TestDecorator::run(result);
|
||||
TestDecorator::run(result);
|
||||
tearDown();
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
Test::Type getType() const;
|
||||
|
||||
virtual void deleteContents();
|
||||
|
||||
|
||||
const std::vector<Test*> tests() const;
|
||||
|
||||
private:
|
||||
@ -80,7 +80,7 @@ inline void TestSuite::addTest(Test* test)
|
||||
// Returns a std::string representation of the test suite.
|
||||
inline std::string TestSuite::toString() const
|
||||
{
|
||||
return "suite " + _name;
|
||||
return "suite " + _name;
|
||||
}
|
||||
|
||||
// Returns the type of the test, see Test::Type
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
virtual void printErrors(std::ostream& stream);
|
||||
virtual void printFailures(std::ostream& stream);
|
||||
virtual void printHeader(std::ostream& stream);
|
||||
|
||||
|
||||
protected:
|
||||
std::string shortName(const std::string& testName);
|
||||
void setup();
|
||||
|
@ -32,26 +32,26 @@ inline std::string estring(std::string& expandedString)
|
||||
// Create a std::string from an int
|
||||
inline std::string estring(int number)
|
||||
{
|
||||
char buffer[50];
|
||||
std::snprintf(buffer, sizeof(buffer), "%d", number);
|
||||
return std::string (buffer);
|
||||
char buffer[50];
|
||||
std::snprintf(buffer, sizeof(buffer), "%d", number);
|
||||
return std::string (buffer);
|
||||
}
|
||||
|
||||
|
||||
// Create a string from a long
|
||||
inline std::string estring(long number)
|
||||
{
|
||||
char buffer[50];
|
||||
std::snprintf(buffer, sizeof(buffer), "%ld", number);
|
||||
return std::string (buffer);
|
||||
char buffer[50];
|
||||
std::snprintf(buffer, sizeof(buffer), "%ld", number);
|
||||
return std::string (buffer);
|
||||
}
|
||||
|
||||
|
||||
// Create a std::string from a double
|
||||
inline std::string estring(double number)
|
||||
{
|
||||
char buffer[50];
|
||||
std::snprintf(buffer, sizeof(buffer), "%lf", number);
|
||||
char buffer[50];
|
||||
std::snprintf(buffer, sizeof(buffer), "%lf", number);
|
||||
return std::string(buffer);
|
||||
}
|
||||
|
||||
@ -59,8 +59,8 @@ inline std::string estring(double number)
|
||||
// Create a std::string from a double
|
||||
inline std::string estring(const void* ptr)
|
||||
{
|
||||
char buffer[50];
|
||||
std::snprintf(buffer, sizeof(buffer), "%p", ptr);
|
||||
char buffer[50];
|
||||
std::snprintf(buffer, sizeof(buffer), "%p", ptr);
|
||||
return std::string(buffer);
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ void TestSuite::deleteContents()
|
||||
// Runs the tests and collects their result in a TestResult.
|
||||
void TestSuite::run(TestResult *result, const Test::Callback& callback)
|
||||
{
|
||||
for (std::vector<Test*>::iterator it = _tests.begin(); it != _tests.end(); ++it)
|
||||
for (std::vector<Test*>::iterator it = _tests.begin(); it != _tests.end(); ++it)
|
||||
{
|
||||
if (result->shouldStop ())
|
||||
break;
|
||||
|
@ -43,8 +43,8 @@ public:
|
||||
/// Destroys the CipherFactory.
|
||||
|
||||
Cipher* createCipher(const CipherKey& key);
|
||||
/// Creates a Cipher object for the given Cipher name. Valid cipher
|
||||
/// names depend on the OpenSSL version the library is linked with;
|
||||
/// Creates a Cipher object for the given Cipher name. Valid cipher
|
||||
/// names depend on the OpenSSL version the library is linked with;
|
||||
/// see the output of
|
||||
///
|
||||
/// openssl enc --help
|
||||
@ -64,7 +64,7 @@ public:
|
||||
Cipher* createCipher(const EVPPKey& key);
|
||||
/// Creates an EVPCipher using the given EVP key
|
||||
/// for public key encryption/private key decryption.
|
||||
|
||||
|
||||
static CipherFactory& defaultFactory();
|
||||
/// Returns the default CipherFactory.
|
||||
|
||||
|
@ -39,13 +39,13 @@ public:
|
||||
/// See the OpenSSL documentation for a list of supported digest algorithms.
|
||||
///
|
||||
/// Throws a Poco::NotFoundException if no algorithm with the given name exists.
|
||||
|
||||
|
||||
~DigestEngine();
|
||||
/// Destroys the DigestEngine.
|
||||
|
||||
|
||||
const std::string& algorithm() const;
|
||||
/// Returns the name of the digest algorithm.
|
||||
|
||||
|
||||
int nid() const;
|
||||
/// Returns the NID (OpenSSL object identifier) of the digest algorithm.
|
||||
|
||||
@ -56,7 +56,7 @@ public:
|
||||
|
||||
protected:
|
||||
void updateImpl(const void* data, std::size_t length);
|
||||
|
||||
|
||||
private:
|
||||
std::string _name;
|
||||
EVP_MD_CTX* _pContext;
|
||||
|
@ -62,8 +62,8 @@ public:
|
||||
|
||||
ECKeyImpl(const std::string& publicKeyFile, const std::string& privateKeyFile, const std::string& privateKeyPassphrase);
|
||||
/// Creates the ECKey, by reading public and private key from the given files and
|
||||
/// using the given passphrase for the private key. Can only by used for signing if
|
||||
/// a private key is available.
|
||||
/// using the given passphrase for the private key. Can only by used for signing if
|
||||
/// a private key is available.
|
||||
|
||||
ECKeyImpl(std::istream* pPublicKeyStream, std::istream* pPrivateKeyStream, const std::string& privateKeyPassphrase);
|
||||
/// Creates the ECKey. Can only by used for signing if pPrivKey
|
||||
@ -91,7 +91,7 @@ public:
|
||||
void save(const std::string& publicKeyFile,
|
||||
const std::string& privateKeyFile = "",
|
||||
const std::string& privateKeyPassphrase = "") const;
|
||||
/// Exports the public and private keys to the given files.
|
||||
/// Exports the public and private keys to the given files.
|
||||
///
|
||||
/// If an empty filename is specified, the corresponding key
|
||||
/// is not exported.
|
||||
|
@ -220,7 +220,7 @@ private:
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4996) // deprecation warnings
|
||||
#endif
|
||||
#endif
|
||||
pFile = fopen(keyFile.c_str(), "r");
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(pop)
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
virtual void save(const std::string& publicKeyFile,
|
||||
const std::string& privateKeyFile = "",
|
||||
const std::string& privateKeyPassphrase = "") const = 0;
|
||||
/// Exports the public and private keys to the given files.
|
||||
/// Exports the public and private keys to the given files.
|
||||
///
|
||||
/// If an empty filename is specified, the corresponding key
|
||||
/// is not exported.
|
||||
|
@ -39,7 +39,7 @@ class Crypto_API RSADigestEngine: public Poco::DigestEngine
|
||||
/// signed. Then, the hash value is encrypted, using
|
||||
/// the RSA private key.
|
||||
///
|
||||
/// To verify a signature, pass it to the verify()
|
||||
/// To verify a signature, pass it to the verify()
|
||||
/// member function. It will decrypt the signature
|
||||
/// using the RSA public key and compare the resulting
|
||||
/// hash with the actual hash of the data.
|
||||
@ -50,7 +50,7 @@ public:
|
||||
DIGEST_MD5,
|
||||
DIGEST_SHA1
|
||||
};
|
||||
|
||||
|
||||
//@ deprecated
|
||||
RSADigestEngine(const RSAKey& key, DigestType digestType = DIGEST_SHA1);
|
||||
/// Creates the RSADigestEngine with the given RSA key,
|
||||
@ -74,11 +74,11 @@ public:
|
||||
void reset();
|
||||
/// Resets the engine so that a new
|
||||
/// digest can be computed.
|
||||
|
||||
|
||||
const DigestEngine::Digest& digest();
|
||||
/// Finishes the computation of the digest
|
||||
/// Finishes the computation of the digest
|
||||
/// (the first time it's called) and
|
||||
/// returns the message digest.
|
||||
/// returns the message digest.
|
||||
///
|
||||
/// Can be called multiple times.
|
||||
|
||||
|
@ -65,8 +65,8 @@ public:
|
||||
|
||||
RSAKeyImpl(const std::string& publicKeyFile, const std::string& privateKeyFile, const std::string& privateKeyPassphrase);
|
||||
/// Creates the RSAKey, by reading public and private key from the given files and
|
||||
/// using the given passphrase for the private key. Can only by used for signing if
|
||||
/// a private key is available.
|
||||
/// using the given passphrase for the private key. Can only by used for signing if
|
||||
/// a private key is available.
|
||||
|
||||
RSAKeyImpl(std::istream* pPublicKeyStream, std::istream* pPrivateKeyStream, const std::string& privateKeyPassphrase);
|
||||
/// Creates the RSAKey. Can only by used for signing if pPrivKey
|
||||
@ -97,7 +97,7 @@ public:
|
||||
void save(const std::string& publicKeyFile,
|
||||
const std::string& privateKeyFile = "",
|
||||
const std::string& privateKeyPassphrase = "") const;
|
||||
/// Exports the public and private keys to the given files.
|
||||
/// Exports the public and private keys to the given files.
|
||||
///
|
||||
/// If an empty filename is specified, the corresponding key
|
||||
/// is not exported.
|
||||
|
@ -52,29 +52,29 @@ public:
|
||||
{
|
||||
Poco::Crypto::initializeCrypto();
|
||||
}
|
||||
|
||||
|
||||
~RSAApp()
|
||||
{
|
||||
Poco::Crypto::uninitializeCrypto();
|
||||
}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
void initialize(Application& self)
|
||||
{
|
||||
loadConfiguration(); // load default configuration files, if present
|
||||
Application::initialize(self);
|
||||
}
|
||||
|
||||
|
||||
void uninitialize()
|
||||
{
|
||||
Application::uninitialize();
|
||||
}
|
||||
|
||||
|
||||
void reinitialize(Application& self)
|
||||
{
|
||||
Application::reinitialize(self);
|
||||
}
|
||||
|
||||
|
||||
void defineOptions(OptionSet& options)
|
||||
{
|
||||
Application::defineOptions(options);
|
||||
@ -97,7 +97,7 @@ protected:
|
||||
.repeatable(false)
|
||||
.argument("512|1024|2048|4096")
|
||||
.callback(OptionCallback<RSAApp>(this, &RSAApp::handleKeyLength)));
|
||||
|
||||
|
||||
options.addOption(
|
||||
Option("exponent", "e", "defines the exponent of the key")
|
||||
.required(false)
|
||||
@ -119,14 +119,14 @@ protected:
|
||||
.argument("pwd")
|
||||
.callback(OptionCallback<RSAApp>(this, &RSAApp::handlePassword)));
|
||||
}
|
||||
|
||||
|
||||
void handleHelp(const std::string& name, const std::string& value)
|
||||
{
|
||||
_helpRequested = true;
|
||||
displayHelp();
|
||||
stopOptionsProcessing();
|
||||
}
|
||||
|
||||
|
||||
void handleKeyLength(const std::string& name, const std::string& value)
|
||||
{
|
||||
int keyLen = Poco::NumberParser::parse(value);
|
||||
@ -150,12 +150,12 @@ protected:
|
||||
throw Poco::Util::IncompatibleOptionsException("Empty file prefix forbidden");
|
||||
_name = value;
|
||||
}
|
||||
|
||||
|
||||
void handlePassword(const std::string& name, const std::string& value)
|
||||
{
|
||||
_pwd = value;
|
||||
}
|
||||
|
||||
|
||||
void displayHelp()
|
||||
{
|
||||
HelpFormatter helpFormatter(options());
|
||||
@ -176,14 +176,14 @@ protected:
|
||||
logger().information("Generating key: DONE");
|
||||
std::string pubFile(_name + ".pub");
|
||||
std::string privFile(_name + ".priv");
|
||||
|
||||
|
||||
logger().information("Saving key to " + pubFile + " and " + privFile);
|
||||
key.save(pubFile, privFile, _pwd);
|
||||
logger().information("Key saved");
|
||||
}
|
||||
return Application::EXIT_OK;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
bool _helpRequested;
|
||||
RSAKey::KeyLength _length;
|
||||
|
@ -28,7 +28,7 @@ CryptoTransform::~CryptoTransform()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
int CryptoTransform::setPadding(int padding)
|
||||
{
|
||||
return 1;
|
||||
|
@ -26,10 +26,10 @@ DigestEngine::DigestEngine(const std::string& name):
|
||||
{
|
||||
const EVP_MD* md = EVP_get_digestbyname(_name.c_str());
|
||||
if (!md) throw Poco::NotFoundException(_name);
|
||||
EVP_DigestInit_ex(_pContext, md, NULL);
|
||||
EVP_DigestInit_ex(_pContext, md, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
DigestEngine::~DigestEngine()
|
||||
{
|
||||
EVP_MD_CTX_destroy(_pContext);
|
||||
|
@ -51,7 +51,7 @@ void RSADigestEngine::reset()
|
||||
_signature.clear();
|
||||
}
|
||||
|
||||
|
||||
|
||||
const DigestEngine::Digest& RSADigestEngine::digest()
|
||||
{
|
||||
if (_digest.empty())
|
||||
@ -77,7 +77,7 @@ const DigestEngine::Digest& RSADigestEngine::signature()
|
||||
return _signature;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool RSADigestEngine::verify(const DigestEngine::Digest& sig)
|
||||
{
|
||||
digest();
|
||||
|
@ -47,7 +47,7 @@ void DigestEngineTest::testMD5()
|
||||
|
||||
engine.update("abcdefghijklmnopqrstuvwxyz");
|
||||
assertTrue (DigestEngine::digestToHex(engine.digest()) == "c3fcd3d76192e4007dfb496cca67e13b");
|
||||
|
||||
|
||||
engine.update("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
engine.update("abcdefghijklmnopqrstuvwxyz0123456789");
|
||||
assertTrue (DigestEngine::digestToHex(engine.digest()) == "d174ab98d277d9f5a5611c2c9f419d9f");
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
{
|
||||
Poco::Crypto::initializeCrypto();
|
||||
}
|
||||
|
||||
|
||||
~CryptoInitializer()
|
||||
{
|
||||
Poco::Crypto::uninitializeCrypto();
|
||||
@ -34,7 +34,7 @@ public:
|
||||
int main(int ac, char **av)
|
||||
{
|
||||
CryptoInitializer ci;
|
||||
|
||||
|
||||
std::vector<std::string> args;
|
||||
for (int i = 0; i < ac; ++i)
|
||||
args.push_back(std::string(av[i]));
|
||||
|
@ -251,7 +251,7 @@ void RSATest::testRSACipherLarge()
|
||||
sizes.push_back (16383);
|
||||
sizes.push_back (16384);
|
||||
sizes.push_back (16385);
|
||||
|
||||
|
||||
Cipher::Ptr pCipher = CipherFactory::defaultFactory().createCipher(RSAKey(RSAKey::KL_1024, RSAKey::EXP_SMALL));
|
||||
for (std::vector<std::size_t>::const_iterator it = sizes.begin(); it != sizes.end(); ++it)
|
||||
{
|
||||
@ -273,7 +273,7 @@ void RSATest::testCertificate()
|
||||
Cipher::Ptr pCipher = CipherFactory::defaultFactory().createCipher(publicKey);
|
||||
Cipher::Ptr pCipher2 = CipherFactory::defaultFactory().createCipher(privateKey);
|
||||
std::string val("lets do some encryption");
|
||||
|
||||
|
||||
std::string enc = pCipher->encryptString(val);
|
||||
std::string dec = pCipher2->decryptString(enc);
|
||||
assertTrue (dec == val);
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
{
|
||||
Poco::Crypto::initializeCrypto();
|
||||
}
|
||||
|
||||
|
||||
~CryptoInitializer()
|
||||
{
|
||||
Poco::Crypto::uninitializeCrypto();
|
||||
@ -42,7 +42,7 @@ int _tmain(int argc, wchar_t* argv[])
|
||||
std::wcstombs(buffer, argv[i], sizeof(buffer));
|
||||
args.push_back(std::string(buffer));
|
||||
}
|
||||
CppUnit::TestRunner runner;
|
||||
CppUnit::TestRunner runner;
|
||||
runner.addTest("CryptoTestSuite", CryptoTestSuite::suite());
|
||||
return runner.run(args) ? 0 : 1;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ public:
|
||||
{
|
||||
Poco::Crypto::initializeCrypto();
|
||||
}
|
||||
|
||||
|
||||
~CryptoInitializer()
|
||||
{
|
||||
Poco::Crypto::uninitializeCrypto();
|
||||
|
@ -35,7 +35,7 @@ public:
|
||||
|
||||
Connector();
|
||||
/// Creates the Connector.
|
||||
|
||||
|
||||
virtual ~Connector();
|
||||
/// Destroys the Connector.
|
||||
|
||||
|
@ -40,10 +40,10 @@ class MySQL_API MySQLStatementImpl: public Poco::Data::StatementImpl
|
||||
public:
|
||||
MySQLStatementImpl(SessionImpl& s);
|
||||
/// Creates the MySQLStatementImpl.
|
||||
|
||||
|
||||
~MySQLStatementImpl();
|
||||
/// Destroys the MySQLStatementImpl.
|
||||
|
||||
|
||||
protected:
|
||||
virtual std::size_t columnsReturned() const;
|
||||
/// Returns number of columns returned by query.
|
||||
@ -51,32 +51,32 @@ protected:
|
||||
virtual int affectedRowCount() const;
|
||||
/// Returns the number of affected rows.
|
||||
/// Used to find out the number of rows affected by insert, delete or update.
|
||||
|
||||
|
||||
virtual const MetaColumn& metaColumn(std::size_t pos) const;
|
||||
/// Returns column meta data.
|
||||
|
||||
|
||||
virtual bool hasNext();
|
||||
/// Returns true if a call to next() will return data.
|
||||
|
||||
|
||||
virtual std::size_t next();
|
||||
/// Retrieves the next row from the resultset.
|
||||
/// Will throw, if the resultset is empty.
|
||||
|
||||
|
||||
virtual bool canBind() const;
|
||||
/// Returns true if a valid statement is set and we can bind.
|
||||
|
||||
virtual bool canCompile() const;
|
||||
/// Returns true if another compile is possible.
|
||||
|
||||
|
||||
virtual void compileImpl();
|
||||
/// Compiles the statement, doesn't bind yet
|
||||
|
||||
|
||||
virtual void bindImpl();
|
||||
/// Binds parameters
|
||||
|
||||
|
||||
virtual Poco::Data::AbstractExtractor::Ptr extractor();
|
||||
/// Returns the concrete extractor used by the statement.
|
||||
|
||||
|
||||
virtual Poco::Data::AbstractBinder::Ptr binder();
|
||||
/// Returns the concrete binder used by the statement.
|
||||
|
||||
|
@ -78,16 +78,16 @@ namespace
|
||||
default:
|
||||
throw Poco::Data::MySQL::StatementException("unknown field type");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Poco::Data::MetaColumn::ColumnDataType fieldType(const MYSQL_FIELD& field)
|
||||
/// Convert field MySQL-type to Poco-type
|
||||
/// Convert field MySQL-type to Poco-type
|
||||
{
|
||||
bool unsig = ((field.flags & UNSIGNED_FLAG) == UNSIGNED_FLAG);
|
||||
|
||||
switch (field.type)
|
||||
{
|
||||
case MYSQL_TYPE_TINY:
|
||||
case MYSQL_TYPE_TINY:
|
||||
if (unsig) return Poco::Data::MetaColumn::FDT_UINT8;
|
||||
return Poco::Data::MetaColumn::FDT_INT8;
|
||||
|
||||
@ -96,32 +96,32 @@ namespace
|
||||
return Poco::Data::MetaColumn::FDT_INT16;
|
||||
|
||||
case MYSQL_TYPE_INT24:
|
||||
case MYSQL_TYPE_LONG:
|
||||
case MYSQL_TYPE_LONG:
|
||||
if (unsig) return Poco::Data::MetaColumn::FDT_UINT32;
|
||||
return Poco::Data::MetaColumn::FDT_INT32;
|
||||
|
||||
case MYSQL_TYPE_FLOAT:
|
||||
case MYSQL_TYPE_FLOAT:
|
||||
return Poco::Data::MetaColumn::FDT_FLOAT;
|
||||
|
||||
case MYSQL_TYPE_DECIMAL:
|
||||
case MYSQL_TYPE_NEWDECIMAL:
|
||||
case MYSQL_TYPE_DOUBLE:
|
||||
case MYSQL_TYPE_DOUBLE:
|
||||
return Poco::Data::MetaColumn::FDT_DOUBLE;
|
||||
|
||||
case MYSQL_TYPE_LONGLONG:
|
||||
case MYSQL_TYPE_LONGLONG:
|
||||
if (unsig) return Poco::Data::MetaColumn::FDT_UINT64;
|
||||
return Poco::Data::MetaColumn::FDT_INT64;
|
||||
|
||||
|
||||
case MYSQL_TYPE_DATE:
|
||||
return Poco::Data::MetaColumn::FDT_DATE;
|
||||
|
||||
|
||||
case MYSQL_TYPE_TIME:
|
||||
return Poco::Data::MetaColumn::FDT_TIME;
|
||||
|
||||
|
||||
case MYSQL_TYPE_DATETIME:
|
||||
case MYSQL_TYPE_TIMESTAMP:
|
||||
return Poco::Data::MetaColumn::FDT_TIMESTAMP;
|
||||
|
||||
|
||||
case MYSQL_TYPE_STRING:
|
||||
case MYSQL_TYPE_VAR_STRING:
|
||||
return Poco::Data::MetaColumn::FDT_STRING;
|
||||
@ -244,7 +244,7 @@ std::size_t ResultMetadata::length(std::size_t pos) const
|
||||
}
|
||||
|
||||
|
||||
const unsigned char* ResultMetadata::rawData(std::size_t pos) const
|
||||
const unsigned char* ResultMetadata::rawData(std::size_t pos) const
|
||||
{
|
||||
if ((_lengths[pos] == 0) && (_row[pos].buffer == nullptr))
|
||||
return reinterpret_cast<const unsigned char*>("");
|
||||
@ -254,7 +254,7 @@ const unsigned char* ResultMetadata::rawData(std::size_t pos) const
|
||||
}
|
||||
|
||||
|
||||
bool ResultMetadata::isNull(std::size_t pos) const
|
||||
bool ResultMetadata::isNull(std::size_t pos) const
|
||||
{
|
||||
return (_isNull[pos] != 0);
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ include ODBC.make
|
||||
|
||||
objects = Binder ConnectionHandle Connector EnvironmentHandle \
|
||||
Extractor ODBCException ODBCMetaColumn ODBCStatementImpl \
|
||||
Parameter Preparator SessionImpl TypeInfo Unicode Utility
|
||||
Parameter Preparator SessionImpl TypeInfo Unicode Utility
|
||||
|
||||
target = PocoDataODBC
|
||||
target_version = $(LIBVERSION)
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
///
|
||||
/// This can cause issues with SQL Server, resulting in an error
|
||||
/// ("The data types varchar and text are incompatible in the equal to operator")
|
||||
/// when comparing against a VARCHAR.
|
||||
/// when comparing against a VARCHAR.
|
||||
///
|
||||
/// Set this to false to bind std::string to SQL_VARCHAR.
|
||||
///
|
||||
|
@ -36,7 +36,7 @@ template <typename H, SQLSMALLINT handleType>
|
||||
class Diagnostics
|
||||
/// Utility class providing functionality for retrieving ODBC diagnostic
|
||||
/// records. Diagnostics object must be created with corresponding handle
|
||||
/// as constructor argument. During construction, diagnostic records fields
|
||||
/// as constructor argument. During construction, diagnostic records fields
|
||||
/// are populated and the object is ready for querying.
|
||||
{
|
||||
public:
|
||||
@ -92,7 +92,7 @@ public:
|
||||
}
|
||||
|
||||
std::string connectionName() const
|
||||
/// Returns the connection name.
|
||||
/// Returns the connection name.
|
||||
/// If there is no active connection, connection name defaults to NONE.
|
||||
/// If connection name is not applicable for query context (such as when querying environment handle),
|
||||
/// connection name defaults to NOT_APPLICABLE.
|
||||
@ -146,54 +146,54 @@ public:
|
||||
|
||||
reset();
|
||||
|
||||
while (!Utility::isError(SQLGetDiagRec(handleType,
|
||||
_handle,
|
||||
count,
|
||||
df._sqlState,
|
||||
&df._nativeError,
|
||||
df._message,
|
||||
SQL_MESSAGE_LENGTH,
|
||||
&messageLength)))
|
||||
while (!Utility::isError(SQLGetDiagRec(handleType,
|
||||
_handle,
|
||||
count,
|
||||
df._sqlState,
|
||||
&df._nativeError,
|
||||
df._message,
|
||||
SQL_MESSAGE_LENGTH,
|
||||
&messageLength)))
|
||||
{
|
||||
if (1 == count)
|
||||
{
|
||||
// success of the following two calls is optional
|
||||
// (they fail if connection has not been established yet
|
||||
// or return empty string if not applicable for the context)
|
||||
if (Utility::isError(SQLGetDiagField(handleType,
|
||||
_handle,
|
||||
count,
|
||||
SQL_DIAG_CONNECTION_NAME,
|
||||
_connectionName,
|
||||
sizeof(_connectionName),
|
||||
if (Utility::isError(SQLGetDiagField(handleType,
|
||||
_handle,
|
||||
count,
|
||||
SQL_DIAG_CONNECTION_NAME,
|
||||
_connectionName,
|
||||
sizeof(_connectionName),
|
||||
&messageLength)))
|
||||
{
|
||||
std::size_t len = sizeof(_connectionName) > none.length() ?
|
||||
std::size_t len = sizeof(_connectionName) > none.length() ?
|
||||
none.length() : sizeof(_connectionName) - 1;
|
||||
std::memcpy(_connectionName, none.c_str(), len);
|
||||
}
|
||||
else if (0 == _connectionName[0])
|
||||
else if (0 == _connectionName[0])
|
||||
{
|
||||
std::size_t len = sizeof(_connectionName) > na.length() ?
|
||||
std::size_t len = sizeof(_connectionName) > na.length() ?
|
||||
na.length() : sizeof(_connectionName) - 1;
|
||||
std::memcpy(_connectionName, na.c_str(), len);
|
||||
}
|
||||
|
||||
if (Utility::isError(SQLGetDiagField(handleType,
|
||||
_handle,
|
||||
count,
|
||||
SQL_DIAG_SERVER_NAME,
|
||||
_serverName,
|
||||
sizeof(_serverName),
|
||||
|
||||
if (Utility::isError(SQLGetDiagField(handleType,
|
||||
_handle,
|
||||
count,
|
||||
SQL_DIAG_SERVER_NAME,
|
||||
_serverName,
|
||||
sizeof(_serverName),
|
||||
&messageLength)))
|
||||
{
|
||||
std::size_t len = sizeof(_serverName) > none.length() ?
|
||||
std::size_t len = sizeof(_serverName) > none.length() ?
|
||||
none.length() : sizeof(_serverName) - 1;
|
||||
std::memcpy(_serverName, none.c_str(), len);
|
||||
}
|
||||
else if (0 == _serverName[0])
|
||||
else if (0 == _serverName[0])
|
||||
{
|
||||
std::size_t len = sizeof(_serverName) > na.length() ?
|
||||
std::size_t len = sizeof(_serverName) > na.length() ?
|
||||
na.length() : sizeof(_serverName) - 1;
|
||||
std::memcpy(_serverName, na.c_str(), len);
|
||||
}
|
||||
|
@ -66,11 +66,11 @@ public:
|
||||
std::string& toString(int index, std::string& str) const
|
||||
/// Generates the string for the diagnostic record.
|
||||
{
|
||||
if ((index < 0) || (index > (count() - 1)))
|
||||
if ((index < 0) || (index > (count() - 1)))
|
||||
return str;
|
||||
|
||||
std::string s;
|
||||
Poco::format(s,
|
||||
Poco::format(s,
|
||||
"===========================\n"
|
||||
"ODBC Diagnostic record #%d:\n"
|
||||
"===========================\n"
|
||||
@ -90,7 +90,7 @@ public:
|
||||
{
|
||||
std::string str;
|
||||
|
||||
Poco::format(str,
|
||||
Poco::format(str,
|
||||
"Connection:%s\nServer:%s\n",
|
||||
_diagnostics.connectionName(),
|
||||
_diagnostics.serverName());
|
||||
|
@ -39,14 +39,14 @@ class Handle
|
||||
/// ODBC handle class template
|
||||
{
|
||||
public:
|
||||
Handle(const ConnectionHandle& rConnection):
|
||||
Handle(const ConnectionHandle& rConnection):
|
||||
_rConnection(rConnection),
|
||||
_handle(0)
|
||||
/// Creates the Handle.
|
||||
{
|
||||
if (Utility::isError(SQLAllocHandle(handleType,
|
||||
_rConnection,
|
||||
&_handle)))
|
||||
if (Utility::isError(SQLAllocHandle(handleType,
|
||||
_rConnection,
|
||||
&_handle)))
|
||||
{
|
||||
throw ODBCException("Could not allocate statement handle.");
|
||||
}
|
||||
@ -58,7 +58,7 @@ public:
|
||||
try
|
||||
{
|
||||
#if defined(_DEBUG)
|
||||
SQLRETURN rc =
|
||||
SQLRETURN rc =
|
||||
#endif
|
||||
SQLFreeHandle(handleType, _handle);
|
||||
// N.B. Destructors should not throw, but neither do we want to
|
||||
|
@ -39,15 +39,15 @@ class ODBC_API ODBCMetaColumn: public MetaColumn
|
||||
public:
|
||||
explicit ODBCMetaColumn(const StatementHandle& rStmt, std::size_t position);
|
||||
/// Creates the ODBCMetaColumn.
|
||||
|
||||
|
||||
~ODBCMetaColumn();
|
||||
/// Destroys the ODBCMetaColumn.
|
||||
|
||||
std::size_t dataLength() const;
|
||||
/// A numeric value that is either the maximum or actual character length of a character
|
||||
/// string or binary data type. It is the maximum character length for a fixed-length data type,
|
||||
/// or the actual character length for a variable-length data type. Its value always excludes the
|
||||
/// null-termination byte that ends the character string.
|
||||
/// A numeric value that is either the maximum or actual character length of a character
|
||||
/// string or binary data type. It is the maximum character length for a fixed-length data type,
|
||||
/// or the actual character length for a variable-length data type. Its value always excludes the
|
||||
/// null-termination byte that ends the character string.
|
||||
/// This information is returned from the SQL_DESC_LENGTH record field of the IRD.
|
||||
|
||||
bool isUnsigned() const;
|
||||
|
@ -76,7 +76,7 @@ protected:
|
||||
/// Returns true if another compile is possible.
|
||||
|
||||
void compileImpl();
|
||||
/// Compiles the statement, doesn't bind yet.
|
||||
/// Compiles the statement, doesn't bind yet.
|
||||
/// Does nothing if the statement has already been compiled.
|
||||
|
||||
void bindImpl();
|
||||
@ -101,12 +101,12 @@ private:
|
||||
typedef std::vector<ExtractorPtr> ExtractorVec;
|
||||
typedef std::vector<ODBCMetaColumn*> ColumnPtrVec;
|
||||
typedef std::vector<ColumnPtrVec> ColumnPtrVecVec;
|
||||
|
||||
|
||||
static const std::string INVALID_CURSOR_STATE;
|
||||
|
||||
void clear();
|
||||
/// Closes the cursor and resets indicator variables.
|
||||
|
||||
|
||||
void doBind();
|
||||
/// Binds parameters.
|
||||
|
||||
@ -119,8 +119,8 @@ private:
|
||||
void doPrepare();
|
||||
/// Prepares placeholders for data returned by statement.
|
||||
/// It is called during statement compilation for SQL statements
|
||||
/// returning data. For stored procedures returning datasets,
|
||||
/// it is called upon the first check for data availability
|
||||
/// returning data. For stored procedures returning datasets,
|
||||
/// it is called upon the first check for data availability
|
||||
/// (see hasNext() function).
|
||||
|
||||
bool hasData() const;
|
||||
@ -133,8 +133,8 @@ private:
|
||||
/// Returns true if there is a row fetched but not yet extracted.
|
||||
|
||||
void putData();
|
||||
/// Called whenever SQLExecute returns SQL_NEED_DATA. This is expected
|
||||
/// behavior for PB_AT_EXEC binding mode.
|
||||
/// Called whenever SQLExecute returns SQL_NEED_DATA. This is expected
|
||||
/// behavior for PB_AT_EXEC binding mode.
|
||||
|
||||
void addPreparator();
|
||||
void fillColumns();
|
||||
|
@ -36,7 +36,7 @@ class ODBC_API Parameter
|
||||
public:
|
||||
explicit Parameter(const StatementHandle& rStmt, std::size_t colNum);
|
||||
/// Creates the Parameter.
|
||||
|
||||
|
||||
~Parameter();
|
||||
/// Destroys the Parameter.
|
||||
|
||||
@ -47,11 +47,11 @@ public:
|
||||
/// Returns the SQL data type.
|
||||
|
||||
std::size_t columnSize() const;
|
||||
/// Returns the the size of the column or expression of the corresponding
|
||||
/// Returns the the size of the column or expression of the corresponding
|
||||
/// parameter marker as defined by the data source.
|
||||
|
||||
std::size_t decimalDigits() const;
|
||||
/// Returns the number of decimal digits of the column or expression
|
||||
/// Returns the number of decimal digits of the column or expression
|
||||
/// of the corresponding parameter as defined by the data source.
|
||||
|
||||
bool isNullable() const;
|
||||
|
@ -54,15 +54,15 @@ public:
|
||||
|
||||
SessionImpl(const std::string& connect,
|
||||
std::size_t loginTimeout,
|
||||
std::size_t maxFieldSize = ODBC_MAX_FIELD_SIZE,
|
||||
std::size_t maxFieldSize = ODBC_MAX_FIELD_SIZE,
|
||||
bool autoBind = true,
|
||||
bool autoExtract = true);
|
||||
/// Creates the SessionImpl. Opens a connection to the database.
|
||||
/// Throws NotConnectedException if connection was not succesful.
|
||||
|
||||
//@ deprecated
|
||||
SessionImpl(const std::string& connect,
|
||||
Poco::Any maxFieldSize = ODBC_MAX_FIELD_SIZE,
|
||||
SessionImpl(const std::string& connect,
|
||||
Poco::Any maxFieldSize = ODBC_MAX_FIELD_SIZE,
|
||||
bool enforceCapability=false,
|
||||
bool autoBind = true,
|
||||
bool autoExtract = true);
|
||||
@ -144,7 +144,7 @@ public:
|
||||
|
||||
void setMaxFieldSize(const std::string& rName, const Poco::Any& rValue);
|
||||
/// Sets the max field size (the default used when column size is unknown).
|
||||
|
||||
|
||||
Poco::Any getMaxFieldSize(const std::string& rName="") const;
|
||||
/// Returns the max field size (the default used when column size is unknown).
|
||||
|
||||
@ -154,11 +154,11 @@ public:
|
||||
void setQueryTimeout(const std::string&, const Poco::Any& value);
|
||||
/// Sets the timeout (in seconds) for queries.
|
||||
/// Value must be of type int.
|
||||
|
||||
|
||||
Poco::Any getQueryTimeout(const std::string&) const;
|
||||
/// Returns the timeout (in seconds) for queries,
|
||||
/// or -1 if no timeout has been set.
|
||||
|
||||
|
||||
int queryTimeout() const;
|
||||
/// Returns the timeout (in seconds) for queries,
|
||||
/// or -1 if no timeout has been set.
|
||||
@ -230,7 +230,7 @@ inline void SessionImpl::setMaxFieldSize(const std::string& rName, const Poco::A
|
||||
_maxFieldSize = rValue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline Poco::Any SessionImpl::getMaxFieldSize(const std::string& rName) const
|
||||
{
|
||||
return _maxFieldSize;
|
||||
@ -242,7 +242,7 @@ inline void SessionImpl::setDataTypeInfo(const std::string& rName, const Poco::A
|
||||
throw InvalidAccessException();
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline Poco::Any SessionImpl::dataTypeInfo(const std::string& rName) const
|
||||
{
|
||||
return &_dataTypes;
|
||||
|
@ -89,12 +89,12 @@ public:
|
||||
/// Returns information about specified data type as specified by parameter 'type'.
|
||||
/// The requested information is specified by parameter 'param'.
|
||||
/// Will fail with a Poco::NotFoundException thrown if the param is not found
|
||||
|
||||
|
||||
bool tryGetInfo(SQLSMALLINT type, const std::string& param, DynamicAny& result) const;
|
||||
/// Returns information about specified data type as specified by parameter 'type' in param result.
|
||||
/// The requested information is specified by parameter 'param'.
|
||||
/// Will return false if the param is not found. The value of result will be not changed in this case.
|
||||
|
||||
|
||||
|
||||
void print(std::ostream& ostr);
|
||||
/// Prints all the types (as reported by the underlying database)
|
||||
@ -104,8 +104,8 @@ private:
|
||||
void fillCTypes();
|
||||
void fillSQLTypes();
|
||||
|
||||
DataTypeMap _cDataTypes;
|
||||
DataTypeMap _sqlDataTypes;
|
||||
DataTypeMap _cDataTypes;
|
||||
DataTypeMap _sqlDataTypes;
|
||||
TypeInfoVec _typeInfo;
|
||||
SQLHDBC* _pHDBC;
|
||||
};
|
||||
|
@ -27,7 +27,7 @@ inline void makeUTF16(SQLCHAR* pSQLChar, SQLINTEGER length, std::wstring& target
|
||||
/// Utility function for conversion from UTF-8 to UTF-16
|
||||
{
|
||||
int len = length;
|
||||
if (SQL_NTS == len)
|
||||
if (SQL_NTS == len)
|
||||
len = (int) std::strlen((const char *) pSQLChar);
|
||||
|
||||
UnicodeConverter::toUTF16((const char *) pSQLChar, len, target);
|
||||
@ -45,7 +45,7 @@ inline void makeUTF8(Poco::Buffer<wchar_t>& buffer, SQLINTEGER length, SQLPOINTE
|
||||
length /= sizeof(wchar_t);
|
||||
std::string result;
|
||||
UnicodeConverter::toUTF8(buffer.begin(), length, result);
|
||||
|
||||
|
||||
std::memset(pTarget, 0, targetLength);
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(push)
|
||||
|
@ -24,14 +24,14 @@ namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
ConnectionHandle::ConnectionHandle(EnvironmentHandle* pEnvironment):
|
||||
ConnectionHandle::ConnectionHandle(EnvironmentHandle* pEnvironment):
|
||||
_pEnvironment(pEnvironment ? pEnvironment : new EnvironmentHandle),
|
||||
_hdbc(SQL_NULL_HDBC),
|
||||
_hdbc(SQL_NULL_HDBC),
|
||||
_ownsEnvironment(pEnvironment ? false : true)
|
||||
{
|
||||
if (Utility::isError(SQLAllocHandle(SQL_HANDLE_DBC,
|
||||
_pEnvironment->handle(),
|
||||
&_hdbc)))
|
||||
if (Utility::isError(SQLAllocHandle(SQL_HANDLE_DBC,
|
||||
_pEnvironment->handle(),
|
||||
&_hdbc)))
|
||||
{
|
||||
throw ODBCException("Could not allocate connection handle.");
|
||||
}
|
||||
|
@ -26,12 +26,12 @@ namespace ODBC {
|
||||
|
||||
EnvironmentHandle::EnvironmentHandle(): _henv(SQL_NULL_HENV)
|
||||
{
|
||||
if (Utility::isError(SQLAllocHandle(SQL_HANDLE_ENV,
|
||||
SQL_NULL_HANDLE,
|
||||
if (Utility::isError(SQLAllocHandle(SQL_HANDLE_ENV,
|
||||
SQL_NULL_HANDLE,
|
||||
&_henv)) ||
|
||||
Utility::isError(SQLSetEnvAttr(_henv,
|
||||
SQL_ATTR_ODBC_VERSION,
|
||||
(SQLPOINTER) SQL_OV_ODBC3,
|
||||
Utility::isError(SQLSetEnvAttr(_henv,
|
||||
SQL_ATTR_ODBC_VERSION,
|
||||
(SQLPOINTER) SQL_OV_ODBC3,
|
||||
0)))
|
||||
{
|
||||
throw ODBCException("Could not initialize environment.");
|
||||
|
@ -23,14 +23,14 @@ namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
Parameter::Parameter(const StatementHandle& rStmt, std::size_t colNum) :
|
||||
_rStmt(rStmt),
|
||||
Parameter::Parameter(const StatementHandle& rStmt, std::size_t colNum) :
|
||||
_rStmt(rStmt),
|
||||
_number(colNum)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Parameter::~Parameter()
|
||||
{
|
||||
}
|
||||
@ -38,8 +38,8 @@ Parameter::~Parameter()
|
||||
|
||||
void Parameter::init()
|
||||
{
|
||||
if (Utility::isError(SQLDescribeParam(_rStmt,
|
||||
(SQLUSMALLINT) _number + 1,
|
||||
if (Utility::isError(SQLDescribeParam(_rStmt,
|
||||
(SQLUSMALLINT) _number + 1,
|
||||
&_dataType,
|
||||
&_columnSize,
|
||||
&_decimalDigits,
|
||||
|
@ -31,7 +31,7 @@ SessionImpl::SessionImpl(const std::string& connect,
|
||||
std::size_t loginTimeout,
|
||||
std::size_t maxFieldSize,
|
||||
bool autoBind,
|
||||
bool autoExtract):
|
||||
bool autoExtract):
|
||||
Poco::Data::AbstractSessionImpl<SessionImpl>(connect, loginTimeout),
|
||||
_connector(Connector::KEY),
|
||||
_maxFieldSize(maxFieldSize),
|
||||
@ -49,7 +49,7 @@ SessionImpl::SessionImpl(const std::string& connect,
|
||||
|
||||
|
||||
SessionImpl::SessionImpl(const std::string& connect,
|
||||
Poco::Any maxFieldSize,
|
||||
Poco::Any maxFieldSize,
|
||||
bool enforceCapability,
|
||||
bool autoBind,
|
||||
bool autoExtract): Poco::Data::AbstractSessionImpl<SessionImpl>(connect),
|
||||
@ -136,20 +136,20 @@ void SessionImpl::open(const std::string& connect)
|
||||
}
|
||||
|
||||
_dataTypes.fillTypeInfo(_db);
|
||||
addProperty("dataTypeInfo",
|
||||
&SessionImpl::setDataTypeInfo,
|
||||
addProperty("dataTypeInfo",
|
||||
&SessionImpl::setDataTypeInfo,
|
||||
&SessionImpl::dataTypeInfo);
|
||||
|
||||
addFeature("autoCommit",
|
||||
&SessionImpl::autoCommit,
|
||||
addFeature("autoCommit",
|
||||
&SessionImpl::autoCommit,
|
||||
&SessionImpl::isAutoCommit);
|
||||
|
||||
addFeature("autoBind",
|
||||
&SessionImpl::autoBind,
|
||||
addFeature("autoBind",
|
||||
&SessionImpl::autoBind,
|
||||
&SessionImpl::isAutoBind);
|
||||
|
||||
addFeature("autoExtract",
|
||||
&SessionImpl::autoExtract,
|
||||
addFeature("autoExtract",
|
||||
&SessionImpl::autoExtract,
|
||||
&SessionImpl::isAutoExtract);
|
||||
|
||||
addProperty("maxFieldSize",
|
||||
@ -222,11 +222,11 @@ bool SessionImpl::canTransact() const
|
||||
if (ODBC_TXN_CAPABILITY_UNKNOWN == _canTransact)
|
||||
{
|
||||
SQLUSMALLINT ret;
|
||||
checkError(Poco::Data::ODBC::SQLGetInfo(_db, SQL_TXN_CAPABLE, &ret, 0, 0),
|
||||
checkError(Poco::Data::ODBC::SQLGetInfo(_db, SQL_TXN_CAPABLE, &ret, 0, 0),
|
||||
"Failed to obtain transaction capability info.");
|
||||
|
||||
_canTransact = (SQL_TC_NONE != ret) ?
|
||||
ODBC_TXN_CAPABILITY_TRUE :
|
||||
_canTransact = (SQL_TC_NONE != ret) ?
|
||||
ODBC_TXN_CAPABILITY_TRUE :
|
||||
ODBC_TXN_CAPABILITY_FALSE;
|
||||
}
|
||||
|
||||
@ -329,10 +329,10 @@ Poco::UInt32 SessionImpl::transactionIsolation(SQLULEN isolation)
|
||||
|
||||
void SessionImpl::autoCommit(const std::string&, bool val)
|
||||
{
|
||||
checkError(Poco::Data::ODBC::SQLSetConnectAttr(_db,
|
||||
SQL_ATTR_AUTOCOMMIT,
|
||||
val ? (SQLPOINTER) SQL_AUTOCOMMIT_ON :
|
||||
(SQLPOINTER) SQL_AUTOCOMMIT_OFF,
|
||||
checkError(Poco::Data::ODBC::SQLSetConnectAttr(_db,
|
||||
SQL_ATTR_AUTOCOMMIT,
|
||||
val ? (SQLPOINTER) SQL_AUTOCOMMIT_ON :
|
||||
(SQLPOINTER) SQL_AUTOCOMMIT_OFF,
|
||||
SQL_IS_UINTEGER), "Failed to set automatic commit.");
|
||||
}
|
||||
|
||||
@ -415,7 +415,7 @@ void SessionImpl::close()
|
||||
{
|
||||
commit();
|
||||
}
|
||||
catch (ConnectionException&)
|
||||
catch (ConnectionException&)
|
||||
{
|
||||
}
|
||||
|
||||
@ -433,7 +433,7 @@ int SessionImpl::maxStatementLength() const
|
||||
0,
|
||||
0)))
|
||||
{
|
||||
throw ConnectionException(_db,
|
||||
throw ConnectionException(_db,
|
||||
"SQLGetInfo(SQL_MAXIMUM_STATEMENT_LENGTH)");
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ void TypeInfo::fillTypeInfo(SQLHDBC pHDBC)
|
||||
char literalSuffix[stringSize] = { 0 };
|
||||
char createParams[stringSize] = { 0 };
|
||||
char localTypeName[stringSize] = { 0 };
|
||||
|
||||
|
||||
TypeInfoTup ti("TYPE_NAME", "",
|
||||
"DATA_TYPE", 0,
|
||||
"COLUMN_SIZE", 0,
|
||||
@ -142,10 +142,10 @@ void TypeInfo::fillTypeInfo(SQLHDBC pHDBC)
|
||||
ti.set<4>(literalSuffix);
|
||||
rc = SQLGetData(hstmt, 6, SQL_C_CHAR, createParams, sizeof(createParams), &ind);
|
||||
ti.set<5>(createParams);
|
||||
rc = SQLGetData(hstmt, 7, SQL_C_SSHORT, &ti.get<6>(), sizeof(SQLSMALLINT), &ind);
|
||||
rc = SQLGetData(hstmt, 8, SQL_C_SSHORT, &ti.get<7>(), sizeof(SQLSMALLINT), &ind);
|
||||
rc = SQLGetData(hstmt, 9, SQL_C_SSHORT, &ti.get<8>(), sizeof(SQLSMALLINT), &ind);
|
||||
rc = SQLGetData(hstmt, 10, SQL_C_SSHORT, &ti.get<9>(), sizeof(SQLSMALLINT), &ind);
|
||||
rc = SQLGetData(hstmt, 7, SQL_C_SSHORT, &ti.get<6>(), sizeof(SQLSMALLINT), &ind);
|
||||
rc = SQLGetData(hstmt, 8, SQL_C_SSHORT, &ti.get<7>(), sizeof(SQLSMALLINT), &ind);
|
||||
rc = SQLGetData(hstmt, 9, SQL_C_SSHORT, &ti.get<8>(), sizeof(SQLSMALLINT), &ind);
|
||||
rc = SQLGetData(hstmt, 10, SQL_C_SSHORT, &ti.get<9>(), sizeof(SQLSMALLINT), &ind);
|
||||
rc = SQLGetData(hstmt, 11, SQL_C_SSHORT, &ti.get<10>(), sizeof(SQLSMALLINT), &ind);
|
||||
rc = SQLGetData(hstmt, 12, SQL_C_SSHORT, &ti.get<11>(), sizeof(SQLSMALLINT), &ind);
|
||||
rc = SQLGetData(hstmt, 13, SQL_C_CHAR, localTypeName, sizeof(localTypeName), &ind);
|
||||
@ -192,7 +192,7 @@ bool TypeInfo::tryGetInfo(SQLSMALLINT type, const std::string& param, DynamicAny
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -239,24 +239,24 @@ void TypeInfo::print(std::ostream& ostr)
|
||||
|
||||
for (; it != end; ++it)
|
||||
{
|
||||
ostr << it->get<0>() << "\t"
|
||||
<< it->get<1>() << "\t"
|
||||
<< it->get<2>() << "\t"
|
||||
<< it->get<3>() << "\t"
|
||||
<< it->get<4>() << "\t"
|
||||
<< it->get<5>() << "\t"
|
||||
<< it->get<6>() << "\t"
|
||||
<< it->get<7>() << "\t"
|
||||
<< it->get<8>() << "\t"
|
||||
<< it->get<9>() << "\t"
|
||||
<< it->get<10>() << "\t"
|
||||
<< it->get<11>() << "\t"
|
||||
<< it->get<12>() << "\t"
|
||||
<< it->get<13>() << "\t"
|
||||
ostr << it->get<0>() << "\t"
|
||||
<< it->get<1>() << "\t"
|
||||
<< it->get<2>() << "\t"
|
||||
<< it->get<3>() << "\t"
|
||||
<< it->get<4>() << "\t"
|
||||
<< it->get<5>() << "\t"
|
||||
<< it->get<6>() << "\t"
|
||||
<< it->get<7>() << "\t"
|
||||
<< it->get<8>() << "\t"
|
||||
<< it->get<9>() << "\t"
|
||||
<< it->get<10>() << "\t"
|
||||
<< it->get<11>() << "\t"
|
||||
<< it->get<12>() << "\t"
|
||||
<< it->get<13>() << "\t"
|
||||
<< it->get<14>() << "\t"
|
||||
<< it->get<15>() << "\t"
|
||||
<< it->get<16>() << "\t"
|
||||
<< it->get<17>() << "\t"
|
||||
<< it->get<15>() << "\t"
|
||||
<< it->get<16>() << "\t"
|
||||
<< it->get<17>() << "\t"
|
||||
<< it->get<18>() << std::endl;
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ namespace ODBC {
|
||||
void makeUTF16(SQLCHAR* pSQLChar, SQLINTEGER length, std::string& target)
|
||||
{
|
||||
int len = length;
|
||||
if (SQL_NTS == len)
|
||||
if (SQL_NTS == len)
|
||||
len = (int) std::strlen((const char *) pSQLChar);
|
||||
|
||||
UTF8Encoding utf8Encoding;
|
||||
@ -59,7 +59,7 @@ void makeUTF8(Poco::Buffer<SQLWCHAR>& buffer, SQLINTEGER length, SQLPOINTER pTar
|
||||
std::string result;
|
||||
if (0 != converter.convert(buffer.begin(), length, result))
|
||||
throw DataFormatException("Error converting UTF-16 to UTF-8");
|
||||
|
||||
|
||||
std::memset(pTarget, 0, targetLength);
|
||||
std::strncpy((char*) pTarget, result.c_str(), result.size() < targetLength ? result.size() : targetLength);
|
||||
}
|
||||
@ -69,7 +69,7 @@ SQLRETURN SQLColAttribute(SQLHSTMT hstmt,
|
||||
SQLUSMALLINT iCol,
|
||||
SQLUSMALLINT iField,
|
||||
SQLPOINTER pCharAttr,
|
||||
SQLSMALLINT cbCharAttrMax,
|
||||
SQLSMALLINT cbCharAttrMax,
|
||||
SQLSMALLINT* pcbCharAttr,
|
||||
NumAttrPtrType pNumAttr)
|
||||
{
|
||||
@ -93,7 +93,7 @@ SQLRETURN SQLColAttribute(SQLHSTMT hstmt,
|
||||
iCol,
|
||||
iField,
|
||||
pCharAttr,
|
||||
cbCharAttrMax,
|
||||
cbCharAttrMax,
|
||||
pcbCharAttr,
|
||||
pNumAttr);
|
||||
}
|
||||
@ -133,8 +133,8 @@ SQLRETURN SQLConnect(SQLHDBC hdbc,
|
||||
|
||||
std::string sqlPWD;
|
||||
makeUTF16(szAuthStr, cbAuthStr, sqlPWD);
|
||||
|
||||
return SQLConnectW(hdbc,
|
||||
|
||||
return SQLConnectW(hdbc,
|
||||
(SQLWCHAR*) sqlDSN.c_str(), cbDSN,
|
||||
(SQLWCHAR*) sqlUID.c_str(), cbUID,
|
||||
(SQLWCHAR*) sqlPWD.c_str(), cbAuthStr);
|
||||
@ -211,7 +211,7 @@ SQLRETURN SQLGetConnectAttr(SQLHDBC hdbc,
|
||||
makeUTF8(buffer, *pcbValue, rgbValue, cbValueMax);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return SQLGetConnectAttrW(hdbc,
|
||||
fAttribute,
|
||||
@ -231,9 +231,9 @@ SQLRETURN SQLGetCursorName(SQLHSTMT hstmt,
|
||||
|
||||
|
||||
SQLRETURN SQLSetDescField(SQLHDESC hdesc,
|
||||
SQLSMALLINT iRecord,
|
||||
SQLSMALLINT iRecord,
|
||||
SQLSMALLINT iField,
|
||||
SQLPOINTER rgbValue,
|
||||
SQLPOINTER rgbValue,
|
||||
SQLINTEGER cbValueMax)
|
||||
{
|
||||
if (isString(rgbValue, cbValueMax))
|
||||
@ -242,16 +242,16 @@ SQLRETURN SQLSetDescField(SQLHDESC hdesc,
|
||||
makeUTF16((SQLCHAR*) rgbValue, cbValueMax, str);
|
||||
|
||||
return SQLSetDescFieldW(hdesc,
|
||||
iRecord,
|
||||
iRecord,
|
||||
iField,
|
||||
(SQLPOINTER) str.c_str(),
|
||||
(SQLPOINTER) str.c_str(),
|
||||
(SQLINTEGER) str.size() * sizeof(SQLWCHAR));
|
||||
}
|
||||
|
||||
return SQLSetDescFieldW(hdesc,
|
||||
iRecord,
|
||||
iRecord,
|
||||
iField,
|
||||
rgbValue,
|
||||
rgbValue,
|
||||
cbValueMax);
|
||||
}
|
||||
|
||||
@ -296,7 +296,7 @@ SQLRETURN SQLGetDescRec(SQLHDESC hdesc,
|
||||
SQLSMALLINT* pfType,
|
||||
SQLSMALLINT* pfSubType,
|
||||
SQLLEN* pLength,
|
||||
SQLSMALLINT* pPrecision,
|
||||
SQLSMALLINT* pPrecision,
|
||||
SQLSMALLINT* pScale,
|
||||
SQLSMALLINT* pNullable)
|
||||
{
|
||||
@ -391,7 +391,7 @@ SQLRETURN SQLSetConnectAttr(SQLHDBC hdbc,
|
||||
|
||||
return SQLSetConnectAttrW(hdbc,
|
||||
fAttribute,
|
||||
(SQLWCHAR*) str.c_str(),
|
||||
(SQLWCHAR*) str.c_str(),
|
||||
(SQLINTEGER) str.size() * sizeof(SQLWCHAR));
|
||||
}
|
||||
|
||||
@ -487,7 +487,7 @@ SQLRETURN SQLGetInfo(SQLHDBC hdbc,
|
||||
pcbInfoValue);
|
||||
|
||||
makeUTF8(buffer, *pcbInfoValue, rgbInfoValue, cbInfoValueMax);
|
||||
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -590,12 +590,12 @@ SQLRETURN SQLDriverConnect(SQLHDBC hdbc,
|
||||
SQLUSMALLINT fDriverCompletion)
|
||||
{
|
||||
SQLSMALLINT len = cbConnStrIn;
|
||||
if (SQL_NTS == len)
|
||||
if (SQL_NTS == len)
|
||||
len = (SQLSMALLINT) std::strlen((const char*) szConnStrIn) + 1;
|
||||
|
||||
std::string connStrIn;
|
||||
makeUTF16(szConnStrIn, len, connStrIn);
|
||||
|
||||
|
||||
Buffer<SQLWCHAR> out(cbConnStrOutMax);
|
||||
SQLRETURN rc = SQLDriverConnectW(hdbc,
|
||||
hwnd,
|
||||
|
@ -97,7 +97,7 @@ SQLRETURN SQLConnect(SQLHDBC hdbc,
|
||||
|
||||
std::wstring sqlPWD;
|
||||
makeUTF16(szAuthStr, cbAuthStr, sqlPWD);
|
||||
|
||||
|
||||
return SQLConnectW(hdbc,
|
||||
(SQLWCHAR*) sqlDSN.c_str(),
|
||||
(SQLSMALLINT) sqlDSN.size(),
|
||||
@ -155,8 +155,8 @@ SQLRETURN SQLExecDirect(SQLHSTMT hstmt,
|
||||
std::wstring sqlStr;
|
||||
makeUTF16(szSqlStr, cbSqlStr, sqlStr);
|
||||
|
||||
return SQLExecDirectW(hstmt,
|
||||
(SQLWCHAR*) sqlStr.c_str(),
|
||||
return SQLExecDirectW(hstmt,
|
||||
(SQLWCHAR*) sqlStr.c_str(),
|
||||
(SQLINTEGER) sqlStr.size());
|
||||
}
|
||||
|
||||
@ -180,7 +180,7 @@ SQLRETURN SQLGetConnectAttr(SQLHDBC hdbc,
|
||||
makeUTF8(buffer, *pcbValue, rgbValue, cbValueMax);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return SQLGetConnectAttrW(hdbc,
|
||||
fAttribute,
|
||||
@ -200,9 +200,9 @@ SQLRETURN SQLGetCursorName(SQLHSTMT hstmt,
|
||||
|
||||
|
||||
SQLRETURN SQLSetDescField(SQLHDESC hdesc,
|
||||
SQLSMALLINT iRecord,
|
||||
SQLSMALLINT iRecord,
|
||||
SQLSMALLINT iField,
|
||||
SQLPOINTER rgbValue,
|
||||
SQLPOINTER rgbValue,
|
||||
SQLINTEGER cbValueMax)
|
||||
{
|
||||
if (isString(rgbValue, cbValueMax))
|
||||
@ -211,18 +211,18 @@ SQLRETURN SQLSetDescField(SQLHDESC hdesc,
|
||||
makeUTF16((SQLCHAR*) rgbValue, cbValueMax, str);
|
||||
|
||||
SQLRETURN rc = SQLSetDescFieldW(hdesc,
|
||||
iRecord,
|
||||
iRecord,
|
||||
iField,
|
||||
(SQLPOINTER) str.c_str(),
|
||||
(SQLPOINTER) str.c_str(),
|
||||
(SQLINTEGER) str.size() * sizeof(std::wstring::value_type));
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
return SQLSetDescFieldW(hdesc,
|
||||
iRecord,
|
||||
iRecord,
|
||||
iField,
|
||||
rgbValue,
|
||||
rgbValue,
|
||||
cbValueMax);
|
||||
}
|
||||
|
||||
@ -266,7 +266,7 @@ SQLRETURN SQLGetDescRec(SQLHDESC hdesc,
|
||||
SQLSMALLINT* pfType,
|
||||
SQLSMALLINT* pfSubType,
|
||||
SQLLEN* pLength,
|
||||
SQLSMALLINT* pPrecision,
|
||||
SQLSMALLINT* pPrecision,
|
||||
SQLSMALLINT* pScale,
|
||||
SQLSMALLINT* pNullable)
|
||||
{
|
||||
@ -344,8 +344,8 @@ SQLRETURN SQLPrepare(SQLHSTMT hstmt,
|
||||
std::wstring sqlStr;
|
||||
makeUTF16(szSqlStr, cbSqlStr, sqlStr);
|
||||
|
||||
return SQLPrepareW(hstmt,
|
||||
(SQLWCHAR*) sqlStr.c_str(),
|
||||
return SQLPrepareW(hstmt,
|
||||
(SQLWCHAR*) sqlStr.c_str(),
|
||||
(SQLINTEGER) sqlStr.size());
|
||||
}
|
||||
|
||||
@ -362,13 +362,13 @@ SQLRETURN SQLSetConnectAttr(SQLHDBC hdbc,
|
||||
|
||||
return SQLSetConnectAttrW(hdbc,
|
||||
fAttribute,
|
||||
(SQLWCHAR*) str.c_str(),
|
||||
(SQLWCHAR*) str.c_str(),
|
||||
(SQLINTEGER) str.size() * sizeof(std::wstring::value_type));
|
||||
}
|
||||
|
||||
return SQLSetConnectAttrW(hdbc,
|
||||
fAttribute,
|
||||
rgbValue,
|
||||
rgbValue,
|
||||
cbValue);
|
||||
}
|
||||
|
||||
@ -576,7 +576,7 @@ SQLRETURN SQLDriverConnect(SQLHDBC hdbc,
|
||||
{
|
||||
std::wstring connStrIn;
|
||||
int len = cbConnStrIn;
|
||||
if (SQL_NTS == len)
|
||||
if (SQL_NTS == len)
|
||||
len = (int) std::strlen((const char*) szConnStrIn);
|
||||
|
||||
Poco::UnicodeConverter::toUTF16((const char *) szConnStrIn, len, connStrIn);
|
||||
|
@ -41,7 +41,7 @@ Utility::DriverMap& Utility::drivers(Utility::DriverMap& driverMap)
|
||||
SQLSMALLINT len2 = length;
|
||||
RETCODE rc = 0;
|
||||
|
||||
if (!Utility::isError(rc = SQLDrivers(henv,
|
||||
if (!Utility::isError(rc = SQLDrivers(henv,
|
||||
SQL_FETCH_FIRST,
|
||||
desc,
|
||||
length,
|
||||
@ -52,12 +52,12 @@ Utility::DriverMap& Utility::drivers(Utility::DriverMap& driverMap)
|
||||
{
|
||||
do
|
||||
{
|
||||
driverMap.insert(DSNMap::value_type(std::string((char *) desc),
|
||||
driverMap.insert(DSNMap::value_type(std::string((char *) desc),
|
||||
std::string((char *) attr)));
|
||||
std::memset(desc, 0, length);
|
||||
std::memset(attr, 0, length);
|
||||
len2 = length;
|
||||
}while (!Utility::isError(rc = SQLDrivers(henv,
|
||||
}while (!Utility::isError(rc = SQLDrivers(henv,
|
||||
SQL_FETCH_NEXT,
|
||||
desc,
|
||||
length,
|
||||
@ -67,7 +67,7 @@ Utility::DriverMap& Utility::drivers(Utility::DriverMap& driverMap)
|
||||
&len2)));
|
||||
}
|
||||
|
||||
if (SQL_NO_DATA != rc)
|
||||
if (SQL_NO_DATA != rc)
|
||||
throw EnvironmentException(henv);
|
||||
|
||||
return driverMap;
|
||||
@ -88,7 +88,7 @@ Utility::DSNMap& Utility::dataSources(Utility::DSNMap& dsnMap)
|
||||
SQLSMALLINT len2 = length;
|
||||
RETCODE rc = 0;
|
||||
|
||||
while (!Utility::isError(rc = Poco::Data::ODBC::SQLDataSources(henv,
|
||||
while (!Utility::isError(rc = Poco::Data::ODBC::SQLDataSources(henv,
|
||||
SQL_FETCH_NEXT,
|
||||
dsn,
|
||||
SQL_MAX_DSN_LENGTH,
|
||||
@ -103,7 +103,7 @@ Utility::DSNMap& Utility::dataSources(Utility::DSNMap& dsnMap)
|
||||
len2 = length;
|
||||
}
|
||||
|
||||
if (SQL_NO_DATA != rc)
|
||||
if (SQL_NO_DATA != rc)
|
||||
throw EnvironmentException(henv);
|
||||
|
||||
return dsnMap;
|
||||
|
@ -40,7 +40,7 @@ std::string ODBCAccessTest::_dbConnString;
|
||||
Poco::Data::ODBC::Utility::DriverMap ODBCAccessTest::_drivers;
|
||||
|
||||
|
||||
ODBCAccessTest::ODBCAccessTest(const std::string& name):
|
||||
ODBCAccessTest::ODBCAccessTest(const std::string& name):
|
||||
CppUnit::TestCase(name)
|
||||
{
|
||||
}
|
||||
@ -123,13 +123,13 @@ bool ODBCAccessTest::canConnect(const std::string& driver, const std::string& ds
|
||||
{
|
||||
if (((itDrv->first).find(driver) != std::string::npos))
|
||||
{
|
||||
std::cout << "Driver found: " << itDrv->first
|
||||
std::cout << "Driver found: " << itDrv->first
|
||||
<< " (" << itDrv->second << ')' << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (_drivers.end() == itDrv)
|
||||
if (_drivers.end() == itDrv)
|
||||
{
|
||||
std::cout << driver << " driver NOT found, tests not available." << std::endl;
|
||||
return false;
|
||||
@ -142,7 +142,7 @@ bool ODBCAccessTest::canConnect(const std::string& driver, const std::string& ds
|
||||
{
|
||||
if (itDSN->first == dsn && itDSN->second == driver)
|
||||
{
|
||||
std::cout << "DSN found: " << itDSN->first
|
||||
std::cout << "DSN found: " << itDSN->first
|
||||
<< " (" << itDSN->second << ')' << std::endl;
|
||||
format(_dbConnString, "DSN=%s", dsn);
|
||||
return true;
|
||||
|
@ -25,7 +25,7 @@
|
||||
class ODBCAccessTest: public CppUnit::TestCase
|
||||
/// MS Access ODBC test class
|
||||
/// Tested:
|
||||
///
|
||||
///
|
||||
/// Driver | DB | OS
|
||||
/// ------------+-----------+------------------------------------------
|
||||
/// 4.00.6305.00| Jet 4.0 | MS Windows XP Professional x64 v.2003/SP1
|
||||
|
@ -66,7 +66,7 @@ std::string ODBCDB2Test::_connectString = "Driver=" DB2_ODBC_DRIVER ";"
|
||||
"Pwd=" DB2_PWD ";";
|
||||
|
||||
|
||||
ODBCDB2Test::ODBCDB2Test(const std::string& name):
|
||||
ODBCDB2Test::ODBCDB2Test(const std::string& name):
|
||||
ODBCTest(name, _pSession, _pExecutor, _dsn, _uid, _pwd, _connectString)
|
||||
{
|
||||
}
|
||||
@ -110,7 +110,7 @@ void ODBCDB2Test::testBareboneODBC()
|
||||
void ODBCDB2Test::testBLOB()
|
||||
{
|
||||
if (!_pSession) fail ("Test not available.");
|
||||
|
||||
|
||||
const std::size_t maxFldSize = 1000000;
|
||||
_pSession->setProperty("maxFieldSize", Poco::Any(maxFldSize-1));
|
||||
recreatePersonBLOBTable();
|
||||
@ -120,7 +120,7 @@ void ODBCDB2Test::testBLOB()
|
||||
_pExecutor->blob(maxFldSize);
|
||||
fail ("must fail");
|
||||
}
|
||||
catch (DataException&)
|
||||
catch (DataException&)
|
||||
{
|
||||
_pSession->setProperty("maxFieldSize", Poco::Any(maxFldSize));
|
||||
}
|
||||
@ -183,14 +183,14 @@ void ODBCDB2Test::testStoredProcedure()
|
||||
"BEGIN "
|
||||
" SET outParam = inParam*inParam; "
|
||||
"END" , now;
|
||||
|
||||
|
||||
|
||||
i = 2;
|
||||
int j = 0;
|
||||
*_pSession << "{call storedProcedure(?, ?)}", in(i), out(j), now;
|
||||
assertTrue (4 == j);
|
||||
dropObject("PROCEDURE", "storedProcedure");
|
||||
|
||||
|
||||
*_pSession << "CREATE PROCEDURE storedProcedure(INOUT ioParam INTEGER) "
|
||||
"BEGIN "
|
||||
" SET ioParam = ioParam*ioParam; "
|
||||
@ -209,7 +209,7 @@ void ODBCDB2Test::testStoredProcedure()
|
||||
" SET outParam = inParam; "
|
||||
"END" , now;
|
||||
|
||||
std::string inParam =
|
||||
std::string inParam =
|
||||
"1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
|
||||
"1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
|
||||
"1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
|
||||
@ -272,7 +272,7 @@ void ODBCDB2Test::testStoredProcedureDynamicAny()
|
||||
for (int k = 0; k < 8;)
|
||||
{
|
||||
_pSession->setFeature("autoBind", bindValue(k));
|
||||
|
||||
|
||||
DynamicAny i = 2;
|
||||
DynamicAny j = 0;
|
||||
|
||||
@ -319,12 +319,12 @@ void ODBCDB2Test::testStoredFunction()
|
||||
*_pSession << "{? = call storedFunction()}", out(i), now;
|
||||
assertTrue (-1 == i);
|
||||
dropObject("PROCEDURE", "storedFunction");
|
||||
|
||||
|
||||
*_pSession << "CREATE PROCEDURE storedFunction(inParam INTEGER) "
|
||||
"BEGIN "
|
||||
" RETURN inParam*inParam; "
|
||||
"END" , now;
|
||||
|
||||
|
||||
i = 2;
|
||||
int result = 0;
|
||||
*_pSession << "{? = call storedFunction(?)}", out(result), in(i), now;
|
||||
@ -342,7 +342,7 @@ void ODBCDB2Test::testStoredFunction()
|
||||
result = 0;
|
||||
*_pSession << "{? = call storedFunction(?, ?)}", out(result), in(i), out(j), now;
|
||||
assertTrue (4 == j);
|
||||
assertTrue (j == result);
|
||||
assertTrue (j == result);
|
||||
dropObject("PROCEDURE", "storedFunction");
|
||||
|
||||
*_pSession << "CREATE PROCEDURE storedFunction(INOUT param1 INTEGER, INOUT param2 INTEGER) "
|
||||
@ -360,7 +360,7 @@ void ODBCDB2Test::testStoredFunction()
|
||||
*_pSession << "{? = call storedFunction(?, ?)}", out(result), io(i), io(j), now;
|
||||
assertTrue (1 == j);
|
||||
assertTrue (2 == i);
|
||||
assertTrue (3 == result);
|
||||
assertTrue (3 == result);
|
||||
|
||||
Tuple<int, int> params(1, 2);
|
||||
assertTrue (1 == params.get<0>());
|
||||
@ -369,7 +369,7 @@ void ODBCDB2Test::testStoredFunction()
|
||||
*_pSession << "{? = call storedFunction(?, ?)}", out(result), io(params), now;
|
||||
assertTrue (1 == params.get<1>());
|
||||
assertTrue (2 == params.get<0>());
|
||||
assertTrue (3 == result);
|
||||
assertTrue (3 == result);
|
||||
|
||||
dropObject("PROCEDURE", "storedFunction");
|
||||
|
||||
@ -545,14 +545,14 @@ void ODBCDB2Test::recreateNullsTable(const std::string& notNull)
|
||||
void ODBCDB2Test::recreateMiscTable()
|
||||
{
|
||||
dropObject("TABLE", "MiscTest");
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
session() << "CREATE TABLE MiscTest "
|
||||
"(First VARCHAR(30),"
|
||||
"Second BLOB,"
|
||||
"Third INTEGER,"
|
||||
"Fourth FLOAT,"
|
||||
"Fifth TIMESTAMP)", now;
|
||||
"Fifth TIMESTAMP)", now;
|
||||
} catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail ("recreateMiscTable()"); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail ("recreateMiscTable()"); }
|
||||
}
|
||||
@ -563,19 +563,19 @@ void ODBCDB2Test::recreateLogTable()
|
||||
dropObject("TABLE", "T_POCO_LOG");
|
||||
dropObject("TABLE", "T_POCO_LOG_ARCHIVE");
|
||||
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
std::string sql = "CREATE TABLE %s "
|
||||
"(Source VARCHAR(100),"
|
||||
"Name VARCHAR(100),"
|
||||
"ProcessId INTEGER,"
|
||||
"Thread VARCHAR(100), "
|
||||
"ThreadId INTEGER,"
|
||||
"ThreadId INTEGER,"
|
||||
"Priority INTEGER,"
|
||||
"Text VARCHAR(100),"
|
||||
"DateTime TIMESTAMP)";
|
||||
"DateTime TIMESTAMP)";
|
||||
|
||||
session() << sql, "T_POCO_LOG", now;
|
||||
session() << sql, "T_POCO_LOG", now;
|
||||
session() << sql, "T_POCO_LOG_ARCHIVE", now;
|
||||
|
||||
} catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail ("recreateLogTable()"); }
|
||||
|
@ -21,7 +21,7 @@
|
||||
class ODBCDB2Test: public ODBCTest
|
||||
/// IBM DB2 UDB ODBC test class
|
||||
/// Tested:
|
||||
///
|
||||
///
|
||||
/// Driver | DB | OS
|
||||
/// ------------+-------------------+------------------------------------------
|
||||
/// 9.01.00.356 | DB2 Express-C 9.1 | MS Windows XP Professional x64 v.2003/SP1
|
||||
|
@ -61,7 +61,7 @@ std::string ODBCMySQLTest::_connectString = "DRIVER={" MYSQL_ODBC_DRIVE
|
||||
"PWD=" MYSQL_PWD ";";
|
||||
|
||||
|
||||
ODBCMySQLTest::ODBCMySQLTest(const std::string& name):
|
||||
ODBCMySQLTest::ODBCMySQLTest(const std::string& name):
|
||||
ODBCTest(name, _pSession, _pExecutor, _dsn, _uid, _pwd, _connectString)
|
||||
{
|
||||
_pExecutor->execute("SET @@global.sql_mode= '';"); // disable strict mode
|
||||
@ -120,7 +120,7 @@ So, we skip this test.
|
||||
void ODBCMySQLTest::testBLOB()
|
||||
{
|
||||
if (!_pSession) fail ("Test not available.");
|
||||
|
||||
|
||||
const std::size_t maxFldSize = 65534;
|
||||
_pSession->setProperty("maxFieldSize", Poco::Any(maxFldSize-1));
|
||||
recreatePersonBLOBTable();
|
||||
@ -130,7 +130,7 @@ void ODBCMySQLTest::testBLOB()
|
||||
_pExecutor->blob(maxFldSize);
|
||||
fail ("must fail");
|
||||
}
|
||||
catch (DataException&)
|
||||
catch (DataException&)
|
||||
{
|
||||
_pSession->setProperty("maxFieldSize", Poco::Any(maxFldSize));
|
||||
}
|
||||
@ -182,10 +182,10 @@ void ODBCMySQLTest::testNull()
|
||||
|
||||
void ODBCMySQLTest::testStoredProcedure()
|
||||
{
|
||||
//MySQL is currently buggy in this area:
|
||||
//MySQL is currently buggy in this area:
|
||||
// http://bugs.mysql.com/bug.php?id=17898
|
||||
// http://bugs.mysql.com/bug.php?id=27632
|
||||
// Additionally, the standard ODBC stored procedure call syntax
|
||||
// Additionally, the standard ODBC stored procedure call syntax
|
||||
// {call storedProcedure(?)} is currently (3.51.12.00) not supported.
|
||||
// See http://bugs.mysql.com/bug.php?id=26535
|
||||
// Poco::Data support for MySQL ODBC is postponed until the above
|
||||
@ -195,10 +195,10 @@ void ODBCMySQLTest::testStoredProcedure()
|
||||
|
||||
void ODBCMySQLTest::testStoredFunction()
|
||||
{
|
||||
//MySQL is currently buggy in this area:
|
||||
//MySQL is currently buggy in this area:
|
||||
// http://bugs.mysql.com/bug.php?id=17898
|
||||
// http://bugs.mysql.com/bug.php?id=27632
|
||||
// Additionally, the standard ODBC stored procedure call syntax
|
||||
// Additionally, the standard ODBC stored procedure call syntax
|
||||
// {call storedProcedure(?)} is currently (3.51.12.00) not supported.
|
||||
// See http://bugs.mysql.com/bug.php?id=26535
|
||||
// Poco::Data support for MySQL ODBC is postponed until the above
|
||||
@ -390,19 +390,19 @@ void ODBCMySQLTest::recreateLogTable()
|
||||
dropObject("TABLE", "T_POCO_LOG");
|
||||
dropObject("TABLE", "T_POCO_LOG_ARCHIVE");
|
||||
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
std::string sql = "CREATE TABLE %s "
|
||||
"(Source VARCHAR(100),"
|
||||
"Name VARCHAR(100),"
|
||||
"ProcessId INTEGER,"
|
||||
"Thread VARCHAR(100), "
|
||||
"ThreadId INTEGER,"
|
||||
"ThreadId INTEGER,"
|
||||
"Priority INTEGER,"
|
||||
"Text VARCHAR(100),"
|
||||
"DateTime DATETIME)";
|
||||
"DateTime DATETIME)";
|
||||
|
||||
session() << sql, "T_POCO_LOG", now;
|
||||
session() << sql, "T_POCO_LOG", now;
|
||||
session() << sql, "T_POCO_LOG_ARCHIVE", now;
|
||||
|
||||
} catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail ("recreateLogTable()"); }
|
||||
|
@ -21,8 +21,8 @@
|
||||
class ODBCMySQLTest: public ODBCTest
|
||||
/// MySQL ODBC test class
|
||||
/// Tested:
|
||||
///
|
||||
/// Driver | DB | OS | Driver Manager
|
||||
///
|
||||
/// Driver | DB | OS | Driver Manager
|
||||
/// ----------------+---------------------------+-------------------------------------------+---------------------
|
||||
/// 03.51.12.00 | MySQL 5.0.27-community-nt | MS Windows XP Professional x64 v.2003/SP1 | 3.526.3959.0
|
||||
/// 3.51.11.-6 | MySQL 5.0.27-community-nt | Ubuntu 7.04 (2.6.20-15-generic #2 SMP) | unixODBC 2.2.11.-13
|
||||
@ -41,7 +41,7 @@ public:
|
||||
void testStoredFunction();
|
||||
|
||||
void testNull();
|
||||
|
||||
|
||||
void testMultipleResults();
|
||||
void testFilter();
|
||||
|
||||
|
@ -81,7 +81,7 @@ std::string ODBCOracleTest::_connectString = "DRIVER={" ORACLE_ODBC_DRI
|
||||
"APA=T;" // thread safety (T/F), default T
|
||||
"DBA=W;"; // write access (R/W)
|
||||
|
||||
const std::string ODBCOracleTest::MULTI_INSERT =
|
||||
const std::string ODBCOracleTest::MULTI_INSERT =
|
||||
"BEGIN "
|
||||
"INSERT INTO Test VALUES ('1', 2, 3.5);"
|
||||
"INSERT INTO Test VALUES ('2', 3, 4.5);"
|
||||
@ -94,7 +94,7 @@ const std::string ODBCOracleTest::MULTI_SELECT =
|
||||
"{CALL multiResultsProcedure()}";
|
||||
|
||||
|
||||
ODBCOracleTest::ODBCOracleTest(const std::string& name):
|
||||
ODBCOracleTest::ODBCOracleTest(const std::string& name):
|
||||
ODBCTest(name, _pSession, _pExecutor, _dsn, _uid, _pwd, _connectString)
|
||||
{
|
||||
}
|
||||
@ -139,27 +139,27 @@ void ODBCOracleTest::testBarebone()
|
||||
"OPEN ret5 FOR SELECT * FROM Test WHERE First = '5';"
|
||||
"END multiResultsProcedure;" , now;
|
||||
|
||||
_pExecutor->bareboneODBCMultiResultTest(_connectString,
|
||||
tableCreateString,
|
||||
SQLExecutor::PB_IMMEDIATE,
|
||||
_pExecutor->bareboneODBCMultiResultTest(_connectString,
|
||||
tableCreateString,
|
||||
SQLExecutor::PB_IMMEDIATE,
|
||||
SQLExecutor::DE_MANUAL,
|
||||
MULTI_INSERT,
|
||||
MULTI_SELECT);
|
||||
_pExecutor->bareboneODBCMultiResultTest(_connectString,
|
||||
tableCreateString,
|
||||
SQLExecutor::PB_IMMEDIATE,
|
||||
_pExecutor->bareboneODBCMultiResultTest(_connectString,
|
||||
tableCreateString,
|
||||
SQLExecutor::PB_IMMEDIATE,
|
||||
SQLExecutor::DE_BOUND,
|
||||
MULTI_INSERT,
|
||||
MULTI_SELECT);
|
||||
_pExecutor->bareboneODBCMultiResultTest(_connectString,
|
||||
tableCreateString,
|
||||
SQLExecutor::PB_AT_EXEC,
|
||||
_pExecutor->bareboneODBCMultiResultTest(_connectString,
|
||||
tableCreateString,
|
||||
SQLExecutor::PB_AT_EXEC,
|
||||
SQLExecutor::DE_MANUAL,
|
||||
MULTI_INSERT,
|
||||
MULTI_SELECT);
|
||||
_pExecutor->bareboneODBCMultiResultTest(_connectString,
|
||||
tableCreateString,
|
||||
SQLExecutor::PB_AT_EXEC,
|
||||
_pExecutor->bareboneODBCMultiResultTest(_connectString,
|
||||
tableCreateString,
|
||||
SQLExecutor::PB_AT_EXEC,
|
||||
SQLExecutor::DE_BOUND,
|
||||
MULTI_INSERT,
|
||||
MULTI_SELECT);
|
||||
@ -178,7 +178,7 @@ void ODBCOracleTest::testBLOB()
|
||||
executor().blob(maxFldSize);
|
||||
fail ("must fail");
|
||||
}
|
||||
catch (DataException&)
|
||||
catch (DataException&)
|
||||
{
|
||||
session().setProperty("maxFieldSize", Poco::Any(maxFldSize));
|
||||
}
|
||||
@ -277,7 +277,7 @@ void ODBCOracleTest::testStoredProcedure()
|
||||
k += 2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//strings only work with auto-binding
|
||||
session().setFeature("autoBind", true);
|
||||
|
||||
@ -286,7 +286,7 @@ void ODBCOracleTest::testStoredProcedure()
|
||||
" BEGIN outParam := inParam; "
|
||||
"END storedProcedure;" , now;
|
||||
|
||||
std::string inParam =
|
||||
std::string inParam =
|
||||
"1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
|
||||
"1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
|
||||
"1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
|
||||
@ -342,7 +342,7 @@ void ODBCOracleTest::testStoredProcedureDynamicAny()
|
||||
for (int k = 0; k < 8;)
|
||||
{
|
||||
session().setFeature("autoBind", bindValue(k));
|
||||
|
||||
|
||||
DynamicAny i = 2;
|
||||
DynamicAny j = 0;
|
||||
|
||||
@ -391,15 +391,15 @@ void ODBCOracleTest::testCursorStoredProcedure()
|
||||
" OPEN ret FOR "
|
||||
" SELECT * "
|
||||
" FROM Person "
|
||||
" WHERE Age < ageLimit "
|
||||
" WHERE Age < ageLimit "
|
||||
" ORDER BY Age DESC; "
|
||||
" END storedCursorProcedure;" , now;
|
||||
|
||||
people.clear();
|
||||
int age = 13;
|
||||
|
||||
|
||||
*_pSession << "{call storedCursorProcedure(?)}", in(age), into(people), now;
|
||||
|
||||
|
||||
assertTrue (2 == people.size());
|
||||
assertTrue (Person("Simpson", "Bart", "Springfield", 12) == people[0]);
|
||||
assertTrue (Person("Simpson", "Lisa", "Springfield", 10) == people[1]);
|
||||
@ -460,7 +460,7 @@ void ODBCOracleTest::testStoredFunction()
|
||||
result = 0;
|
||||
*_pSession << "{? = call storedFunction(?, ?)}", out(result), in(i), out(j), now;
|
||||
assertTrue (4 == j);
|
||||
assertTrue (j == result);
|
||||
assertTrue (j == result);
|
||||
dropObject("FUNCTION", "storedFunction");
|
||||
|
||||
*_pSession << "CREATE OR REPLACE "
|
||||
@ -475,8 +475,8 @@ void ODBCOracleTest::testStoredFunction()
|
||||
*_pSession << "{? = call storedFunction(?, ?)}", out(result), io(i), io(j), now;
|
||||
assertTrue (1 == j);
|
||||
assertTrue (2 == i);
|
||||
assertTrue (3 == result);
|
||||
|
||||
assertTrue (3 == result);
|
||||
|
||||
Tuple<int, int> params(1, 2);
|
||||
assertTrue (1 == params.get<0>());
|
||||
assertTrue (2 == params.get<1>());
|
||||
@ -484,9 +484,9 @@ void ODBCOracleTest::testStoredFunction()
|
||||
*_pSession << "{? = call storedFunction(?, ?)}", out(result), io(params), now;
|
||||
assertTrue (1 == params.get<1>());
|
||||
assertTrue (2 == params.get<0>());
|
||||
assertTrue (3 == result);
|
||||
assertTrue (3 == result);
|
||||
dropObject("FUNCTION", "storedFunction");
|
||||
|
||||
|
||||
k += 2;
|
||||
}
|
||||
|
||||
@ -530,16 +530,16 @@ void ODBCOracleTest::testCursorStoredFunction()
|
||||
" OPEN ret FOR "
|
||||
" SELECT * "
|
||||
" FROM Person "
|
||||
" WHERE Age < ageLimit "
|
||||
" WHERE Age < ageLimit "
|
||||
" ORDER BY Age DESC; "
|
||||
" RETURN ret; "
|
||||
" END storedCursorFunction;" , now;
|
||||
|
||||
people.clear();
|
||||
int age = 13;
|
||||
|
||||
|
||||
*_pSession << "{call storedCursorFunction(?)}", in(age), into(people), now;
|
||||
|
||||
|
||||
assertTrue (2 == people.size());
|
||||
assertTrue (Person("Simpson", "Bart", "Springfield", 12) == people[0]);
|
||||
assertTrue (Person("Simpson", "Lisa", "Springfield", 10) == people[1]);
|
||||
@ -553,7 +553,7 @@ void ODBCOracleTest::testCursorStoredFunction()
|
||||
|
||||
dropObject("TABLE", "Person");
|
||||
dropObject("FUNCTION", "storedCursorFunction");
|
||||
|
||||
|
||||
k += 2;
|
||||
}
|
||||
}
|
||||
@ -611,7 +611,7 @@ void ODBCOracleTest::testAutoTransaction()
|
||||
assertTrue (0 == count);
|
||||
|
||||
session().setFeature("autoCommit", false);
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
AutoTransaction at(session());
|
||||
@ -794,14 +794,14 @@ void ODBCOracleTest::recreateNullsTable(const std::string& notNull)
|
||||
void ODBCOracleTest::recreateMiscTable()
|
||||
{
|
||||
dropObject("TABLE", "MiscTest");
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
session() << "CREATE TABLE MiscTest "
|
||||
"(First VARCHAR(30),"
|
||||
"Second BLOB,"
|
||||
"Third INTEGER,"
|
||||
"Fourth NUMBER,"
|
||||
"Fifth TIMESTAMP)", now;
|
||||
"Fifth TIMESTAMP)", now;
|
||||
} catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail ("recreateMiscTable()"); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail ("recreateMiscTable()"); }
|
||||
}
|
||||
@ -812,20 +812,20 @@ void ODBCOracleTest::recreateLogTable()
|
||||
dropObject("TABLE", "T_POCO_LOG");
|
||||
dropObject("TABLE", "T_POCO_LOG_ARCHIVE");
|
||||
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
std::string sql = "CREATE TABLE %s "
|
||||
"(Source VARCHAR(100),"
|
||||
"Name VARCHAR(100),"
|
||||
"ProcessId INTEGER,"
|
||||
"Thread VARCHAR(100), "
|
||||
"ThreadId INTEGER,"
|
||||
"ThreadId INTEGER,"
|
||||
"Priority INTEGER,"
|
||||
"Text VARCHAR(100),"
|
||||
"DateTime TIMESTAMP)";
|
||||
"DateTime TIMESTAMP)";
|
||||
|
||||
session() << sql, "T_POCO_LOG", now;
|
||||
session() << sql, "T_POCO_LOG_ARCHIVE", now;
|
||||
session() << sql, "T_POCO_LOG", now;
|
||||
session() << sql, "T_POCO_LOG_ARCHIVE", now;
|
||||
|
||||
} catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail ("recreateLogTable()"); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail ("recreateLogTable()"); }
|
||||
|
@ -21,7 +21,7 @@
|
||||
class ODBCOracleTest: public ODBCTest
|
||||
/// Oracle ODBC test class
|
||||
/// Tested:
|
||||
///
|
||||
///
|
||||
/// Driver | DB | OS
|
||||
/// ------------+-------------------------------+------------------------------------------
|
||||
/// 10.02.00.01 | Oracle9i Release 9.2.0.4.0 | MS Windows XP Professional x64 v.2003/SP1
|
||||
@ -51,7 +51,7 @@ public:
|
||||
|
||||
private:
|
||||
static void testBarebone();
|
||||
|
||||
|
||||
void dropObject(const std::string& type, const std::string& name);
|
||||
void recreateNullableTable();
|
||||
void recreatePersonTable();
|
||||
@ -72,7 +72,7 @@ private:
|
||||
|
||||
static ODBCTest::SessionPtr _pSession;
|
||||
static ODBCTest::ExecPtr _pExecutor;
|
||||
|
||||
|
||||
static std::string _driver;
|
||||
static std::string _dsn;
|
||||
static std::string _uid;
|
||||
|
@ -75,7 +75,7 @@ std::string ODBCPostgreSQLTest::_driver = POSTGRESQL_ODBC_DRIVER;
|
||||
std::string ODBCPostgreSQLTest::_dsn = POSTGRESQL_DSN;
|
||||
std::string ODBCPostgreSQLTest::_uid = POSTGRESQL_UID;
|
||||
std::string ODBCPostgreSQLTest::_pwd = POSTGRESQL_PWD;
|
||||
std::string ODBCPostgreSQLTest::_connectString =
|
||||
std::string ODBCPostgreSQLTest::_connectString =
|
||||
"DRIVER=" POSTGRESQL_ODBC_DRIVER ";"
|
||||
"DATABASE=" POSTGRESQL_DB ";"
|
||||
"SERVER=" POSTGRESQL_SERVER ";"
|
||||
@ -114,7 +114,7 @@ std::string ODBCPostgreSQLTest::_connectString =
|
||||
"ReadOnly=0;";
|
||||
|
||||
|
||||
ODBCPostgreSQLTest::ODBCPostgreSQLTest(const std::string& name):
|
||||
ODBCPostgreSQLTest::ODBCPostgreSQLTest(const std::string& name):
|
||||
ODBCTest(name, _pSession, _pExecutor, _dsn, _uid, _pwd, _connectString)
|
||||
{
|
||||
}
|
||||
@ -179,7 +179,7 @@ void ODBCPostgreSQLTest::testBLOB()
|
||||
executor().blob(maxFldSize);
|
||||
fail ("must fail");
|
||||
}
|
||||
catch (DataException&)
|
||||
catch (DataException&)
|
||||
{
|
||||
session().setProperty("maxFieldSize", Poco::Any(maxFldSize));
|
||||
}
|
||||
@ -207,7 +207,7 @@ void ODBCPostgreSQLTest::testStoredFunction()
|
||||
session().setFeature("autoExtract", bindValue(k+1));
|
||||
|
||||
dropObject("FUNCTION", "storedFunction()");
|
||||
try
|
||||
try
|
||||
{
|
||||
session() << "CREATE FUNCTION storedFunction() RETURNS INTEGER AS '"
|
||||
"BEGIN "
|
||||
@ -223,7 +223,7 @@ void ODBCPostgreSQLTest::testStoredFunction()
|
||||
assertTrue (-1 == i);
|
||||
dropObject("FUNCTION", "storedFunction()");
|
||||
|
||||
try
|
||||
try
|
||||
{
|
||||
session() << "CREATE FUNCTION storedFunction(INTEGER) RETURNS INTEGER AS '"
|
||||
"BEGIN "
|
||||
@ -241,7 +241,7 @@ void ODBCPostgreSQLTest::testStoredFunction()
|
||||
dropObject("FUNCTION", "storedFunction(INTEGER)");
|
||||
|
||||
dropObject("FUNCTION", "storedFunction(TIMESTAMP)");
|
||||
try
|
||||
try
|
||||
{
|
||||
session() << "CREATE FUNCTION storedFunction(TIMESTAMP) RETURNS TIMESTAMP AS '"
|
||||
"BEGIN "
|
||||
@ -259,23 +259,23 @@ void ODBCPostgreSQLTest::testStoredFunction()
|
||||
dropObject("FUNCTION", "storedFunction(TIMESTAMP)");
|
||||
|
||||
dropObject("FUNCTION", "storedFunction(TEXT, TEXT)");
|
||||
try
|
||||
try
|
||||
{
|
||||
session() << "CREATE FUNCTION storedFunction(TEXT,TEXT) RETURNS TEXT AS '"
|
||||
"BEGIN "
|
||||
" RETURN $1 || '', '' || $2 || ''!'';"
|
||||
"END;'"
|
||||
"LANGUAGE 'plpgsql'" , now;
|
||||
"LANGUAGE 'plpgsql'" , now;
|
||||
}
|
||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (func); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (func); }
|
||||
|
||||
|
||||
std::string param1 = "Hello";
|
||||
std::string param2 = "world";
|
||||
std::string ret;
|
||||
try
|
||||
try
|
||||
{
|
||||
session() << "{? = call storedFunction(?,?)}", out(ret), in(param1), in(param2), now;
|
||||
session() << "{? = call storedFunction(?,?)}", out(ret), in(param1), in(param2), now;
|
||||
}
|
||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (func); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (func); }
|
||||
@ -346,13 +346,13 @@ void ODBCPostgreSQLTest::configurePLPgSQL()
|
||||
"RETURNS OPAQUE "
|
||||
"AS '%splpgsql.dll' "
|
||||
"LANGUAGE 'C';", _libDir), now;
|
||||
|
||||
|
||||
session() << "CREATE LANGUAGE 'plpgsql' "
|
||||
"HANDLER plpgsql_call_handler "
|
||||
"LANCOMPILER 'PL/pgSQL'", now;
|
||||
|
||||
}catch(StatementException& ex)
|
||||
{
|
||||
}catch(StatementException& ex)
|
||||
{
|
||||
if (1 != ex.diagnostics().nativeError(0))
|
||||
throw;
|
||||
}
|
||||
@ -522,15 +522,15 @@ void ODBCPostgreSQLTest::recreateBoolTable()
|
||||
void ODBCPostgreSQLTest::recreateMiscTable()
|
||||
{
|
||||
dropObject("TABLE", "MiscTest");
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
// Mammoth does not bind columns properly
|
||||
session() << "CREATE TABLE MiscTest "
|
||||
"(First VARCHAR(30),"
|
||||
"Second BYTEA,"
|
||||
"Third INTEGER,"
|
||||
"Fourth FLOAT,"
|
||||
"Fifth TIMESTAMP)", now;
|
||||
"Fifth TIMESTAMP)", now;
|
||||
} catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail ("recreateMiscTable()"); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail ("recreateMiscTable()"); }
|
||||
}
|
||||
@ -541,20 +541,20 @@ void ODBCPostgreSQLTest::recreateLogTable()
|
||||
dropObject("TABLE", "T_POCO_LOG");
|
||||
dropObject("TABLE", "T_POCO_LOG_ARCHIVE");
|
||||
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
std::string sql = "CREATE TABLE %s "
|
||||
"(Source VARCHAR,"
|
||||
"Name VARCHAR,"
|
||||
"ProcessId INTEGER,"
|
||||
"Thread VARCHAR, "
|
||||
"ThreadId INTEGER,"
|
||||
"ThreadId INTEGER,"
|
||||
"Priority INTEGER,"
|
||||
"Text VARCHAR,"
|
||||
"DateTime TIMESTAMP)";
|
||||
"DateTime TIMESTAMP)";
|
||||
|
||||
session() << sql, "T_POCO_LOG", now;
|
||||
session() << sql, "T_POCO_LOG_ARCHIVE", now;
|
||||
session() << sql, "T_POCO_LOG", now;
|
||||
session() << sql, "T_POCO_LOG_ARCHIVE", now;
|
||||
|
||||
} catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail ("recreateLogTable()"); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail ("recreateLogTable()"); }
|
||||
|
@ -25,15 +25,15 @@
|
||||
class ODBCPostgreSQLTest: public ODBCTest
|
||||
/// PostgreSQL ODBC test class
|
||||
/// Tested:
|
||||
///
|
||||
///
|
||||
/// Driver | DB | OS | Driver Manager |Notes
|
||||
/// ---------------+----------------------+-------------------------------------------+--------------------+--------------------------
|
||||
/// 07.03.02.60 | PostgreSQL 7.4.6 | MS Windows XP Professional x64 v.2003/SP1 | 3.526.3959.0 | BLOB fails (missing 'lo')
|
||||
/// 08.01.02.00 | PostgreSQL 8.1.5-1 | MS Windows XP Professional x64 v.2003/SP1 | 3.526.3959.0 |
|
||||
/// 1:08.01.0200-2 | PostgreSQL 8.1.5-1 | Ubuntu 7.04 (2.6.20-15-generic #2 SMP) | unixODBC 2.2.11.-13|
|
||||
/// Mammoth ODBCng | | | |
|
||||
/// Mammoth ODBCng | | | |
|
||||
/// (0.99.00.122) | PostgreSQL 8.1.5-1 | MS Windows XP Professional x64 v.2003/SP1 | 3.526.3959.0 |
|
||||
///
|
||||
///
|
||||
{
|
||||
public:
|
||||
ODBCPostgreSQLTest(const std::string& name);
|
||||
@ -71,8 +71,8 @@ private:
|
||||
|
||||
void configurePLPgSQL();
|
||||
/// Configures PL/pgSQL in the database. A reasonable defaults
|
||||
/// for the interpreter location on WIN32 and POSIX platforms are
|
||||
/// supplied (see installDir member variable).
|
||||
/// for the interpreter location on WIN32 and POSIX platforms are
|
||||
/// supplied (see installDir member variable).
|
||||
/// If these do not work, user must determine the proper location,
|
||||
/// modify the function and recompile.
|
||||
/// Alternative is direct database configuration for PL/pgSQL usage.
|
||||
|
@ -107,7 +107,7 @@ std::string ODBCSQLServerTest::_connectString = "DRIVER=" MS_SQL_SERVER_ODBC_DRI
|
||||
;
|
||||
|
||||
|
||||
ODBCSQLServerTest::ODBCSQLServerTest(const std::string& name):
|
||||
ODBCSQLServerTest::ODBCSQLServerTest(const std::string& name):
|
||||
ODBCTest(name, _pSession, _pExecutor, _dsn, _uid, _pwd, _connectString)
|
||||
{
|
||||
}
|
||||
@ -128,13 +128,13 @@ void ODBCSQLServerTest::testBareboneODBC()
|
||||
"Fifth FLOAT,"
|
||||
"Sixth DATETIME)";
|
||||
|
||||
executor().bareboneODBCTest(dbConnString(), tableCreateString,
|
||||
executor().bareboneODBCTest(dbConnString(), tableCreateString,
|
||||
SQLExecutor::PB_IMMEDIATE, SQLExecutor::DE_MANUAL, true, "CONVERT(VARBINARY(30),?)");
|
||||
executor().bareboneODBCTest(dbConnString(), tableCreateString,
|
||||
executor().bareboneODBCTest(dbConnString(), tableCreateString,
|
||||
SQLExecutor::PB_IMMEDIATE, SQLExecutor::DE_BOUND, true, "CONVERT(VARBINARY(30),?)");
|
||||
executor().bareboneODBCTest(dbConnString(), tableCreateString,
|
||||
executor().bareboneODBCTest(dbConnString(), tableCreateString,
|
||||
SQLExecutor::PB_AT_EXEC, SQLExecutor::DE_MANUAL, true, "CONVERT(VARBINARY(30),?)");
|
||||
executor().bareboneODBCTest(dbConnString(), tableCreateString,
|
||||
executor().bareboneODBCTest(dbConnString(), tableCreateString,
|
||||
SQLExecutor::PB_AT_EXEC, SQLExecutor::DE_BOUND, true, "CONVERT(VARBINARY(30),?)");
|
||||
|
||||
tableCreateString = "CREATE TABLE Test "
|
||||
@ -255,7 +255,7 @@ void ODBCSQLServerTest::testStoredProcedure()
|
||||
"SET @outParam = -1; "
|
||||
"END;"
|
||||
, now;
|
||||
|
||||
|
||||
int i = 0;
|
||||
session() << "{call storedProcedure(?)}", out(i), now;
|
||||
assertTrue (-1 == i);
|
||||
@ -298,8 +298,8 @@ void ODBCSQLServerTest::testStoredProcedure()
|
||||
}
|
||||
/*TODO - currently fails with following error:
|
||||
|
||||
[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid parameter
|
||||
2 (''): Data type 0x23 is a deprecated large object, or LOB, but is marked as output parameter.
|
||||
[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid parameter
|
||||
2 (''): Data type 0x23 is a deprecated large object, or LOB, but is marked as output parameter.
|
||||
Deprecated types are not supported as output parameters. Use current large object types instead.
|
||||
|
||||
session().setFeature("autoBind", true);
|
||||
@ -340,16 +340,16 @@ void ODBCSQLServerTest::testCursorStoredProcedure()
|
||||
"BEGIN "
|
||||
" SELECT * "
|
||||
" FROM Person "
|
||||
" WHERE Age < @ageLimit "
|
||||
" WHERE Age < @ageLimit "
|
||||
" ORDER BY Age DESC; "
|
||||
"END;"
|
||||
, now;
|
||||
|
||||
people.clear();
|
||||
int age = 13;
|
||||
|
||||
|
||||
session() << "{call storedCursorProcedure(?)}", in(age), into(people), now;
|
||||
|
||||
|
||||
assertTrue (2 == people.size());
|
||||
assertTrue (Person("Simpson", "Bart", "Springfield", 12) == people[0]);
|
||||
assertTrue (Person("Simpson", "Lisa", "Springfield", 10) == people[1]);
|
||||
@ -410,7 +410,7 @@ void ODBCSQLServerTest::testStoredProcedureDynamicAny()
|
||||
for (int k = 0; k < 8;)
|
||||
{
|
||||
session().setFeature("autoBind", bindValue(k));
|
||||
|
||||
|
||||
DynamicAny i = 2;
|
||||
DynamicAny j = 0;
|
||||
|
||||
@ -507,7 +507,7 @@ void ODBCSQLServerTest::testStoredFunction()
|
||||
session() << "{? = call storedFunction(?, ?)}", out(result), io(i), io(j), now;
|
||||
assertTrue (1 == j);
|
||||
assertTrue (2 == i);
|
||||
assertTrue (3 == result);
|
||||
assertTrue (3 == result);
|
||||
|
||||
Tuple<int, int> params(1, 2);
|
||||
assertTrue (1 == params.get<0>());
|
||||
@ -516,7 +516,7 @@ void ODBCSQLServerTest::testStoredFunction()
|
||||
session() << "{? = call storedFunction(?, ?)}", out(result), io(params), now;
|
||||
assertTrue (1 == params.get<1>());
|
||||
assertTrue (2 == params.get<0>());
|
||||
assertTrue (3 == result);
|
||||
assertTrue (3 == result);
|
||||
|
||||
dropObject("PROCEDURE", "storedFunction");
|
||||
|
||||
@ -684,15 +684,15 @@ void ODBCSQLServerTest::recreateBoolTable()
|
||||
void ODBCSQLServerTest::recreateMiscTable()
|
||||
{
|
||||
dropObject("TABLE", "MiscTest");
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
session() << "CREATE TABLE MiscTest "
|
||||
"(First VARCHAR(30),"
|
||||
"Second VARBINARY(30),"
|
||||
"Third INTEGER,"
|
||||
"Fourth FLOAT,"
|
||||
"Fifth DATETIME,"
|
||||
"Sixth BIT)", now;
|
||||
"Sixth BIT)", now;
|
||||
} catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail ("recreateMiscTable()"); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail ("recreateMiscTable()"); }
|
||||
}
|
||||
@ -703,20 +703,20 @@ void ODBCSQLServerTest::recreateLogTable()
|
||||
dropObject("TABLE", "T_POCO_LOG");
|
||||
dropObject("TABLE", "T_POCO_LOG_ARCHIVE");
|
||||
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
std::string sql = "CREATE TABLE %s "
|
||||
"(Source VARCHAR(max),"
|
||||
"Name VARCHAR(max),"
|
||||
"ProcessId INTEGER,"
|
||||
"Thread VARCHAR(max), "
|
||||
"ThreadId INTEGER,"
|
||||
"ThreadId INTEGER,"
|
||||
"Priority INTEGER,"
|
||||
"Text VARCHAR(max),"
|
||||
"DateTime DATETIME)";
|
||||
|
||||
session() << sql, "T_POCO_LOG", now;
|
||||
session() << sql, "T_POCO_LOG_ARCHIVE", now;
|
||||
session() << sql, "T_POCO_LOG", now;
|
||||
session() << sql, "T_POCO_LOG_ARCHIVE", now;
|
||||
|
||||
} catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail ("recreateLogTable()"); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail ("recreateLogTable()"); }
|
||||
|
@ -25,7 +25,7 @@
|
||||
class ODBCSQLServerTest: public ODBCTest
|
||||
/// SQLServer ODBC test class
|
||||
/// Tested:
|
||||
///
|
||||
///
|
||||
/// Driver | DB | OS
|
||||
/// --------------------+-----------------------------------+------------------------------------------
|
||||
/// 2000.86.1830.00 | SQL Server Express 9.0.2047 | MS Windows XP Professional x64 v.2003/SP1
|
||||
@ -48,7 +48,7 @@ public:
|
||||
void testCursorStoredProcedure();
|
||||
void testStoredProcedureAny();
|
||||
void testStoredProcedureDynamicAny();
|
||||
|
||||
|
||||
void testStoredFunction();
|
||||
|
||||
static CppUnit::Test* suite();
|
||||
|
@ -45,11 +45,11 @@ std::string ODBCSQLiteTest::_driver = SQLITE_ODBC_DRIVER;
|
||||
std::string ODBCSQLiteTest::_dsn = SQLITE_DSN;
|
||||
std::string ODBCSQLiteTest::_uid = "";
|
||||
std::string ODBCSQLiteTest::_pwd = "";
|
||||
std::string ODBCSQLiteTest::_connectString = "Driver=" SQLITE_ODBC_DRIVER
|
||||
std::string ODBCSQLiteTest::_connectString = "Driver=" SQLITE_ODBC_DRIVER
|
||||
";Database=" SQLITE_DB ";";
|
||||
|
||||
|
||||
ODBCSQLiteTest::ODBCSQLiteTest(const std::string& name):
|
||||
ODBCSQLiteTest::ODBCSQLiteTest(const std::string& name):
|
||||
ODBCTest(name, _pSession, _pExecutor, _dsn, _uid, _pwd, _connectString)
|
||||
{
|
||||
}
|
||||
@ -116,7 +116,7 @@ void ODBCSQLiteTest::testAffectedRows()
|
||||
// why "WHERE 1" is necessary here
|
||||
_pExecutor->affectedRows("WHERE 1");
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -156,7 +156,7 @@ void ODBCSQLiteTest::dropObject(const std::string& type, const std::string& name
|
||||
}
|
||||
}
|
||||
|
||||
if (!ignoreError)
|
||||
if (!ignoreError)
|
||||
{
|
||||
std::cout << ex.toString() << std::endl;
|
||||
throw;
|
||||
@ -273,15 +273,15 @@ void ODBCSQLiteTest::recreateNullsTable(const std::string& notNull)
|
||||
void ODBCSQLiteTest::recreateMiscTable()
|
||||
{
|
||||
dropObject("TABLE", "MiscTest");
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
// SQLite fails with BLOB bulk operations
|
||||
session() << "CREATE TABLE MiscTest "
|
||||
"(First VARCHAR(30),"
|
||||
//"Second BLOB,"
|
||||
"Third INTEGER,"
|
||||
"Fourth REAL,"
|
||||
"Fifth DATETIME)", now;
|
||||
"Fifth DATETIME)", now;
|
||||
} catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail ("recreateMiscTable()"); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail ("recreateMiscTable()"); }
|
||||
}
|
||||
@ -292,20 +292,20 @@ void ODBCSQLiteTest::recreateLogTable()
|
||||
dropObject("TABLE", "T_POCO_LOG");
|
||||
dropObject("TABLE", "T_POCO_LOG_ARCHIVE");
|
||||
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
std::string sql = "CREATE TABLE %s "
|
||||
"(Source VARCHAR,"
|
||||
"Name VARCHAR,"
|
||||
"ProcessId INTEGER,"
|
||||
"Thread VARCHAR, "
|
||||
"ThreadId INTEGER,"
|
||||
"ThreadId INTEGER,"
|
||||
"Priority INTEGER,"
|
||||
"Text VARCHAR,"
|
||||
"DateTime DATETIME)";
|
||||
|
||||
session() << sql, "T_POCO_LOG", now;
|
||||
session() << sql, "T_POCO_LOG_ARCHIVE", now;
|
||||
session() << sql, "T_POCO_LOG", now;
|
||||
session() << sql, "T_POCO_LOG_ARCHIVE", now;
|
||||
|
||||
} catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail ("recreateLogTable()"); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail ("recreateLogTable()"); }
|
||||
|
@ -21,7 +21,7 @@
|
||||
class ODBCSQLiteTest: public ODBCTest
|
||||
/// SQLite3 ODBC test class
|
||||
/// Tested:
|
||||
///
|
||||
///
|
||||
/// Driver | DB | OS
|
||||
/// ------------+---------------+------------------------------------------
|
||||
/// 00.70.00.00 | SQLite 3.* | MS Windows XP Professional x64 v.2003/SP1
|
||||
|
@ -49,7 +49,7 @@ using Poco::NotFoundException;
|
||||
|
||||
|
||||
ODBCTest::Drivers ODBCTest::_drivers;
|
||||
const bool ODBCTest::_bindValues[8] =
|
||||
const bool ODBCTest::_bindValues[8] =
|
||||
{true, true, true, false, false, true, false, false};
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@ ODBCTest::ODBCTest(const std::string& name,
|
||||
std::string& rDSN,
|
||||
std::string& rUID,
|
||||
std::string& rPwd,
|
||||
std::string& rConnectString):
|
||||
std::string& rConnectString):
|
||||
CppUnit::TestCase(name),
|
||||
_pSession(pSession),
|
||||
_pExecutor(pExecutor),
|
||||
@ -212,7 +212,7 @@ void ODBCTest::testInsertVector()
|
||||
_pSession->setFeature("autoExtract", bindValue(i+1));
|
||||
_pExecutor->insertVector();
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -227,7 +227,7 @@ void ODBCTest::testInsertEmptyVector()
|
||||
_pSession->setFeature("autoExtract", bindValue(i+1));
|
||||
_pExecutor->insertEmptyVector();
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -257,7 +257,7 @@ void ODBCTest::testComplexTypeList()
|
||||
_pSession->setFeature("autoExtract", bindValue(i+1));
|
||||
_pExecutor->complexTypeList();
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -272,7 +272,7 @@ void ODBCTest::testInsertList()
|
||||
_pSession->setFeature("autoExtract", bindValue(i+1));
|
||||
_pExecutor->insertList();
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -287,7 +287,7 @@ void ODBCTest::testInsertEmptyList()
|
||||
_pSession->setFeature("autoExtract", bindValue(i+1));
|
||||
_pExecutor->insertEmptyList();
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -317,7 +317,7 @@ void ODBCTest::testComplexTypeDeque()
|
||||
_pSession->setFeature("autoExtract", bindValue(i+1));
|
||||
_pExecutor->complexTypeDeque();
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -332,7 +332,7 @@ void ODBCTest::testInsertDeque()
|
||||
_pSession->setFeature("autoExtract", bindValue(i+1));
|
||||
_pExecutor->insertDeque();
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -347,7 +347,7 @@ void ODBCTest::testInsertEmptyDeque()
|
||||
_pSession->setFeature("autoExtract", bindValue(i+1));
|
||||
_pExecutor->insertEmptyDeque();
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -362,7 +362,7 @@ void ODBCTest::testAffectedRows()
|
||||
_pSession->setFeature("autoExtract", bindValue(i+1));
|
||||
_pExecutor->affectedRows();
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -377,7 +377,7 @@ void ODBCTest::testInsertSingleBulk()
|
||||
_pSession->setFeature("autoExtract", bindValue(i+1));
|
||||
_pExecutor->insertSingleBulk();
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -392,7 +392,7 @@ void ODBCTest::testInsertSingleBulkVec()
|
||||
_pSession->setFeature("autoExtract", bindValue(i+1));
|
||||
_pExecutor->insertSingleBulkVec();
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -422,7 +422,7 @@ void ODBCTest::testLimitZero()
|
||||
_pSession->setFeature("autoExtract", bindValue(i+1));
|
||||
_pExecutor->limitZero();
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -432,7 +432,7 @@ void ODBCTest::testLimitOnce()
|
||||
|
||||
recreateIntsTable();
|
||||
_pExecutor->limitOnce();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -579,7 +579,7 @@ void ODBCTest::testMultiSetComplex()
|
||||
_pSession->setFeature("autoExtract", bindValue(i+1));
|
||||
_pExecutor->multiSetComplex();
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -654,7 +654,7 @@ void ODBCTest::testSelectIntoSingleStep()
|
||||
_pSession->setFeature("autoExtract", bindValue(i+1));
|
||||
_pExecutor->selectIntoSingleStep();
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -669,7 +669,7 @@ void ODBCTest::testSelectIntoSingleFail()
|
||||
_pSession->setFeature("autoExtract", bindValue(i+1));
|
||||
_pExecutor->selectIntoSingleFail();
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -684,7 +684,7 @@ void ODBCTest::testLowerLimitOk()
|
||||
_pSession->setFeature("autoExtract", bindValue(i+1));
|
||||
_pExecutor->lowerLimitOk();
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -699,7 +699,7 @@ void ODBCTest::testSingleSelect()
|
||||
_pSession->setFeature("autoExtract", bindValue(i+1));
|
||||
_pExecutor->singleSelect();
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1300,13 +1300,13 @@ bool ODBCTest::canConnect(const std::string& driver,
|
||||
{
|
||||
if (((itDrv->first).find(driver) != std::string::npos))
|
||||
{
|
||||
std::cout << "Driver found: " << itDrv->first
|
||||
std::cout << "Driver found: " << itDrv->first
|
||||
<< " (" << itDrv->second << ')' << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (_drivers.end() == itDrv)
|
||||
if (_drivers.end() == itDrv)
|
||||
{
|
||||
dsn = "";
|
||||
uid = "";
|
||||
@ -1365,7 +1365,7 @@ ODBCTest::SessionPtr ODBCTest::init(const std::string& driver,
|
||||
{
|
||||
Utility::drivers(_drivers);
|
||||
if (!canConnect(driver, dsn, uid, pwd, dbConnString, db)) return 0;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
std::cout << "Conecting to [" << dbConnString << ']' << std::endl;
|
||||
|
@ -221,38 +221,38 @@ private:
|
||||
// inlines
|
||||
//
|
||||
|
||||
inline void ODBCTest::testStoredProcedure()
|
||||
{
|
||||
inline void ODBCTest::testStoredProcedure()
|
||||
{
|
||||
throw Poco::NotImplementedException("ODBCTest::testStoredProcedure()");
|
||||
}
|
||||
|
||||
|
||||
inline void ODBCTest::testStoredProcedureAny()
|
||||
{
|
||||
inline void ODBCTest::testStoredProcedureAny()
|
||||
{
|
||||
throw Poco::NotImplementedException("ODBCTest::testStoredProcedureAny()");
|
||||
}
|
||||
|
||||
|
||||
inline void ODBCTest::testStoredProcedureDynamicAny()
|
||||
{
|
||||
inline void ODBCTest::testStoredProcedureDynamicAny()
|
||||
{
|
||||
throw Poco::NotImplementedException("ODBCTest::testStoredProcedureDynamicAny()");
|
||||
}
|
||||
|
||||
|
||||
inline void ODBCTest::testStoredFunction()
|
||||
{
|
||||
inline void ODBCTest::testStoredFunction()
|
||||
{
|
||||
throw Poco::NotImplementedException("ODBCTest::testStoredFunction()");
|
||||
}
|
||||
|
||||
|
||||
inline void ODBCTest::testStoredFunctionAny()
|
||||
{
|
||||
inline void ODBCTest::testStoredFunctionAny()
|
||||
{
|
||||
throw Poco::NotImplementedException("ODBCTest::testStoredFunctionAny()");
|
||||
}
|
||||
|
||||
|
||||
inline void ODBCTest::testStoredFunctionDynamicAny()
|
||||
{
|
||||
inline void ODBCTest::testStoredFunctionDynamicAny()
|
||||
{
|
||||
throw Poco::NotImplementedException("ODBCTest::testStoredFunctionDynamicAny()");
|
||||
}
|
||||
|
||||
@ -264,109 +264,109 @@ inline void ODBCTest::dropObject(const std::string& type, const std::string& nam
|
||||
|
||||
|
||||
inline void ODBCTest::recreateNullableTable()
|
||||
{
|
||||
{
|
||||
throw Poco::NotImplementedException("ODBCTest::recreateNullableTable()");
|
||||
}
|
||||
|
||||
|
||||
inline void ODBCTest::recreatePersonTable()
|
||||
{
|
||||
{
|
||||
throw Poco::NotImplementedException("ODBCTest::recreatePersonTable()");
|
||||
}
|
||||
|
||||
|
||||
inline void ODBCTest::recreatePersonTupleTable()
|
||||
{
|
||||
{
|
||||
throw Poco::NotImplementedException("ODBCTest::recreatePersonTupleTable()");
|
||||
}
|
||||
|
||||
|
||||
inline void ODBCTest::recreatePersonBLOBTable()
|
||||
{
|
||||
{
|
||||
throw Poco::NotImplementedException("ODBCTest::recreatePersonBLOBTable()");
|
||||
}
|
||||
|
||||
|
||||
inline void ODBCTest::recreatePersonDateTimeTable()
|
||||
{
|
||||
{
|
||||
throw Poco::NotImplementedException("ODBCTest::recreatePersonDateTimeTable()");
|
||||
}
|
||||
|
||||
|
||||
inline void ODBCTest::recreatePersonDateTable()
|
||||
{
|
||||
{
|
||||
throw Poco::NotImplementedException("ODBCTest::recreatePersonDateTable()");
|
||||
}
|
||||
|
||||
|
||||
inline void ODBCTest::recreatePersonTimeTable()
|
||||
{
|
||||
{
|
||||
throw Poco::NotImplementedException("ODBCTest::recreatePersonTimeTable()");
|
||||
}
|
||||
|
||||
|
||||
inline void ODBCTest::recreateStringsTable()
|
||||
{
|
||||
{
|
||||
throw Poco::NotImplementedException("ODBCTest::recreateStringsTable()");
|
||||
}
|
||||
|
||||
|
||||
inline void ODBCTest::recreateIntsTable()
|
||||
{
|
||||
{
|
||||
throw Poco::NotImplementedException("ODBCTest::recreateIntsTable()");
|
||||
}
|
||||
|
||||
|
||||
inline void ODBCTest::recreateFloatsTable()
|
||||
{
|
||||
{
|
||||
throw Poco::NotImplementedException("ODBCTest::recreateFloatsTable()");
|
||||
}
|
||||
|
||||
|
||||
inline void ODBCTest::recreateUUIDsTable()
|
||||
{
|
||||
{
|
||||
throw Poco::NotImplementedException("ODBCTest::recreateUUIDsTable()");
|
||||
}
|
||||
|
||||
|
||||
inline void ODBCTest::recreateTuplesTable()
|
||||
{
|
||||
{
|
||||
throw Poco::NotImplementedException("ODBCTest::recreateTuplesTable()");
|
||||
}
|
||||
|
||||
|
||||
inline void ODBCTest::recreateVectorsTable()
|
||||
{
|
||||
{
|
||||
throw Poco::NotImplementedException("ODBCTest::recreateVectorsTable()");
|
||||
}
|
||||
|
||||
|
||||
inline void ODBCTest::recreateAnysTable()
|
||||
{
|
||||
{
|
||||
throw Poco::NotImplementedException("ODBCTest::recreateAnysTable()");
|
||||
}
|
||||
|
||||
|
||||
inline void ODBCTest::recreateNullsTable(const std::string&)
|
||||
{
|
||||
{
|
||||
throw Poco::NotImplementedException("ODBCTest::recreateNullsTable()");
|
||||
}
|
||||
|
||||
|
||||
inline void ODBCTest::recreateBoolTable()
|
||||
{
|
||||
{
|
||||
throw Poco::NotImplementedException("ODBCTest::recreateBoolTable()");
|
||||
}
|
||||
|
||||
|
||||
inline void ODBCTest::recreateMiscTable()
|
||||
{
|
||||
{
|
||||
throw Poco::NotImplementedException("ODBCTest::recreateMiscTable()");
|
||||
}
|
||||
|
||||
|
||||
inline void ODBCTest::recreateLogTable()
|
||||
{
|
||||
{
|
||||
throw Poco::NotImplementedException("ODBCTest::recreateLogTable()");
|
||||
}
|
||||
|
||||
@ -383,48 +383,48 @@ inline void ODBCTest::recreateEncodingTables()
|
||||
}
|
||||
|
||||
|
||||
inline bool ODBCTest::bindValue(int i)
|
||||
{
|
||||
inline bool ODBCTest::bindValue(int i)
|
||||
{
|
||||
poco_assert (i < 8);
|
||||
return _bindValues[i];
|
||||
return _bindValues[i];
|
||||
}
|
||||
|
||||
|
||||
inline Poco::Data::Session& ODBCTest::session()
|
||||
{
|
||||
inline Poco::Data::Session& ODBCTest::session()
|
||||
{
|
||||
poco_check_ptr (_pSession);
|
||||
return *_pSession;
|
||||
return *_pSession;
|
||||
}
|
||||
|
||||
|
||||
inline SQLExecutor& ODBCTest::executor()
|
||||
{
|
||||
inline SQLExecutor& ODBCTest::executor()
|
||||
{
|
||||
poco_check_ptr (_pExecutor);
|
||||
return *_pExecutor;
|
||||
return *_pExecutor;
|
||||
}
|
||||
|
||||
|
||||
inline const std::string& ODBCTest::dsn()
|
||||
{
|
||||
return _rDSN;
|
||||
inline const std::string& ODBCTest::dsn()
|
||||
{
|
||||
return _rDSN;
|
||||
}
|
||||
|
||||
|
||||
inline const std::string& ODBCTest::uid()
|
||||
{
|
||||
return _rUID;
|
||||
inline const std::string& ODBCTest::uid()
|
||||
{
|
||||
return _rUID;
|
||||
}
|
||||
|
||||
|
||||
inline const std::string& ODBCTest::pwd()
|
||||
{
|
||||
return _rPwd;
|
||||
inline const std::string& ODBCTest::pwd()
|
||||
{
|
||||
return _rPwd;
|
||||
}
|
||||
|
||||
|
||||
inline const std::string& ODBCTest::dbConnString()
|
||||
{
|
||||
return _rConnectString;
|
||||
inline const std::string& ODBCTest::dbConnString()
|
||||
{
|
||||
return _rConnectString;
|
||||
}
|
||||
|
||||
|
||||
|
@ -26,15 +26,15 @@ CppUnit::Test* ODBCTestSuite::suite()
|
||||
|
||||
// WARNING!
|
||||
// On Win XP Pro, the PostgreSQL connection fails if attempted after DB2 w/ following error:
|
||||
//
|
||||
// sqlState="IM003"
|
||||
// message="Specified driver could not be loaded due to system error 127 (PostgreSQL ANSI)."
|
||||
// nativeError=160
|
||||
//
|
||||
// sqlState="IM003"
|
||||
// message="Specified driver could not be loaded due to system error 127 (PostgreSQL ANSI)."
|
||||
// nativeError=160
|
||||
// System error 127 is "The specified procedure could not be found."
|
||||
// This problem does not manifest with Mammoth ODBCng PostgreSQL driver.
|
||||
//
|
||||
// Oracle tests do not exit cleanly if Oracle driver is loaded after DB2.
|
||||
//
|
||||
//
|
||||
// For the time being, the workaround is to connect to DB2 after connecting to PostgreSQL and Oracle.
|
||||
|
||||
addTest(pSuite, ODBCMySQLTest::suite());
|
||||
|
@ -180,9 +180,9 @@ template <>
|
||||
class TypeHandler<Person>
|
||||
{
|
||||
public:
|
||||
static void bind(std::size_t pos,
|
||||
const Person& obj,
|
||||
AbstractBinder::Ptr pBinder,
|
||||
static void bind(std::size_t pos,
|
||||
const Person& obj,
|
||||
AbstractBinder::Ptr pBinder,
|
||||
AbstractBinder::Direction dir = AbstractBinder::PD_IN)
|
||||
{
|
||||
// the table is defined as Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))
|
||||
@ -231,9 +231,9 @@ template <>
|
||||
class TypeHandler<RefCountedPerson>
|
||||
{
|
||||
public:
|
||||
static void bind(std::size_t pos,
|
||||
const RefCountedPerson& obj,
|
||||
AbstractBinder::Ptr pBinder,
|
||||
static void bind(std::size_t pos,
|
||||
const RefCountedPerson& obj,
|
||||
AbstractBinder::Ptr pBinder,
|
||||
AbstractBinder::Direction dir = AbstractBinder::PD_IN)
|
||||
{
|
||||
// the table is defined as Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))
|
||||
@ -281,7 +281,7 @@ private:
|
||||
} } // namespace Poco::Data
|
||||
|
||||
|
||||
const std::string SQLExecutor::MULTI_INSERT =
|
||||
const std::string SQLExecutor::MULTI_INSERT =
|
||||
"INSERT INTO Test VALUES ('1', 2, 3.5);"
|
||||
"INSERT INTO Test VALUES ('2', 3, 4.5);"
|
||||
"INSERT INTO Test VALUES ('3', 4, 5.5);"
|
||||
@ -309,9 +309,9 @@ SQLExecutor::~SQLExecutor()
|
||||
}
|
||||
|
||||
|
||||
void SQLExecutor::bareboneODBCTest(const std::string& dbConnString,
|
||||
const std::string& tableCreateString,
|
||||
SQLExecutor::DataBinding bindMode,
|
||||
void SQLExecutor::bareboneODBCTest(const std::string& dbConnString,
|
||||
const std::string& tableCreateString,
|
||||
SQLExecutor::DataBinding bindMode,
|
||||
SQLExecutor::DataExtraction extractMode,
|
||||
bool doTime,
|
||||
const std::string& blobPlaceholder)
|
||||
@ -349,7 +349,7 @@ void SQLExecutor::bareboneODBCTest(const std::string& dbConnString,
|
||||
|
||||
rc = SQLGetTypeInfo(hstmt, SQL_TYPE_TIMESTAMP);
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
|
||||
|
||||
rc = SQLFetch(hstmt);
|
||||
assertTrue (SQL_SUCCEEDED(rc) || SQL_NO_DATA == rc);
|
||||
|
||||
@ -414,15 +414,15 @@ void SQLExecutor::bareboneODBCTest(const std::string& dbConnString,
|
||||
if (SQLExecutor::PB_AT_EXEC == bindMode)
|
||||
li[0] = SQL_LEN_DATA_AT_EXEC(size);
|
||||
|
||||
rc = SQLBindParameter(hstmt,
|
||||
(SQLUSMALLINT) 1,
|
||||
SQL_PARAM_INPUT,
|
||||
SQL_C_CHAR,
|
||||
SQL_LONGVARCHAR,
|
||||
rc = SQLBindParameter(hstmt,
|
||||
(SQLUSMALLINT) 1,
|
||||
SQL_PARAM_INPUT,
|
||||
SQL_C_CHAR,
|
||||
SQL_LONGVARCHAR,
|
||||
(SQLUINTEGER) size,
|
||||
0,
|
||||
(SQLPOINTER) str[0].c_str(),
|
||||
size,
|
||||
(SQLPOINTER) str[0].c_str(),
|
||||
size,
|
||||
&li[0]);
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
|
||||
@ -431,15 +431,15 @@ void SQLExecutor::bareboneODBCTest(const std::string& dbConnString,
|
||||
li[1] = SQL_LEN_DATA_AT_EXEC(size);
|
||||
else li[1] = SQL_NTS;
|
||||
|
||||
rc = SQLBindParameter(hstmt,
|
||||
(SQLUSMALLINT) 2,
|
||||
SQL_PARAM_INPUT,
|
||||
SQL_C_CHAR,
|
||||
SQL_LONGVARCHAR,
|
||||
rc = SQLBindParameter(hstmt,
|
||||
(SQLUSMALLINT) 2,
|
||||
SQL_PARAM_INPUT,
|
||||
SQL_C_CHAR,
|
||||
SQL_LONGVARCHAR,
|
||||
(SQLUINTEGER) size,
|
||||
0,
|
||||
(SQLPOINTER) str[1].c_str(),
|
||||
size,
|
||||
(SQLPOINTER) str[1].c_str(),
|
||||
size,
|
||||
&li[1]);
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
|
||||
@ -448,39 +448,39 @@ void SQLExecutor::bareboneODBCTest(const std::string& dbConnString,
|
||||
li[2] = SQL_LEN_DATA_AT_EXEC(size);
|
||||
else li[2] = size;
|
||||
|
||||
rc = SQLBindParameter(hstmt,
|
||||
(SQLUSMALLINT) 3,
|
||||
SQL_PARAM_INPUT,
|
||||
SQL_C_BINARY,
|
||||
SQL_LONGVARBINARY,
|
||||
rc = SQLBindParameter(hstmt,
|
||||
(SQLUSMALLINT) 3,
|
||||
SQL_PARAM_INPUT,
|
||||
SQL_C_BINARY,
|
||||
SQL_LONGVARBINARY,
|
||||
(SQLUINTEGER) size,
|
||||
0,
|
||||
(SQLPOINTER) str[2].data(),
|
||||
size,
|
||||
(SQLPOINTER) str[2].data(),
|
||||
size,
|
||||
&li[2]);
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
|
||||
rc = SQLBindParameter(hstmt,
|
||||
(SQLUSMALLINT) 4,
|
||||
SQL_PARAM_INPUT,
|
||||
SQL_C_SLONG,
|
||||
SQL_INTEGER,
|
||||
rc = SQLBindParameter(hstmt,
|
||||
(SQLUSMALLINT) 4,
|
||||
SQL_PARAM_INPUT,
|
||||
SQL_C_SLONG,
|
||||
SQL_INTEGER,
|
||||
0,
|
||||
0,
|
||||
(SQLPOINTER) &fourth,
|
||||
0,
|
||||
(SQLPOINTER) &fourth,
|
||||
0,
|
||||
0);
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
|
||||
rc = SQLBindParameter(hstmt,
|
||||
(SQLUSMALLINT) 5,
|
||||
SQL_PARAM_INPUT,
|
||||
SQL_C_FLOAT,
|
||||
SQL_REAL,
|
||||
rc = SQLBindParameter(hstmt,
|
||||
(SQLUSMALLINT) 5,
|
||||
SQL_PARAM_INPUT,
|
||||
SQL_C_FLOAT,
|
||||
SQL_REAL,
|
||||
0,
|
||||
1,
|
||||
(SQLPOINTER) &fifth,
|
||||
0,
|
||||
(SQLPOINTER) &fifth,
|
||||
0,
|
||||
0);
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
|
||||
@ -499,14 +499,14 @@ void SQLExecutor::bareboneODBCTest(const std::string& dbConnString,
|
||||
else
|
||||
std::cerr << '[' << name() << ']' << " Warning: could not get SQL_TYPE_TIMESTAMP parameter description." << std::endl;
|
||||
|
||||
rc = SQLBindParameter(hstmt,
|
||||
(SQLUSMALLINT) 6,
|
||||
SQL_PARAM_INPUT,
|
||||
SQL_C_TYPE_TIMESTAMP,
|
||||
SQL_TYPE_TIMESTAMP,
|
||||
rc = SQLBindParameter(hstmt,
|
||||
(SQLUSMALLINT) 6,
|
||||
SQL_PARAM_INPUT,
|
||||
SQL_C_TYPE_TIMESTAMP,
|
||||
SQL_TYPE_TIMESTAMP,
|
||||
dateTimeColSize,
|
||||
dateTimeDecDigits,
|
||||
(SQLPOINTER) &sixth,
|
||||
(SQLPOINTER) &sixth,
|
||||
0,
|
||||
0);
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
@ -520,9 +520,9 @@ void SQLExecutor::bareboneODBCTest(const std::string& dbConnString,
|
||||
while (SQL_NEED_DATA == (rc = SQLParamData(hstmt, &pParam)))
|
||||
{
|
||||
SQLINTEGER dataSize = 0;
|
||||
// Data size should be ignored for non-null,
|
||||
// non-variable length fields, but SQLite ODBC
|
||||
// driver insists on it always being the actual
|
||||
// Data size should be ignored for non-null,
|
||||
// non-variable length fields, but SQLite ODBC
|
||||
// driver insists on it always being the actual
|
||||
// data length
|
||||
|
||||
if (pParam == (SQLPOINTER) str[0].c_str())
|
||||
@ -558,55 +558,55 @@ void SQLExecutor::bareboneODBCTest(const std::string& dbConnString,
|
||||
|
||||
if (SQLExecutor::DE_BOUND == extractMode)
|
||||
{
|
||||
rc = SQLBindCol(hstmt,
|
||||
(SQLUSMALLINT) 1,
|
||||
SQL_C_CHAR,
|
||||
(SQLPOINTER) chr[0],
|
||||
(SQLINTEGER) sizeof(chr[0]),
|
||||
rc = SQLBindCol(hstmt,
|
||||
(SQLUSMALLINT) 1,
|
||||
SQL_C_CHAR,
|
||||
(SQLPOINTER) chr[0],
|
||||
(SQLINTEGER) sizeof(chr[0]),
|
||||
&lengths[0]);
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
|
||||
rc = SQLBindCol(hstmt,
|
||||
(SQLUSMALLINT) 2,
|
||||
SQL_C_CHAR,
|
||||
(SQLPOINTER) chr[1],
|
||||
(SQLINTEGER) sizeof(chr[1]),
|
||||
rc = SQLBindCol(hstmt,
|
||||
(SQLUSMALLINT) 2,
|
||||
SQL_C_CHAR,
|
||||
(SQLPOINTER) chr[1],
|
||||
(SQLINTEGER) sizeof(chr[1]),
|
||||
&lengths[1]);
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
|
||||
rc = SQLBindCol(hstmt,
|
||||
(SQLUSMALLINT) 3,
|
||||
SQL_C_BINARY,
|
||||
(SQLPOINTER) chr[2],
|
||||
(SQLINTEGER) sizeof(chr[2]),
|
||||
rc = SQLBindCol(hstmt,
|
||||
(SQLUSMALLINT) 3,
|
||||
SQL_C_BINARY,
|
||||
(SQLPOINTER) chr[2],
|
||||
(SQLINTEGER) sizeof(chr[2]),
|
||||
&lengths[2]);
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
|
||||
rc = SQLBindCol(hstmt,
|
||||
(SQLUSMALLINT) 4,
|
||||
SQL_C_SLONG,
|
||||
(SQLPOINTER) &fourth,
|
||||
(SQLINTEGER) 0,
|
||||
rc = SQLBindCol(hstmt,
|
||||
(SQLUSMALLINT) 4,
|
||||
SQL_C_SLONG,
|
||||
(SQLPOINTER) &fourth,
|
||||
(SQLINTEGER) 0,
|
||||
&lengths[3]);
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
|
||||
rc = SQLBindCol(hstmt,
|
||||
(SQLUSMALLINT) 5,
|
||||
SQL_C_FLOAT,
|
||||
(SQLPOINTER) &fifth,
|
||||
(SQLINTEGER) 0,
|
||||
rc = SQLBindCol(hstmt,
|
||||
(SQLUSMALLINT) 5,
|
||||
SQL_C_FLOAT,
|
||||
(SQLPOINTER) &fifth,
|
||||
(SQLINTEGER) 0,
|
||||
&lengths[4]);
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
|
||||
rc = SQLBindCol(hstmt,
|
||||
(SQLUSMALLINT) 6,
|
||||
SQL_C_TYPE_TIMESTAMP,
|
||||
(SQLPOINTER) &sixth,
|
||||
(SQLINTEGER) 0,
|
||||
rc = SQLBindCol(hstmt,
|
||||
(SQLUSMALLINT) 6,
|
||||
SQL_C_TYPE_TIMESTAMP,
|
||||
(SQLPOINTER) &sixth,
|
||||
(SQLINTEGER) 0,
|
||||
&lengths[5]);
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
}
|
||||
|
||||
|
||||
rc = SQLExecute(hstmt);
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
rc = SQLFetch(hstmt);
|
||||
@ -615,67 +615,67 @@ void SQLExecutor::bareboneODBCTest(const std::string& dbConnString,
|
||||
if (SQLExecutor::DE_MANUAL == extractMode)
|
||||
{
|
||||
SQLLEN len = lengths[0] = 0;
|
||||
while (SQL_SUCCESS_WITH_INFO == (rc = SQLGetData(hstmt,
|
||||
(SQLUSMALLINT) 1,
|
||||
SQL_C_CHAR,
|
||||
chr[0] + len,
|
||||
while (SQL_SUCCESS_WITH_INFO == (rc = SQLGetData(hstmt,
|
||||
(SQLUSMALLINT) 1,
|
||||
SQL_C_CHAR,
|
||||
chr[0] + len,
|
||||
sizeof(chr[0]) - len,
|
||||
&lengths[0])))
|
||||
{
|
||||
len += lengths[0];
|
||||
if (!lengths[0] || len >= sizeof(chr[1]))
|
||||
if (!lengths[0] || len >= sizeof(chr[1]))
|
||||
break;
|
||||
}
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
|
||||
len = lengths[1] = 0;
|
||||
while (SQL_SUCCESS_WITH_INFO == (rc = SQLGetData(hstmt,
|
||||
(SQLUSMALLINT) 2,
|
||||
SQL_C_CHAR,
|
||||
chr[1] + len,
|
||||
while (SQL_SUCCESS_WITH_INFO == (rc = SQLGetData(hstmt,
|
||||
(SQLUSMALLINT) 2,
|
||||
SQL_C_CHAR,
|
||||
chr[1] + len,
|
||||
sizeof(chr[1]) - len,
|
||||
&lengths[1])))
|
||||
{
|
||||
len += lengths[1];
|
||||
if (!lengths[1] || len >= sizeof(chr[1]))
|
||||
if (!lengths[1] || len >= sizeof(chr[1]))
|
||||
break;
|
||||
}
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
|
||||
len = lengths[2] = 0;
|
||||
while (SQL_SUCCESS_WITH_INFO == (rc = SQLGetData(hstmt,
|
||||
(SQLUSMALLINT) 3,
|
||||
SQL_C_BINARY,
|
||||
chr[2] + len,
|
||||
while (SQL_SUCCESS_WITH_INFO == (rc = SQLGetData(hstmt,
|
||||
(SQLUSMALLINT) 3,
|
||||
SQL_C_BINARY,
|
||||
chr[2] + len,
|
||||
sizeof(chr[2]) - len,
|
||||
&lengths[2])))
|
||||
{
|
||||
len += lengths[1];
|
||||
if (!lengths[2] || len >= sizeof(chr[2]))
|
||||
if (!lengths[2] || len >= sizeof(chr[2]))
|
||||
break;
|
||||
}
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
|
||||
rc = SQLGetData(hstmt,
|
||||
(SQLUSMALLINT) 4,
|
||||
SQL_C_SLONG,
|
||||
&fourth,
|
||||
rc = SQLGetData(hstmt,
|
||||
(SQLUSMALLINT) 4,
|
||||
SQL_C_SLONG,
|
||||
&fourth,
|
||||
0,
|
||||
&lengths[3]);
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
|
||||
rc = SQLGetData(hstmt,
|
||||
(SQLUSMALLINT) 5,
|
||||
SQL_C_FLOAT,
|
||||
&fifth,
|
||||
rc = SQLGetData(hstmt,
|
||||
(SQLUSMALLINT) 5,
|
||||
SQL_C_FLOAT,
|
||||
&fifth,
|
||||
0,
|
||||
&lengths[4]);
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
|
||||
rc = SQLGetData(hstmt,
|
||||
(SQLUSMALLINT) 6,
|
||||
SQL_C_TYPE_TIMESTAMP,
|
||||
&sixth,
|
||||
rc = SQLGetData(hstmt,
|
||||
(SQLUSMALLINT) 6,
|
||||
SQL_C_TYPE_TIMESTAMP,
|
||||
&sixth,
|
||||
0,
|
||||
&lengths[5]);
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
@ -728,9 +728,9 @@ void SQLExecutor::bareboneODBCTest(const std::string& dbConnString,
|
||||
}
|
||||
|
||||
|
||||
void SQLExecutor::bareboneODBCMultiResultTest(const std::string& dbConnString,
|
||||
const std::string& tableCreateString,
|
||||
SQLExecutor::DataBinding bindMode,
|
||||
void SQLExecutor::bareboneODBCMultiResultTest(const std::string& dbConnString,
|
||||
const std::string& tableCreateString,
|
||||
SQLExecutor::DataBinding bindMode,
|
||||
SQLExecutor::DataExtraction extractMode,
|
||||
const std::string& insert,
|
||||
const std::string& select)
|
||||
@ -802,11 +802,11 @@ void SQLExecutor::bareboneODBCMultiResultTest(const std::string& dbConnString,
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
if (SQLExecutor::DE_BOUND == extractMode)
|
||||
{
|
||||
rc = SQLBindCol(hstmt,
|
||||
(SQLUSMALLINT) 1,
|
||||
SQL_C_SLONG,
|
||||
(SQLPOINTER) &count,
|
||||
(SQLINTEGER) 0,
|
||||
rc = SQLBindCol(hstmt,
|
||||
(SQLUSMALLINT) 1,
|
||||
SQL_C_SLONG,
|
||||
(SQLPOINTER) &count,
|
||||
(SQLINTEGER) 0,
|
||||
&length);
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
}
|
||||
@ -819,10 +819,10 @@ void SQLExecutor::bareboneODBCMultiResultTest(const std::string& dbConnString,
|
||||
|
||||
if (SQLExecutor::DE_MANUAL == extractMode)
|
||||
{
|
||||
rc = SQLGetData(hstmt,
|
||||
(SQLUSMALLINT) 1,
|
||||
SQL_C_SLONG,
|
||||
&count,
|
||||
rc = SQLGetData(hstmt,
|
||||
(SQLUSMALLINT) 1,
|
||||
SQL_C_SLONG,
|
||||
&count,
|
||||
0,
|
||||
&length);
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
@ -841,34 +841,34 @@ void SQLExecutor::bareboneODBCMultiResultTest(const std::string& dbConnString,
|
||||
SQLLEN lengths[3] = { 0 };
|
||||
int second = 0;
|
||||
float third = 0.0f;
|
||||
|
||||
|
||||
if (SQLExecutor::DE_BOUND == extractMode)
|
||||
{
|
||||
rc = SQLBindCol(hstmt,
|
||||
(SQLUSMALLINT) 1,
|
||||
SQL_C_CHAR,
|
||||
(SQLPOINTER) chr,
|
||||
(SQLINTEGER) 4,
|
||||
rc = SQLBindCol(hstmt,
|
||||
(SQLUSMALLINT) 1,
|
||||
SQL_C_CHAR,
|
||||
(SQLPOINTER) chr,
|
||||
(SQLINTEGER) 4,
|
||||
&lengths[0]);
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
|
||||
rc = SQLBindCol(hstmt,
|
||||
(SQLUSMALLINT) 2,
|
||||
SQL_C_SLONG,
|
||||
(SQLPOINTER) &second,
|
||||
(SQLINTEGER) 0,
|
||||
rc = SQLBindCol(hstmt,
|
||||
(SQLUSMALLINT) 2,
|
||||
SQL_C_SLONG,
|
||||
(SQLPOINTER) &second,
|
||||
(SQLINTEGER) 0,
|
||||
&lengths[1]);
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
|
||||
rc = SQLBindCol(hstmt,
|
||||
(SQLUSMALLINT) 3,
|
||||
SQL_C_FLOAT,
|
||||
(SQLPOINTER) &third,
|
||||
(SQLINTEGER) 0,
|
||||
rc = SQLBindCol(hstmt,
|
||||
(SQLUSMALLINT) 3,
|
||||
SQL_C_FLOAT,
|
||||
(SQLPOINTER) &third,
|
||||
(SQLINTEGER) 0,
|
||||
&lengths[2]);
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
}
|
||||
|
||||
|
||||
rc = SQLExecute(hstmt);
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
|
||||
@ -884,26 +884,26 @@ void SQLExecutor::bareboneODBCMultiResultTest(const std::string& dbConnString,
|
||||
|
||||
if (SQLExecutor::DE_MANUAL == extractMode)
|
||||
{
|
||||
rc = SQLGetData(hstmt,
|
||||
(SQLUSMALLINT) 1,
|
||||
SQL_C_CHAR,
|
||||
chr,
|
||||
rc = SQLGetData(hstmt,
|
||||
(SQLUSMALLINT) 1,
|
||||
SQL_C_CHAR,
|
||||
chr,
|
||||
4,
|
||||
&lengths[0]);
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
|
||||
rc = SQLGetData(hstmt,
|
||||
(SQLUSMALLINT) 2,
|
||||
SQL_C_SLONG,
|
||||
&second,
|
||||
rc = SQLGetData(hstmt,
|
||||
(SQLUSMALLINT) 2,
|
||||
SQL_C_SLONG,
|
||||
&second,
|
||||
0,
|
||||
&lengths[1]);
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
|
||||
rc = SQLGetData(hstmt,
|
||||
(SQLUSMALLINT) 3,
|
||||
SQL_C_FLOAT,
|
||||
&third,
|
||||
rc = SQLGetData(hstmt,
|
||||
(SQLUSMALLINT) 3,
|
||||
SQL_C_FLOAT,
|
||||
&third,
|
||||
0,
|
||||
&lengths[2]);
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
@ -1568,7 +1568,7 @@ void SQLExecutor::insertSingleBulkVec()
|
||||
{
|
||||
std::string funct = "insertSingleBulkVec()";
|
||||
std::vector<int> data;
|
||||
|
||||
|
||||
for (int x = 0; x < 100; ++x)
|
||||
data.push_back(x);
|
||||
|
||||
@ -1674,9 +1674,9 @@ void SQLExecutor::limitPrepare()
|
||||
data.push_back(x);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Statement stmt = (session() << "INSERT INTO Strings VALUES (?)", use(data));
|
||||
try
|
||||
{
|
||||
Statement stmt = (session() << "INSERT INTO Strings VALUES (?)", use(data));
|
||||
assertTrue (100 == stmt.execute());
|
||||
}
|
||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||
@ -1738,13 +1738,13 @@ void SQLExecutor::doBulkPerformance(Poco::UInt32 size)
|
||||
std::vector<std::string> strings(size, "abc");
|
||||
std::vector<double> floats(size, .5);
|
||||
std::vector<DateTime> dateTimes(size);
|
||||
|
||||
|
||||
Stopwatch sw;
|
||||
try
|
||||
try
|
||||
{
|
||||
sw.start();
|
||||
session() << "INSERT INTO MiscTest (First, Third, Fourth, Fifth) VALUES (?,?,?,?)",
|
||||
use(strings),
|
||||
session() << "INSERT INTO MiscTest (First, Third, Fourth, Fifth) VALUES (?,?,?,?)",
|
||||
use(strings),
|
||||
use(ints),
|
||||
use(floats),
|
||||
use(dateTimes), now;
|
||||
@ -1758,18 +1758,18 @@ void SQLExecutor::doBulkPerformance(Poco::UInt32 size)
|
||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||
|
||||
try
|
||||
try
|
||||
{
|
||||
sw.restart();
|
||||
session() << "INSERT INTO MiscTest (First, Third, Fourth, Fifth) VALUES (?,?,?,?)",
|
||||
use(strings, bulk),
|
||||
session() << "INSERT INTO MiscTest (First, Third, Fourth, Fifth) VALUES (?,?,?,?)",
|
||||
use(strings, bulk),
|
||||
use(ints, bulk),
|
||||
use(floats, bulk),
|
||||
use(dateTimes, bulk), now;
|
||||
sw.stop();
|
||||
} catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||
|
||||
|
||||
double bulkTime = sw.elapsed() / 1000.0;
|
||||
|
||||
double speedup;
|
||||
@ -1781,10 +1781,10 @@ void SQLExecutor::doBulkPerformance(Poco::UInt32 size)
|
||||
else
|
||||
speedup = time / bulkTime;
|
||||
|
||||
std::cout << "INSERT => Size:" << size
|
||||
<< ", Time: " << time
|
||||
<< ", Bulk Time: " << bulkTime
|
||||
<< " [ms], Speedup: " << speedup
|
||||
std::cout << "INSERT => Size:" << size
|
||||
<< ", Time: " << time
|
||||
<< ", Bulk Time: " << bulkTime
|
||||
<< " [ms], Speedup: " << speedup
|
||||
<< 'x' << std::endl;
|
||||
|
||||
ints.clear();
|
||||
@ -1792,19 +1792,19 @@ void SQLExecutor::doBulkPerformance(Poco::UInt32 size)
|
||||
floats.clear();
|
||||
dateTimes.clear();
|
||||
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
sw.restart();
|
||||
session() << "SELECT First, Third, Fourth, Fifth FROM MiscTest",
|
||||
into(strings),
|
||||
into(ints),
|
||||
session() << "SELECT First, Third, Fourth, Fifth FROM MiscTest",
|
||||
into(strings),
|
||||
into(ints),
|
||||
into(floats),
|
||||
into(dateTimes),
|
||||
now;
|
||||
now;
|
||||
sw.stop();
|
||||
} catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||
|
||||
|
||||
time = sw.elapsed() / 1000.0;
|
||||
|
||||
assertTrue (ints.size() == size);
|
||||
@ -1813,20 +1813,20 @@ void SQLExecutor::doBulkPerformance(Poco::UInt32 size)
|
||||
strings.clear();
|
||||
floats.clear();
|
||||
dateTimes.clear();
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
sw.restart();
|
||||
session() << "SELECT First, Third, Fourth, Fifth FROM MiscTest",
|
||||
session() << "SELECT First, Third, Fourth, Fifth FROM MiscTest",
|
||||
into(strings, bulk(size)),
|
||||
into(ints, bulk(size)),
|
||||
into(floats, bulk(size)),
|
||||
into(dateTimes, bulk(size)),
|
||||
now;
|
||||
now;
|
||||
sw.stop();
|
||||
} catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||
|
||||
|
||||
bulkTime = sw.elapsed() / 1000.0;
|
||||
|
||||
assertTrue (ints.size() == size);
|
||||
@ -1839,10 +1839,10 @@ void SQLExecutor::doBulkPerformance(Poco::UInt32 size)
|
||||
else
|
||||
speedup = time / bulkTime;
|
||||
|
||||
std::cout << "SELECT => Size:" << size
|
||||
<< ", Time: " << time
|
||||
<< ", Bulk Time: " << bulkTime
|
||||
<< " [ms], Speedup: " << speedup
|
||||
std::cout << "SELECT => Size:" << size
|
||||
<< ", Time: " << time
|
||||
<< ", Bulk Time: " << bulkTime
|
||||
<< " [ms], Speedup: " << speedup
|
||||
<< 'x' << std::endl;
|
||||
}
|
||||
|
||||
@ -2078,7 +2078,7 @@ void SQLExecutor::multiMapComplex()
|
||||
people.insert(std::make_pair("LN1", p1));
|
||||
people.insert(std::make_pair("LN1", p1));
|
||||
people.insert(std::make_pair("LN2", p2));
|
||||
|
||||
|
||||
try { session() << "INSERT INTO Person VALUES (?,?,?,?)", use(people), now; }
|
||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||
@ -2140,7 +2140,7 @@ void SQLExecutor::selectIntoSingleStep()
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||
assertTrue (count == 2);
|
||||
Person result;
|
||||
Statement stmt = (session() << "SELECT * FROM Person", into(result), limit(1));
|
||||
Statement stmt = (session() << "SELECT * FROM Person", into(result), limit(1));
|
||||
stmt.execute();
|
||||
assertTrue (result == p1);
|
||||
assertTrue (!stmt.done());
|
||||
@ -2406,7 +2406,7 @@ void SQLExecutor::blob(int bigSize, const std::string& blobPlaceholder)
|
||||
|
||||
CLOB img("0123456789", 10);
|
||||
int count = 0;
|
||||
try { session() << format("INSERT INTO Person VALUES (?,?,?,%s)", blobPlaceholder),
|
||||
try { session() << format("INSERT INTO Person VALUES (?,?,?,%s)", blobPlaceholder),
|
||||
use(lastName), use(firstName), use(address), use(img), now; }
|
||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||
@ -2432,7 +2432,7 @@ void SQLExecutor::blob(int bigSize, const std::string& blobPlaceholder)
|
||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||
|
||||
try { session() << format("INSERT INTO Person VALUES (?,?,?,%s)", blobPlaceholder),
|
||||
try { session() << format("INSERT INTO Person VALUES (?,?,?,%s)", blobPlaceholder),
|
||||
use(lastName), use(firstName), use(address), use(big), now; }
|
||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||
@ -2510,11 +2510,11 @@ void SQLExecutor::date()
|
||||
|
||||
Date bornDate(1965, 6, 18);
|
||||
int count = 0;
|
||||
try { session() << "INSERT INTO Person VALUES (?,?,?,?)",
|
||||
use(lastName),
|
||||
use(firstName),
|
||||
use(address),
|
||||
use(bornDate),
|
||||
try { session() << "INSERT INTO Person VALUES (?,?,?,?)",
|
||||
use(lastName),
|
||||
use(firstName),
|
||||
use(address),
|
||||
use(bornDate),
|
||||
now; }
|
||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||
@ -2549,11 +2549,11 @@ void SQLExecutor::time()
|
||||
|
||||
Time bornTime (5, 35, 1);
|
||||
int count = 0;
|
||||
try { session() << "INSERT INTO Person VALUES (?,?,?,?)",
|
||||
use(lastName),
|
||||
use(firstName),
|
||||
use(address),
|
||||
use(bornTime),
|
||||
try { session() << "INSERT INTO Person VALUES (?,?,?,?)",
|
||||
use(lastName),
|
||||
use(firstName),
|
||||
use(address),
|
||||
use(bornTime),
|
||||
now; }
|
||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||
@ -2601,7 +2601,7 @@ void SQLExecutor::tupleVector()
|
||||
typedef Tuple<int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int> TupleType;
|
||||
std::string funct = "tupleVector()";
|
||||
TupleType t(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19);
|
||||
Tuple<int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int>
|
||||
Tuple<int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int>
|
||||
t10(10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29);
|
||||
TupleType t100(100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119);
|
||||
std::vector<TupleType> v;
|
||||
@ -2640,8 +2640,8 @@ void SQLExecutor::internalExtraction()
|
||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
Statement stmt = (session() << "SELECT * FROM Vectors", now);
|
||||
RecordSet rset(stmt);
|
||||
|
||||
@ -2697,7 +2697,7 @@ void SQLExecutor::internalExtraction()
|
||||
|
||||
i = rset.value("str0", 2);
|
||||
assertTrue (5 == i);
|
||||
|
||||
|
||||
const Column<std::deque<int> >& col = rset.column<std::deque<int> >(0);
|
||||
Column<std::deque<int> >::Iterator it = col.begin();
|
||||
Column<std::deque<int> >::Iterator end = col.end();
|
||||
@ -2737,7 +2737,7 @@ void SQLExecutor::internalExtraction()
|
||||
|
||||
try { rset.value<std::string>(0,0); fail ("must fail"); }
|
||||
catch (BadCastException&) { }
|
||||
|
||||
|
||||
stmt = (session() << "DELETE FROM Vectors", now);
|
||||
rset = stmt;
|
||||
|
||||
@ -2762,8 +2762,8 @@ void SQLExecutor::filter(const std::string& query, const std::string& intFldName
|
||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
Statement stmt = (session() << query, now);
|
||||
RecordSet rset(stmt);
|
||||
assertTrue (rset.totalRowCount() == 4);
|
||||
@ -2773,11 +2773,11 @@ void SQLExecutor::filter(const std::string& query, const std::string& intFldName
|
||||
assertTrue (!pRF->isEmpty());
|
||||
|
||||
Var da;
|
||||
try
|
||||
try
|
||||
{
|
||||
da = rset.value(0, 1);
|
||||
fail ("must fail");
|
||||
} catch (InvalidAccessException&)
|
||||
} catch (InvalidAccessException&)
|
||||
{
|
||||
da = rset.value(0, 1, false);
|
||||
assertTrue (2 == da);
|
||||
@ -2846,22 +2846,22 @@ void SQLExecutor::internalBulkExtraction()
|
||||
age[i] = i;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
session() << "INSERT INTO Person VALUES (?,?,?,?)",
|
||||
use(lastName, bulk),
|
||||
use(firstName, bulk),
|
||||
use(address, bulk),
|
||||
use(age, bulk),
|
||||
now;
|
||||
try
|
||||
{
|
||||
session() << "INSERT INTO Person VALUES (?,?,?,?)",
|
||||
use(lastName, bulk),
|
||||
use(firstName, bulk),
|
||||
use(address, bulk),
|
||||
use(age, bulk),
|
||||
now;
|
||||
}
|
||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
Statement stmt = (session() << "SELECT * FROM Person", bulk(size), now);
|
||||
RecordSet rset(stmt);
|
||||
RecordSet rset(stmt);
|
||||
assertTrue (size == rset.rowCount());
|
||||
assertTrue ("LN0" == rset["LastName"]);
|
||||
assertTrue (0 == rset["Age"]);
|
||||
@ -2875,10 +2875,10 @@ void SQLExecutor::internalBulkExtraction()
|
||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
Statement stmt = (session() << "SELECT * FROM Person", limit(size), bulk, now);
|
||||
RecordSet rset(stmt);
|
||||
RecordSet rset(stmt);
|
||||
assertTrue (size == rset.rowCount());
|
||||
assertTrue ("LN0" == rset["LastName"]);
|
||||
assertTrue (0 == rset["Age"]);
|
||||
@ -2971,8 +2971,8 @@ void SQLExecutor::internalStorageType()
|
||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
std::vector<Statement::Manipulator>::iterator it = manips.begin();
|
||||
std::vector<Statement::Manipulator>::iterator end = manips.end();
|
||||
|
||||
@ -3029,15 +3029,15 @@ void SQLExecutor::notNulls(const std::string& sqlState)
|
||||
{
|
||||
session() << "INSERT INTO NullTest (i,r,v) VALUES (?,?,?)", use(null), use(null), use(null), now;
|
||||
fail ("must fail");
|
||||
}catch (StatementException& se)
|
||||
{
|
||||
}catch (StatementException& se)
|
||||
{
|
||||
//double check if we're failing for the right reason
|
||||
//default sqlState value is "23502"; some drivers report "HY???" codes
|
||||
if (se.diagnostics().fields().size())
|
||||
{
|
||||
std::string st = se.diagnostics().sqlState(0);
|
||||
if (sqlState != st)
|
||||
std::cerr << '[' << name() << ']' << " Warning: expected SQL state [" << sqlState <<
|
||||
std::cerr << '[' << name() << ']' << " Warning: expected SQL state [" << sqlState <<
|
||||
"], received [" << se.diagnostics().sqlState(0) << "] instead." << std::endl;
|
||||
}
|
||||
}
|
||||
@ -3185,7 +3185,7 @@ void SQLExecutor::rowIterator()
|
||||
std::ostringstream osLoop;
|
||||
RecordSet::Iterator it = rset.begin();
|
||||
RecordSet::Iterator end = rset.end();
|
||||
for (int i = 1; it != end; ++it, ++i)
|
||||
for (int i = 1; it != end; ++it, ++i)
|
||||
{
|
||||
assertTrue (it->get(0) == i);
|
||||
osLoop << *it;
|
||||
@ -3202,7 +3202,7 @@ void SQLExecutor::rowIterator()
|
||||
assertTrue (!pRF->isEmpty());
|
||||
it = rset.begin();
|
||||
end = rset.end();
|
||||
for (int i = 1; it != end; ++it, ++i)
|
||||
for (int i = 1; it != end; ++it, ++i)
|
||||
{
|
||||
assertTrue (it->get(0) == i);
|
||||
assertTrue (1 == i);
|
||||
@ -3279,7 +3279,7 @@ void SQLExecutor::asynchronous(int rowCount)
|
||||
Statement::Result result = stmt.executeAsync();
|
||||
assertTrue (!stmt.isAsync());
|
||||
result.wait();
|
||||
|
||||
|
||||
Statement stmt1 = (tmp << "SELECT * FROM Strings", into(data), async, now);
|
||||
assertTrue (stmt1.isAsync());
|
||||
assertTrue (stmt1.wait() == rowCount);
|
||||
@ -3302,7 +3302,7 @@ void SQLExecutor::asynchronous(int rowCount)
|
||||
assertTrue (stmt.isAsync());
|
||||
stmt.wait();
|
||||
assertTrue (stmt.execute() == 0);
|
||||
|
||||
|
||||
// +++ if this part of the test case fails, increase the rowCount until achieved
|
||||
// that first execute is still executing when the second one is called
|
||||
try {
|
||||
@ -3338,7 +3338,7 @@ void SQLExecutor::asynchronous(int rowCount)
|
||||
assertTrue (data.size() == 0);
|
||||
assertTrue (!stmt2.done());
|
||||
std::size_t rows = 0;
|
||||
|
||||
|
||||
for (int i = 0; !stmt2.done(); i += step)
|
||||
{
|
||||
stmt2.execute();
|
||||
@ -3504,8 +3504,8 @@ void SQLExecutor::sqlChannel(const std::string& connect)
|
||||
rs2.moveNext();
|
||||
assertTrue ("WarningSource" == rs2["Source"]);
|
||||
assertTrue ("f Warning sync message" == rs2["Text"]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail ("sqlChannel()"); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail ("sqlChannel()"); }
|
||||
}
|
||||
@ -3518,7 +3518,7 @@ void SQLExecutor::sqlLogger(const std::string& connect)
|
||||
Logger& root = Logger::root();
|
||||
root.setChannel(new SQLChannel(Poco::Data::ODBC::Connector::KEY, connect, "TestSQLChannel"));
|
||||
root.setLevel(Message::PRIO_INFORMATION);
|
||||
|
||||
|
||||
root.information("a Informational message");
|
||||
root.warning("b Warning message");
|
||||
root.debug("Debug message");
|
||||
@ -3532,26 +3532,26 @@ void SQLExecutor::sqlLogger(const std::string& connect)
|
||||
assertTrue ("TestSQLChannel" == rs["Source"]);
|
||||
assertTrue ("b Warning message" == rs["Text"]);
|
||||
root.setChannel(nullptr);
|
||||
}
|
||||
}
|
||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail ("sqlLogger()"); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail ("sqlLogger()"); }
|
||||
}
|
||||
|
||||
|
||||
void SQLExecutor::setTransactionIsolation(Session& session, Poco::UInt32 ti)
|
||||
{
|
||||
{
|
||||
if (session.hasTransactionIsolation(ti))
|
||||
{
|
||||
std::string funct = "setTransactionIsolation()";
|
||||
|
||||
try
|
||||
try
|
||||
{
|
||||
Transaction t(session, false);
|
||||
t.setIsolation(ti);
|
||||
|
||||
|
||||
assertTrue (ti == t.getIsolation());
|
||||
assertTrue (t.isIsolation(ti));
|
||||
|
||||
|
||||
assertTrue (ti == session.getTransactionIsolation());
|
||||
assertTrue (session.isTransactionIsolation(ti));
|
||||
}
|
||||
@ -3714,11 +3714,11 @@ void SQLExecutor::transaction(const std::string& connect)
|
||||
Transaction trans(session());
|
||||
assertTrue (trans.isActive());
|
||||
assertTrue (session().isTransaction());
|
||||
|
||||
|
||||
try { session() << "INSERT INTO Person VALUES (?,?,?,?)", use(lastNames), use(firstNames), use(addresses), use(ages), now; }
|
||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||
|
||||
|
||||
assertTrue (session().isTransaction());
|
||||
assertTrue (trans.isActive());
|
||||
|
||||
@ -3770,7 +3770,7 @@ void SQLExecutor::transaction(const std::string& connect)
|
||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||
assertTrue (0 == count);
|
||||
try
|
||||
try
|
||||
{
|
||||
stmt1.wait(5000);
|
||||
if (local.getTransactionIsolation() == Session::TRANSACTION_READ_UNCOMMITTED)
|
||||
@ -3818,7 +3818,7 @@ void SQLExecutor::transaction(const std::string& connect)
|
||||
assertTrue (0 == count);
|
||||
|
||||
trans.execute(sql);
|
||||
|
||||
|
||||
Statement stmt3 = (local << "SELECT COUNT(*) FROM Person", into(locCount), now);
|
||||
assertTrue (2 == locCount);
|
||||
|
||||
@ -3870,7 +3870,7 @@ void SQLExecutor::transactor()
|
||||
try { session() << "DELETE FROM Person", now; session().commit();}
|
||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||
|
||||
|
||||
try { session() << "SELECT count(*) FROM Person", into(count), now; }
|
||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||
@ -3961,7 +3961,7 @@ void SQLExecutor::nullable()
|
||||
assertTrue (rs.isNull("EmptyInteger"));
|
||||
assertTrue (rs.isNull("EmptyFloat"));
|
||||
assertTrue (rs.isNull("EmptyDateTime"));
|
||||
|
||||
|
||||
Var di = 1;
|
||||
Var df = 1.5;
|
||||
Var ds = "abc";
|
||||
@ -3971,7 +3971,7 @@ void SQLExecutor::nullable()
|
||||
assertTrue (!df.isEmpty());
|
||||
assertTrue (!ds.isEmpty());
|
||||
assertTrue (!dd.isEmpty());
|
||||
|
||||
|
||||
Statement stmt = (session() << "SELECT EmptyString, EmptyInteger, EmptyFloat, EmptyDateTime FROM NullableTest", into(ds), into(di), into(df), into(dd), now);
|
||||
|
||||
assertTrue (di.isEmpty());
|
||||
@ -4004,9 +4004,9 @@ void SQLExecutor::reconnect()
|
||||
assertTrue (session().isConnected());
|
||||
session().close();
|
||||
assertTrue (!session().isConnected());
|
||||
try
|
||||
try
|
||||
{
|
||||
session() << "SELECT LastName FROM Person", into(result), now;
|
||||
session() << "SELECT LastName FROM Person", into(result), now;
|
||||
fail ("must fail");
|
||||
}
|
||||
catch(NotConnectedException&){ }
|
||||
|
@ -80,7 +80,7 @@ public:
|
||||
PB_IMMEDIATE,
|
||||
PB_AT_EXEC
|
||||
};
|
||||
|
||||
|
||||
enum DataExtraction
|
||||
{
|
||||
DE_MANUAL,
|
||||
@ -95,22 +95,22 @@ public:
|
||||
|
||||
void bareboneODBCTest(const std::string& dbConnString,
|
||||
const std::string& tableCreateString,
|
||||
DataBinding bindMode,
|
||||
DataBinding bindMode,
|
||||
DataExtraction extractMode,
|
||||
bool doTime=true,
|
||||
const std::string& blobPlaceholder="?");
|
||||
|
||||
void bareboneODBCMultiResultTest(const std::string& dbConnString,
|
||||
const std::string& tableCreateString,
|
||||
SQLExecutor::DataBinding bindMode,
|
||||
void bareboneODBCMultiResultTest(const std::string& dbConnString,
|
||||
const std::string& tableCreateString,
|
||||
SQLExecutor::DataBinding bindMode,
|
||||
SQLExecutor::DataExtraction extractMode,
|
||||
const std::string& insert = MULTI_INSERT,
|
||||
const std::string& select = MULTI_SELECT);
|
||||
/// The above two functions use "bare bone" ODBC API calls
|
||||
/// The above two functions use "bare bone" ODBC API calls
|
||||
/// (i.e. calls are not "wrapped" in PocoData framework structures).
|
||||
/// The purpose of the functions is to verify that a driver behaves
|
||||
/// correctly as well as to determine its capabilities
|
||||
/// (e.g. SQLGetData() restrictions relaxation policy, if any).
|
||||
/// correctly as well as to determine its capabilities
|
||||
/// (e.g. SQLGetData() restrictions relaxation policy, if any).
|
||||
/// If these test pass, subsequent tests failures are likely ours.
|
||||
|
||||
void zeroRows();
|
||||
@ -158,7 +158,7 @@ public:
|
||||
C4 floats;
|
||||
C5 dateTimes(size);
|
||||
C6 bools;
|
||||
|
||||
|
||||
for (int i = 0; i < size; ++i)
|
||||
{
|
||||
ints.push_back(i);
|
||||
@ -168,12 +168,12 @@ public:
|
||||
bools.push_back(0 == i % 2);
|
||||
}
|
||||
|
||||
try
|
||||
try
|
||||
{
|
||||
session() <<
|
||||
Poco::format("INSERT INTO MiscTest VALUES (?,%s,?,?,?,?)", blobPlaceholder),
|
||||
use(strings),
|
||||
use(blobs),
|
||||
session() <<
|
||||
Poco::format("INSERT INTO MiscTest VALUES (?,%s,?,?,?,?)", blobPlaceholder),
|
||||
use(strings),
|
||||
use(blobs),
|
||||
use(ints),
|
||||
use(floats),
|
||||
use(dateTimes),
|
||||
@ -185,12 +185,12 @@ public:
|
||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||
|
||||
try
|
||||
try
|
||||
{
|
||||
session() <<
|
||||
session() <<
|
||||
Poco::format("INSERT INTO MiscTest VALUES (?,%s,?,?,?,?)", blobPlaceholder),
|
||||
use(strings, bulk),
|
||||
use(blobs, bulk),
|
||||
use(strings, bulk),
|
||||
use(blobs, bulk),
|
||||
use(ints, bulk),
|
||||
use(floats, bulk),
|
||||
use(dateTimes, bulk),
|
||||
@ -204,20 +204,20 @@ public:
|
||||
floats.clear();
|
||||
dateTimes.clear();
|
||||
bools.clear();
|
||||
|
||||
try
|
||||
{
|
||||
session() << "SELECT * FROM MiscTest ORDER BY Third",
|
||||
into(strings),
|
||||
into(blobs),
|
||||
into(ints),
|
||||
|
||||
try
|
||||
{
|
||||
session() << "SELECT * FROM MiscTest ORDER BY Third",
|
||||
into(strings),
|
||||
into(blobs),
|
||||
into(ints),
|
||||
into(floats),
|
||||
into(dateTimes),
|
||||
into(bools),
|
||||
now;
|
||||
now;
|
||||
} catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||
|
||||
|
||||
std::string number = Poco::NumberFormatter::format(size - 1);
|
||||
assert (size == ints.size());
|
||||
assert (0 == ints.front());
|
||||
@ -235,16 +235,16 @@ public:
|
||||
|
||||
ints.clear();
|
||||
|
||||
try
|
||||
{
|
||||
session() << "SELECT First FROM MiscTest", into(ints, bulk(size)), limit(size+1), now;
|
||||
try
|
||||
{
|
||||
session() << "SELECT First FROM MiscTest", into(ints, bulk(size)), limit(size+1), now;
|
||||
fail ("must fail");
|
||||
}
|
||||
catch(Poco::InvalidArgumentException&){ }
|
||||
|
||||
try
|
||||
{
|
||||
session() << "SELECT First FROM MiscTest", into(ints), bulk(size), now;
|
||||
try
|
||||
{
|
||||
session() << "SELECT First FROM MiscTest", into(ints), bulk(size), now;
|
||||
fail ("must fail");
|
||||
}
|
||||
catch(Poco::InvalidAccessException&){ }
|
||||
@ -258,17 +258,17 @@ public:
|
||||
dateTimes.clear();
|
||||
bools.clear();
|
||||
bools.resize(size);
|
||||
|
||||
try
|
||||
{
|
||||
session() << "SELECT First, Second, Third, Fourth, Fifth, Sixth FROM MiscTest ORDER BY Third",
|
||||
|
||||
try
|
||||
{
|
||||
session() << "SELECT First, Second, Third, Fourth, Fifth, Sixth FROM MiscTest ORDER BY Third",
|
||||
into(strings, bulk),
|
||||
into(blobs, bulk(size)),
|
||||
into(ints, bulk(size)),
|
||||
into(floats, bulk),
|
||||
into(dateTimes, bulk(size)),
|
||||
into(bools, bulk),
|
||||
now;
|
||||
now;
|
||||
} catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||
|
||||
@ -300,7 +300,7 @@ public:
|
||||
C3 blobs;
|
||||
C4 floats;
|
||||
C5 dateTimes(size);
|
||||
|
||||
|
||||
for (int i = 0; i < size; ++i)
|
||||
{
|
||||
ints.push_back(i);
|
||||
@ -309,11 +309,11 @@ public:
|
||||
floats.push_back(i + .5);
|
||||
}
|
||||
|
||||
try
|
||||
try
|
||||
{
|
||||
session() << "INSERT INTO MiscTest VALUES (?,?,?,?,?)",
|
||||
use(strings),
|
||||
use(blobs),
|
||||
session() << "INSERT INTO MiscTest VALUES (?,?,?,?,?)",
|
||||
use(strings),
|
||||
use(blobs),
|
||||
use(ints),
|
||||
use(floats),
|
||||
use(dateTimes), now;
|
||||
@ -324,35 +324,35 @@ public:
|
||||
catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||
|
||||
try
|
||||
try
|
||||
{
|
||||
session() << "INSERT INTO MiscTest VALUES (?,?,?,?,?)",
|
||||
use(strings, bulk),
|
||||
use(blobs, bulk),
|
||||
session() << "INSERT INTO MiscTest VALUES (?,?,?,?,?)",
|
||||
use(strings, bulk),
|
||||
use(blobs, bulk),
|
||||
use(ints, bulk),
|
||||
use(floats, bulk),
|
||||
use(dateTimes, bulk), now;
|
||||
} catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||
|
||||
|
||||
ints.clear();
|
||||
strings.clear();
|
||||
blobs.clear();
|
||||
floats.clear();
|
||||
dateTimes.clear();
|
||||
|
||||
try
|
||||
{
|
||||
session() << "SELECT * FROM MiscTest ORDER BY First",
|
||||
into(strings),
|
||||
into(blobs),
|
||||
into(ints),
|
||||
try
|
||||
{
|
||||
session() << "SELECT * FROM MiscTest ORDER BY First",
|
||||
into(strings),
|
||||
into(blobs),
|
||||
into(ints),
|
||||
into(floats),
|
||||
into(dateTimes),
|
||||
now;
|
||||
now;
|
||||
} catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||
|
||||
|
||||
std::string number = Poco::NumberFormatter::format(size - 1);
|
||||
assert (size == ints.size());
|
||||
assert (0 == ints.front());
|
||||
@ -368,16 +368,16 @@ public:
|
||||
|
||||
ints.clear();
|
||||
|
||||
try
|
||||
{
|
||||
session() << "SELECT First FROM MiscTest", into(ints, bulk(size)), limit(size+1), now;
|
||||
try
|
||||
{
|
||||
session() << "SELECT First FROM MiscTest", into(ints, bulk(size)), limit(size+1), now;
|
||||
fail ("must fail");
|
||||
}
|
||||
catch(Poco::InvalidArgumentException&){ }
|
||||
|
||||
try
|
||||
{
|
||||
session() << "SELECT First FROM MiscTest", into(ints), bulk(size), now;
|
||||
try
|
||||
{
|
||||
session() << "SELECT First FROM MiscTest", into(ints), bulk(size), now;
|
||||
fail ("must fail");
|
||||
}
|
||||
catch(Poco::InvalidAccessException&){ }
|
||||
@ -387,19 +387,19 @@ public:
|
||||
blobs.clear();
|
||||
floats.clear();
|
||||
dateTimes.clear();
|
||||
|
||||
try
|
||||
{
|
||||
session() << "SELECT * FROM MiscTest ORDER BY First",
|
||||
|
||||
try
|
||||
{
|
||||
session() << "SELECT * FROM MiscTest ORDER BY First",
|
||||
into(strings, bulk(size)),
|
||||
into(blobs, bulk(size)),
|
||||
into(ints, bulk(size)),
|
||||
into(floats, bulk(size)),
|
||||
into(dateTimes, bulk(size)),
|
||||
now;
|
||||
now;
|
||||
} catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); }
|
||||
catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); }
|
||||
|
||||
|
||||
assert (size == ints.size());
|
||||
assert (0 == ints.front());
|
||||
assert (size - 1 == ints.back());
|
||||
@ -474,7 +474,7 @@ public:
|
||||
void tupleVector();
|
||||
|
||||
void internalExtraction();
|
||||
void filter(const std::string& query =
|
||||
void filter(const std::string& query =
|
||||
"SELECT * FROM Vectors ORDER BY int0 ASC",
|
||||
const std::string& intFldName = "int0");
|
||||
|
||||
@ -487,11 +487,11 @@ public:
|
||||
void stdVectorBool();
|
||||
|
||||
void asynchronous(int rowCount = 500);
|
||||
|
||||
|
||||
void any();
|
||||
void dynamicAny();
|
||||
|
||||
void multipleResults(const std::string& sql =
|
||||
void multipleResults(const std::string& sql =
|
||||
"SELECT * FROM Person WHERE Age = ?; "
|
||||
"SELECT Age FROM Person WHERE FirstName = 'Bart'; "
|
||||
"SELECT * FROM Person WHERE Age = ? OR Age = ? ORDER BY Age;");
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user