mirror of
https://github.com/pocoproject/poco.git
synced 2025-04-15 22:50:36 +02:00
imported 1.3.1
This commit is contained in:
commit
8a8204c022
778
CHANGELOG
Normal file
778
CHANGELOG
Normal file
@ -0,0 +1,778 @@
|
||||
This is the changelog file for the POCO C++ Libraries.
|
||||
|
||||
Release 1.3.1 (2007-08-08)
|
||||
==========================
|
||||
|
||||
Foundation, XML, Net, Util:
|
||||
- DynamicAny fixes for char conversions
|
||||
- fixed SF# 1733362: Strange timeout handling in SocketImpl::poll and Socket::select
|
||||
- fixed SF patch# 1728912: crash in POCO on Solaris
|
||||
- fixed SF# 1732138: Bug in WinRegistryConfiguration::getString
|
||||
- fixed SF# 1730790: Reference counting breaks NetworkInterface::list()
|
||||
- fixed SF# 1720733: Poco::SignalHandler bug
|
||||
- fixed SF# 1718724: Poco::StreamCopier::copyStream loops forever
|
||||
- fixed SF# 1718437: HashMap bug
|
||||
- changed LinearHashTable iterator implementation. less templates -> good thing.
|
||||
- fixed SF# 1733964: DynamicAny compile error
|
||||
- UUIDGenerator: fixed infinite loop with non ethernet interfaces
|
||||
- updated expat to 2.0.1
|
||||
- fixed SF# 1730566: HTTP server throws exception
|
||||
- Glob supports symbolic links (additional flag to control behavior)
|
||||
- fixed a problem with non blocking connect in NetSSL_OpenSSL
|
||||
(see http://www.appinf.com/poco/wiki/tiki-view_forum_thread.php?comments_parentId=441&topics_threshold=0&topics_offset=29&topics_sort_mode=commentDate_desc&topics_find=&forumId=6)
|
||||
- fixed a problem with SSL renegotiation in NetSSL_OpenSSL (thanks to Sanjay Chouksey for the fix)
|
||||
- fixed SF# 1714753: NetSSL_OpenSSL: HTTPS connections fail with wildcard certs
|
||||
- HTTPClientSession: set Host header only if it's not already set (proposed by EHL)
|
||||
- NetworkInterface (Windows): Loopback interface now has correct netmask;
|
||||
interfaces that do not have an IP address assigned are no longer reported.
|
||||
- Fixes for VC++ W4 warnings from EHL
|
||||
- SharedMemory: first constructor has an additional "server" parameter
|
||||
Setting to true does not unlink the shared memory region when the SharedMemory object is destroyed. (Alessandro Oliveira Ungaro)
|
||||
- fixed SF# 1768231: MemoryPool constructor
|
||||
|
||||
Data:
|
||||
- fixed SF# 1739989: Data::RecordSet::operator = () (in 1.3 branch)
|
||||
- fixed SF# 1747525: SQLite, Transactions and Session Pooling (in 1.3 branch)
|
||||
- upgraded to SQLite 3.4.1
|
||||
|
||||
Release 1.3.0 (2007-05-07)
|
||||
==========================
|
||||
|
||||
- added HashMap, HashSet classes
|
||||
- the HashFunction class template has been changed in an incompatible
|
||||
way. The member function formerly named hash() is now the function
|
||||
call operator. If you have defined your own HashFunction classes,
|
||||
you have to update your code. Sorry for the inconvenience.
|
||||
- added Poco::Tuple
|
||||
- added AbstractCache::getAllKeys(), improved performance of the get operation
|
||||
- fixed AbstractCache::size() to do cache replacement before returning the size
|
||||
- added additional match() method to RegularExpression and documented the fact that the simple
|
||||
match() method internally sets RE_ANCHORED and RE_NOTEMPTY.
|
||||
- added ExpirationDecorator template. Decorates data types so that they can be used with UniqueExpireCaches
|
||||
- added operator ! to AutoPtr and SharedPtr
|
||||
- Buffer uses std::size_t instead of int
|
||||
- Exception::what() now returns exception name instead of message
|
||||
- added poco_ndc_dbg() macro (same as poco_ndc(), but only enabled in debug builds)
|
||||
- added Environment::get(name, defaultValue);
|
||||
- Foundation.h now includes Config.h at the very beginning.
|
||||
- added replace() and replaceInPlace() to Poco/String.h
|
||||
- added AutoPtr::assign() and SharedPtr::assign()
|
||||
- added operator () to AbstractEvent
|
||||
- gcc Makefiles now strip release builds
|
||||
- Void now has a == and != operator
|
||||
- Base64Encoder and HexBinaryEncoder now support an unlimited line length
|
||||
(no newlines written), by specifying a line length of 0
|
||||
- NumberParser now has stricter syntax requirements: garbage following a number leads to a SyntaxException
|
||||
(Thanks to phireis@gmail.com for the suggestion)
|
||||
- fixed SF# 1676830: Don't use -rpath in libraries
|
||||
- fixed SF# 1670279: AbstractConfiguration::unckeckedExpand crash
|
||||
- fixed a warning in Hashtable
|
||||
- HTTPClientSession now uses a keepAliveTimeout for better persistent connection handling
|
||||
- added DateTime::makeUTC() and DateTime::makeLocal()
|
||||
- added another constructor to LocalDateTime
|
||||
- POCO_WIN32_UTF8 is ignored on non-Windows platforms
|
||||
- fixed a timeout bug (with NetSSL) in HTTPSession
|
||||
- AsyncChannel is automatically opened with first log()
|
||||
- minor fix to NotificationQueue sample (reported by Laszlo Keresztfalvi)
|
||||
- added File::canExecute() and File::setExecutable()
|
||||
- added SharedMemory class to Foundation
|
||||
- added FileStream, FileInputStream, FileOutputStream to Foundation
|
||||
- added NodeAppender class to XML for faster DOM tree creation
|
||||
- HTTPServerRequest and HTTPServerResponse are now abstract base classes,
|
||||
actual functionality has moved into HTTPServerRequestImpl and
|
||||
HTTPServerResponseImpl. This allows us to plug other HTTP servers
|
||||
into POCO.
|
||||
- added DynamicAny class to Foundation
|
||||
- replaced std::fstream with Poco::FileStream across POCO.
|
||||
- added Poco::Checksum class to Foundation.
|
||||
- fixed SF# 1700811: conflict in threadpool
|
||||
- bugfix: File::moveTo() does not work if the target is a directory
|
||||
- File::copyTo() and File::moveTo() now copy/move directories recursively
|
||||
- refactored NetworkInterface (now using pimpl idiom);
|
||||
added broadcast address and netmask support
|
||||
- fixed SF# 1688982: POP3ClientSession fails when retrieving mails with attachment
|
||||
- fixed SF# 1655104: Enhance Poco::TextEncoding functionality
|
||||
- added Poco::Condition class, implementing a POSIX-style condition variable
|
||||
- fixed a bug in File::create() for Windows
|
||||
- added poco_static_assert (imported from boost)
|
||||
- added Thread::join(timeout) and Thread::tryJoin()
|
||||
- ClassLoader support for named manifests (see ClassLibrary.h - POCO_EXPORT_NAMED_MANIFEST)
|
||||
- POCO_WIN32_UTF8: UNICODE #define is no longer required (and no longer
|
||||
automatically defined in POCO_WIN32_UTF8 is defined)
|
||||
- PCRE: upgraded to PCRE version 7.1
|
||||
- fixed SF# 1682162: Suggestion on thread priority
|
||||
- fixed SF# 1613460: MSVC/STLPort warnings
|
||||
- fixed SF# 1709358: Format double percent std::String bug
|
||||
- added WindowsConsoleChannel class to Foundation
|
||||
- added AutoPtr::unsafeCast<>() and SharedPtr::unsafeCast<>()
|
||||
- fixed SF# 1708552: Failed to build on arm and powerpc
|
||||
- fixed SF$ 1708529: Failed to build using GCC 4.3: missing #includes
|
||||
- fixed SF# 1710053: LogStream proposal
|
||||
- fixed a bug involving empty root directories in Windows DirectoryIterator implementation
|
||||
(see http://www.appinf.com/poco/wiki/tiki-view_forum_thread.php?comments_parentId=343&forumId=6)
|
||||
- robustness improvements to ActiveMethod - removed the opportunity for memory leaks in
|
||||
case something goes while invoking the method
|
||||
- made C library usage more C++-like - use C++ headers (e.g. <cstring>) instead of
|
||||
C ones (<string.h>). Also, use C library functions in std namespace.
|
||||
- added Unicode and UTF8String for improved Unicode support.
|
||||
The Unicode class can be used to obtain the Unicode properties of a character.
|
||||
The UTF8 class provides case insensitive comparison and case conversion
|
||||
for UTF-8 encoded strings.
|
||||
- added UnWindows.h header file, replaced all #include <windows.h> with #include "Poco/UnWindows.h".
|
||||
See the Poco/UnWindows.h header file for a rationale and explanations.
|
||||
- fixed SF# 1713820: StreamSocketImpl::sendBytes sends too many bytes
|
||||
- File::copyTo(): on Windows, the copy now always has the read-only flag reset, to be consistent
|
||||
with other platforms.
|
||||
- With Microsoft Visual C++, the necessary POCO libraries are now implicitly linked when
|
||||
the corresponding header files are included (#pragma comment(lib, "PocoXYZ.lib") is used).
|
||||
To disable this, compile POCO with the preprocessor symbol POCO_NO_AUTOMATIC_LIBS #define'd
|
||||
(see Poco/Foundation.h and Poco/Config.h).
|
||||
- The Visual Studio project files for the POCO libraries now include configurations
|
||||
for building static libraries.
|
||||
|
||||
|
||||
Release 1.2.9 (2007-02-26)
|
||||
==========================
|
||||
|
||||
- fixed a formatting problem in Util::HelpFormatter
|
||||
- HTTPClientSession::sendRequest() now attempts to send the complete request in one network packet.
|
||||
- improved network performance of ChunkedOutputStream: chunk size and chunk data
|
||||
are sent in one network packet if possible
|
||||
- fixed SF# 1655035: Wrong expires field calculation in HTTPCookie
|
||||
(thanks to Sergey N. Yatskevich for this and other fixes)
|
||||
- fixed SF# 1655049: Fix discrepancy of a code to the description
|
||||
- fixed SF# 1655170: Poco::Timezone::standardName() problem on WIN32
|
||||
- fixed SF# 1629095: POCO_WIN32_UTF8 problem
|
||||
There is a new function Path::transcode() that can be used to convert a path (or any other string)
|
||||
from UTF-8 to the current Windows code page. This string can the be passed as a filename
|
||||
to an fstream or fopen(). This function only does the conversion on Windows,
|
||||
and only, if POCO_WIN32_UTF8 is defined. Otherwise, it simply returns the unmodified argument.
|
||||
- fixed SF# 1659607: Probably a bug in Poco::Net::DialogSocket
|
||||
- HTTPServer network performance improvement: responses that fit into a single network packet
|
||||
sent with HTTPServerResponse::sendFile() or the new HTTPServerResponse::sendBuffer() are
|
||||
sent in only one packet.
|
||||
- added HTTPServerResponse::sendBuffer()
|
||||
- HTTPServer now sends a Bad Request response if it fails to parse the HTTP request header.
|
||||
- HTTPServer now sends an Internal Server Error response if the request handler throws an
|
||||
exception prior to sending a response.- enabled TCP_NODELAY per default on TCPServer/HTTPServer
|
||||
- fixed a bug in HTTP persistent connection handling
|
||||
(server does not send Connection: close when it reaches connection maximum)
|
||||
- HTMLForm - POST submission of URL encoded form no longer uses chunked transfer encoding
|
||||
(thus improving interoperability with certain web servers)
|
||||
- integrated Environment.cpp from Main (missing get(var, default))
|
||||
- added missing AutoPtr include to Util/Application
|
||||
(and using Poco::AutoPtr is no longer necessary for POCO_APP_MAIN macro)
|
||||
- fixed SF# 1635420: Per Regents of the University of Calfornia letter,
|
||||
remove advertising from BSD licensed parts
|
||||
- fixed SF# 1633133: MultipartWriter writes superluous CR-LF at beginning
|
||||
|
||||
|
||||
Release 1.2.8 (2007-01-04)
|
||||
==========================
|
||||
|
||||
- fixed SF# 1613906: Util/Application.h and GCC 3.3
|
||||
- fixed a byte order issue (failed test) in IPv6 address formatting
|
||||
- fixed SF# 1626640: Poco::Net::SocketReactor bug
|
||||
- fixed client side chunked transfer encoding handling
|
||||
- fixed client side persistent connection handling
|
||||
- fixed SF# 1623536: HTTP Server Chunked Transfer Encoding Bug
|
||||
- improved HTTP server exception text
|
||||
- fixed SF# 1616294: KeepAlive HTTPServerSession patch
|
||||
- fixed SF# 1616296: Trivial Poco::TaskCustomNotification patch
|
||||
- fixed SF# 1619282: PurgeStrategy bug fix
|
||||
- fixed SF# 1620855: Format problem
|
||||
there is a new format specifier %z for std::size_t, as well as a new
|
||||
flag ? for %d, %i, %o, %x meaning any signed or unsigned integer
|
||||
|
||||
|
||||
Release 1.2.7 (2006-12-07)
|
||||
==========================
|
||||
|
||||
- Poco::File: fixed root directory handling
|
||||
- fixed UUIDGenerator documentation
|
||||
- clarified Application::setUnixOptions() documentation
|
||||
- fixes for issue [SOAPLite Transport 0000023]: SOAP Transport Listener should be able to use existing HTTPServer instance
|
||||
- fixing mantis issues 13, 14, 15, 16, 17, 18, 19, 21
|
||||
- fixed SF# 1597022: Signed/unsigned warning in StringTokenizer::operator[]
|
||||
- fixed SF# 1598601: Message::op= leaks
|
||||
- fixed SF# 1605960: PatternFormatter crashes on custom property
|
||||
- fixed SF# 1605950: Memory leak in Logger sample code
|
||||
- fixed SF# 1591635: Copy Paste Error in sample code
|
||||
- fixed SF# 1591512: SMTPClientSession response stream
|
||||
- fixed SF #1592776: LayeredConfiguration: getRaw should enumerate in reverse order
|
||||
- SF Patch # 1599848 ] VS 2005 Util build fails
|
||||
- Logger::dump() now uses std::size_t instead of int for buffer size
|
||||
- LayeredConfiguration now supports a priority value for each configuration.
|
||||
Also, it's possible to specify for each configuration added whether it
|
||||
should be writeable.
|
||||
- ServerApplication: cd to root directory only if running as a daemon
|
||||
- added Message::swap()
|
||||
- improvements to build system:
|
||||
global Makefile has correct dependencies for samples
|
||||
on Windows, samples build after libraries are ready
|
||||
configure supports --no-wstring and --no-fpenvironment flags
|
||||
build system supports POCO_FLAGS environment variable for compiler flags
|
||||
- RemoteGen: fixed error handling for write protected files (SystemException)
|
||||
fixing integral constant overflow messages with large cache expiration, m_ support for type serializers,
|
||||
case-insensitive comparison added
|
||||
|
||||
|
||||
Release 1.2.6 (2006-11-19)
|
||||
==========================
|
||||
|
||||
- added additional match() method to RegularExpression and documented the fact that the simple
|
||||
match() method internally sets RE_ANCHORED and RE_NOTEMPTY.
|
||||
- added ExpirationDecorator template. Decorates data types so that they can be used with UniqueExpireCaches
|
||||
- added operator ! to AutoPtr and SharedPtr
|
||||
- Buffer uses std::size_t instead of int
|
||||
- added poco_ndc_dbg() macro (same as poco_ndc(), but only enabled in debug builds)
|
||||
- Foundation.h now includes Config.h at the very beginning.
|
||||
- added AutoPtr::assign() and SharedPtr::assign()
|
||||
- added operator () to AbstractEvent
|
||||
- gcc Makefiles now strip release builds
|
||||
- documentation improvements
|
||||
|
||||
|
||||
Release 1.2.5 (2006-10-23)
|
||||
==========================
|
||||
|
||||
- Improved LoggingConfigurator: channel creation and configuration is now a two-step process.
|
||||
This means that the previous problems with PropertyFileConfiguration and IniFileConfiguration when referencing other channels are solved.
|
||||
- improved options handling: better handling of (non) ambiguities.
|
||||
If both an option named "help" and one named "helper" is specified, this no longer causes ambiguity errors.
|
||||
- added check for duplicate option definition
|
||||
- ThreadPool bugfix: fixed a crash that occurs on Linux multiprocessor machines
|
||||
(caused by an thread unsafe string assignment corrupting the heap...)
|
||||
(SF# 1575315)
|
||||
- improved ThreadPool performance
|
||||
- XML now compiles with -DXML_UNICODE_WCHAR_T (SF# 1575174)
|
||||
- fixed SF# 1572757: HTML forms can have more than one key/value pair with the same name
|
||||
- got rid of the dynamic casts in Events, Events/Cache: simpler/faster Delegate < operator,
|
||||
prevents some rare dynamic casts error from occuring when using StrategyCollection with Caches
|
||||
- improvements to Logger and LoggingConfigurator:
|
||||
* added Logger::unsafeGet()
|
||||
* added Logger::setProperty(loggerName, propertyName, value)
|
||||
* LoggingConfigurator now correctly (re)configures existing Loggers
|
||||
(prior to this change, if a Logger named "a.b.c" existed before
|
||||
the LoggingConfigurator started its work, and the LoggingConfigurator
|
||||
configured a Logger named "a.b", then "a.b.c" would not inherit
|
||||
the new configuration).
|
||||
- improvements to SplitterChannel and EventLogChannel configuration
|
||||
- improved LoggingRegistry exception messages
|
||||
- MessageHeader::read() is more liberal with malformed message headers.
|
||||
This fixes problems with certain network cameras sending malformed HTTP headers.
|
||||
|
||||
|
||||
Release 1.2.4 (2006-10-02)
|
||||
==========================
|
||||
|
||||
- some code beautifying and improvements to comments
|
||||
- DOMParser now automatically sets FEATURE_NAMESPACE_PREFIXES
|
||||
- fixed SF #1567051: DOMBuilder/DOMParser/NamespaceStrategy bug
|
||||
- fixed SF #1567364: POCO_APP_MAIN
|
||||
- added Document::getElementById() (two-argument) and getElementByIdNS()
|
||||
- added another test for DOMParser
|
||||
- added AutoPtr::isNull() (to be consistent with SharedPtr)
|
||||
- this release again compiles on PA-RISC HP-UX systems with aCC
|
||||
- added CMAKE support files contributed by Andrew J. P. Maclean
|
||||
|
||||
|
||||
Release 1.2.3 (2006-09-14)
|
||||
==========================
|
||||
|
||||
- configure script now checks if (auto)selected configuration is supported
|
||||
- fixed SF #1552904: NamedEvent bug?
|
||||
- fixed SF #1552787: POCO not handling EINTR
|
||||
- fixed SF #1552846: Random::~Random uses scalar delete
|
||||
- fixed SF #1552987: TLSSlot should explicitly default-construct _value
|
||||
- IPAddress no longer accepts an empty address string
|
||||
- split up Observer.h into AbstractObserver.h and Observer.h
|
||||
- added NObserver class template which supports an AutoPtr
|
||||
argument for the notification callback
|
||||
- changed EchoServer sample to use NObserver
|
||||
- some Windows-specific files were missing in the tarballs
|
||||
|
||||
|
||||
Release 1.2.2 (2006-09-01)
|
||||
==========================
|
||||
|
||||
- fixed SF # 1549973: NotificationCenter::hasObservers() returns wrong result
|
||||
- fixed a memory leak in EchoServer sample
|
||||
- fixed SocketReactor TimeoutNotification bug (SF #1549365, SocketNotifier::addObserver() incorrect behavior)
|
||||
- fixed SF# 1549513: MultipartReader does not work with Unix-style linefeeds
|
||||
- MailMessage and HTMLForm: processing of multipart messages will no longer fail if a PartHandler does not read all data from the part stream.
|
||||
- added additional test case (Unix-style line ends) to MultipartReaderTest
|
||||
|
||||
|
||||
Release 1.2.1 (2006-08-29)
|
||||
==========================
|
||||
|
||||
- fixed Config.h header (no more #undefs)
|
||||
|
||||
Release 1.2.0 (2006-08-29)
|
||||
==========================
|
||||
|
||||
- DateTime fixes: Julian Day is no longer stored internally.
|
||||
Times (hours, minutes, seconds, ...) are now always taken from an utcValue (if available) and not from the Julian day.
|
||||
The Julian day is only used for calculating year, month and day (except when the Julian day is the only thing we have)
|
||||
This helps us get rid of rounding errors that the Julian Day arithmetic introduced.- on Windows, UUIDGenerator no longer uses Netbios, but GetAdaptersInfo instead
|
||||
- The main Makefile now has correct dependencies
|
||||
- updated poco-doc.pl with latest version by Caleb Epstein
|
||||
- fixed SF #1542722: InflatingInputStream: buffer error
|
||||
- improved Windows UTF-8 support
|
||||
- added Logger::names()
|
||||
- added configure script and make install target
|
||||
- XMLWriter bugfix: pretty-print bug with characters() and rawCharacters()
|
||||
- improvements to build system: support builds outside of source tree
|
||||
- added header doc conversion tool contributed by Caleb Epstein
|
||||
- fixed SF #1542618 (build/config/Linux patch)
|
||||
- bugfix: BinaryReader/BinaryWriter BOM is now 16 bits, as documented
|
||||
- fixed SF #1542247 (Compiler warning from OptionCallback)
|
||||
- fixed SF #1542253 (ServerApplication::handleOption doesn't call Application::handleOption)
|
||||
- added Application::stopOptionsProcessing()
|
||||
- updated samples
|
||||
- Util::Application command line handling now supports:
|
||||
* argument validation (Option::validator(); see Validator, IntValidator, RegExpValidator)
|
||||
* binding of argument values to config properties (Option::binding())
|
||||
* callbacks for arguments (Option::callback())
|
||||
* checking of required parameters
|
||||
- changed header file locations:
|
||||
Foundation headers are now in Poco (#include "Poco/Foundation.h")
|
||||
XML headers are now in Poco/XML, Poco/SAX and Poco/DOM (#include "Poco/XML/XML.h")
|
||||
Util headers are now in Poco/Util (#include "Poco/Util/Util.h")
|
||||
etc.
|
||||
Unfortunately, this change will break existing code. However, fixing the code is
|
||||
a matter of a few global search/replace operations and can be done quickly.
|
||||
On the plus side, POCO is now a much better citizen when used with other
|
||||
libraries.
|
||||
- changed namespaces:
|
||||
Foundation is now Poco
|
||||
XML is now Poco::XML
|
||||
Util is now Poco::Util
|
||||
Net is now Poco::Net
|
||||
- removed namespace macros
|
||||
- fixed some warnings reported by gcc -Wall -Wextra
|
||||
- fixed AutoPtr and LayeredConfiguration documentation
|
||||
- improved StreamSocket::receiveBytes() doc
|
||||
- added Pipe and PipeStream classes
|
||||
- added support for I/O redirection (pipes) to Process::launch()
|
||||
- added LogStream class (ostream interface to Logger)
|
||||
- improved Makefiles (no more double-building if clean all is specified)
|
||||
- added CppUnit and DateTime testsuite contributions by Andrew Marlow
|
||||
- improved Cygwin and minimal MinGW support
|
||||
- FileChannel: gzip compression if archived files now runs in a background thread (SF #1537481)
|
||||
- POCO now compiles with large (64-bit) file support on Linux (SF #1536634)
|
||||
- added format() function, which provides typesafe sprintf-like functionality (SF #1327621)
|
||||
- added File::isLink()
|
||||
- bugfix: dangling symbolic links in a directory no longer cause recursive remove to fail with file not found error
|
||||
- added Void class (useful as argument to ActiveMethod)
|
||||
- ActiveResult now supports exceptions
|
||||
- bugfix: Timezone::utcOffset() and Timezone::dst() returned wrong values on Unix platforms (SF #1535428)
|
||||
- added ActiveDispatcher class
|
||||
- added ActiveStarter class, which is a policy used by ActiveMethod for starting methods
|
||||
- ActiveRunnable moved to its own header file
|
||||
- ThreadPool: added startWithPriority(), which allows for running threads with a different priority
|
||||
- added error handling to dir sample
|
||||
- added additional test case to HTTPServer test suite- HTMLForm: should now work with request methods other than POST and GET (all non-POST requests are treated the same as GET)
|
||||
- clarified HTMLForm documentation
|
||||
- HTMLForm bugfix: uploaded files no longer end up in value; PartHandler is called instead
|
||||
- NameValueCollection: added get(name, defaultValue)
|
||||
- added HTTPFormServer sample
|
||||
- added Foundation::HashTable and SimpleHashTable
|
||||
- added Net::HTTPSessionFactory
|
||||
- improvements to AutoPtr and SharedPtr
|
||||
- improvements to namespaces handling in XMLWriter
|
||||
- Foundation Cache: fixed add implementation to match the docu: a 2nd add will now simply overwrite existing entries
|
||||
- added DateTime::isValid()
|
||||
- added Exception::rethrow() (virtual, must be overridden by all subclasses)
|
||||
- Timer can now use a user-supplied ThreadPool
|
||||
- added rethrow() to exception classes
|
||||
- Net: made some constructors explicit
|
||||
- Net: added SocketAddress constructor to HTTPClientSession
|
||||
- Net: added HTTPSession::networkException() to check for exceptions swallowed by stream classes
|
||||
- Net: added single string argument constructor to SocketAddress.
|
||||
- Net: improved HTTPClientSession error handling (no more "Invalid HTTP version string" exceptions when the server prematurely closes the connection due to too much load)
|
||||
- Net: improved HTTPSession error handling. Exceptions while sending and receiving data are stored for later retrieval and no longer get lost since streambufs swallow them.
|
||||
- Net: added HTTPLoadTest sample
|
||||
- fixed a bug when opening logfiles on Unix platforms causing an existing logfile to be truncated
|
||||
- bugfix: log file purge intervals given in months did not work, due to a stupid typo
|
||||
- added RawSocket and ICMP classes
|
||||
- UUID: fixed a doc formatting bug
|
||||
- NetworkInterface::list() now includes loopback interface on Windows (SF #1460309)
|
||||
- made Exception::message() and Exception::nested() inline
|
||||
- added Net::UnsupportedRedirectException
|
||||
- HTTPStreamFactory throws an UnsupportedRedirectException if it encounters a redirect to https
|
||||
- HTTP: fixed bad 100 Continue handling in client and server code
|
||||
- added CONTRIBUTORS file
|
||||
|
||||
|
||||
Release 1.1.2 (2006-07-07)
|
||||
==========================
|
||||
|
||||
- Changed license to Boost license
|
||||
- DBlite and NetSSL have been removed from the Boost-licensed release.
|
||||
Please contact Applied Informatics (info@appinf.com) if you're interested in them.
|
||||
|
||||
|
||||
Release 1.1.1 (2006-04-03)
|
||||
==========================
|
||||
|
||||
- NetSSL_OpenSSL now supports separate certificate verification
|
||||
settings for client and server.
|
||||
- fixed SF #1460309 (enumerating network interfaces failed on 64bit Linux)
|
||||
- TCPServer no longer crashes if accept() fails
|
||||
|
||||
|
||||
Release 1.1.0 (2006-03-23)
|
||||
==========================
|
||||
|
||||
- events no longer require awkward += new syntax
|
||||
- source code and documentation cleanups
|
||||
- basic support for new compilers and platforms
|
||||
|
||||
|
||||
Release 1.1b2 (2006-03-04)
|
||||
==========================
|
||||
|
||||
- made NetSSL threadsafe (added locking callbacks for OpenSSL)
|
||||
- improved OpenSSL initialization (random generator seeding)
|
||||
- various changes to improve compatibility with various platforms
|
||||
|
||||
|
||||
Release 1.1b1 (2006-03-03)
|
||||
==========================
|
||||
|
||||
- New Events package in Foundation. The package supports C#-style event handling
|
||||
- New Cache package in Foundation: a templates-based caching framework
|
||||
- added Any class to Foundation
|
||||
- added DBLite library
|
||||
- fixed a memory leak with layered configurations in the application
|
||||
- made POCO_DLL the default (unless POCO_STATIC is #defined)
|
||||
It is no longer necessary to specify POCO_DLL in projects that use Poco
|
||||
(SourceForge Patch #1408231 and Feature Request #1407575).
|
||||
- added Buffer template class to Foundation
|
||||
- added the UnicodeConverter utility class. This is mainly used for Windows Unicode support and probably of little use for anything else.
|
||||
- added Path::resolve()
|
||||
- added Windows Unicode support. This calls the Unicode variant of the Windows API functions.
|
||||
For this to work, all strings must be UTF-8 encoded and POCO_WIN32_UTF8 must be defined in all compilation units.
|
||||
- added StreamCopier::copyToString()
|
||||
- added URIStreamOpener::unregisterStreamFactory() and new variants of URIStreamOpener::open() that also work with filesystem paths.
|
||||
This fixes SourceForge Bug #1409064 and Feature Request #1409062.
|
||||
- added NodeIterator::currentNodeNP() to XML library
|
||||
- added some sanity checks to UTF8Encoding::convert()
|
||||
- added NetSSL - SSL support for Net library, based on OpenSSL
|
||||
- console output of processes launched with Process::launch() is now visible
|
||||
|
||||
|
||||
Release 1.0.0 (2006-01-19)
|
||||
==========================
|
||||
|
||||
- removed unnecessary console output from ProcessTest
|
||||
- documentation fixes
|
||||
|
||||
|
||||
Release 1.0b2 (2006-01-16)
|
||||
==========================
|
||||
|
||||
- added ProcessHandle class
|
||||
- Process::launch() now returns a ProcessHandle instead of a process ID.
|
||||
This fixes a potential problem on Windows with Process::wait() when
|
||||
the process terminates before wait() is called.
|
||||
- added SplitterChannel::close()
|
||||
- added Logger::destroy()
|
||||
- added POP3ClientSession::deleteMessage()
|
||||
- added test for Process::launch()
|
||||
- documentation fixes
|
||||
|
||||
|
||||
Release 1.0b1 (2006-01-09)
|
||||
==========================
|
||||
|
||||
- improved recognition of Windows paths in Path::parseGuess()
|
||||
- added setCurrentLineNumber()/getCurrentLineNumber() to CountingStreamBuf
|
||||
- improvememts to StreamTokenizer and Token; fixed documentation
|
||||
- added a workaround for some strange istream behaviour with VS 2005 and FTPClientSessionTest
|
||||
- improved exception/error reporting in cppunit
|
||||
- added POP3ClientSession
|
||||
- added Process::launch() and Process::wait()
|
||||
- added Mail sample
|
||||
- added MailStream and SMTPClientSession classes
|
||||
- renamed some methods in DialogSocket to make them more general
|
||||
- NullPartHandler has moved out of HTMLForm.cpp into a separate file
|
||||
- Base64Encoder now always writes \r\n line ends
|
||||
- MessageHeader::quote has an optional addition arg controlling the treatment of whitespace
|
||||
- bugfix: MultipartReader had a problem with empty lines (\r\n sequences) in a part
|
||||
- added MailMessage and MailRecipient classes
|
||||
- added text encoding support for Windows-1252 codepage
|
||||
|
||||
|
||||
Release 1.0a1 (2006-01-03) [internal]
|
||||
=====================================
|
||||
|
||||
- mediaType is used consistently to refer to a MIME media type (some occurences of contentType and mimeType have been replaced)
|
||||
- moved MediaType::quote() to MessageHeader and made it public
|
||||
- added MultipartWriter::stream()
|
||||
- Renamed AttachmentSource to PartSource and AttachmentHandler to PartHandler
|
||||
- SIGPIPE is always blocked in main thread on Unix systems
|
||||
- added EchoServer sample
|
||||
- fixed a bug in SocketImpl::setBlocking() - did exactly the opposite (value to ioctl was wrong)
|
||||
- fixed a memory leak in NotificationQueue sample
|
||||
- added comparison operators to Socket so that Sockets can be used as keys in maps
|
||||
- added Socket::setBlocking()
|
||||
- added StreamSocket::connectNB() (non-blocking connect)
|
||||
- added Observer::accepts()
|
||||
- added SocketReactor, SocketConnector and SocketAcceptor classes to support event-based socket programming
|
||||
- NamespacePrefixesStrategy now uses expat's XML_SetReturnNSTriplet().
|
||||
The previously used separate namespace handling code has been removed.
|
||||
This improves performance if NamespacePrefixesStrategy is used (both the n
|
||||
amespaces and namespace-prefixes SAX2 features are used)
|
||||
- upgraded expat to 2.0 pre-release (2005-12-27) snapshot
|
||||
- added TeeInputStream and TeeOutputStream classes
|
||||
- added download sample for URIStreamOpener
|
||||
- renamed registerOpener() to registerFactory() in HTTPStreamFactory and FTPStreamFactory
|
||||
- added LineEndingConverter streams
|
||||
- added FTPClientSession
|
||||
- code and documentation clean-up
|
||||
- added DialogSocket class
|
||||
- reorganized HTTP test suites
|
||||
- added FTPClientSession and FTPStreamFactory
|
||||
- added DialogSocket class
|
||||
|
||||
|
||||
Release 0.96.1 (2005-12-28)
|
||||
===========================
|
||||
|
||||
- fixed a memory leak caused by a bug in Microsoft's stream implementation (see the comment in Foundation/StreamUtil.h for an explanation)
|
||||
- added samples for Net library
|
||||
- added uptime() and startTime() to Util::Application
|
||||
- added DateTimeFormatter::format() for Timespan
|
||||
- added ErrorHandler class and better exception handling for threads
|
||||
- added poco_debugger() and poco_debugger_msg() macros
|
||||
- added project and solution files for Visual Studio 2005 (due to some bugs/leaks in Microsofts standard library - see
|
||||
http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=e08bd793-3fef-40ff-adda-ed313e0eafcc
|
||||
we do not recommend using this for production purposes)
|
||||
- fixed two problems with out-of-range string iterator in Path (the testsuite triggered an assertion in VC++ 8.0)
|
||||
- fixed mac line endings in a few files
|
||||
- added a workaround to the class loader that fixes strange behavior with VC++ 8.0. There seems to be a problem with typeid() not returning a valid typeinfo under certain circumstances.
|
||||
- added buffer allocator argument to buffered stream buffer templates
|
||||
- added buffer pools to HTTP to reduce memory fragmentation and to improve performance
|
||||
- added Net to Windows build.cmd script
|
||||
- added swap() to various classes that already support assignment
|
||||
- added a null pointer check in DOMWriter::writeNode()
|
||||
- fixed documentation in BinaryWriter.h and BinaryReader.h
|
||||
- added explicit support for network byte order to BinaryReader and BinaryWriter
|
||||
- added basic support for FreeBSD (needs more testing)
|
||||
- BinaryReader: renamed readRawData() to readRaw() to be consistent with BinaryWriter::writeRaw()
|
||||
- added support for uppercase output to HexBinaryEncoder.
|
||||
- added MediaType class
|
||||
- added QuotedPrintableEncoder and QuotedPrintableDecoder classes
|
||||
- renamed ObjectFactory to Instantiator. This should prevent the confusion caused by DynamicFactory and ObjectFactory. Sorry for the inconvenience if you are already using this.
|
||||
- AttachmentSource::filename() now returns const string&
|
||||
- added StringAttachmentSource
|
||||
- replaced old-style C casts with C++ casts in NetworkInterface.cpp
|
||||
- MutexImpl (WIN32): replaced InitializeCriticalSection with InitializeCriticalSectionAndSpinCount, which should increase performance on multiprocessor or multicore systems when many locks are used.
|
||||
- fixed a problem with STLport 5.0 when compiling StreamTokenizer
|
||||
- HTTPStreamOpener now also works with no-path URIs (like http://www.appinf.com)
|
||||
- fixed wrong delete usage (plain delete instead of delete [] was used in a few cases)
|
||||
- fixed a handle leak in WinTestRunner
|
||||
|
||||
|
||||
Release 0.95.4 (2005-11-07)
|
||||
===========================
|
||||
|
||||
- fixed #1348006 and #1348005
|
||||
|
||||
|
||||
Release 0.95.3 (2005-10-28) [internal]
|
||||
======================================
|
||||
|
||||
- updated build scripts (patch #1339015)
|
||||
- added support for AMD64 platforms (patch #1339015)
|
||||
- MultipartWriter creates its own boundary if an empty string is passed in as boundary
|
||||
- made MultipartWriter::createBoundary() public
|
||||
- fixed wrong documentation for DateTimeFormat::HTTP_FORMAT
|
||||
- added support for HTTP Basic authentication
|
||||
- added support for HTTP Cookies
|
||||
- added support for HTML forms
|
||||
|
||||
|
||||
Release 0.95.2 (2005-10-22) [internal]
|
||||
======================================
|
||||
|
||||
- fixed a potential problems with streams when close in destructor fails (added try..catch block around close in destructors)
|
||||
- added HTTPServer & friends
|
||||
- added hasIdleThreads() method to NotificationQueue
|
||||
- added TCPServer and friend
|
||||
- added support for HTTP proxies to HTTPClientSession and HTTPStreamOpener
|
||||
- fixed documentation bugs (Mutex.h, ClassLoader.h)
|
||||
|
||||
|
||||
Relesae 0.95.1 (2005-10-15) [internal]
|
||||
======================================
|
||||
|
||||
- Tasks can now throw custom notifications (contributed by Alex Fabijanic)
|
||||
- renamed URIFileStreamFactory to FileStreamFactory
|
||||
- added a few methods to URI (setPathEtc(), getPathEtc(), getPathAndQuery())
|
||||
- added new exception classes
|
||||
- fixed some documentation
|
||||
- added basic checks when reading a MessageHeader from a stream
|
||||
- added HTTP classes (testsuite still incomplete)
|
||||
- added MessageHeader, NameValueCollection, MultipartReader and MultipartWriter classes
|
||||
- added Timespan::useconds()
|
||||
- added ClassLoader::isLibraryLoaded()
|
||||
- Socket classes use Timespan::useconds() to fill struct timeval
|
||||
- added DatagramSocket, MulticastSocket and NetworkInterface classes
|
||||
- added socket classes and related basic stuff
|
||||
- added additonal constructor/assign to Timespan- added BasicBufferedBidirectionalStreamBuf
|
||||
- fixed a potential MT issue in Base64Decoder
|
||||
- code beautifying in [Un]BufferedStreamBuf
|
||||
- more improvements to ClassLoader
|
||||
- code cleanup and naming convention fixes (changed all *Imp classes to *Impl for consistency)
|
||||
|
||||
|
||||
Release 0.94.1 (2005-09-30) [internal]
|
||||
======================================
|
||||
|
||||
- added MetaSingleton (based on a contribution by Alex Fabijanic)
|
||||
- added ClassLoader::create()
|
||||
- added ClassLoader::instance()
|
||||
- code clean-ups in FileChannel and related classes
|
||||
- added SimpleFileChannel
|
||||
- RotateAtTimeStrategy:
|
||||
::getNextRollover() rewritten (buggy)
|
||||
- DateTime
|
||||
microseconds assert corrected
|
||||
asserts in computeGregorian() (except for year - see comment in computeGregorian())
|
||||
milliseconds calculation modified in computeGregorian()
|
||||
microseconds assigned in computeGregorian()
|
||||
normalize() and checkLimit() private functions to correct cases of overflow for milli/microseconds
|
||||
- LocalDateTime: added timestamp() method
|
||||
- FileChannel:
|
||||
added "times" property (used to determine whether to use UTC or local time with RotateAtTimeStrategy)
|
||||
::setProperty() modified (whenever "times" property is set, methods setRotation and setArchive are
|
||||
reinvoked to reflect the change)
|
||||
- FileChannel: added support for archived file compression and archived file purging
|
||||
- FileChannel tests modified
|
||||
- FileChannel: put LogFile, RotateStrategy and ArchiveStrategy into their own files
|
||||
- Message: added thread id field
|
||||
- PatternFormatter: added %I specifier for thread id
|
||||
- ThreadPool: PooledThread can be assigned a name
|
||||
- TaskManager: task name is reflected in thread name
|
||||
- fixed LocalDateTime::operator - (const Timespan&) [#0000004]
|
||||
- upon startup all loggers' channels are set to a console channel
|
||||
- improved search for application configuration files (see loadConfiguration()).
|
||||
- added Glob class (fixes #1249700)
|
||||
- upgraded to zlib 1.2.3 (fixes #1261712)
|
||||
- added Logger::dump()
|
||||
- fixed a wrong condition in Logger::log(const Message&)
|
||||
- Path::find() now also works with relative paths in addition to plain file names
|
||||
- added Path(const Path&, const Path&) constructor
|
||||
- added SharedPtr template
|
||||
- added Path::tryParse()
|
||||
- SAXParser::parse()/EntityResolverImpl now works for both URIs and local filesystem paths (fixes #1254812)
|
||||
|
||||
|
||||
Release 0.93.1 (2005-08-01)
|
||||
===========================
|
||||
|
||||
This release contains various new features, improvements and bugfixes:
|
||||
- bugfix: UUIDGenerator throws an exception if no connected ethernet adapter can
|
||||
be found (and thus no MAC address can be obtained)
|
||||
- added UUIDGenerator::createOne() method
|
||||
- added error handling to UUID sample application
|
||||
- added relational (==, !=, <, <=, >, >=) and arithmetic operators (+, -, +=, -=) to DateTime
|
||||
- added LocalDateTime class
|
||||
- added support for LocalDateTime to DateTimeParser and DateTimeFormatter
|
||||
- added enqueueUrgentNotification() to NotificationQueue
|
||||
- added support for timezone specifiers (%z, %Z) to PatternFormatter
|
||||
- added [] operator and count() to StringTokenizer
|
||||
- added elapsed() and isElapsed() to Timestamp
|
||||
- added tzd() to Timezone
|
||||
- added WinRegistryKey and WinService classes (Windows only)
|
||||
- added index operator and count() to StringTokenizer
|
||||
- added day/time-based log rotation (thanks to Alex Fabijanic), minor improvements to DateTimeParser
|
||||
- support for Mac OS X 10.4/gcc 4.0.0
|
||||
- added NamedMutex and NamedEvent
|
||||
- added Process::kill()
|
||||
- added NoPermissionException
|
||||
- added Task and TaskManager classes
|
||||
- added ServerApplication class
|
||||
- bugfix: EventLogChannel - _logFile was not properly initialized in one constructor
|
||||
- bugfix: File::createDirectories did not work for hierarchies deeper than three
|
||||
- added Util::FilesystemConfiguration
|
||||
- documented logging policy: log() must open channel if it hasn't been opened yet
|
||||
- FileChannel::log() opens channel if necessary
|
||||
- the application reference passed to initialize() and reinitialize() is no longer const
|
||||
- improved application logging initialization
|
||||
- fixed a problem with configuration view and property placeholders
|
||||
- fixed Util build configuration for Visual Studio
|
||||
- improved application samples
|
||||
- fixed documentation for Semaphore class
|
||||
|
||||
|
||||
Release 0.92.1 (2005-05-09)
|
||||
===========================
|
||||
|
||||
This release introduces the Util library that provides support for
|
||||
configuration file parsing (different file formats), command line
|
||||
argument processing, logging configuration and a framework for
|
||||
command line/server applications.
|
||||
There have also been various changes to the Foundation library:
|
||||
- a new RefCountedObject class that acts as a base class for
|
||||
various classes that use reference counting
|
||||
- some missing members have been added to the AutoPtr template
|
||||
- various improvements and bugfixes to the Logging framework, as well as
|
||||
new LoggingFactory and LoggingRegistry classses, and a NullChannel class
|
||||
- the SignalHandler class (Unix platforms only)
|
||||
- ObjectFactory and DynamicFactory template classes
|
||||
- the Path::find method for searching a file in a list of directories
|
||||
- various new Exception classes
|
||||
|
||||
|
||||
Release 0.91.4 (2005-04-11)
|
||||
===========================
|
||||
|
||||
This is mainly a maintenance release that adds support for QNX Neutrino
|
||||
and OpenVMS. There are also minor bugfixes and improvements.
|
||||
|
||||
The Unix build system has been modified to work on QNX Neutrino.
|
||||
The OpenVMS build system has been fixed and works now.
|
||||
Some missing #include's have been added for QNX Neutrino.
|
||||
Foundation/String.h: icompare now supports comparison with const char*;
|
||||
the classic C version of isspace() has been used in a few places instead of the
|
||||
C++ <locale> version, this has been fixed.
|
||||
Foundation/Exception.h: IllegalStateException added.
|
||||
|
||||
|
||||
Release 0.91.3 (2005-03-19)
|
||||
===========================
|
||||
|
||||
This is a maintenance release that adds support for Solaris/Sun Forte C++.
|
||||
No new features have been added.
|
||||
|
||||
An implementation of FPEnvironment for Solaris has been included.
|
||||
All stream classes have been modified to work around an initialization
|
||||
problem that surfaced with Sun's C++ compiler when using STLport.
|
||||
Source-code compatibility with the previous release is not affected. Various
|
||||
minor changes, mostly adding missing #include's for Solaris.
|
||||
|
||||
|
||||
Release 0.91.2 (2005-02-27)
|
||||
===========================
|
||||
|
||||
Minor improvements to the Unix build system. No actual changes in the
|
||||
libraries.
|
||||
|
||||
|
||||
Release 0.91.1 (2005-02-21)
|
||||
===========================
|
||||
|
||||
This is the first public release of the C++ Portable Components.
|
||||
The release does not contain all features planned for the later 1.0 release
|
||||
(the NET library is missing, for example), but is already quite usable.
|
||||
Please refer to the README file for more information and instructions for
|
||||
building the libraries.
|
||||
|
||||
|
||||
--
|
||||
$Id: //poco/1.3/dist/CHANGELOG#12 $
|
13
CONTRIBUTORS
Normal file
13
CONTRIBUTORS
Normal file
@ -0,0 +1,13 @@
|
||||
Guenter Obiltschnig <guenter.obiltschnig@appinf.com>
|
||||
Alex Fabijanic <aleskx@gmail.com>
|
||||
Peter Schojer <peter.schojer@appinf.com>
|
||||
Claus Dabringer <claus.dabringer@appinf.com>
|
||||
Andrew Marlow <public@marlowa.plus.com>
|
||||
Caleb Epstein <caleb.epstein@gmail.com>
|
||||
Andrew J. P. Maclean <a.maclean@optusnet.com.au>
|
||||
Paschal Mushubi <mushubi@sympatico.ca>
|
||||
Sergey N. Yatskevich <snc@begun.ru>
|
||||
Krzysztof Burghardt <burghardt@users.sourceforge.net>
|
||||
|
||||
--
|
||||
$Id: //poco/1.3/dist/CONTRIBUTORS#3 $
|
42
CppUnit/CppUnit_vs71.sln
Normal file
42
CppUnit/CppUnit_vs71.sln
Normal file
@ -0,0 +1,42 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CppUnit", "CppUnit_VS71.vcproj", "{138BB448-808A-4FE5-A66D-78D1F8770F59}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WinTestRunner", "WinTestRunner\WinTestRunner_VS71.vcproj", "{BA620CC4-0E7D-4B9D-88E2-6DBE5C51FCBD}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{138BB448-808A-4FE5-A66D-78D1F8770F59} = {138BB448-808A-4FE5-A66D-78D1F8770F59}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
debug_shared = debug_shared
|
||||
debug_static = debug_static
|
||||
release_shared = release_shared
|
||||
release_static = release_static
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectDependencies) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{138BB448-808A-4FE5-A66D-78D1F8770F59}.debug_shared.ActiveCfg = debug_shared|Win32
|
||||
{138BB448-808A-4FE5-A66D-78D1F8770F59}.debug_shared.Build.0 = debug_shared|Win32
|
||||
{138BB448-808A-4FE5-A66D-78D1F8770F59}.debug_static.ActiveCfg = debug_static|Win32
|
||||
{138BB448-808A-4FE5-A66D-78D1F8770F59}.debug_static.Build.0 = debug_static|Win32
|
||||
{138BB448-808A-4FE5-A66D-78D1F8770F59}.release_shared.ActiveCfg = release_shared|Win32
|
||||
{138BB448-808A-4FE5-A66D-78D1F8770F59}.release_shared.Build.0 = release_shared|Win32
|
||||
{138BB448-808A-4FE5-A66D-78D1F8770F59}.release_static.ActiveCfg = release_static|Win32
|
||||
{138BB448-808A-4FE5-A66D-78D1F8770F59}.release_static.Build.0 = release_static|Win32
|
||||
{BA620CC4-0E7D-4B9D-88E2-6DBE5C51FCBD}.debug_shared.ActiveCfg = debug_shared|Win32
|
||||
{BA620CC4-0E7D-4B9D-88E2-6DBE5C51FCBD}.debug_shared.Build.0 = debug_shared|Win32
|
||||
{BA620CC4-0E7D-4B9D-88E2-6DBE5C51FCBD}.debug_static.ActiveCfg = debug_static|Win32
|
||||
{BA620CC4-0E7D-4B9D-88E2-6DBE5C51FCBD}.debug_static.Build.0 = debug_static|Win32
|
||||
{BA620CC4-0E7D-4B9D-88E2-6DBE5C51FCBD}.release_shared.ActiveCfg = release_shared|Win32
|
||||
{BA620CC4-0E7D-4B9D-88E2-6DBE5C51FCBD}.release_shared.Build.0 = release_shared|Win32
|
||||
{BA620CC4-0E7D-4B9D-88E2-6DBE5C51FCBD}.release_static.ActiveCfg = release_static|Win32
|
||||
{BA620CC4-0E7D-4B9D-88E2-6DBE5C51FCBD}.release_static.Build.0 = release_static|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
396
CppUnit/CppUnit_vs71.vcproj
Normal file
396
CppUnit/CppUnit_vs71.vcproj
Normal file
@ -0,0 +1,396 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="CppUnit"
|
||||
ProjectGUID="{138BB448-808A-4FE5-A66D-78D1F8770F59}"
|
||||
Keyword="MFCProj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="debug_shared|Win32"
|
||||
OutputDirectory=".\obj\debug_shared"
|
||||
IntermediateDirectory=".\obj\debug_shared"
|
||||
ConfigurationType="2"
|
||||
UseOfMFC="2"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
InlineFunctionExpansion="0"
|
||||
EnableIntrinsicFunctions="FALSE"
|
||||
AdditionalIncludeDirectories="include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;CppUnit_EXPORTS"
|
||||
StringPooling="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="TRUE"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
PrecompiledHeaderFile=""
|
||||
AssemblerListingLocation=""
|
||||
ObjectFile="$(IntDir)/"
|
||||
ProgramDataBaseFileName="$(IntDir)/vc70.pdb"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"
|
||||
ShowIncludes="FALSE"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
ShowProgress="0"
|
||||
OutputFile="..\bin\CppUnitd.dll"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories=""
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="..\bin\CppUnitd.pdb"
|
||||
ImportLibrary="..\lib\CppUnitd.lib"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="TRUE"
|
||||
SuppressStartupBanner="TRUE"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\lib/CppUnit.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="3079"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="release_shared|Win32"
|
||||
OutputDirectory=".\obj\release_shared"
|
||||
IntermediateDirectory=".\obj\release_shared"
|
||||
ConfigurationType="2"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="TRUE"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="TRUE"
|
||||
AdditionalIncludeDirectories="include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_AFXDLL;POCO_DLL;CppUnit_EXPORTS"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="FALSE"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
PrecompiledHeaderFile=""
|
||||
AssemblerListingLocation=""
|
||||
ObjectFile="$(IntDir)/"
|
||||
ProgramDataBaseFileName="$(IntDir)/vc70.pdb"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\bin\CppUnit.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories=""
|
||||
ProgramDatabaseFile=""
|
||||
ImportLibrary="..\lib\CppUnit.lib"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="TRUE"
|
||||
SuppressStartupBanner="TRUE"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\lib/CppUnit.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="3079"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="debug_static|Win32"
|
||||
OutputDirectory=".\obj\debug_static"
|
||||
IntermediateDirectory=".\obj\debug_static"
|
||||
ConfigurationType="4"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
InlineFunctionExpansion="0"
|
||||
EnableIntrinsicFunctions="FALSE"
|
||||
AdditionalIncludeDirectories="include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_STATIC"
|
||||
StringPooling="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="TRUE"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
PrecompiledHeaderFile=""
|
||||
AssemblerListingLocation=""
|
||||
ObjectFile="$(IntDir)/"
|
||||
ProgramDataBaseFileName="$(IntDir)/vc70.pdb"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"
|
||||
ShowIncludes="FALSE"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\lib\CppUnitmtd.lib"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="TRUE"
|
||||
SuppressStartupBanner="TRUE"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\lib/CppUnit.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="3079"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="release_static|Win32"
|
||||
OutputDirectory=".\obj\release_static"
|
||||
IntermediateDirectory=".\obj\release_static"
|
||||
ConfigurationType="4"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="TRUE"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="TRUE"
|
||||
AdditionalIncludeDirectories="include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_AFXDLL;POCO_STATIC;CppUnit_EXPORTS"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="FALSE"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
PrecompiledHeaderFile=""
|
||||
AssemblerListingLocation=""
|
||||
ObjectFile="$(IntDir)/"
|
||||
ProgramDataBaseFileName="$(IntDir)/vc70.pdb"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\lib\CppUnitmt.lib"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="TRUE"
|
||||
SuppressStartupBanner="TRUE"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\lib/CppUnit.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="3079"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
|
||||
<File
|
||||
RelativePath=".\src\CppUnitException.cpp">
|
||||
<FileConfiguration
|
||||
Name="debug_shared|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release_shared|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="debug_static|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release_static|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\TestCase.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\TestDecorator.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\TestFailure.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\TestResult.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\TestRunner.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\TestSuite.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\TextTestResult.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Include Files"
|
||||
Filter="*.h">
|
||||
<File
|
||||
RelativePath=".\include\CppUnit\CppUnit.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CppUnit\CppUnitException.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CppUnit\estring.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CppUnit\Guards.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CppUnit\Orthodox.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CppUnit\RepeatedTest.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CppUnit\Test.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CppUnit\TestCaller.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CppUnit\TestCase.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CppUnit\TestDecorator.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CppUnit\TestFailure.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CppUnit\TestResult.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CppUnit\TestRunner.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CppUnit\TestSetup.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CppUnit\TestSuite.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CppUnit\TextTestResult.h">
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
38
CppUnit/CppUnit_vs80.sln
Normal file
38
CppUnit/CppUnit_vs80.sln
Normal file
@ -0,0 +1,38 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CppUnit", "CppUnit_vs80.vcproj", "{138BB448-808A-4FE5-A66D-78D1F8770F59}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WinTestRunner", "WinTestRunner\WinTestRunner_vs80.vcproj", "{BA620CC4-0E7D-4B9D-88E2-6DBE5C51FCBD}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{138BB448-808A-4FE5-A66D-78D1F8770F59} = {138BB448-808A-4FE5-A66D-78D1F8770F59}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
debug_shared|Win32 = debug_shared|Win32
|
||||
debug_static|Win32 = debug_static|Win32
|
||||
release_shared|Win32 = release_shared|Win32
|
||||
release_static|Win32 = release_static|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{138BB448-808A-4FE5-A66D-78D1F8770F59}.debug_shared|Win32.ActiveCfg = debug_shared|Win32
|
||||
{138BB448-808A-4FE5-A66D-78D1F8770F59}.debug_shared|Win32.Build.0 = debug_shared|Win32
|
||||
{138BB448-808A-4FE5-A66D-78D1F8770F59}.debug_static|Win32.ActiveCfg = debug_static|Win32
|
||||
{138BB448-808A-4FE5-A66D-78D1F8770F59}.debug_static|Win32.Build.0 = debug_static|Win32
|
||||
{138BB448-808A-4FE5-A66D-78D1F8770F59}.release_shared|Win32.ActiveCfg = release_shared|Win32
|
||||
{138BB448-808A-4FE5-A66D-78D1F8770F59}.release_shared|Win32.Build.0 = release_shared|Win32
|
||||
{138BB448-808A-4FE5-A66D-78D1F8770F59}.release_static|Win32.ActiveCfg = release_static|Win32
|
||||
{138BB448-808A-4FE5-A66D-78D1F8770F59}.release_static|Win32.Build.0 = release_static|Win32
|
||||
{BA620CC4-0E7D-4B9D-88E2-6DBE5C51FCBD}.debug_shared|Win32.ActiveCfg = debug_shared|Win32
|
||||
{BA620CC4-0E7D-4B9D-88E2-6DBE5C51FCBD}.debug_shared|Win32.Build.0 = debug_shared|Win32
|
||||
{BA620CC4-0E7D-4B9D-88E2-6DBE5C51FCBD}.debug_static|Win32.ActiveCfg = debug_static|Win32
|
||||
{BA620CC4-0E7D-4B9D-88E2-6DBE5C51FCBD}.debug_static|Win32.Build.0 = debug_static|Win32
|
||||
{BA620CC4-0E7D-4B9D-88E2-6DBE5C51FCBD}.release_shared|Win32.ActiveCfg = release_shared|Win32
|
||||
{BA620CC4-0E7D-4B9D-88E2-6DBE5C51FCBD}.release_shared|Win32.Build.0 = release_shared|Win32
|
||||
{BA620CC4-0E7D-4B9D-88E2-6DBE5C51FCBD}.release_static|Win32.ActiveCfg = release_static|Win32
|
||||
{BA620CC4-0E7D-4B9D-88E2-6DBE5C51FCBD}.release_static|Win32.Build.0 = release_static|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
540
CppUnit/CppUnit_vs80.vcproj
Normal file
540
CppUnit/CppUnit_vs80.vcproj
Normal file
@ -0,0 +1,540 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Name="CppUnit"
|
||||
ProjectGUID="{138BB448-808A-4FE5-A66D-78D1F8770F59}"
|
||||
Keyword="MFCProj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="debug_shared|Win32"
|
||||
OutputDirectory=".\obj\debug_shared"
|
||||
IntermediateDirectory=".\obj\debug_shared"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="2"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="true"
|
||||
SuppressStartupBanner="true"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\lib/CppUnit.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
InlineFunctionExpansion="0"
|
||||
EnableIntrinsicFunctions="false"
|
||||
AdditionalIncludeDirectories="include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;CppUnit_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
|
||||
StringPooling="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="true"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
PrecompiledHeaderFile=""
|
||||
AssemblerListingLocation=""
|
||||
ObjectFile="$(IntDir)/"
|
||||
ProgramDataBaseFileName="$(IntDir)/vc80.pdb"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"
|
||||
ShowIncludes="false"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="3079"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
ShowProgress="0"
|
||||
OutputFile="..\bin\CppUnitd.dll"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories=""
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="..\bin\CppUnitd.pdb"
|
||||
ImportLibrary="..\lib\CppUnitd.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="release_shared|Win32"
|
||||
OutputDirectory=".\obj\release_shared"
|
||||
IntermediateDirectory=".\obj\release_shared"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="true"
|
||||
SuppressStartupBanner="true"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\lib/CppUnit.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories="include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_AFXDLL;POCO_DLL;CppUnit_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="false"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
PrecompiledHeaderFile=""
|
||||
AssemblerListingLocation=""
|
||||
ObjectFile="$(IntDir)/"
|
||||
ProgramDataBaseFileName="$(IntDir)/vc70.pdb"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="3079"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\bin\CppUnit.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories=""
|
||||
ProgramDatabaseFile=""
|
||||
ImportLibrary="..\lib\CppUnit.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="debug_static|Win32"
|
||||
OutputDirectory=".\obj\debug_static"
|
||||
IntermediateDirectory=".\obj\debug_static"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="2"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="true"
|
||||
SuppressStartupBanner="true"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\lib/CppUnit.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
InlineFunctionExpansion="0"
|
||||
EnableIntrinsicFunctions="false"
|
||||
AdditionalIncludeDirectories="include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_STATIC;_CRT_SECURE_NO_DEPRECATE"
|
||||
StringPooling="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="true"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
PrecompiledHeaderFile=""
|
||||
AssemblerListingLocation=""
|
||||
ObjectFile="$(IntDir)/"
|
||||
ProgramDataBaseFileName="$(IntDir)/vc80.pdb"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"
|
||||
ShowIncludes="false"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="3079"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\lib\CppUnitmtd.lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="release_static|Win32"
|
||||
OutputDirectory=".\obj\release_static"
|
||||
IntermediateDirectory=".\obj\release_static"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="true"
|
||||
SuppressStartupBanner="true"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\lib/CppUnit.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories="include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_AFXDLL;POCO_STATIC;_CRT_SECURE_NO_DEPRECATE"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="false"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
PrecompiledHeaderFile=""
|
||||
AssemblerListingLocation=""
|
||||
ObjectFile="$(IntDir)/"
|
||||
ProgramDataBaseFileName="$(IntDir)/vc70.pdb"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="3079"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\lib\CppUnitmt.lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\CppUnitException.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="debug_shared|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release_shared|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="debug_static|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release_static|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\TestCase.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\TestDecorator.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\TestFailure.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\TestResult.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\TestRunner.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\TestSuite.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\TextTestResult.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Include Files"
|
||||
Filter="*.h"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\include\CppUnit\CppUnit.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CppUnit\CppUnitException.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CppUnit\estring.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CppUnit\Guards.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CppUnit\Orthodox.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CppUnit\RepeatedTest.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CppUnit\Test.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CppUnit\TestCaller.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CppUnit\TestCase.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CppUnit\TestDecorator.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CppUnit\TestFailure.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CppUnit\TestResult.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CppUnit\TestRunner.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CppUnit\TestSetup.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CppUnit\TestSuite.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CppUnit\TextTestResult.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
18
CppUnit/Makefile
Normal file
18
CppUnit/Makefile
Normal file
@ -0,0 +1,18 @@
|
||||
#
|
||||
# Makefile
|
||||
#
|
||||
# $Id: //poco/1.3/CppUnit/Makefile#1 $
|
||||
#
|
||||
# Makefile for Poco CppUnit
|
||||
#
|
||||
|
||||
include $(POCO_BASE)/build/rules/global
|
||||
|
||||
objects = CppUnitException TestDecorator TestResult TestSuite \
|
||||
TestCase TestFailure TestRunner TextTestResult
|
||||
|
||||
target = CppUnit
|
||||
target_version = 1
|
||||
target_libs =
|
||||
|
||||
include $(POCO_BASE)/build/rules/lib
|
346
CppUnit/WinTestRunner/WinTestRunner_vs71.vcproj
Normal file
346
CppUnit/WinTestRunner/WinTestRunner_vs71.vcproj
Normal file
@ -0,0 +1,346 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="WinTestRunner"
|
||||
ProjectGUID="{BA620CC4-0E7D-4B9D-88E2-6DBE5C51FCBD}"
|
||||
Keyword="MFCProj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="release_shared|Win32"
|
||||
OutputDirectory=".\obj\release_shared"
|
||||
IntermediateDirectory=".\obj\release_shared"
|
||||
ConfigurationType="2"
|
||||
UseOfMFC="2"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="TRUE"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="TRUE"
|
||||
AdditionalIncludeDirectories="include;..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WinTestRunner_EXPORTS;WINVER=0x0500"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="FALSE"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
PrecompiledHeaderFile=""
|
||||
AssemblerListingLocation=""
|
||||
ObjectFile="$(IntDir)\"
|
||||
ProgramDataBaseFileName="$(IntDir)/vc70.pdb"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="cppunit.lib winmm.lib"
|
||||
OutputFile="..\..\bin\WinTestRunner.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\..\lib"
|
||||
ProgramDatabaseFile=""
|
||||
SubSystem="2"
|
||||
ImportLibrary="..\..\lib\WinTestRunner.lib"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="TRUE"
|
||||
SuppressStartupBanner="TRUE"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\lib\wintestrunner.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="3079"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="debug_shared|Win32"
|
||||
OutputDirectory=".\obj\debug_shared"
|
||||
IntermediateDirectory=".\obj\debug_shared"
|
||||
ConfigurationType="2"
|
||||
UseOfMFC="2"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
InlineFunctionExpansion="0"
|
||||
EnableIntrinsicFunctions="FALSE"
|
||||
AdditionalIncludeDirectories="include;..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WinTestRunner_EXPORTS;WINVER=0x0500"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="TRUE"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
PrecompiledHeaderFile=""
|
||||
AssemblerListingLocation=""
|
||||
ObjectFile="$(IntDir)\"
|
||||
ProgramDataBaseFileName="$(IntDir)\vc70.pdb"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"
|
||||
ShowIncludes="FALSE"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="cppunitd.lib winmm.lib"
|
||||
ShowProgress="0"
|
||||
OutputFile="..\..\bin\WinTestRunnerd.dll"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\..\lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="..\..\bin\WinTestRunnerd.pdb"
|
||||
SubSystem="2"
|
||||
ImportLibrary="..\..\lib\WinTestRunnerd.lib"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="TRUE"
|
||||
SuppressStartupBanner="TRUE"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\lib\wintestrunner.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="3079"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="debug_static|Win32"
|
||||
OutputDirectory=".\obj\debug_static"
|
||||
IntermediateDirectory=".\obj\debug_static"
|
||||
ConfigurationType="4"
|
||||
UseOfMFC="2"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
InlineFunctionExpansion="0"
|
||||
EnableIntrinsicFunctions="FALSE"
|
||||
AdditionalIncludeDirectories="include;..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_STATIC;WINVER=0x0500"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="TRUE"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
PrecompiledHeaderFile=""
|
||||
AssemblerListingLocation=""
|
||||
ObjectFile="$(IntDir)\"
|
||||
ProgramDataBaseFileName="$(IntDir)\vc70.pdb"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"
|
||||
ShowIncludes="FALSE"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\..\lib\WinTestRunnermtd.lib"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="TRUE"
|
||||
SuppressStartupBanner="TRUE"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\lib\wintestrunner.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="3079"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="release_static|Win32"
|
||||
OutputDirectory=".\obj\release_static"
|
||||
IntermediateDirectory=".\obj\release_static"
|
||||
ConfigurationType="4"
|
||||
UseOfMFC="2"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="TRUE"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="TRUE"
|
||||
AdditionalIncludeDirectories="include;..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_STATIC;WINVER=0x0500"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="FALSE"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
PrecompiledHeaderFile=""
|
||||
AssemblerListingLocation=""
|
||||
ObjectFile="$(IntDir)\"
|
||||
ProgramDataBaseFileName="$(IntDir)/vc70.pdb"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\..\lib\WinTestRunnermt.lib"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="TRUE"
|
||||
SuppressStartupBanner="TRUE"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\lib\wintestrunner.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="3079"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
|
||||
<File
|
||||
RelativePath="src\ActiveTest.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\DLLMain.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\GUITestResult.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\ProgressBar.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\TestRunnerDlg.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\WinTestRunner.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Include Files"
|
||||
Filter="*.h">
|
||||
<File
|
||||
RelativePath=".\src\ActiveTest.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\GUITestResult.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ProgressBar.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\TestRunnerDlg.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\WinTestRunner\WinTestRunner.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\res\Resource.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\res\WinTestRunner.rc">
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
<Global
|
||||
Name="RESOURCE_FILE"
|
||||
Value="TestRunner.rc"/>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
472
CppUnit/WinTestRunner/WinTestRunner_vs80.vcproj
Normal file
472
CppUnit/WinTestRunner/WinTestRunner_vs80.vcproj
Normal file
@ -0,0 +1,472 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Name="WinTestRunner"
|
||||
ProjectGUID="{BA620CC4-0E7D-4B9D-88E2-6DBE5C51FCBD}"
|
||||
Keyword="MFCProj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="release_shared|Win32"
|
||||
OutputDirectory=".\obj\release_shared"
|
||||
IntermediateDirectory=".\obj\release_shared"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="2"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="true"
|
||||
SuppressStartupBanner="true"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\lib\wintestrunner.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories="include;..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;WinTestRunner_EXPORTS;WINVER=0x0500;_CRT_SECURE_NO_DEPRECATE"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="false"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
PrecompiledHeaderFile=""
|
||||
AssemblerListingLocation=""
|
||||
ObjectFile="$(IntDir)\"
|
||||
ProgramDataBaseFileName="$(IntDir)/vc70.pdb"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="3079"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="cppunit.lib winmm.lib"
|
||||
OutputFile="..\..\bin\WinTestRunner.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="..\..\lib"
|
||||
ProgramDatabaseFile=""
|
||||
SubSystem="2"
|
||||
ImportLibrary="..\..\lib\WinTestRunner.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="debug_shared|Win32"
|
||||
OutputDirectory=".\obj\debug_shared"
|
||||
IntermediateDirectory=".\obj\debug_shared"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="2"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="true"
|
||||
SuppressStartupBanner="true"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\lib\wintestrunner.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
InlineFunctionExpansion="0"
|
||||
EnableIntrinsicFunctions="false"
|
||||
AdditionalIncludeDirectories="include;..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;WinTestRunner_EXPORTS;WINVER=0x0500;_CRT_SECURE_NO_DEPRECATE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="true"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
PrecompiledHeaderFile=""
|
||||
AssemblerListingLocation=""
|
||||
ObjectFile="$(IntDir)\"
|
||||
ProgramDataBaseFileName="$(IntDir)\vc70.pdb"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"
|
||||
ShowIncludes="false"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="3079"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="cppunitd.lib winmm.lib"
|
||||
ShowProgress="0"
|
||||
OutputFile="..\..\bin\WinTestRunnerd.dll"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="..\..\lib"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="..\..\bin\WinTestRunnerd.pdb"
|
||||
SubSystem="2"
|
||||
ImportLibrary="..\..\lib\WinTestRunnerd.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="debug_static|Win32"
|
||||
OutputDirectory=".\obj\debug_static"
|
||||
IntermediateDirectory=".\obj\debug_static"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="2"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="true"
|
||||
SuppressStartupBanner="true"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\lib\wintestrunner.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
InlineFunctionExpansion="0"
|
||||
EnableIntrinsicFunctions="false"
|
||||
AdditionalIncludeDirectories="include;..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_STATIC;WINVER=0x0500;_CRT_SECURE_NO_DEPRECATE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="true"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
PrecompiledHeaderFile=""
|
||||
AssemblerListingLocation=""
|
||||
ObjectFile="$(IntDir)\"
|
||||
ProgramDataBaseFileName="$(IntDir)\vc70.pdb"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"
|
||||
ShowIncludes="false"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="3079"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\..\lib\WinTestRunnermtd.lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="release_static|Win32"
|
||||
OutputDirectory=".\obj\release_static"
|
||||
IntermediateDirectory=".\obj\release_static"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="2"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="true"
|
||||
SuppressStartupBanner="true"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\lib\wintestrunner.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories="include;..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_STATIC;WINVER=0x0500;_CRT_SECURE_NO_DEPRECATE"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="false"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
PrecompiledHeaderFile=""
|
||||
AssemblerListingLocation=""
|
||||
ObjectFile="$(IntDir)\"
|
||||
ProgramDataBaseFileName="$(IntDir)/vc70.pdb"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="3079"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\..\lib\WinTestRunnermt.lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
>
|
||||
<File
|
||||
RelativePath="src\ActiveTest.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\DLLMain.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\GUITestResult.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\ProgressBar.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="src\TestRunnerDlg.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\WinTestRunner.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Include Files"
|
||||
Filter="*.h"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\ActiveTest.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\GUITestResult.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ProgressBar.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\TestRunnerDlg.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\WinTestRunner\WinTestRunner.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\res\Resource.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\res\WinTestRunner.rc"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
<Global
|
||||
Name="RESOURCE_FILE"
|
||||
Value="TestRunner.rc"
|
||||
/>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
67
CppUnit/WinTestRunner/include/WinTestRunner/WinTestRunner.h
Normal file
67
CppUnit/WinTestRunner/include/WinTestRunner/WinTestRunner.h
Normal file
@ -0,0 +1,67 @@
|
||||
//
|
||||
// WinTestRunner.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/WinTestRunner/include/WinTestRunner/WinTestRunner.h#2 $
|
||||
//
|
||||
// Application shell for CppUnit's TestRunner dialog.
|
||||
//
|
||||
|
||||
|
||||
#ifndef WinTestRunner_H_INCLUDED
|
||||
#define WinTestRunner_H_INCLUDED
|
||||
|
||||
|
||||
#if !defined(POCO_STATIC)
|
||||
#if defined(WinTestRunner_EXPORTS)
|
||||
#define WinTestRunner_API __declspec(dllexport)
|
||||
#else
|
||||
#define WinTestRunner_API __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
#define WinTestRunner_API
|
||||
#endif
|
||||
|
||||
|
||||
#include "CppUnit/CppUnit.h"
|
||||
#include <vector>
|
||||
#include <afxwin.h>
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
class Test;
|
||||
|
||||
|
||||
class WinTestRunner_API WinTestRunner
|
||||
{
|
||||
public:
|
||||
WinTestRunner();
|
||||
~WinTestRunner();
|
||||
|
||||
void run();
|
||||
void addTest(Test* pTest);
|
||||
|
||||
private:
|
||||
std::vector<Test*> _tests;
|
||||
};
|
||||
|
||||
|
||||
class WinTestRunner_API WinTestRunnerApp: public CWinApp
|
||||
/// A simple application class that hosts the TestRunner dialog.
|
||||
/// Create a subclass and override the TestMain() method.
|
||||
{
|
||||
public:
|
||||
virtual BOOL InitInstance();
|
||||
|
||||
virtual void TestMain() = 0;
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
|
||||
} // namespace CppUnit
|
||||
|
||||
|
||||
#endif // WinTestRunner_H_INCLUDED
|
||||
|
27
CppUnit/WinTestRunner/res/Resource.h
Normal file
27
CppUnit/WinTestRunner/res/Resource.h
Normal file
@ -0,0 +1,27 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by TestRunner.rc
|
||||
//
|
||||
#define IDD_DIALOG_TESTRUNNER 129
|
||||
#define IDC_LIST 1000
|
||||
#define ID_RUN 1001
|
||||
#define ID_STOP 1002
|
||||
#define IDC_PROGRESS 1003
|
||||
#define IDC_INDICATOR 1004
|
||||
#define IDC_COMBO_TEST 1005
|
||||
#define IDC_STATIC_RUNS 1007
|
||||
#define IDC_STATIC_ERRORS 1008
|
||||
#define IDC_STATIC_FAILURES 1009
|
||||
#define IDC_EDIT_TIME 1010
|
||||
#define IDC_CHK_AUTORUN 1013
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 131
|
||||
#define _APS_NEXT_COMMAND_VALUE 32771
|
||||
#define _APS_NEXT_CONTROL_VALUE 1014
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
175
CppUnit/WinTestRunner/res/WinTestRunner.rc
Normal file
175
CppUnit/WinTestRunner/res/WinTestRunner.rc
Normal file
@ -0,0 +1,175 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
|
||||
"#define _AFX_NO_OLE_RESOURCES\r\n"
|
||||
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
|
||||
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
|
||||
"\r\n"
|
||||
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
|
||||
"#ifdef _WIN32\r\n"
|
||||
"LANGUAGE 9, 1\r\n"
|
||||
"#pragma code_page(1252)\r\n"
|
||||
"#endif\r\n"
|
||||
"#include ""..\\res\\WinTestRunner.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
|
||||
"#include ""afxres.rc"" // Standard components\r\n"
|
||||
"#endif\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,0,1
|
||||
PRODUCTVERSION 1,0,0,1
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "FileDescription", "CppUnit WinTestRunner DLL"
|
||||
VALUE "FileVersion", "1, 0, 0, 1"
|
||||
VALUE "InternalName", "WinTestRunner"
|
||||
VALUE "LegalCopyright", "Copyright (c) 2005"
|
||||
VALUE "OriginalFilename", "TestRunner.dll"
|
||||
VALUE "ProductName", "CppUnit WinTestRunner Dynamic Link Library"
|
||||
VALUE "ProductVersion", "1, 0, 0, 1"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_DIALOG_TESTRUNNER DIALOGEX 0, 0, 512, 300
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "CppUnit WinTestRunner"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x0
|
||||
BEGIN
|
||||
COMBOBOX IDC_COMBO_TEST,7,20,424,273,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
DEFPUSHBUTTON "Run",ID_RUN,455,7,50,14
|
||||
DEFPUSHBUTTON "Stop",ID_STOP,455,24,50,14
|
||||
CONTROL "List1",IDC_LIST,"SysListView32",LVS_REPORT | WS_BORDER |
|
||||
WS_TABSTOP,7,110,498,160
|
||||
PUSHBUTTON "Close",IDOK,455,279,50,14
|
||||
LTEXT "Test Name:",IDC_STATIC,7,9,179,9
|
||||
LTEXT "Progress:",IDC_STATIC,7,55,49,9
|
||||
LTEXT "Errors and Failures:",IDC_STATIC,7,99,67,9
|
||||
LTEXT "Runs:",IDC_STATIC,457,54,26,10
|
||||
LTEXT "Failures:",IDC_STATIC,457,80,26,10
|
||||
LTEXT "Errors:",IDC_STATIC,457,67,26,10
|
||||
RTEXT "0",IDC_STATIC_RUNS,487,54,16,10
|
||||
RTEXT "0",IDC_STATIC_ERRORS,487,67,16,10
|
||||
RTEXT "0",IDC_STATIC_FAILURES,487,80,16,10
|
||||
EDITTEXT IDC_EDIT_TIME,7,281,440,12,ES_AUTOHSCROLL | ES_READONLY |
|
||||
NOT WS_BORDER
|
||||
LTEXT "",IDC_PROGRESS,7,67,424,20,SS_SUNKEN | NOT WS_VISIBLE
|
||||
CONTROL "Auto Run",IDC_CHK_AUTORUN,"Button",BS_AUTOCHECKBOX |
|
||||
BS_LEFTTEXT | WS_TABSTOP,383,38,46,10
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO
|
||||
BEGIN
|
||||
IDD_DIALOG_TESTRUNNER, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 505
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 293
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
#define _AFX_NO_SPLITTER_RESOURCES
|
||||
#define _AFX_NO_OLE_RESOURCES
|
||||
#define _AFX_NO_TRACKER_RESOURCES
|
||||
#define _AFX_NO_PROPERTY_RESOURCES
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE 9, 1
|
||||
#pragma code_page(1252)
|
||||
#endif
|
||||
#include "afxres.rc" // Standard components
|
||||
#endif
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
44
CppUnit/WinTestRunner/src/ActiveTest.cpp
Normal file
44
CppUnit/WinTestRunner/src/ActiveTest.cpp
Normal file
@ -0,0 +1,44 @@
|
||||
//
|
||||
// ActiveTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/WinTestRunner/src/ActiveTest.cpp#1 $
|
||||
//
|
||||
|
||||
|
||||
#include <afxwin.h>
|
||||
#include "ActiveTest.h"
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
// Spawn a thread to a test
|
||||
void ActiveTest::run(TestResult* result)
|
||||
{
|
||||
CWinThread* thread;
|
||||
|
||||
setTestResult(result);
|
||||
_runCompleted.ResetEvent();
|
||||
|
||||
thread = AfxBeginThread(threadFunction, this, THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED);
|
||||
DuplicateHandle(GetCurrentProcess(), thread->m_hThread, GetCurrentProcess(), &_threadHandle, 0, FALSE, DUPLICATE_SAME_ACCESS);
|
||||
|
||||
thread->ResumeThread();
|
||||
}
|
||||
|
||||
|
||||
// Simple execution thread. Assuming that an ActiveTest instance
|
||||
// only creates one of these at a time.
|
||||
UINT ActiveTest::threadFunction(LPVOID thisInstance)
|
||||
{
|
||||
ActiveTest* test = (ActiveTest*) thisInstance;
|
||||
|
||||
test->run();
|
||||
test->_runCompleted.SetEvent();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
} // namespace CppUnit
|
||||
|
89
CppUnit/WinTestRunner/src/ActiveTest.h
Normal file
89
CppUnit/WinTestRunner/src/ActiveTest.h
Normal file
@ -0,0 +1,89 @@
|
||||
//
|
||||
// ActiveTest.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/WinTestRunner/src/ActiveTest.h#1 $
|
||||
//
|
||||
|
||||
|
||||
#ifndef ActiveTest_INCLUDED
|
||||
#define ActiveTest_INCLUDED
|
||||
|
||||
|
||||
#include "CppUnit/CppUnit.h"
|
||||
#include "CppUnit/TestDecorator.h"
|
||||
#include <afxmt.h>
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
/* A Microsoft-specific active test
|
||||
*
|
||||
* An active test manages its own
|
||||
* thread of execution. This one
|
||||
* is very simple and only sufficient
|
||||
* for the limited use we put it through
|
||||
* in the TestRunner. It spawns a thread
|
||||
* on run (TestResult *) and signals
|
||||
* completion of the test.
|
||||
*
|
||||
* We assume that only one thread
|
||||
* will be active at once for each
|
||||
* instance.
|
||||
*
|
||||
*/
|
||||
class ActiveTest: public TestDecorator
|
||||
{
|
||||
public:
|
||||
ActiveTest(Test* test);
|
||||
~ActiveTest();
|
||||
|
||||
void run(TestResult* result);
|
||||
|
||||
protected:
|
||||
HANDLE _threadHandle;
|
||||
CEvent _runCompleted;
|
||||
TestResult* _currentTestResult;
|
||||
|
||||
void run ();
|
||||
void setTestResult(TestResult* result);
|
||||
static UINT threadFunction(LPVOID thisInstance);
|
||||
};
|
||||
|
||||
|
||||
// Construct the active test
|
||||
inline ActiveTest::ActiveTest(Test *test): TestDecorator(test)
|
||||
{
|
||||
_currentTestResult = NULL;
|
||||
_threadHandle = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
|
||||
// Pend until the test has completed
|
||||
inline ActiveTest::~ActiveTest()
|
||||
{
|
||||
CSingleLock(&_runCompleted, TRUE);
|
||||
CloseHandle(_threadHandle);
|
||||
}
|
||||
|
||||
|
||||
// Set the test result that we are to run
|
||||
inline void ActiveTest::setTestResult(TestResult* result)
|
||||
{
|
||||
_currentTestResult = result;
|
||||
}
|
||||
|
||||
|
||||
// Run our test result
|
||||
inline void ActiveTest::run()
|
||||
{
|
||||
TestDecorator::run(_currentTestResult);
|
||||
}
|
||||
|
||||
|
||||
} // namespace CppUnit
|
||||
|
||||
|
||||
#endif // ActiveTest_INCLUDED
|
||||
|
||||
|
50
CppUnit/WinTestRunner/src/DLLMain.cpp
Normal file
50
CppUnit/WinTestRunner/src/DLLMain.cpp
Normal file
@ -0,0 +1,50 @@
|
||||
//
|
||||
// DLLMain.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/WinTestRunner/src/DLLMain.cpp#1 $
|
||||
//
|
||||
|
||||
|
||||
#include <afxwin.h>
|
||||
#include <afxdllx.h>
|
||||
|
||||
|
||||
static AFX_EXTENSION_MODULE TestRunnerDLL = { NULL, NULL };
|
||||
|
||||
|
||||
extern "C" int APIENTRY
|
||||
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
|
||||
{
|
||||
// Remove this if you use lpReserved
|
||||
UNREFERENCED_PARAMETER(lpReserved);
|
||||
|
||||
if (dwReason == DLL_PROCESS_ATTACH)
|
||||
{
|
||||
TRACE0("WinTestRunner.DLL Initializing\n");
|
||||
|
||||
// Extension DLL one-time initialization
|
||||
if (!AfxInitExtensionModule(TestRunnerDLL, hInstance))
|
||||
return 0;
|
||||
|
||||
// Insert this DLL into the resource chain
|
||||
// NOTE: If this Extension DLL is being implicitly linked to by
|
||||
// an MFC Regular DLL (such as an ActiveX Control)
|
||||
// instead of an MFC application, then you will want to
|
||||
// remove this line from DllMain and put it in a separate
|
||||
// function exported from this Extension DLL. The Regular DLL
|
||||
// that uses this Extension DLL should then explicitly call that
|
||||
// function to initialize this Extension DLL. Otherwise,
|
||||
// the CDynLinkLibrary object will not be attached to the
|
||||
// Regular DLL's resource chain, and serious problems will
|
||||
// result.
|
||||
|
||||
new CDynLinkLibrary(TestRunnerDLL);
|
||||
}
|
||||
else if (dwReason == DLL_PROCESS_DETACH)
|
||||
{
|
||||
TRACE0("WinTestRunner.DLL Terminating\n");
|
||||
// Terminate the library before destructors are called
|
||||
AfxTermExtensionModule(TestRunnerDLL);
|
||||
}
|
||||
return 1; // ok
|
||||
}
|
52
CppUnit/WinTestRunner/src/GUITestResult.cpp
Normal file
52
CppUnit/WinTestRunner/src/GUITestResult.cpp
Normal file
@ -0,0 +1,52 @@
|
||||
//
|
||||
// GUITestResult.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/WinTestRunner/src/GUITestResult.cpp#2 $
|
||||
//
|
||||
|
||||
|
||||
#include "TestRunnerDlg.h"
|
||||
#include "GUITestResult.h"
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
void GUITestResult::addError(Test *test, CppUnitException *e)
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
|
||||
TestResult::addError(test, e);
|
||||
_runner->addError(this, test, e);
|
||||
}
|
||||
|
||||
|
||||
void GUITestResult::addFailure(Test *test, CppUnitException *e)
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
|
||||
TestResult::addFailure(test, e);
|
||||
_runner->addFailure(this, test, e);
|
||||
}
|
||||
|
||||
|
||||
void GUITestResult::startTest(Test *test)
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
|
||||
TestResult::startTest(test);
|
||||
_runner->startTest(test);
|
||||
}
|
||||
|
||||
|
||||
void GUITestResult::endTest(Test *test)
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
|
||||
TestResult::endTest(test);
|
||||
_runner->endTest(this, test);
|
||||
}
|
||||
|
||||
|
||||
} // namespace CppUnit
|
||||
|
83
CppUnit/WinTestRunner/src/GUITestResult.h
Normal file
83
CppUnit/WinTestRunner/src/GUITestResult.h
Normal file
@ -0,0 +1,83 @@
|
||||
//
|
||||
// GUITestResult.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/WinTestRunner/src/GUITestResult.h#2 $
|
||||
//
|
||||
|
||||
|
||||
#ifndef GuiTestResult_INCLUDED
|
||||
#define GuiTestResult_INCLUDED
|
||||
|
||||
|
||||
#include "CppUnit/CppUnit.h"
|
||||
#include "CppUnit/TestResult.h"
|
||||
#include <afxmt.h>
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
class TestRunnerDlg;
|
||||
|
||||
|
||||
class GUITestResult: public TestResult
|
||||
{
|
||||
public:
|
||||
GUITestResult(TestRunnerDlg* runner);
|
||||
~GUITestResult();
|
||||
|
||||
void addError(Test* test, CppUnitException* e);
|
||||
void addFailure(Test* test, CppUnitException* e);
|
||||
|
||||
void startTest(Test* test);
|
||||
void endTest(Test* test);
|
||||
void stop();
|
||||
|
||||
protected:
|
||||
class LightweightSynchronizationObject: public TestResult::SynchronizationObject
|
||||
{
|
||||
public:
|
||||
void lock()
|
||||
{
|
||||
_syncObject.Lock();
|
||||
}
|
||||
|
||||
void unlock()
|
||||
{
|
||||
_syncObject.Unlock();
|
||||
}
|
||||
|
||||
private:
|
||||
CCriticalSection _syncObject;
|
||||
};
|
||||
|
||||
private:
|
||||
TestRunnerDlg *_runner;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Construct with lightweight synchronization
|
||||
inline GUITestResult::GUITestResult(TestRunnerDlg* runner): _runner(runner)
|
||||
{
|
||||
setSynchronizationObject(new LightweightSynchronizationObject());
|
||||
}
|
||||
|
||||
|
||||
// Destructor
|
||||
inline GUITestResult::~GUITestResult()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// Override without protection to prevent deadlock
|
||||
inline void GUITestResult::stop()
|
||||
{
|
||||
_stop = true;
|
||||
}
|
||||
|
||||
|
||||
} // namespace CppUnit
|
||||
|
||||
|
||||
#endif // GuiTestResult_INCLUDED
|
140
CppUnit/WinTestRunner/src/ProgressBar.cpp
Normal file
140
CppUnit/WinTestRunner/src/ProgressBar.cpp
Normal file
@ -0,0 +1,140 @@
|
||||
//
|
||||
// ProgressBar.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/WinTestRunner/src/ProgressBar.cpp#1 $
|
||||
//
|
||||
|
||||
|
||||
#include "ProgressBar.h"
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
// Paint the progress bar in response to a paint message
|
||||
void ProgressBar::paint(CDC& dc)
|
||||
{
|
||||
paintBackground (dc);
|
||||
paintStatus (dc);
|
||||
}
|
||||
|
||||
|
||||
// Paint the background of the progress bar region
|
||||
void ProgressBar::paintBackground (CDC& dc)
|
||||
{
|
||||
CBrush brshBackground;
|
||||
CPen penGray (PS_SOLID, 1, RGB (128, 128, 128));
|
||||
CPen penWhite (PS_SOLID, 1, RGB (255, 255, 255));
|
||||
|
||||
VERIFY (brshBackground.CreateSolidBrush (::GetSysColor (COLOR_BTNFACE)));
|
||||
|
||||
dc.FillRect (_bounds, &brshBackground);
|
||||
|
||||
CPen *pOldPen;
|
||||
|
||||
pOldPen = dc.SelectObject (&penGray);
|
||||
{
|
||||
dc.MoveTo (_bounds.left, _bounds.top);
|
||||
dc.LineTo (_bounds.left + _bounds.Width () -1, _bounds.top);
|
||||
|
||||
dc.MoveTo (_bounds.left, _bounds.top);
|
||||
dc.LineTo (_bounds.left, _bounds.top + _bounds.Height () -1);
|
||||
|
||||
}
|
||||
dc.SelectObject (&penWhite);
|
||||
{
|
||||
dc.MoveTo (_bounds.left + _bounds.Width () -1, _bounds.top);
|
||||
dc.LineTo (_bounds.left + _bounds.Width () -1, _bounds.top + _bounds.Height () -1);
|
||||
|
||||
dc.MoveTo (_bounds.left, _bounds.top + _bounds.Height () -1);
|
||||
dc.LineTo (_bounds.left + _bounds.Width () -1, _bounds.top + _bounds.Height () -1);
|
||||
|
||||
}
|
||||
dc.SelectObject (pOldPen);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Paint the actual status of the progress bar
|
||||
void ProgressBar::paintStatus (CDC& dc)
|
||||
{
|
||||
if (_progress <= 0)
|
||||
return;
|
||||
|
||||
CBrush brshStatus;
|
||||
CRect rect (_bounds.left, _bounds.top,
|
||||
_bounds.left + _progressX, _bounds.bottom);
|
||||
|
||||
COLORREF statusColor = getStatusColor ();
|
||||
|
||||
VERIFY (brshStatus.CreateSolidBrush (statusColor));
|
||||
|
||||
rect.DeflateRect (1, 1);
|
||||
dc.FillRect (rect, &brshStatus);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Paint the current step
|
||||
void ProgressBar::paintStep (int startX, int endX)
|
||||
{
|
||||
// kludge: painting the whole region on each step
|
||||
_baseWindow->RedrawWindow (_bounds);
|
||||
_baseWindow->UpdateWindow ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Setup the progress bar for execution over a total number of steps
|
||||
void ProgressBar::start (int total)
|
||||
{
|
||||
_total = total;
|
||||
reset ();
|
||||
}
|
||||
|
||||
|
||||
// Take one step, indicating whether it was a successful step
|
||||
void ProgressBar::step (bool successful)
|
||||
{
|
||||
_progress++;
|
||||
|
||||
int x = _progressX;
|
||||
|
||||
_progressX = scale (_progress);
|
||||
|
||||
if (!_error && !successful)
|
||||
{
|
||||
_error = true;
|
||||
x = 1;
|
||||
}
|
||||
|
||||
paintStep (x, _progressX);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Map from steps to display units
|
||||
int ProgressBar::scale (int value)
|
||||
{
|
||||
if (_total > 0)
|
||||
return max (1, value * (_bounds.Width () - 1) / _total);
|
||||
|
||||
return value;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Reset the progress bar
|
||||
void ProgressBar::reset ()
|
||||
{
|
||||
_progressX = 1;
|
||||
_progress = 0;
|
||||
_error = false;
|
||||
|
||||
_baseWindow->RedrawWindow (_bounds);
|
||||
_baseWindow->UpdateWindow ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
} // namespace CppUnit
|
74
CppUnit/WinTestRunner/src/ProgressBar.h
Normal file
74
CppUnit/WinTestRunner/src/ProgressBar.h
Normal file
@ -0,0 +1,74 @@
|
||||
//
|
||||
// ProgressBar.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/WinTestRunner/src/ProgressBar.h#1 $
|
||||
//
|
||||
|
||||
|
||||
#ifndef ProgressBar_INCLUDED
|
||||
#define ProgressBar_INCLUDED
|
||||
|
||||
|
||||
#include "CppUnit/CppUnit.h"
|
||||
#include <afxwin.h>
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
/* A Simple ProgressBar for test execution display
|
||||
*/
|
||||
class ProgressBar
|
||||
{
|
||||
public:
|
||||
ProgressBar(CWnd* baseWindow, CRect& bounds);
|
||||
|
||||
void step(bool successful);
|
||||
void paint(CDC& dc);
|
||||
int scale(int value);
|
||||
void reset();
|
||||
void start(int total);
|
||||
|
||||
protected:
|
||||
void paintBackground(CDC& dc);
|
||||
void paintStatus(CDC& dc);
|
||||
COLORREF getStatusColor();
|
||||
void paintStep(int startX, int endX);
|
||||
|
||||
CWnd* _baseWindow;
|
||||
CRect _bounds;
|
||||
|
||||
bool _error;
|
||||
int _total;
|
||||
int _progress;
|
||||
int _progressX;
|
||||
};
|
||||
|
||||
|
||||
// Construct a ProgressBar
|
||||
inline ProgressBar::ProgressBar(CWnd* baseWindow, CRect& bounds):
|
||||
_baseWindow(baseWindow),
|
||||
_bounds(bounds),
|
||||
_error(false),
|
||||
_total(0),
|
||||
_progress(0),
|
||||
_progressX(0)
|
||||
{
|
||||
WINDOWINFO wi;
|
||||
wi.cbSize = sizeof(WINDOWINFO);
|
||||
baseWindow->GetWindowInfo(&wi);
|
||||
_bounds.OffsetRect(-wi.rcClient.left, -wi.rcClient.top);
|
||||
}
|
||||
|
||||
|
||||
// Get the current color
|
||||
inline COLORREF ProgressBar::getStatusColor()
|
||||
{
|
||||
return _error ? RGB(255, 0, 0) : RGB(0, 255, 0);
|
||||
}
|
||||
|
||||
|
||||
} // namespace CppUnit
|
||||
|
||||
|
||||
#endif // ProgressBar_INCLUDED
|
106
CppUnit/WinTestRunner/src/SynchronizedTestResult.h
Normal file
106
CppUnit/WinTestRunner/src/SynchronizedTestResult.h
Normal file
@ -0,0 +1,106 @@
|
||||
#ifndef SYNCHRONIZEDTESTRESULTDECORATOR_H
|
||||
#define SYNCHRONIZEDTESTRESULTDECORATOR_H
|
||||
|
||||
#include <afxmt.h>
|
||||
#include "TestResultDecorator.h"
|
||||
|
||||
class SynchronizedTestResult : public TestResultDecorator
|
||||
{
|
||||
public:
|
||||
SynchronizedTestResult (TestResult *result);
|
||||
~SynchronizedTestResult ();
|
||||
|
||||
|
||||
bool shouldStop ();
|
||||
void addError (Test *test, CppUnitException *e);
|
||||
void addFailure (Test *test, CppUnitException *e);
|
||||
void startTest (Test *test);
|
||||
void endTest (Test *test);
|
||||
int runTests ();
|
||||
int testErrors ();
|
||||
int testFailures ();
|
||||
bool wasSuccessful ();
|
||||
void stop ();
|
||||
|
||||
vector<TestFailure *>& errors ();
|
||||
vector<TestFailure *>& failures ();
|
||||
|
||||
private:
|
||||
CCriticalSection m_criticalSection;
|
||||
|
||||
};
|
||||
|
||||
|
||||
// Constructor
|
||||
inline SynchronizedTestResult::SynchronizedTestResult (TestResult *result)
|
||||
: TestResultDecorator (result) {}
|
||||
|
||||
// Destructor
|
||||
inline SynchronizedTestResult::~SynchronizedTestResult ()
|
||||
{}
|
||||
|
||||
// Returns whether the test should stop
|
||||
inline bool SynchronizedTestResult::shouldStop ()
|
||||
{ CSingleLock sync (&m_criticalSection, TRUE); return m_result->shouldStop (); }
|
||||
|
||||
|
||||
// Adds an error to the list of errors. The passed in exception
|
||||
// caused the error
|
||||
inline void SynchronizedTestResult::addError (Test *test, CppUnitException *e)
|
||||
{ CSingleLock sync (&m_criticalSection, TRUE); m_result->addError (test, e); }
|
||||
|
||||
|
||||
// Adds a failure to the list of failures. The passed in exception
|
||||
// caused the failure.
|
||||
inline void SynchronizedTestResult::addFailure (Test *test, CppUnitException *e)
|
||||
{ CSingleLock sync (&m_criticalSection, TRUE); m_result->addFailure (test, e); }
|
||||
|
||||
|
||||
// Informs the result that a test will be started.
|
||||
inline void SynchronizedTestResult::startTest (Test *test)
|
||||
{ CSingleLock sync (&m_criticalSection, TRUE); m_result->startTest (test); }
|
||||
|
||||
|
||||
// Informs the result that a test was completed.
|
||||
inline void SynchronizedTestResult::endTest (Test *test)
|
||||
{ CSingleLock sync (&m_criticalSection, TRUE); m_result->endTest (test); }
|
||||
|
||||
|
||||
// Gets the number of run tests.
|
||||
inline int SynchronizedTestResult::runTests ()
|
||||
{ CSingleLock sync (&m_criticalSection, TRUE); return m_result->runTests (); }
|
||||
|
||||
|
||||
// Gets the number of detected errors.
|
||||
inline int SynchronizedTestResult::testErrors ()
|
||||
{ CSingleLock sync (&m_criticalSection, TRUE); return m_result->testErrors (); }
|
||||
|
||||
|
||||
// Gets the number of detected failures.
|
||||
inline int SynchronizedTestResult::testFailures ()
|
||||
{ CSingleLock sync (&m_criticalSection, TRUE); return m_result->testFailures (); }
|
||||
|
||||
|
||||
// Returns whether the entire test was successful or not.
|
||||
inline bool SynchronizedTestResult::wasSuccessful ()
|
||||
{ CSingleLock sync (&m_criticalSection, TRUE); return m_result->wasSuccessful (); }
|
||||
|
||||
|
||||
// Marks that the test run should stop.
|
||||
inline void SynchronizedTestResult::stop ()
|
||||
{ CSingleLock sync (&m_criticalSection, TRUE); m_result->stop (); }
|
||||
|
||||
|
||||
// Returns a vector of the errors.
|
||||
inline vector<TestFailure *>& SynchronizedTestResult::errors ()
|
||||
{ CSingleLock sync (&m_criticalSection, TRUE); return m_result->errors (); }
|
||||
|
||||
|
||||
// Returns a vector of the failures.
|
||||
inline vector<TestFailure *>& SynchronizedTestResult::failures ()
|
||||
{ CSingleLock sync (&m_criticalSection, TRUE); return m_result->failures (); }
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
102
CppUnit/WinTestRunner/src/TestResultDecorator.h
Normal file
102
CppUnit/WinTestRunner/src/TestResultDecorator.h
Normal file
@ -0,0 +1,102 @@
|
||||
#ifndef CPP_UNIT_TESTRESULTDECORATOR_H
|
||||
#define CPP_UNIT_TESTRESULTDECORATOR_H
|
||||
|
||||
#include "TestResult.h"
|
||||
|
||||
class TestResultDecorator
|
||||
{
|
||||
public:
|
||||
TestResultDecorator (TestResult *result);
|
||||
virtual ~TestResultDecorator ();
|
||||
|
||||
|
||||
virtual bool shouldStop ();
|
||||
virtual void addError (Test *test, CppUnitException *e);
|
||||
virtual void addFailure (Test *test, CppUnitException *e);
|
||||
virtual void startTest (Test *test);
|
||||
virtual void endTest (Test *test);
|
||||
virtual int runTests ();
|
||||
virtual int testErrors ();
|
||||
virtual int testFailures ();
|
||||
virtual bool wasSuccessful ();
|
||||
virtual void stop ();
|
||||
|
||||
vector<TestFailure *>& errors ();
|
||||
vector<TestFailure *>& failures ();
|
||||
|
||||
protected:
|
||||
TestResult *m_result;
|
||||
};
|
||||
|
||||
|
||||
inline TestResultDecorator::TestResultDecorator (TestResult *result)
|
||||
: m_result (result) {}
|
||||
|
||||
inline TestResultDecorator::~TestResultDecorator ()
|
||||
{}
|
||||
|
||||
// Returns whether the test should stop
|
||||
inline bool TestResultDecorator::shouldStop ()
|
||||
{ return m_result->shouldStop (); }
|
||||
|
||||
|
||||
// Adds an error to the list of errors. The passed in exception
|
||||
// caused the error
|
||||
inline void TestResultDecorator::addError (Test *test, CppUnitException *e)
|
||||
{ m_result->addError (test, e); }
|
||||
|
||||
|
||||
// Adds a failure to the list of failures. The passed in exception
|
||||
// caused the failure.
|
||||
inline void TestResultDecorator::addFailure (Test *test, CppUnitException *e)
|
||||
{ m_result->addFailure (test, e); }
|
||||
|
||||
|
||||
// Informs the result that a test will be started.
|
||||
inline void TestResultDecorator::startTest (Test *test)
|
||||
{ m_result->startTest (test); }
|
||||
|
||||
|
||||
// Informs the result that a test was completed.
|
||||
inline void TestResultDecorator::endTest (Test *test)
|
||||
{ m_result->endTest (test); }
|
||||
|
||||
|
||||
// Gets the number of run tests.
|
||||
inline int TestResultDecorator::runTests ()
|
||||
{ return m_result->runTests (); }
|
||||
|
||||
|
||||
// Gets the number of detected errors.
|
||||
inline int TestResultDecorator::testErrors ()
|
||||
{ return m_result->testErrors (); }
|
||||
|
||||
|
||||
// Gets the number of detected failures.
|
||||
inline int TestResultDecorator::testFailures ()
|
||||
{ return m_result->testFailures (); }
|
||||
|
||||
|
||||
// Returns whether the entire test was successful or not.
|
||||
inline bool TestResultDecorator::wasSuccessful ()
|
||||
{ return m_result->wasSuccessful (); }
|
||||
|
||||
|
||||
// Marks that the test run should stop.
|
||||
inline void TestResultDecorator::stop ()
|
||||
{ m_result->stop (); }
|
||||
|
||||
|
||||
// Returns a vector of the errors.
|
||||
inline vector<TestFailure *>& TestResultDecorator::errors ()
|
||||
{ return m_result->errors (); }
|
||||
|
||||
|
||||
// Returns a vector of the failures.
|
||||
inline vector<TestFailure *>& TestResultDecorator::failures ()
|
||||
{ return m_result->failures (); }
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
439
CppUnit/WinTestRunner/src/TestRunnerDlg.cpp
Normal file
439
CppUnit/WinTestRunner/src/TestRunnerDlg.cpp
Normal file
@ -0,0 +1,439 @@
|
||||
//
|
||||
// TestRunnerDlg.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/WinTestRunner/src/TestRunnerDlg.cpp#2 $
|
||||
//
|
||||
|
||||
|
||||
#include <afxwin.h>
|
||||
#include <afxext.h>
|
||||
#include <afxcmn.h>
|
||||
#include <mmsystem.h>
|
||||
#include "TestRunnerDlg.h"
|
||||
#include "ActiveTest.h"
|
||||
#include "GUITestResult.h"
|
||||
#include "ProgressBar.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "TestRunnerDlg.h"
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
TestRunnerDlg::TestRunnerDlg(CWnd* pParent): CDialog(TestRunnerDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(TestRunnerDlg)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
|
||||
_testsProgress = 0;
|
||||
_selectedTest = 0;
|
||||
_currentTest = 0;
|
||||
}
|
||||
|
||||
|
||||
void TestRunnerDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(TestRunnerDlg)
|
||||
// NOTE: the ClassWizard will add DDX and DDV calls here
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(TestRunnerDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(TestRunnerDlg)
|
||||
ON_BN_CLICKED(ID_RUN, OnRun)
|
||||
ON_BN_CLICKED(ID_STOP, OnStop)
|
||||
ON_CBN_SELCHANGE(IDC_COMBO_TEST, OnSelchangeComboTest)
|
||||
ON_BN_CLICKED(IDC_CHK_AUTORUN, OnBnClickedAutorun)
|
||||
ON_WM_PAINT()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
BOOL TestRunnerDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
CListCtrl *listCtrl = (CListCtrl *)GetDlgItem (IDC_LIST);
|
||||
CComboBox *comboBox = (CComboBox *)GetDlgItem (IDC_COMBO_TEST);
|
||||
|
||||
ASSERT (listCtrl);
|
||||
ASSERT (comboBox);
|
||||
|
||||
CString title;
|
||||
GetWindowText(title);
|
||||
#if defined(_DEBUG)
|
||||
title.Append(" [debug]");
|
||||
#else
|
||||
title.Append(" [release]");
|
||||
#endif
|
||||
SetWindowText(title);
|
||||
|
||||
listCtrl->InsertColumn (0,"Type", LVCFMT_LEFT, 16 + listCtrl->GetStringWidth ("Type"), 1);
|
||||
listCtrl->InsertColumn (1,"Name", LVCFMT_LEFT, 16 * listCtrl->GetStringWidth ("X"), 2);
|
||||
listCtrl->InsertColumn (2,"Failed Condition", LVCFMT_LEFT, 24 * listCtrl->GetStringWidth ("M"), 3);
|
||||
listCtrl->InsertColumn (3,"Line", LVCFMT_LEFT, 16 + listCtrl->GetStringWidth ("0000"), 4);
|
||||
listCtrl->InsertColumn (4,"File Name", LVCFMT_LEFT, 36 * listCtrl->GetStringWidth ("M"), 5);
|
||||
|
||||
int numberOfCases = 0;
|
||||
|
||||
CWinApp* pApp = AfxGetApp();
|
||||
CString lastTestCS = pApp->GetProfileString("Tests", "lastTest");
|
||||
std::string lastTest((LPCSTR) lastTestCS);
|
||||
int sel = -1;
|
||||
for (std::vector<TestInfo>::iterator it = _tests.begin (); it != _tests.end (); ++it)
|
||||
{
|
||||
std::string cbName(it->level*4, ' ');
|
||||
cbName.append(it->pTest->toString());
|
||||
comboBox->AddString (cbName.c_str ());
|
||||
if (sel < 0)
|
||||
{
|
||||
if (lastTest.empty() || lastTest == it->pTest->toString())
|
||||
{
|
||||
_selectedTest = it->pTest;
|
||||
sel = numberOfCases;
|
||||
}
|
||||
}
|
||||
numberOfCases++;
|
||||
}
|
||||
|
||||
if (numberOfCases > 0)
|
||||
{
|
||||
if (sel < 0)
|
||||
{
|
||||
_selectedTest = _tests[0].pTest;
|
||||
sel = 0;
|
||||
}
|
||||
comboBox->SetCurSel (sel);
|
||||
}
|
||||
else
|
||||
{
|
||||
beRunDisabled ();
|
||||
}
|
||||
CWnd *pProgress = GetDlgItem(IDC_PROGRESS);
|
||||
CRect rect;
|
||||
pProgress->GetWindowRect(&rect);
|
||||
_testsProgress = new ProgressBar (this, rect);
|
||||
|
||||
CButton* autoRunBtn = (CButton*) GetDlgItem(IDC_CHK_AUTORUN);
|
||||
autoRunBtn->SetCheck(pApp->GetProfileInt("Tests", "autoRun", BST_UNCHECKED));
|
||||
|
||||
reset ();
|
||||
|
||||
if (autoRunBtn->GetCheck() == BST_CHECKED)
|
||||
{
|
||||
OnRun();
|
||||
}
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
|
||||
TestRunnerDlg::~TestRunnerDlg ()
|
||||
{
|
||||
freeState ();
|
||||
delete _testsProgress;
|
||||
}
|
||||
|
||||
|
||||
void TestRunnerDlg::OnRun()
|
||||
{
|
||||
if (_selectedTest == 0)
|
||||
return;
|
||||
|
||||
freeState ();
|
||||
reset ();
|
||||
|
||||
beRunning ();
|
||||
|
||||
int numberOfTests = _selectedTest->countTestCases ();
|
||||
|
||||
_testsProgress->start (numberOfTests);
|
||||
|
||||
_result = new GUITestResult ((TestRunnerDlg *)this);
|
||||
_activeTest = new ActiveTest (_selectedTest);
|
||||
|
||||
_testStartTime = timeGetTime ();
|
||||
|
||||
_activeTest->run (_result);
|
||||
|
||||
_testEndTime = timeGetTime ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void TestRunnerDlg::addListEntry(const std::string& type, TestResult *result, Test *test, CppUnitException *e)
|
||||
{
|
||||
char stage [80];
|
||||
LV_ITEM lvi;
|
||||
CListCtrl *listCtrl = (CListCtrl *)GetDlgItem (IDC_LIST);
|
||||
int currentEntry = result->testErrors () + result->testFailures () -1;
|
||||
|
||||
sprintf (stage, "%s", type.c_str ());
|
||||
|
||||
lvi.mask = LVIF_TEXT;
|
||||
lvi.iItem = currentEntry;
|
||||
lvi.iSubItem = 0;
|
||||
lvi.pszText = stage;
|
||||
lvi.iImage = 0;
|
||||
lvi.stateMask = 0;
|
||||
lvi.state = 0;
|
||||
|
||||
listCtrl->InsertItem (&lvi);
|
||||
|
||||
// Set class string
|
||||
listCtrl->SetItemText (currentEntry, 1, test->toString ().c_str ());
|
||||
|
||||
// Set the asserted text
|
||||
listCtrl->SetItemText(currentEntry, 2, e->what ());
|
||||
|
||||
// Set the line number
|
||||
if (e->lineNumber () == CppUnitException::CPPUNIT_UNKNOWNLINENUMBER)
|
||||
sprintf (stage, "<unknown>");
|
||||
else
|
||||
sprintf (stage, "%ld", e->lineNumber ());
|
||||
|
||||
listCtrl->SetItemText(currentEntry, 3, stage);
|
||||
|
||||
// Set the file name
|
||||
listCtrl->SetItemText(currentEntry, 4, e->fileName ().c_str ());
|
||||
|
||||
listCtrl->RedrawItems (currentEntry, currentEntry);
|
||||
listCtrl->UpdateWindow ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void TestRunnerDlg::addError (TestResult *result, Test *test, CppUnitException *e)
|
||||
{
|
||||
addListEntry ("Error", result, test, e);
|
||||
_errors++;
|
||||
|
||||
_currentTest = 0;
|
||||
updateCountsDisplay ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void TestRunnerDlg::addFailure (TestResult *result, Test *test, CppUnitException *e)
|
||||
{
|
||||
addListEntry ("Failure", result, test, e);
|
||||
_failures++;
|
||||
|
||||
_currentTest = 0;
|
||||
updateCountsDisplay ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void TestRunnerDlg::startTest(Test* test)
|
||||
{
|
||||
_currentTest = test;
|
||||
updateCountsDisplay();
|
||||
}
|
||||
|
||||
|
||||
void TestRunnerDlg::endTest (TestResult *result, Test *test)
|
||||
{
|
||||
if (_selectedTest == 0)
|
||||
return;
|
||||
_currentTest = 0;
|
||||
|
||||
_testsRun++;
|
||||
updateCountsDisplay ();
|
||||
_testsProgress->step (_failures == 0 && _errors == 0);
|
||||
|
||||
_testEndTime = timeGetTime ();
|
||||
|
||||
updateCountsDisplay ();
|
||||
|
||||
if (_testsRun >= _selectedTest->countTestCases ())
|
||||
beIdle ();
|
||||
}
|
||||
|
||||
|
||||
void TestRunnerDlg::beRunning ()
|
||||
{
|
||||
CButton *runButton = (CButton *)GetDlgItem (ID_RUN);
|
||||
CButton *closeButton = (CButton *)GetDlgItem (IDOK);
|
||||
|
||||
runButton->EnableWindow (FALSE);
|
||||
closeButton->EnableWindow (FALSE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void TestRunnerDlg::beIdle ()
|
||||
{
|
||||
CButton *runButton = (CButton *)GetDlgItem (ID_RUN);
|
||||
CButton *closeButton = (CButton *)GetDlgItem (IDOK);
|
||||
|
||||
runButton->EnableWindow (TRUE);
|
||||
closeButton->EnableWindow (TRUE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void TestRunnerDlg::beRunDisabled ()
|
||||
{
|
||||
CButton *runButton = (CButton *)GetDlgItem (ID_RUN);
|
||||
CButton *closeButton = (CButton *)GetDlgItem (IDOK);
|
||||
CButton *stopButton = (CButton *)GetDlgItem (ID_STOP);
|
||||
|
||||
runButton->EnableWindow (FALSE);
|
||||
stopButton->EnableWindow (FALSE);
|
||||
closeButton->EnableWindow (TRUE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void TestRunnerDlg::freeState ()
|
||||
{
|
||||
delete _activeTest;
|
||||
delete _result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void TestRunnerDlg::reset ()
|
||||
{
|
||||
_testsRun = 0;
|
||||
_errors = 0;
|
||||
_failures = 0;
|
||||
_testEndTime = _testStartTime;
|
||||
|
||||
updateCountsDisplay ();
|
||||
|
||||
_activeTest = 0;
|
||||
_result = 0;
|
||||
|
||||
CListCtrl *listCtrl = (CListCtrl *)GetDlgItem (IDC_LIST);
|
||||
|
||||
listCtrl->DeleteAllItems ();
|
||||
_testsProgress->reset ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void TestRunnerDlg::updateCountsDisplay ()
|
||||
{
|
||||
CStatic *statTestsRun = (CStatic *)GetDlgItem (IDC_STATIC_RUNS);
|
||||
CStatic *statErrors = (CStatic *)GetDlgItem (IDC_STATIC_ERRORS);
|
||||
CStatic *statFailures = (CStatic *)GetDlgItem (IDC_STATIC_FAILURES);
|
||||
CEdit *editTime = (CEdit *)GetDlgItem (IDC_EDIT_TIME);
|
||||
|
||||
CString argumentString;
|
||||
|
||||
argumentString.Format ("%d", _testsRun);
|
||||
statTestsRun ->SetWindowText (argumentString);
|
||||
|
||||
argumentString.Format ("%d", _errors);
|
||||
statErrors ->SetWindowText (argumentString);
|
||||
|
||||
argumentString.Format ("%d", _failures);
|
||||
statFailures ->SetWindowText (argumentString);
|
||||
|
||||
if (_currentTest)
|
||||
argumentString.Format ("Execution Time: %3.3lf seconds, Current Test: %s", (_testEndTime - _testStartTime) / 1000.0, _currentTest->toString().c_str());
|
||||
else
|
||||
argumentString.Format ("Execution Time: %3.3lf seconds", (_testEndTime - _testStartTime) / 1000.0);
|
||||
|
||||
editTime ->SetWindowText (argumentString);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void TestRunnerDlg::OnStop()
|
||||
{
|
||||
if (_result)
|
||||
_result->stop ();
|
||||
|
||||
beIdle ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void TestRunnerDlg::OnOK()
|
||||
{
|
||||
if (_result)
|
||||
_result->stop ();
|
||||
|
||||
CDialog::OnOK ();
|
||||
}
|
||||
|
||||
|
||||
void TestRunnerDlg::OnSelchangeComboTest()
|
||||
{
|
||||
CComboBox *testsSelection = (CComboBox *)GetDlgItem (IDC_COMBO_TEST);
|
||||
|
||||
int currentSelection = testsSelection->GetCurSel ();
|
||||
|
||||
if (currentSelection >= 0 && currentSelection < _tests.size ())
|
||||
{
|
||||
_selectedTest = (_tests.begin () + currentSelection)->pTest;
|
||||
beIdle ();
|
||||
CWinApp* pApp = AfxGetApp();
|
||||
pApp->WriteProfileString("Tests", "lastTest", _selectedTest->toString().c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
_selectedTest = 0;
|
||||
beRunDisabled ();
|
||||
|
||||
}
|
||||
|
||||
freeState ();
|
||||
reset ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void TestRunnerDlg::OnBnClickedAutorun()
|
||||
{
|
||||
CButton *autoRunBtn = (CButton *)GetDlgItem (IDC_CHK_AUTORUN);
|
||||
CWinApp* pApp = AfxGetApp();
|
||||
pApp->WriteProfileInt("Tests", "autoRun", autoRunBtn->GetCheck());
|
||||
}
|
||||
|
||||
|
||||
void TestRunnerDlg::OnPaint()
|
||||
{
|
||||
CPaintDC dc (this);
|
||||
|
||||
_testsProgress->paint (dc);
|
||||
}
|
||||
|
||||
|
||||
void TestRunnerDlg::setTests(const std::vector<Test*>& tests)
|
||||
{
|
||||
_tests.clear();
|
||||
for (std::vector<Test*>::const_iterator it = tests.begin(); it != tests.end(); ++it)
|
||||
{
|
||||
addTest(*it, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TestRunnerDlg::addTest(Test* pTest, int level)
|
||||
{
|
||||
TestInfo ti;
|
||||
ti.pTest = pTest;
|
||||
ti.level = level;
|
||||
_tests.push_back(ti);
|
||||
TestSuite* pSuite = dynamic_cast<TestSuite*>(pTest);
|
||||
if (pSuite)
|
||||
{
|
||||
const std::vector<Test*>& tests = pSuite->tests();
|
||||
for (std::vector<Test*>::const_iterator it = tests.begin(); it != tests.end(); ++it)
|
||||
{
|
||||
addTest(*it, level + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace CppUnit
|
94
CppUnit/WinTestRunner/src/TestRunnerDlg.h
Normal file
94
CppUnit/WinTestRunner/src/TestRunnerDlg.h
Normal file
@ -0,0 +1,94 @@
|
||||
//
|
||||
// TestRunnerDlg.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/WinTestRunner/src/TestRunnerDlg.h#2 $
|
||||
//
|
||||
|
||||
|
||||
#ifndef TestRunnerDlg_INCLUDED
|
||||
#define TestRunnerDlg_INCLUDED
|
||||
|
||||
|
||||
#include "CppUnit/CppUnit.h"
|
||||
#include "CppUnit/CppUnitException.h"
|
||||
#include "ActiveTest.h"
|
||||
#include <vector>
|
||||
#include "../res/Resource.h"
|
||||
#include <afxwin.h>
|
||||
#include "afxwin.h"
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
class ProgressBar;
|
||||
|
||||
|
||||
class TestRunnerDlg: public CDialog
|
||||
{
|
||||
public:
|
||||
TestRunnerDlg(CWnd* pParent = NULL);
|
||||
~TestRunnerDlg();
|
||||
|
||||
void setTests(const std::vector<Test*>& tests);
|
||||
|
||||
void addError(TestResult* result, Test* test, CppUnitException* e);
|
||||
void addFailure(TestResult* result, Test* test, CppUnitException* e);
|
||||
void startTest(Test* test);
|
||||
void endTest(TestResult* result, Test* test);
|
||||
|
||||
//{{AFX_DATA(TestRunnerDlg)
|
||||
enum { IDD = IDD_DIALOG_TESTRUNNER };
|
||||
// NOTE: the ClassWizard will add data members here
|
||||
//}}AFX_DATA
|
||||
|
||||
//{{AFX_VIRTUAL(TestRunnerDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
protected:
|
||||
//{{AFX_MSG(TestRunnerDlg)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnRun();
|
||||
afx_msg void OnStop();
|
||||
virtual void OnOK();
|
||||
afx_msg void OnSelchangeComboTest();
|
||||
afx_msg void OnBnClickedAutorun();
|
||||
afx_msg void OnPaint();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
void addListEntry(const std::string& type, TestResult* result, Test* test, CppUnitException* e);
|
||||
void beIdle();
|
||||
void beRunning();
|
||||
void beRunDisabled();
|
||||
void reset();
|
||||
void freeState();
|
||||
void updateCountsDisplay();
|
||||
void addTest(Test* pTest, int level);
|
||||
|
||||
struct TestInfo
|
||||
{
|
||||
Test* pTest;
|
||||
int level;
|
||||
};
|
||||
std::vector<TestInfo> _tests;
|
||||
ProgressBar* _testsProgress;
|
||||
Test* _selectedTest;
|
||||
ActiveTest* _activeTest;
|
||||
TestResult* _result;
|
||||
int _testsRun;
|
||||
int _errors;
|
||||
int _failures;
|
||||
DWORD _testStartTime;
|
||||
DWORD _testEndTime;
|
||||
Test* _currentTest;
|
||||
};
|
||||
|
||||
|
||||
} // namespace CppUnit
|
||||
|
||||
|
||||
#endif // TestRunnerDlg_INCLUDED
|
||||
|
64
CppUnit/WinTestRunner/src/WinTestRunner.cpp
Normal file
64
CppUnit/WinTestRunner/src/WinTestRunner.cpp
Normal file
@ -0,0 +1,64 @@
|
||||
//
|
||||
// WinTestRunner.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/WinTestRunner/src/WinTestRunner.cpp#1 $
|
||||
//
|
||||
|
||||
|
||||
#include "WinTestRunner/WinTestRunner.h"
|
||||
#include "TestRunnerDlg.h"
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
WinTestRunner::WinTestRunner()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
WinTestRunner::~WinTestRunner()
|
||||
{
|
||||
for (std::vector<Test*>::iterator it = _tests.begin(); it != _tests.end(); ++it)
|
||||
delete *it;
|
||||
}
|
||||
|
||||
|
||||
void WinTestRunner::run()
|
||||
{
|
||||
TestRunnerDlg dlg;
|
||||
|
||||
dlg.setTests(_tests);
|
||||
dlg.DoModal();
|
||||
}
|
||||
|
||||
|
||||
void WinTestRunner::addTest(Test* pTest)
|
||||
{
|
||||
_tests.push_back(pTest);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(WinTestRunnerApp, CWinApp)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
BOOL WinTestRunnerApp::InitInstance()
|
||||
{
|
||||
AllocConsole();
|
||||
SetConsoleTitle("CppUnit WinTestRunner Console");
|
||||
freopen("CONOUT$", "w", stdout);
|
||||
freopen("CONOUT$", "w", stderr);
|
||||
freopen("CONIN$", "r", stdin);
|
||||
TestMain();
|
||||
FreeConsole();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
void WinTestRunnerApp::TestMain()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
} // namespace CppUnit
|
14
CppUnit/cppunit.vmsbuild
Normal file
14
CppUnit/cppunit.vmsbuild
Normal file
@ -0,0 +1,14 @@
|
||||
#
|
||||
# buildfiles.vms
|
||||
#
|
||||
# $Id: //poco/CppUnit/cppunit.vmsbuild#1 $
|
||||
#
|
||||
LIB=CppUnit
|
||||
CppUnitException
|
||||
TestCase
|
||||
TestDecorator
|
||||
TestFailure
|
||||
TestResult
|
||||
TestRunner
|
||||
TestSuite
|
||||
TextTestResult
|
75
CppUnit/doc/README.html
Normal file
75
CppUnit/doc/README.html
Normal file
@ -0,0 +1,75 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
|
||||
<META NAME="Generator" CONTENT="Microsoft Word 97">
|
||||
<TITLE>CppUnit 1.5</TITLE>
|
||||
<META NAME="Template" CONTENT="C:\Program Files\MSOffice\Office\html.dot">
|
||||
</HEAD>
|
||||
<BODY LINK="#0000ff" VLINK="#800080">
|
||||
|
||||
<P><!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"></P>
|
||||
<H1>CppUnit 1.5</H1>
|
||||
<P>Last Revision: 12/15/99 - Michael Feathers (mfeathers@acm.org) - written in standard C++, tested under Microsoft Visual C++ 6.0</P>
|
||||
<P><HR></P>
|
||||
<H3>Background</H3>
|
||||
<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
|
||||
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 under test
|
||||
doc documentation</PRE>
|
||||
<H3>Installation</H3>
|
||||
<P>To use the test framework, create a makefile or load all files in test\framework into your IDE. In this incarnation of CppUnit, all includes assume the current directory first. A makefile or project can be used to resolve the dependencies. </P>
|
||||
<P>The directory test\textui contains a simple command line example that uses the framework.</P>
|
||||
<H3>Documentation</H3>
|
||||
<P>CppUnit comes with the following documentation: </P>
|
||||
|
||||
<UL>
|
||||
<LI>a cookbook: doc\cookbook.htm </LI>
|
||||
<LI>this file </LI></UL>
|
||||
|
||||
<H3>Samples</H3>
|
||||
<P>You can find several sample test cases in the samples directory: </P>
|
||||
|
||||
<UL>
|
||||
<LI>ExampleTestCase - some simple tests </LI>
|
||||
<LI>Multicaster - test cases for a sample publish/subscribe multicaster class </LI></UL>
|
||||
|
||||
<P>Also, the wiki page <a HREF="http://c2.com/cgi/wiki?ClassHierarchyTestingInCppUnit">http://c2.com/cgi/wiki?ClassHierarchyTestingInCppUnit</a> shows how to automatically apply tests of classes to the classes' subclasses.</P>
|
||||
|
||||
<H3>Extensions</H3>
|
||||
<P>You can find several classes that illustrate framework extensions in the extensions directory: </P>
|
||||
|
||||
<UL>
|
||||
<LI>TestDecorator - A Decorator for Test. You can use it as the base class for decorators that extend test cases. </LI>
|
||||
<LI>TestSetup - A Decorator that can be used to set up and tear down additional fixture state. Subclass TestSetup and insert it into your tests when you want to set up additional state once before the test is run. </LI>
|
||||
<LI>Orthodox - a template class which can be used to verify operations on an arbitrary class.</LI></UL>
|
||||
|
||||
|
||||
<H3>Notes</H3>
|
||||
<P>Porting this framework has been fun. I've tried to maintain the spirit and utility of JUnit in a C++ environment. Naturally, the move from Java to standard C++ forces out several nice JUnit features:</P>
|
||||
<OL>
|
||||
|
||||
<LI>Platform independent GUI.</LI>
|
||||
<LI>Stack traces of test failures</LI>
|
||||
<LI>Active (threaded) tests</LI>
|
||||
<LI>Direct invocation of test cases via reflection</LI>
|
||||
<LI>Run-time loading of new tests</LI></OL>
|
||||
|
||||
<P>In addition, the lack of garbage collection in C++ requires some careful use of the framework classes. In particular, TestSuites are composites that manage the lifetime of any tests added to them. Holding onto a TestResult past the lifetime of the tests which filled it is a bad idea. This is because TestResults hold TestFailures and TestFailures hold pointers to the Tests that generated them.</P>
|
||||
<P>On the plus side, we can use the C++ macro preprocessor to get the exact line at which a failure occurs, along with the actual text inside the assert () call that detected the failure. The features of C++ that enable this are the __LINE__ and __FILE__ preprocessor definitions, along with the <I>stringizing</I> operator. If you find that generating this much literal text bulks up your test executables, you can use the CPP_UNIT_SOURCEANNOT define to disable that portion of the reporting.</P>
|
||||
<P>Note: If you use the C++ macro "assert ()" in your code, or include assert.h, you may have a name clash with CppUnit's assert macro. This can be remedied by changing the name of the macro to "cu_assert ()" in TestCase.h.</P>
|
||||
<P>I'd like to thank Kent Beck and Erich Gamma for the inspiration, design, and a wonderful cookbook that was easily/shamelessly mutated to describe CppUnit. Double thanks to Erich for thinking up a way to implement TestCaller. Additional thanks to Kent, Ward Cunningham, Ron Jeffries, Martin Fowler, and several other netizens of the WikiWikiWeb. I don't think any other bunch of people could have convinced me that rapid development with unit tests can be both effective and easy.</P>
|
||||
<P>Thanks also to Fred Huls for mentioning the idea of template-based testing. The <EM>orthodox</EM> template class demonstrates only a small part of what can be done with templated test cases.</P>
|
||||
<H3>History Of Changes</H3>
|
||||
<P>1.2 -- Added the TestCaller template class. There is now no need to use the CPP_UNIT_TESTCASEDISPATCH macro unless you are using a C++ compiler which does not support templates well. CPP_UNIT_TESTCASEDISPATCH remains in TestCase.h for backward compatibility. I've also kept the use of the macro in the Multicaster sample to leave in an example.</P>
|
||||
<P>1.3 -- Retired the CPP_UNIT_TESTCASEDISPATCH macro and cleaned up the include structure. Fixed bug in the textui version.</P>
|
||||
<P>1.4 -- Removed using directives for std in CppUnit headers. Merged the old AssertionFailedError into CppUnitException. Fixed a memory leak in the TestRunner class of the MS GUI TestRunner. Removed CppUnit.h file. Now headers for each class must be included directly.</P></BODY></HTML>
|
||||
<P>1.5 -- Upgraded projects from VC++ 5.0 to 6.0.</P></BODY></HTML>
|
164
CppUnit/doc/cookbook.htm
Normal file
164
CppUnit/doc/cookbook.htm
Normal file
@ -0,0 +1,164 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
|
||||
<META NAME="Generator" CONTENT="Microsoft Word 97">
|
||||
<TITLE>CppUnit Cookbook</TITLE>
|
||||
<META NAME="Template" CONTENT="C:\Program Files\MSOffice\Office\html.dot">
|
||||
</HEAD>
|
||||
<BODY LINK="#0000ff" VLINK="#800080">
|
||||
|
||||
<P><!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"></P>
|
||||
<H1>CppUnit Cookbook</H1>
|
||||
<P>Here is a short cookbook to help you get started. </P>
|
||||
<H2>Simple Test Case</H2>
|
||||
<P>You want to know whether your code is working. How do you do it? There are many ways. Stepping through a debugger or littering your code with stream output calls are two of the simpler ways, but they both have drawbacks. Stepping through your code is a good idea, but it is not automatic. You have to do it every time you make changes. Streaming out text is also fine, but it makes code ugly and it generates far more information than you need most of the time.</P>
|
||||
<P>Tests in CppUnit can be run automatically. They are easy to set up and once you have written them, they are always there to help you keep confidence in the quality of your code.</P>
|
||||
<P>To make a simple test, here is what you do:</P>
|
||||
<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:
|
||||
ComplexNumberTest (string name) : TestCase (name) {}
|
||||
void runTest () {
|
||||
assert (Complex (10, 1) == Complex (10, 1));
|
||||
assert (!(Complex (1, 1) == Complex (2, 2)));
|
||||
}
|
||||
};</PRE>
|
||||
</TT><P>That was a very simple test. Ordinarily, you'll have many little test cases that you'll want to run on the same set of objects. To do this, use a fixture.</P>
|
||||
<P> </P>
|
||||
<H2>Fixture</H2>
|
||||
<P>A fixture is a known set of objects that serves as a base for a set of test cases. Fixtures come in very handy when you are testing as you develop. Let's try out this style of development and learn about fixtures along the away. Suppose that we are really developing a complex number class. Let's start by defining a empty class named Complex.</P>
|
||||
<TT><PRE>	class Complex {}; </PRE>
|
||||
</TT><P>Now create an instance of ComplexNumberTest above, compile the code and see what happens. The first thing we notice is a few compiler errors. The test uses operator==, but it is not defined. Let's fix that.</P>
|
||||
<TT><PRE>	bool operator== (const Complex& a, const Complex& b) { return true; }</PRE>
|
||||
</TT><P>Now compile the test, and run it. This time it compiles but the test fails. We need a bit more to get an operator== working correctly, so we revisit the code.</P>
|
||||
<TT><PRE>	class Complex {
|
||||
friend bool operator== (const Complex& a, const Complex& b);
|
||||
double real, imaginary;
|
||||
public:
|
||||
Complex () {
|
||||
real = imaginary = 0.0;
|
||||
}
|
||||
};
|
||||
|
||||
bool operator== (const Complex& a, const Complex& b)
|
||||
{ return eq(a.real,b.real) && eq(a.imaginary,b.imaginary); }</PRE>
|
||||
</TT><P>If we compile now and run our test it will pass. </P>
|
||||
<P>Now we are ready to add new operations and new tests. At this point a fixture would be handy. We would probably be better off when doing our tests if we decided to instantiate three or four complex numbers and reuse them across our tests. </P>
|
||||
<P>Here is how we do it:</P>
|
||||
<OL>
|
||||
|
||||
<LI>Add member variables for each part of the fixture </LI>
|
||||
<LI>Override "setUp ()" to initialize the variables </LI>
|
||||
<LI>Override "tearDown ()" to release any permanent resources you allocated in "setUp ()"</LI></OL>
|
||||
|
||||
<TT><PRE>	class ComplexNumberTest : public TestCase {
|
||||
	private:
|
||||
Complex 	*m_10_1, *m_1_1; *m_11_2;
|
||||
	protected:
|
||||
	void		setUp () {
|
||||
			 m_10_1 = new Complex (10, 1);
|
||||
			 m_1_1 = new Complex (1, 1);
|
||||
			 m_11_2 = new Complex (11, 2);
|
||||
}
|
||||
	void		tearDown () {
|
||||
			 delete m_10_1, delete m_1_1, delete m_11_2;
|
||||
			}
|
||||
	};</PRE>
|
||||
</TT><P>Once we have this fixture, we can add the complex addition test case any any others that we need over the course of our development.</P>
|
||||
<P> </P>
|
||||
<H2>Test Case</H2>
|
||||
<P>How do you write and invoke individual tests using a fixture? </P>
|
||||
<P>There are two steps to this process:</P>
|
||||
<OL>
|
||||
|
||||
<LI>Write the test case as a method in the fixture class</LI>
|
||||
<LI>Create a TestCaller which runs that particular method</LI></OL>
|
||||
|
||||
<P>Here is our test case class with a few extra case methods:</P>
|
||||
<TT><PRE>	class ComplexNumberTest : public TestCase {
|
||||
	private:
|
||||
Complex 	*m_10_1, *m_1_1; *m_11_2;
|
||||
	protected:
|
||||
	void		setUp () {
|
||||
			 m_10_1 = new Complex (10, 1);
|
||||
			 m_1_1 = new Complex (1, 1);
|
||||
			 m_11_2 = new Complex (11, 2);
|
||||
}
|
||||
	void		tearDown () {
|
||||
			 delete m_10_1, delete m_1_1, delete m_11_2;
|
||||
			}
|
||||
	void		testEquality () {
|
||||
			 assert (*m_10_1 == *m_10_1);
|
||||
			 assert (!(*m_10_1 == *m_11_2));
|
||||
			}
|
||||
	void		testAddition () {
|
||||
			 assert (*m_10_1 + *m_1_1 == *m_11_2);
|
||||
	}
|
||||
	};</PRE>
|
||||
</TT><P>Create and run instances for each test case like this:</P>
|
||||
<TT><PRE>	test = new TestCaller<ComplexNumberTest>("testEquality", ComplexNumberTest::testEquality);
|
||||
test->run (); </PRE>
|
||||
</TT><P>The second argument to the test caller constructor is the address of a method on ComplexNumberTest. When the test caller is run, that specific method will be run.</P>
|
||||
<P>Once you have several tests, organize them into a suite.</P>
|
||||
<P> </P>
|
||||
<H2>Suite</H2>
|
||||
<P>How do you set up your tests so that you can run them all at once?<BR>
|
||||
<BR>
|
||||
CppUnit provides a TestSuite class that runs any number of TestCases together. For example, to run a single test case, you execute:</P>
|
||||
<TT><PRE>	TestResult result;
|
||||
	TestCaller<ComplexNumberTest> test ("testAddition", ComplexNumberTest::testAddition);
|
||||
	Test.run (&result);</PRE>
|
||||
</TT><P> </P>
|
||||
<P>To create a suite of two or more tests, you do the following:</P>
|
||||
<TT><PRE>	TestSuite suite;
|
||||
	TestResult result;
|
||||
	suite.addTest (new TestCaller<ComplexNumberTest>("testEquality", ComplexNumberTest::testEquality));
|
||||
	suite.addTest (new TestCaller<ComplexNumberTest>("testAddition", ComplexNumberTest::testAddition));
|
||||
	suite.run (&result);
|
||||
</PRE>
|
||||
</TT><P>TestSuites don't only have to contain callers for TestCases. They can contain any object that implements the Test interface. For example, you can create a TestSuite in your code and I can create one in mine, and we can run them together by creating a TestSuite that contains both: </P>
|
||||
<TT><PRE>	TestSuite suite;
|
||||
	suite.addTest (ComplexNumberTest.suite ());
|
||||
	suite.addTest (SurrealNumberTest.suite ());
|
||||
	suite.run (&result);</PRE>
|
||||
</TT><P> </P>
|
||||
<H2>TestRunner</H2>
|
||||
<P>How do you run your tests and collect their results? </P>
|
||||
<P>Once you have a test suite, you'll want to run it. CppUnit provides tools to define the suite to be run and to display its results. You make your suite accessible to a TestRunner program with a static method <I>suite</I> that returns a test suite. <BR>
|
||||
For example, to make a ComplexNumberTest suite available to a TestRunner, add the following code to ComplexNumberTest: </P>
|
||||
<TT><PRE>	public: static Test *suite () {
|
||||
	 TestSuite *suiteOfTests = new TestSuite;
|
||||
	 suiteOfTests->addTest (new TestCaller<ComplexNumberTest>("testEquality", testEquality));
|
||||
	 suiteOfTests->addTest (new TestCaller<ComplexNumberTest>("testAddition", testAddition));
|
||||
return suiteOfTests;
|
||||
	}</PRE>
|
||||
</TT><P>CppUnit provides both a textual version of a TestRunner tool, and a Micosoft Visual C++ 5.0 graphical version. If you are running on another platform, take a look at the graphical version. It is easy to port.</P>
|
||||
<P>To use the text version, include the header file for the test in TestRunner.cpp:</P>
|
||||
<TT><PRE>	#include "ExampleTestCase.h"
|
||||
	#include "ComplexNumberTest.h"</PRE>
|
||||
</TT><P>And add a call to "addTest (string, Test *) in the "main ()" function:</P>
|
||||
<TT><PRE>	int main (int ac, char **av) {
|
||||
	 TestRunner runner;
|
||||
	 runner.addTest (ExampleTestCase::suite ());
|
||||
	 runner.addTest (ComplexNumberTest::suite ());
|
||||
	 runner.run ();
|
||||
	 return 0;
|
||||
	}</PRE>
|
||||
</TT><P>The TestRunner will run the tests. If all the tests pass, you'll get an informative message. If any fail, you'll get the following information:</P>
|
||||
<OL>
|
||||
|
||||
<LI>The name of the test case that failed</LI>
|
||||
<LI>The name of the source file that contains the test</LI>
|
||||
<LI>The line number where the failure occurred</LI>
|
||||
<LI>All of the text inside the call to assert which detected the failure</LI></OL>
|
||||
|
||||
<P>CppUnit distinguishes between <I>failures</I> and <I>errors</I>. A failure is anticipated and checked for with assertions. Errors are unanticipated problems like division by zero and other exceptions thrown by the C++ runtime or your code.</P>
|
||||
<P>If you are running MS Developer's Studio, you can build the GUI version rather easily. There are three projects: culib, TestRunner, and HostApp. They make a static library for the framework, a dialog based TestRunner in a DLL and an example Hosting application, respectively. To incorporate a TestRunner in an application you are developing, link with the static library and the TestRunner DLL. Note that the TestRunner DLL must be in the home directory of your application, the system directory or the path. In your application, create an instance of TestRunnerDlg whenever you want to run tests. Pass tests you want to run to the dialog object and then execute.</P>
|
||||
<P>Here is a screen shot of the TestRunner in use:</P>
|
||||
<P><IMG SRC="test.gif" WIDTH=574 HEIGHT=351></P>
|
||||
<P> </P>
|
||||
<P>More notes about the implementation of CppUnit can be found in README.HTML.</P>
|
||||
<P> </P>
|
||||
<P> </P></BODY>
|
||||
</HTML>
|
15
CppUnit/doc/license.htm
Normal file
15
CppUnit/doc/license.htm
Normal file
@ -0,0 +1,15 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
|
||||
<META NAME="Generator" CONTENT="Microsoft Word 97">
|
||||
<TITLE>License Agreement</TITLE>
|
||||
<META NAME="Template" CONTENT="C:\Program Files\MSOffice\Office\html.dot">
|
||||
</HEAD>
|
||||
<BODY LINK="#0000ff" VLINK="#800080">
|
||||
|
||||
<P>Permission to reproduce and create derivative works from the Software ("Software Derivative Works") is hereby granted to you under the copyright of Michael Feathers. Michael Feathers also grants you the right to distribute the Software and Software Derivative Works. </P>
|
||||
<P>Michael Feathers licenses the Software to you on an "AS IS" basis, without warranty of any kind. Michael Feathers HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES OR CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OR CONDITIONS OF MERCHANTABILITY, NON INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using the Software and assume all risks associated with the use and distribution of this Software, including but not limited to the risks of program errors, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. MICHAEL FEATHERS WILL NOT BE LIABLE FOR ANY DIRECT DAMAGES OR FOR ANY SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY ECONOMIC CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS), EVEN IF MICHAEL FEATHERS HAD BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Michael Feathers will not be liable for the loss of, or damage to, your records or data, or any damages claimed by you based on a third party claim. </P>
|
||||
<P>You agree to distribute the Software and any Software Derivatives under a license agreement that: 1) is sufficient to notify all licensees of the Software and Software Derivatives that Michael Feathers assumes no liability for any claim that may arise regarding the Software or Software Derivatives, and 2) that disclaims all warranties, both express and implied, from Michael Feathers regarding the Software and Software Derivatives. (If you include this Agreement with any distribution of the Software and Software Derivatives you will have meet this requirement). You agree that you will not delete any copyright notices in the Software. </P>
|
||||
<P>This Agreement is the exclusive statement of your rights in the Software as provided by Michael Feathers. Except for the licenses granted to you in the second paragraph above, no other licenses are granted hereunder, by estoppel, implication or otherwise. <BR>
|
||||
</P></BODY>
|
||||
</HTML>
|
BIN
CppUnit/doc/test.gif
Normal file
BIN
CppUnit/doc/test.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
56
CppUnit/include/CppUnit/CppUnit.h
Normal file
56
CppUnit/include/CppUnit/CppUnit.h
Normal file
@ -0,0 +1,56 @@
|
||||
//
|
||||
// CppUnit.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/include/CppUnit/CppUnit.h#1 $
|
||||
//
|
||||
|
||||
|
||||
#ifndef CppUnit_CppUnit_INCLUDED
|
||||
#define CppUnit_CppUnit_INCLUDED
|
||||
|
||||
|
||||
//
|
||||
// Ensure that POCO_DLL is default unless POCO_STATIC is defined
|
||||
//
|
||||
#if defined(_WIN32) && defined(_DLL)
|
||||
#if !defined(POCO_DLL) && !defined(POCO_STATIC)
|
||||
#define POCO_DLL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// The following block is the standard way of creating macros which make exporting
|
||||
// from a DLL simpler. All files within this DLL are compiled with the CppUnit_EXPORTS
|
||||
// symbol defined on the command line. this symbol should not be defined on any project
|
||||
// that uses this DLL. This way any other project whose source files include this file see
|
||||
// CppUnit_API functions as being imported from a DLL, wheras this DLL sees symbols
|
||||
// defined with this macro as being exported.
|
||||
//
|
||||
#if defined(_WIN32) && defined(POCO_DLL)
|
||||
#if defined(CppUnit_EXPORTS)
|
||||
#define CppUnit_API __declspec(dllexport)
|
||||
#else
|
||||
#define CppUnit_API __declspec(dllimport)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(CppUnit_API)
|
||||
#define CppUnit_API
|
||||
#endif
|
||||
|
||||
|
||||
// Turn off some annoying warnings
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:4786) // identifier truncation warning
|
||||
#pragma warning(disable:4503) // decorated name length exceeded - mainly a problem with STLPort
|
||||
#pragma warning(disable:4018) // signed/unsigned comparison
|
||||
#pragma warning(disable:4284) // return type for operator -> is not UDT
|
||||
#pragma warning(disable:4251) // ... needs to have dll-interface warning
|
||||
#pragma warning(disable:4273)
|
||||
#pragma warning(disable:4275) // ... non dll-interface class used as base for dll-interface class
|
||||
#endif
|
||||
|
||||
|
||||
#endif // CppUnit_CppUnit_INCLUDED
|
141
CppUnit/include/CppUnit/CppUnitException.h
Normal file
141
CppUnit/include/CppUnit/CppUnitException.h
Normal file
@ -0,0 +1,141 @@
|
||||
//
|
||||
// CppUnitException.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/include/CppUnit/CppUnitException.h#1 $
|
||||
//
|
||||
|
||||
|
||||
#ifndef CppUnit_CppUnitException_INCLUDED
|
||||
#define CppUnit_CppUnitException_INCLUDED
|
||||
|
||||
|
||||
#include "CppUnit/CppUnit.h"
|
||||
#include <exception>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
class CppUnit_API CppUnitException: public std::exception
|
||||
/// CppUnitException is an exception that serves
|
||||
/// descriptive strings through its what() method
|
||||
{
|
||||
public:
|
||||
CppUnitException(const std::string& message = "",
|
||||
long lineNumber = CPPUNIT_UNKNOWNLINENUMBER,
|
||||
const std::string& fileName = CPPUNIT_UNKNOWNFILENAME);
|
||||
CppUnitException(const std::string& message,
|
||||
long lineNumber,
|
||||
long data1lineNumber,
|
||||
const std::string& fileName);
|
||||
CppUnitException(const std::string& message,
|
||||
long lineNumber,
|
||||
long data1lineNumber,
|
||||
long data2lineNumber,
|
||||
const std::string& fileName);
|
||||
CppUnitException(const CppUnitException& other);
|
||||
virtual ~CppUnitException() throw();
|
||||
|
||||
CppUnitException& operator = (const CppUnitException& other);
|
||||
|
||||
const char* what() const throw ();
|
||||
|
||||
long lineNumber() const;
|
||||
long data1LineNumber() const;
|
||||
long data2LineNumber() const;
|
||||
const std::string& fileName() const;
|
||||
|
||||
static const std::string CPPUNIT_UNKNOWNFILENAME;
|
||||
static const int CPPUNIT_UNKNOWNLINENUMBER;
|
||||
|
||||
private:
|
||||
std::string _message;
|
||||
long _lineNumber;
|
||||
long _data1lineNumber;
|
||||
long _data2lineNumber;
|
||||
std::string _fileName;
|
||||
};
|
||||
|
||||
|
||||
inline CppUnitException::CppUnitException(const CppUnitException& other): exception (other)
|
||||
{
|
||||
_message = other._message;
|
||||
_lineNumber = other._lineNumber;
|
||||
_data1lineNumber = other._data1lineNumber;
|
||||
_data2lineNumber = other._data2lineNumber;
|
||||
_fileName = other._fileName;
|
||||
}
|
||||
|
||||
|
||||
inline CppUnitException::CppUnitException (const std::string& message, long lineNumber, const std::string& fileName): _message(message), _lineNumber(lineNumber), _data1lineNumber(CPPUNIT_UNKNOWNLINENUMBER), _data2lineNumber(CPPUNIT_UNKNOWNLINENUMBER), _fileName(fileName)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
inline CppUnitException::CppUnitException (const std::string& message, long lineNumber, long data1lineNumber, const std::string& fileName): _message(message), _lineNumber(lineNumber), _data1lineNumber(data1lineNumber), _data2lineNumber(CPPUNIT_UNKNOWNLINENUMBER), _fileName(fileName)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
inline CppUnitException::CppUnitException (const std::string& message, long lineNumber, long data1lineNumber, long data2lineNumber, const std::string& fileName): _message(message), _lineNumber(lineNumber), _data1lineNumber(data1lineNumber), _data2lineNumber(data2lineNumber), _fileName(fileName)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
inline CppUnitException::~CppUnitException () throw()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
inline CppUnitException& CppUnitException::operator = (const CppUnitException& other)
|
||||
{
|
||||
exception::operator= (other);
|
||||
|
||||
if (&other != this)
|
||||
{
|
||||
_message = other._message;
|
||||
_lineNumber = other._lineNumber;
|
||||
_data1lineNumber = other._data1lineNumber;
|
||||
_data2lineNumber = other._data2lineNumber;
|
||||
_fileName = other._fileName;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
inline const char* CppUnitException::what() const throw ()
|
||||
{
|
||||
return _message.c_str();
|
||||
}
|
||||
|
||||
|
||||
inline long CppUnitException::lineNumber() const
|
||||
{
|
||||
return _lineNumber;
|
||||
}
|
||||
|
||||
|
||||
inline long CppUnitException::data1LineNumber() const
|
||||
{
|
||||
return _data1lineNumber;
|
||||
}
|
||||
|
||||
|
||||
inline long CppUnitException::data2LineNumber() const
|
||||
{
|
||||
return _data2lineNumber;
|
||||
}
|
||||
|
||||
|
||||
// The file in which the error occurred
|
||||
inline const std::string& CppUnitException::fileName() const
|
||||
{
|
||||
return _fileName;
|
||||
}
|
||||
|
||||
|
||||
} // namespace CppUnit
|
||||
|
||||
|
||||
#endif // CppUnit_CppUnitException_INCLUDED
|
19
CppUnit/include/CppUnit/Guards.h
Normal file
19
CppUnit/include/CppUnit/Guards.h
Normal file
@ -0,0 +1,19 @@
|
||||
//
|
||||
// Guards.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/include/CppUnit/Guards.h#1 $
|
||||
//
|
||||
|
||||
|
||||
#ifndef CppUnit_Guards_INCLUDED
|
||||
#define CppUnit_Guards_INCLUDED
|
||||
|
||||
|
||||
// Prevent copy construction and assignment for a class
|
||||
#define REFERENCEOBJECT(className) \
|
||||
private: \
|
||||
className(const className& other); \
|
||||
className& operator = (const className& other);
|
||||
|
||||
|
||||
#endif // CppUnit_Guards_INCLUDED
|
105
CppUnit/include/CppUnit/Orthodox.h
Normal file
105
CppUnit/include/CppUnit/Orthodox.h
Normal file
@ -0,0 +1,105 @@
|
||||
//
|
||||
// Orthodox.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/include/CppUnit/Orthodox.h#1 $
|
||||
//
|
||||
|
||||
|
||||
#ifndef CppUnit_Orthodox_INCLUDED
|
||||
#define CppUnit_Orthodox_INCLUDED
|
||||
|
||||
|
||||
#include "CppUnit/CppUnit.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
/*
|
||||
* Orthodox performs a simple set of tests on an arbitary
|
||||
* class to make sure that it supports at least the
|
||||
* following operations:
|
||||
*
|
||||
* default construction - constructor
|
||||
* equality/inequality - operator== && operator!=
|
||||
* assignment - operator=
|
||||
* negation - operator!
|
||||
* safe passage - copy construction
|
||||
*
|
||||
* If operations for each of these are not declared
|
||||
* the template will not instantiate. If it does
|
||||
* instantiate, tests are performed to make sure
|
||||
* that the operations have correct semantics.
|
||||
*
|
||||
* Adding an orthodox test to a suite is very
|
||||
* easy:
|
||||
*
|
||||
* public: Test *suite () {
|
||||
* TestSuite *suiteOfTests = new TestSuite;
|
||||
* suiteOfTests->addTest (new ComplexNumberTest ("testAdd");
|
||||
* suiteOfTests->addTest (new TestCaller<Orthodox<Complex> > ());
|
||||
* return suiteOfTests;
|
||||
* }
|
||||
*
|
||||
* Templated test cases be very useful when you are want to
|
||||
* make sure that a group of classes have the same form.
|
||||
*
|
||||
* see TestSuite
|
||||
*/
|
||||
template <class ClassUnderTest>
|
||||
class Orthodox: public TestCase
|
||||
{
|
||||
public:
|
||||
Orthodox(): TestCase("Orthodox")
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
ClassUnderTest call(ClassUnderTest object);
|
||||
void runTest ();
|
||||
};
|
||||
|
||||
|
||||
// Run an orthodoxy test
|
||||
template <class ClassUnderTest>
|
||||
void Orthodox<ClassUnderTest>::runTest()
|
||||
{
|
||||
// make sure we have a default constructor
|
||||
ClassUnderTest a, b, c;
|
||||
|
||||
// make sure we have an equality operator
|
||||
assert (a == b);
|
||||
|
||||
// check the inverse
|
||||
b.operator= (a.operator! ());
|
||||
assert (a != b);
|
||||
|
||||
// double inversion
|
||||
b = !!a;
|
||||
assert (a == b);
|
||||
|
||||
// invert again
|
||||
b = !a;
|
||||
|
||||
// check calls
|
||||
c = a;
|
||||
assert (c == call (a));
|
||||
|
||||
c = b;
|
||||
assert (c == call (b));
|
||||
}
|
||||
|
||||
|
||||
// Exercise a call
|
||||
template <class ClassUnderTest>
|
||||
ClassUnderTest Orthodox<ClassUnderTest>::call(ClassUnderTest object)
|
||||
{
|
||||
return object;
|
||||
}
|
||||
|
||||
|
||||
} // namespace CppUnit
|
||||
|
||||
|
||||
#endif // CppUnit_Orthodox_INCLUDED
|
77
CppUnit/include/CppUnit/RepeatedTest.h
Normal file
77
CppUnit/include/CppUnit/RepeatedTest.h
Normal file
@ -0,0 +1,77 @@
|
||||
//
|
||||
// RepeatedTest.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/include/CppUnit/RepeatedTest.h#1 $
|
||||
//
|
||||
|
||||
|
||||
#ifndef CppUnit_RepeatedTest_INCLUDED
|
||||
#define CppUnit_RepeatedTest_INCLUDED
|
||||
|
||||
|
||||
#include "CppUnit/CppUnit.h"
|
||||
#include "CppUnit/Guards.h"
|
||||
#include "CppUnit/TestDecorator.h"
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
class Test;
|
||||
class TestResult;
|
||||
|
||||
|
||||
/*
|
||||
* A decorator that runs a test repeatedly.
|
||||
* Does not assume ownership of the test it decorates
|
||||
*
|
||||
*/
|
||||
class CppUnit_API RepeatedTest: public TestDecorator
|
||||
{
|
||||
REFERENCEOBJECT (RepeatedTest)
|
||||
|
||||
public:
|
||||
RepeatedTest(Test* test, int timesRepeat): TestDecorator (test), _timesRepeat (timesRepeat)
|
||||
{
|
||||
}
|
||||
|
||||
int countTestCases();
|
||||
std::string toString();
|
||||
void run(TestResult *result);
|
||||
|
||||
private:
|
||||
const int _timesRepeat;
|
||||
};
|
||||
|
||||
|
||||
// Counts the number of test cases that will be run by this test.
|
||||
inline RepeatedTest::countTestCases ()
|
||||
{
|
||||
return TestDecorator::countTestCases() * _timesRepeat;
|
||||
}
|
||||
|
||||
|
||||
// Returns the name of the test instance.
|
||||
inline std::string RepeatedTest::toString()
|
||||
{
|
||||
return TestDecorator::toString() + " (repeated)";
|
||||
}
|
||||
|
||||
|
||||
// Runs a repeated test
|
||||
inline void RepeatedTest::run(TestResult *result)
|
||||
{
|
||||
for (int n = 0; n < _timesRepeat; n++)
|
||||
{
|
||||
if (result->shouldStop())
|
||||
break;
|
||||
|
||||
TestDecorator::run(result);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace CppUnit
|
||||
|
||||
|
||||
#endif // CppUnit_RepeatedTest_INCLUDED
|
65
CppUnit/include/CppUnit/Test.h
Normal file
65
CppUnit/include/CppUnit/Test.h
Normal file
@ -0,0 +1,65 @@
|
||||
//
|
||||
// Test.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/include/CppUnit/Test.h#1 $
|
||||
//
|
||||
|
||||
|
||||
#ifndef CppUnit_Test_INCLUDED
|
||||
#define CppUnit_Test_INCLUDED
|
||||
|
||||
|
||||
#include "CppUnit/CppUnit.h"
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
class TestResult;
|
||||
|
||||
|
||||
/*
|
||||
* A Test can be run and collect its results.
|
||||
* See TestResult.
|
||||
*
|
||||
*/
|
||||
class CppUnit_API Test
|
||||
{
|
||||
public:
|
||||
virtual ~Test() = 0;
|
||||
virtual void run(TestResult* result) = 0;
|
||||
virtual int countTestCases() = 0;
|
||||
virtual std::string toString() = 0;
|
||||
};
|
||||
|
||||
|
||||
inline Test::~Test()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// Runs a test and collects its result in a TestResult instance.
|
||||
inline void Test::run(TestResult *result)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// Counts the number of test cases that will be run by this test.
|
||||
inline int Test::countTestCases()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// Returns the name of the test instance.
|
||||
inline std::string Test::toString()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
} // namespace CppUnit
|
||||
|
||||
|
||||
#endif // CppUnit_Test_INCLUDED
|
95
CppUnit/include/CppUnit/TestCaller.h
Normal file
95
CppUnit/include/CppUnit/TestCaller.h
Normal file
@ -0,0 +1,95 @@
|
||||
//
|
||||
// TestCaller.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/include/CppUnit/TestCaller.h#1 $
|
||||
//
|
||||
|
||||
|
||||
#ifndef CppUnit_TestCaller_INCLUDED
|
||||
#define CppUnit_TestCaller_INCLUDED
|
||||
|
||||
|
||||
#include "CppUnit/CppUnit.h"
|
||||
#include "Guards.h"
|
||||
#include "TestCase.h"
|
||||
#include <memory>
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
/*
|
||||
* A test caller provides access to a test case method
|
||||
* on a test case class. Test callers are useful when
|
||||
* you want to run an individual test or add it to a
|
||||
* suite.
|
||||
*
|
||||
* Here is an example:
|
||||
*
|
||||
* class MathTest : public TestCase {
|
||||
* ...
|
||||
* public:
|
||||
* void setUp ();
|
||||
* void tearDown ();
|
||||
*
|
||||
* void testAdd ();
|
||||
* void testSubtract ();
|
||||
* };
|
||||
*
|
||||
* Test *MathTest::suite () {
|
||||
* TestSuite *suite = new TestSuite;
|
||||
*
|
||||
* suite->addTest (new TestCaller<MathTest> ("testAdd", testAdd));
|
||||
* return suite;
|
||||
* }
|
||||
*
|
||||
* You can use a TestCaller to bind any test method on a TestCase
|
||||
* class, as long as it returns accepts void and returns void.
|
||||
*
|
||||
* See TestCase
|
||||
*/
|
||||
template <class Fixture>
|
||||
class TestCaller: public TestCase
|
||||
{
|
||||
REFERENCEOBJECT (TestCaller)
|
||||
|
||||
typedef void (Fixture::*TestMethod)();
|
||||
|
||||
public:
|
||||
TestCaller(const std::string& name, TestMethod test):
|
||||
TestCase(name),
|
||||
_test(test),
|
||||
_fixture(new Fixture(name))
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
void runTest()
|
||||
{
|
||||
(_fixture.get()->*_test)();
|
||||
}
|
||||
|
||||
void setUp()
|
||||
{
|
||||
_fixture.get()->setUp();
|
||||
}
|
||||
|
||||
void tearDown()
|
||||
{
|
||||
_fixture.get()->tearDown();
|
||||
}
|
||||
|
||||
private:
|
||||
TestMethod _test;
|
||||
std::auto_ptr<Fixture> _fixture;
|
||||
};
|
||||
|
||||
|
||||
} // namespace CppUnit
|
||||
|
||||
|
||||
#define CppUnit_addTest(suite, cls, mth) \
|
||||
suite->addTest(new CppUnit::TestCaller<cls>(#mth, &cls::mth))
|
||||
|
||||
|
||||
#endif // CppUnit_TestCaller_INCLUDED
|
249
CppUnit/include/CppUnit/TestCase.h
Normal file
249
CppUnit/include/CppUnit/TestCase.h
Normal file
@ -0,0 +1,249 @@
|
||||
//
|
||||
// TestCase.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/include/CppUnit/TestCase.h#1 $
|
||||
//
|
||||
|
||||
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#define CppUnit_TestCase_INCLUDED
|
||||
|
||||
|
||||
#include "CppUnit/CppUnit.h"
|
||||
#include "CppUnit/Guards.h"
|
||||
#include "CppUnit/Test.h"
|
||||
#include "CppUnit/CppUnitException.h"
|
||||
#include <string>
|
||||
#include <typeinfo>
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
class TestResult;
|
||||
|
||||
|
||||
/*
|
||||
* A test case defines the fixture to run multiple tests. To define a test case
|
||||
* 1) implement a subclass of TestCase
|
||||
* 2) define instance variables that store the state of the fixture
|
||||
* 3) initialize the fixture state by overriding setUp
|
||||
* 4) clean-up after a test by overriding tearDown.
|
||||
*
|
||||
* Each test runs in its own fixture so there
|
||||
* can be no side effects among test runs.
|
||||
* Here is an example:
|
||||
*
|
||||
* class MathTest : public TestCase {
|
||||
* protected: int m_value1;
|
||||
* protected: int m_value2;
|
||||
*
|
||||
* public: MathTest (std::string name)
|
||||
* : TestCase (name) {
|
||||
* }
|
||||
*
|
||||
* protected: void setUp () {
|
||||
* m_value1 = 2;
|
||||
* m_value2 = 3;
|
||||
* }
|
||||
* }
|
||||
*
|
||||
*
|
||||
* For each test implement a method which interacts
|
||||
* with the fixture. Verify the expected results with assertions specified
|
||||
* by calling assert on the expression you want to test:
|
||||
*
|
||||
* protected: void testAdd () {
|
||||
* int result = value1 + value2;
|
||||
* assert (result == 5);
|
||||
* }
|
||||
*
|
||||
* Once the methods are defined you can run them. To do this, use
|
||||
* a TestCaller.
|
||||
*
|
||||
* Test *test = new TestCaller<MathTest>("testAdd", MathTest::testAdd);
|
||||
* test->run ();
|
||||
*
|
||||
*
|
||||
* The tests to be run can be collected into a TestSuite. CppUnit provides
|
||||
* different test runners which can run a test suite and collect the results.
|
||||
* The test runners expect a static method suite as the entry
|
||||
* point to get a test to run.
|
||||
*
|
||||
* public: static MathTest::suite () {
|
||||
* TestSuite *suiteOfTests = new TestSuite;
|
||||
* suiteOfTests->addTest(new TestCaller<MathTest>("testAdd", testAdd));
|
||||
* suiteOfTests->addTest(new TestCaller<MathTest>("testDivideByZero", testDivideByZero));
|
||||
* return suiteOfTests;
|
||||
* }
|
||||
*
|
||||
* Note that the caller of suite assumes lifetime control
|
||||
* for the returned suite.
|
||||
*
|
||||
* see TestResult, TestSuite and TestCaller
|
||||
*
|
||||
*/
|
||||
class CppUnit_API TestCase: public Test
|
||||
{
|
||||
REFERENCEOBJECT (TestCase)
|
||||
|
||||
public:
|
||||
TestCase(const std::string& Name);
|
||||
~TestCase();
|
||||
|
||||
virtual void run(TestResult* result);
|
||||
virtual TestResult* run();
|
||||
virtual int countTestCases();
|
||||
const std::string& name() const;
|
||||
std::string toString();
|
||||
|
||||
virtual void setUp();
|
||||
virtual void tearDown();
|
||||
|
||||
protected:
|
||||
virtual void runTest();
|
||||
TestResult* defaultResult();
|
||||
|
||||
void assertImplementation(bool condition,
|
||||
const std::string& conditionExpression = "",
|
||||
long lineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER,
|
||||
const std::string& fileName = CppUnitException::CPPUNIT_UNKNOWNFILENAME);
|
||||
|
||||
void loop1assertImplementation(bool condition,
|
||||
const std::string& conditionExpression = "",
|
||||
long lineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER,
|
||||
long dataLineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER,
|
||||
const std::string& fileName = CppUnitException::CPPUNIT_UNKNOWNFILENAME);
|
||||
|
||||
void loop2assertImplementation(bool condition,
|
||||
const std::string& conditionExpression = "",
|
||||
long lineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER,
|
||||
long data1LineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER,
|
||||
long data2LineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER,
|
||||
const std::string& fileName = CppUnitException::CPPUNIT_UNKNOWNFILENAME);
|
||||
|
||||
void assertEquals(long expected,
|
||||
long actual,
|
||||
long lineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER,
|
||||
const std::string& fileName = CppUnitException::CPPUNIT_UNKNOWNFILENAME);
|
||||
|
||||
void assertEquals(double expected,
|
||||
double actual,
|
||||
double delta,
|
||||
long lineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER,
|
||||
const std::string& fileName = CppUnitException::CPPUNIT_UNKNOWNFILENAME);
|
||||
|
||||
void assertEquals(const std::string& expected,
|
||||
const std::string& actual,
|
||||
long lineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER,
|
||||
const std::string& fileName = CppUnitException::CPPUNIT_UNKNOWNFILENAME);
|
||||
|
||||
void assertEquals(const void* expected,
|
||||
const void* actual,
|
||||
long lineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER,
|
||||
const std::string& fileName = CppUnitException::CPPUNIT_UNKNOWNFILENAME);
|
||||
|
||||
std::string notEqualsMessage(long expected, long actual);
|
||||
std::string notEqualsMessage(double expected, double actual);
|
||||
std::string notEqualsMessage(const void* expected, const void* actual);
|
||||
std::string notEqualsMessage(const std::string& expected, const std::string& actual);
|
||||
|
||||
void assertNotNull(const void* pointer,
|
||||
const std::string& pointerExpression = "",
|
||||
long lineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER,
|
||||
const std::string& fileName = CppUnitException::CPPUNIT_UNKNOWNFILENAME);
|
||||
|
||||
void assertNull(const void* pointer,
|
||||
const std::string& pointerExpression = "",
|
||||
long lineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER,
|
||||
const std::string& fileName = CppUnitException::CPPUNIT_UNKNOWNFILENAME);
|
||||
|
||||
void fail(const std::string&message = "",
|
||||
long lineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER,
|
||||
const std::string& fileName = CppUnitException::CPPUNIT_UNKNOWNFILENAME);
|
||||
|
||||
private:
|
||||
const std::string _name;
|
||||
};
|
||||
|
||||
|
||||
// Constructs a test case
|
||||
inline TestCase::TestCase(const std::string& name): _name (name)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// Destructs a test case
|
||||
inline TestCase::~TestCase()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// Returns a count of all the tests executed
|
||||
inline int TestCase::countTestCases()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// Returns the name of the test case
|
||||
inline const std::string& TestCase::name() const
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
|
||||
// A hook for fixture set up
|
||||
inline void TestCase::setUp()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// A hook for fixture tear down
|
||||
inline void TestCase::tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// Returns the name of the test case instance
|
||||
inline std::string TestCase::toString()
|
||||
{
|
||||
const std::type_info& thisClass = typeid(*this);
|
||||
return std::string(thisClass.name()) + "." + name();
|
||||
}
|
||||
|
||||
|
||||
// A set of macros which allow us to get the line number
|
||||
// and file name at the point of an error.
|
||||
// Just goes to show that preprocessors do have some
|
||||
// redeeming qualities.
|
||||
#undef assert
|
||||
#define assert(condition) \
|
||||
(this->assertImplementation((condition), (#condition), __LINE__, __FILE__))
|
||||
|
||||
#define loop_1_assert(data1line, condition) \
|
||||
(this->loop1assertImplementation((condition), (#condition), __LINE__, data1line, __FILE__))
|
||||
|
||||
#define loop_2_assert(data1line, data2line, condition) \
|
||||
(this->loop2assertImplementation((condition), (#condition), __LINE__, data1line, data2line, __FILE__))
|
||||
|
||||
#define assertEqualDelta(expected, actual, delta) \
|
||||
(this->assertEquals((expected), (actual), (delta), __LINE__, __FILE__))
|
||||
|
||||
#define assertEqual(expected, actual) \
|
||||
(this->assertEquals((expected), (actual), __LINE__, __FILE__))
|
||||
|
||||
#define assertNullPtr(ptr) \
|
||||
(this->assertNull((ptr), #ptr, __LINE__, __FILE__))
|
||||
|
||||
#define assertNotNullPtr(ptr) \
|
||||
(this->assertNotNull((ptr), #ptr, __LINE__, __FILE__))
|
||||
|
||||
#define failmsg(msg) \
|
||||
(this->fail(msg, __LINE__, __FILE__))
|
||||
|
||||
|
||||
} // namespace CppUnit
|
||||
|
||||
|
||||
#endif // CppUnit_TestCase_INCLUDED
|
52
CppUnit/include/CppUnit/TestDecorator.h
Normal file
52
CppUnit/include/CppUnit/TestDecorator.h
Normal file
@ -0,0 +1,52 @@
|
||||
//
|
||||
// TestDecorator.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/include/CppUnit/TestDecorator.h#1 $
|
||||
//
|
||||
|
||||
|
||||
#ifndef CppUnit_TestDecorator_INCLUDED
|
||||
#define CppUnit_TestDecorator_INCLUDED
|
||||
|
||||
|
||||
#include "CppUnit/CppUnit.h"
|
||||
#include "CppUnit/Guards.h"
|
||||
#include "CppUnit/Test.h"
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
class TestResult;
|
||||
|
||||
|
||||
/*
|
||||
* A Decorator for Tests
|
||||
*
|
||||
* Does not assume ownership of the test it decorates
|
||||
*
|
||||
*/
|
||||
class CppUnit_API TestDecorator: public Test
|
||||
{
|
||||
REFERENCEOBJECT(TestDecorator)
|
||||
|
||||
public:
|
||||
TestDecorator(Test* test);
|
||||
|
||||
virtual ~TestDecorator();
|
||||
|
||||
int countTestCases();
|
||||
|
||||
void run(TestResult* result);
|
||||
|
||||
std::string toString();
|
||||
|
||||
protected:
|
||||
Test* _test;
|
||||
};
|
||||
|
||||
|
||||
} // namespace CppUnit
|
||||
|
||||
|
||||
#endif // CppUnit_TestDecorator_INCLUDED
|
86
CppUnit/include/CppUnit/TestFailure.h
Normal file
86
CppUnit/include/CppUnit/TestFailure.h
Normal file
@ -0,0 +1,86 @@
|
||||
//
|
||||
// TestFailure.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/include/CppUnit/TestFailure.h#1 $
|
||||
//
|
||||
|
||||
|
||||
#ifndef CppUnit_TestFailure_INCLUDED
|
||||
#define CppUnit_TestFailure_INCLUDED
|
||||
|
||||
|
||||
#include "CppUnit/CppUnit.h"
|
||||
#include "CppUnit/CppUnitException.h"
|
||||
#include "CppUnit/Guards.h"
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
class Test;
|
||||
|
||||
|
||||
/*
|
||||
* A TestFailure collects a failed test together with
|
||||
* the caught exception.
|
||||
*
|
||||
* TestFailure assumes lifetime control for any exception
|
||||
* passed to it. The lifetime of tests is handled by
|
||||
* their TestSuite (if they have been added to one) or
|
||||
* whomever creates them.
|
||||
*
|
||||
* see TestResult
|
||||
* see TestSuite
|
||||
*
|
||||
*/
|
||||
class CppUnit_API TestFailure
|
||||
{
|
||||
REFERENCEOBJECT (TestFailure)
|
||||
|
||||
public:
|
||||
TestFailure(Test* failedTest, CppUnitException* thrownException);
|
||||
~TestFailure();
|
||||
|
||||
Test* failedTest();
|
||||
CppUnitException* thrownException();
|
||||
std::string toString();
|
||||
|
||||
protected:
|
||||
Test* _failedTest;
|
||||
CppUnitException *_thrownException;
|
||||
};
|
||||
|
||||
|
||||
// Constructs a TestFailure with the given test and exception.
|
||||
inline TestFailure::TestFailure(Test* failedTest, CppUnitException* thrownException): _failedTest(failedTest), _thrownException(thrownException)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// Deletes the owned exception.
|
||||
inline TestFailure::~TestFailure()
|
||||
{
|
||||
delete _thrownException;
|
||||
}
|
||||
|
||||
|
||||
// Gets the failed test.
|
||||
inline Test* TestFailure::failedTest()
|
||||
{
|
||||
return _failedTest;
|
||||
}
|
||||
|
||||
|
||||
// Gets the thrown exception.
|
||||
inline CppUnitException* TestFailure::thrownException()
|
||||
{
|
||||
return _thrownException;
|
||||
}
|
||||
|
||||
|
||||
} // namespace CppUnit
|
||||
|
||||
|
||||
#endif // CppUnit_TestFailure_INCLUDED
|
||||
|
||||
|
231
CppUnit/include/CppUnit/TestResult.h
Normal file
231
CppUnit/include/CppUnit/TestResult.h
Normal file
@ -0,0 +1,231 @@
|
||||
//
|
||||
// TestResult.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/include/CppUnit/TestResult.h#1 $
|
||||
//
|
||||
|
||||
|
||||
#ifndef CppUnit_TestResult_INCLUDED
|
||||
#define CppUnit_TestResult_INCLUDED
|
||||
|
||||
|
||||
#include "CppUnit/CppUnit.h"
|
||||
#include "CppUnit/Guards.h"
|
||||
#include "CppUnit/TestFailure.h"
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
class CppUnitException;
|
||||
class Test;
|
||||
|
||||
|
||||
/*
|
||||
* A TestResult collects the results of executing a test case. It is an
|
||||
* instance of the Collecting Parameter pattern.
|
||||
*
|
||||
* The test framework distinguishes between failures and errors.
|
||||
* A failure is anticipated and checked for with assertions. Errors are
|
||||
* unanticipated problems signified by exceptions that are not generated
|
||||
* by the framework.
|
||||
*
|
||||
* TestResult supplies a template method 'setSynchronizationObject ()'
|
||||
* so that subclasses can provide mutual exclusion in the face of multiple
|
||||
* threads. This can be useful when tests execute in one thread and
|
||||
* they fill a subclass of TestResult which effects change in another
|
||||
* thread. To have mutual exclusion, override setSynchronizationObject ()
|
||||
* and make sure that you create an instance of ExclusiveZone at the
|
||||
* beginning of each method.
|
||||
*
|
||||
* see Test
|
||||
*/
|
||||
class CppUnit_API TestResult
|
||||
{
|
||||
REFERENCEOBJECT (TestResult)
|
||||
|
||||
public:
|
||||
TestResult();
|
||||
virtual ~TestResult();
|
||||
|
||||
virtual void addError(Test* test, CppUnitException* e);
|
||||
virtual void addFailure(Test* test, CppUnitException* e);
|
||||
virtual void startTest(Test* test);
|
||||
virtual void endTest(Test* test);
|
||||
virtual int runTests();
|
||||
virtual int testErrors();
|
||||
virtual int testFailures();
|
||||
virtual bool wasSuccessful();
|
||||
virtual bool shouldStop();
|
||||
virtual void stop();
|
||||
|
||||
virtual std::vector<TestFailure*>& errors();
|
||||
virtual std::vector<TestFailure*>& failures();
|
||||
|
||||
class SynchronizationObject
|
||||
{
|
||||
public:
|
||||
SynchronizationObject()
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~SynchronizationObject()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void lock()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void unlock()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class ExclusiveZone
|
||||
{
|
||||
SynchronizationObject* m_syncObject;
|
||||
|
||||
public:
|
||||
ExclusiveZone(SynchronizationObject* syncObject): m_syncObject(syncObject)
|
||||
{
|
||||
m_syncObject->lock();
|
||||
}
|
||||
|
||||
~ExclusiveZone()
|
||||
{
|
||||
m_syncObject->unlock();
|
||||
}
|
||||
};
|
||||
|
||||
protected:
|
||||
virtual void setSynchronizationObject(SynchronizationObject* syncObject);
|
||||
|
||||
std::vector<TestFailure*> _errors;
|
||||
std::vector<TestFailure*> _failures;
|
||||
int _runTests;
|
||||
bool _stop;
|
||||
SynchronizationObject* _syncObject;
|
||||
|
||||
};
|
||||
|
||||
|
||||
// Construct a TestResult
|
||||
inline TestResult::TestResult(): _syncObject(new SynchronizationObject())
|
||||
{
|
||||
_runTests = 0;
|
||||
_stop = false;
|
||||
}
|
||||
|
||||
|
||||
// Adds an error to the list of errors. The passed in exception
|
||||
// caused the error
|
||||
inline void TestResult::addError(Test* test, CppUnitException* e)
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
_errors.push_back(new TestFailure(test, e));
|
||||
}
|
||||
|
||||
|
||||
// Adds a failure to the list of failures. The passed in exception
|
||||
// caused the failure.
|
||||
inline void TestResult::addFailure(Test* test, CppUnitException* e)
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
_failures.push_back(new TestFailure(test, e));
|
||||
}
|
||||
|
||||
|
||||
// Informs the result that a test will be started.
|
||||
inline void TestResult::startTest(Test* test)
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
_runTests++;
|
||||
}
|
||||
|
||||
|
||||
// Informs the result that a test was completed.
|
||||
inline void TestResult::endTest(Test* test)
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
}
|
||||
|
||||
|
||||
// Gets the number of run tests.
|
||||
inline int TestResult::runTests()
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
return _runTests;
|
||||
}
|
||||
|
||||
|
||||
// Gets the number of detected errors.
|
||||
inline int TestResult::testErrors()
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
return (int) _errors.size();
|
||||
}
|
||||
|
||||
|
||||
// Gets the number of detected failures.
|
||||
inline int TestResult::testFailures()
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
return (int) _failures.size();
|
||||
}
|
||||
|
||||
|
||||
// Returns whether the entire test was successful or not.
|
||||
inline bool TestResult::wasSuccessful()
|
||||
{
|
||||
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);
|
||||
return _errors;
|
||||
}
|
||||
|
||||
|
||||
// Returns a std::vector of the failures.
|
||||
inline std::vector<TestFailure*>& TestResult::failures()
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
return _failures;
|
||||
}
|
||||
|
||||
|
||||
// Returns whether testing should be stopped
|
||||
inline bool TestResult::shouldStop()
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
return _stop;
|
||||
}
|
||||
|
||||
|
||||
// Stop testing
|
||||
inline void TestResult::stop()
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
_stop = true;
|
||||
}
|
||||
|
||||
|
||||
// Accept a new synchronization object for protection of this instance
|
||||
// TestResult assumes ownership of the object
|
||||
inline void TestResult::setSynchronizationObject(SynchronizationObject* syncObject)
|
||||
{
|
||||
delete _syncObject;
|
||||
_syncObject = syncObject;
|
||||
}
|
||||
|
||||
|
||||
} // namespace CppUnit
|
||||
|
||||
|
||||
#endif // CppUnit_TestResult_INCLUDED
|
75
CppUnit/include/CppUnit/TestRunner.h
Normal file
75
CppUnit/include/CppUnit/TestRunner.h
Normal file
@ -0,0 +1,75 @@
|
||||
//
|
||||
// TestRunner.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/include/CppUnit/TestRunner.h#1 $
|
||||
//
|
||||
|
||||
|
||||
#ifndef CppUnit_TestRunner_INCLUDED
|
||||
#define CppUnit_TestRunner_INCLUDED
|
||||
|
||||
|
||||
#include "CppUnit/CppUnit.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
class Test;
|
||||
|
||||
|
||||
/*
|
||||
* A command line based tool to run tests.
|
||||
* TestRunner expects as its only argument the name of a TestCase class.
|
||||
* TestRunner prints out a trace as the tests are executed followed by a
|
||||
* summary at the end.
|
||||
*
|
||||
* You can add to the tests that the TestRunner knows about by
|
||||
* making additional calls to "addTest (...)" in main.
|
||||
*
|
||||
* Here is the synopsis:
|
||||
*
|
||||
* TestRunner [-all] [-print] [-wait] ExampleTestCase
|
||||
*
|
||||
*/
|
||||
class CppUnit_API TestRunner
|
||||
{
|
||||
typedef std::pair<std::string, Test*> Mapping;
|
||||
typedef std::vector<Mapping> Mappings;
|
||||
|
||||
public:
|
||||
TestRunner();
|
||||
~TestRunner();
|
||||
|
||||
bool run(const std::vector<std::string>& args);
|
||||
void addTest(const std::string& name, Test* test);
|
||||
|
||||
protected:
|
||||
bool run(Test* test);
|
||||
void printBanner();
|
||||
void print(const std::string& name, Test* pTest, int indent);
|
||||
Test* find(const std::string& name, Test* pTest, const std::string& testName);
|
||||
|
||||
private:
|
||||
Mappings _mappings;
|
||||
};
|
||||
|
||||
|
||||
} // namespace CppUnit
|
||||
|
||||
|
||||
#define CppUnitMain(testCase) \
|
||||
int main(int ac, char **av) \
|
||||
{ \
|
||||
std::vector<std::string> args; \
|
||||
for (int i = 0; i < ac; ++i) \
|
||||
args.push_back(std::string(av[i])); \
|
||||
CppUnit::TestRunner runner; \
|
||||
runner.addTest(#testCase, testCase::suite()); \
|
||||
return runner.run(args) ? 0 : 1; \
|
||||
}
|
||||
|
||||
|
||||
#endif // CppUnit_TestRunner_INCLUDED
|
57
CppUnit/include/CppUnit/TestSetup.h
Normal file
57
CppUnit/include/CppUnit/TestSetup.h
Normal file
@ -0,0 +1,57 @@
|
||||
//
|
||||
// TestSetup.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/include/CppUnit/TestSetup.h#1 $
|
||||
//
|
||||
|
||||
|
||||
#ifndef CppUnit_TestSetup_INCLUDED
|
||||
#define CppUnit_TestSetup_INCLUDED
|
||||
|
||||
|
||||
#include "CppUnit/CppUnit.h"
|
||||
#include "CppUnit/Guards.h"
|
||||
#include "CppUnit/TestDecorator.h"
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
class Test;
|
||||
class TestResult;
|
||||
|
||||
|
||||
class CppUnit_API TestSetup: public TestDecorator
|
||||
{
|
||||
REFERENCEOBJECT (TestSetup)
|
||||
|
||||
public:
|
||||
TestSetup(Test* test): TestDecorator(test)
|
||||
{
|
||||
}
|
||||
|
||||
void run(TestResult* result);
|
||||
|
||||
protected:
|
||||
void setUp()
|
||||
{
|
||||
}
|
||||
|
||||
void tearDown()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
inline void TestSetup::run(TestResult* result)
|
||||
{
|
||||
setUp();
|
||||
TestDecorator::run(result);
|
||||
tearDown();
|
||||
}
|
||||
|
||||
|
||||
} // namespace CppUnit
|
||||
|
||||
|
||||
#endif // CppUnit_TestSetup_INCLUDED
|
98
CppUnit/include/CppUnit/TestSuite.h
Normal file
98
CppUnit/include/CppUnit/TestSuite.h
Normal file
@ -0,0 +1,98 @@
|
||||
//
|
||||
// TestSuite.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/include/CppUnit/TestSuite.h#1 $
|
||||
//
|
||||
|
||||
|
||||
#ifndef CppUnit_TestSuite_INCLUDED
|
||||
#define CppUnit_TestSuite_INCLUDED
|
||||
|
||||
|
||||
#include "CppUnit/CppUnit.h"
|
||||
#include "CppUnit/Guards.h"
|
||||
#include "CppUnit/Test.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
class TestResult;
|
||||
|
||||
|
||||
/*
|
||||
* A TestSuite is a Composite of Tests.
|
||||
* It runs a collection of test cases. Here is an example.
|
||||
*
|
||||
* TestSuite *suite= new TestSuite();
|
||||
* suite->addTest(new TestCaller<MathTest> ("testAdd", testAdd));
|
||||
* suite->addTest(new TestCaller<MathTest> ("testDivideByZero", testDivideByZero));
|
||||
*
|
||||
* Note that TestSuites assume lifetime
|
||||
* control for any tests added to them.
|
||||
*
|
||||
* see Test and TestCaller
|
||||
*/
|
||||
class CppUnit_API TestSuite: public Test
|
||||
{
|
||||
REFERENCEOBJECT (TestSuite)
|
||||
|
||||
public:
|
||||
TestSuite(const std::string& name = "");
|
||||
~TestSuite();
|
||||
|
||||
void run(TestResult* result);
|
||||
int countTestCases();
|
||||
void addTest(Test* test);
|
||||
std::string toString();
|
||||
|
||||
virtual void deleteContents();
|
||||
|
||||
const std::vector<Test*> tests() const;
|
||||
|
||||
private:
|
||||
std::vector<Test*> _tests;
|
||||
const std::string _name;
|
||||
};
|
||||
|
||||
|
||||
// Default constructor
|
||||
inline TestSuite::TestSuite(const std::string& name): _name(name)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// Destructor
|
||||
inline TestSuite::~TestSuite()
|
||||
{
|
||||
deleteContents();
|
||||
}
|
||||
|
||||
|
||||
// Adds a test to the suite.
|
||||
inline void TestSuite::addTest(Test* test)
|
||||
{
|
||||
_tests.push_back(test);
|
||||
}
|
||||
|
||||
|
||||
// Returns a std::string representation of the test suite.
|
||||
inline std::string TestSuite::toString()
|
||||
{
|
||||
return "suite " + _name;
|
||||
}
|
||||
|
||||
|
||||
// Returns all tests
|
||||
inline const std::vector<Test*> TestSuite::tests() const
|
||||
{
|
||||
return _tests;
|
||||
}
|
||||
|
||||
|
||||
} // namespace CppUnit
|
||||
|
||||
|
||||
#endif // CppUnit_TestSuite_INCLUDED
|
47
CppUnit/include/CppUnit/TextTestResult.h
Normal file
47
CppUnit/include/CppUnit/TextTestResult.h
Normal file
@ -0,0 +1,47 @@
|
||||
//
|
||||
// TextTestResult.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/include/CppUnit/TextTestResult.h#1 $
|
||||
//
|
||||
|
||||
|
||||
#ifndef CppUnit_TextTestResult_INCLUDED
|
||||
#define CppUnit_TextTestResult_INCLUDED
|
||||
|
||||
|
||||
#include "CppUnit/CppUnit.h"
|
||||
#include "CppUnit/TestResult.h"
|
||||
#include <ostream>
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
class CppUnit_API TextTestResult: public TestResult
|
||||
{
|
||||
public:
|
||||
virtual void addError(Test* test, CppUnitException* e);
|
||||
virtual void addFailure(Test* test, CppUnitException* e);
|
||||
virtual void startTest(Test* test);
|
||||
virtual void print(std::ostream& stream);
|
||||
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);
|
||||
};
|
||||
|
||||
|
||||
/* insertion operator for easy output */
|
||||
inline std::ostream& operator<< (std::ostream& stream, TextTestResult& result)
|
||||
{
|
||||
result.print(stream);
|
||||
return stream;
|
||||
}
|
||||
|
||||
|
||||
} // namespace CppUnit
|
||||
|
||||
|
||||
#endif // CppUnit_TextTestResult_INCLUDED
|
73
CppUnit/include/CppUnit/estring.h
Normal file
73
CppUnit/include/CppUnit/estring.h
Normal file
@ -0,0 +1,73 @@
|
||||
//
|
||||
// estring.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/include/CppUnit/estring.h#1 $
|
||||
//
|
||||
|
||||
|
||||
#ifndef CppUnit_estring_INCLUDED
|
||||
#define CppUnit_estring_INCLUDED
|
||||
|
||||
|
||||
#include "CppUnit/CppUnit.h"
|
||||
#include <string>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
// Create a std::string from a const char pointer
|
||||
inline std::string estring(const char *cstring)
|
||||
{
|
||||
return std::string(cstring);
|
||||
}
|
||||
|
||||
|
||||
// Create a std::string from a std::string (for uniformities' sake)
|
||||
inline std::string estring(std::string& expandedString)
|
||||
{
|
||||
return expandedString;
|
||||
}
|
||||
|
||||
|
||||
// Create a std::string from an int
|
||||
inline std::string estring(int number)
|
||||
{
|
||||
char buffer[50];
|
||||
sprintf(buffer, "%d", number);
|
||||
return std::string (buffer);
|
||||
}
|
||||
|
||||
|
||||
// Create a string from a long
|
||||
inline std::string estring(long number)
|
||||
{
|
||||
char buffer[50];
|
||||
sprintf(buffer, "%ld", number);
|
||||
return std::string (buffer);
|
||||
}
|
||||
|
||||
|
||||
// Create a std::string from a double
|
||||
inline std::string estring(double number)
|
||||
{
|
||||
char buffer[50];
|
||||
sprintf(buffer, "%lf", number);
|
||||
return std::string(buffer);
|
||||
}
|
||||
|
||||
|
||||
// Create a std::string from a double
|
||||
inline std::string estring(const void* ptr)
|
||||
{
|
||||
char buffer[50];
|
||||
sprintf(buffer, "%p", ptr);
|
||||
return std::string(buffer);
|
||||
}
|
||||
|
||||
|
||||
} // namespace CppUnit
|
||||
|
||||
|
||||
#endif // CppUnit_estring_INCLUDED
|
18
CppUnit/src/CppUnitException.cpp
Normal file
18
CppUnit/src/CppUnitException.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
//
|
||||
// CppUnitException.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/src/CppUnitException.cpp#1 $
|
||||
//
|
||||
|
||||
|
||||
#include "CppUnit/CppUnitException.h"
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
const std::string CppUnitException::CPPUNIT_UNKNOWNFILENAME = "<unknown>";
|
||||
const int CppUnitException::CPPUNIT_UNKNOWNLINENUMBER = -1;
|
||||
|
||||
|
||||
} // namespace CppUnit
|
182
CppUnit/src/TestCase.cpp
Normal file
182
CppUnit/src/TestCase.cpp
Normal file
@ -0,0 +1,182 @@
|
||||
//
|
||||
// TestCase.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/src/TestCase.cpp#1 $
|
||||
//
|
||||
|
||||
|
||||
#include <stdexcept>
|
||||
#include <math.h>
|
||||
#include "CppUnit/TestCase.h"
|
||||
#include "CppUnit/TestResult.h"
|
||||
#include "CppUnit/estring.h"
|
||||
#include <typeinfo>
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
// Create a default TestResult
|
||||
TestResult* TestCase::defaultResult()
|
||||
{
|
||||
return new TestResult;
|
||||
}
|
||||
|
||||
|
||||
// Check for a failed general assertion
|
||||
void TestCase::assertImplementation(bool condition, const std::string& conditionExpression, long lineNumber, const std::string& fileName)
|
||||
{
|
||||
if (!condition)
|
||||
throw CppUnitException(conditionExpression, lineNumber, fileName);
|
||||
}
|
||||
|
||||
|
||||
void TestCase::loop1assertImplementation(bool condition, const std::string& conditionExpression, long lineNumber, long data1lineNumber, const std::string& fileName)
|
||||
{
|
||||
if (!condition)
|
||||
throw CppUnitException(conditionExpression, lineNumber, data1lineNumber, fileName);
|
||||
}
|
||||
|
||||
|
||||
void TestCase::loop2assertImplementation(bool condition, const std::string& conditionExpression, long lineNumber, long data1lineNumber, long data2lineNumber, const std::string& fileName)
|
||||
{
|
||||
if (!condition)
|
||||
throw CppUnitException(conditionExpression, lineNumber, data1lineNumber, data2lineNumber, fileName);
|
||||
}
|
||||
|
||||
|
||||
// Check for a failed equality assertion
|
||||
void TestCase::assertEquals(long expected, long actual, long lineNumber, const std::string& fileName)
|
||||
{
|
||||
if (expected != actual)
|
||||
assertImplementation(false, notEqualsMessage(expected, actual), lineNumber, fileName);
|
||||
}
|
||||
|
||||
|
||||
// Check for a failed equality assertion
|
||||
void TestCase::assertEquals(double expected, double actual, double delta, long lineNumber, const std::string& fileName)
|
||||
{
|
||||
if (fabs(expected - actual) > delta)
|
||||
assertImplementation(false, notEqualsMessage(expected, actual), lineNumber, fileName);
|
||||
}
|
||||
|
||||
|
||||
// Check for a failed equality assertion
|
||||
void TestCase::assertEquals(const void* expected, const void* actual, long lineNumber, const std::string& fileName)
|
||||
{
|
||||
if (expected != actual)
|
||||
assertImplementation(false, notEqualsMessage(expected, actual), lineNumber, fileName);
|
||||
}
|
||||
|
||||
|
||||
// Check for a failed equality assertion
|
||||
void TestCase::assertEquals(const std::string& expected, const std::string& actual, long lineNumber, const std::string& fileName)
|
||||
{
|
||||
if (expected != actual)
|
||||
assertImplementation(false, notEqualsMessage(expected, actual), lineNumber, fileName);
|
||||
}
|
||||
|
||||
|
||||
void TestCase::assertNotNull(const void* pointer, const std::string& pointerExpression, long lineNumber, const std::string& fileName)
|
||||
{
|
||||
if (pointer == NULL)
|
||||
throw CppUnitException(pointerExpression + " must not be NULL", lineNumber, fileName);
|
||||
}
|
||||
|
||||
|
||||
void TestCase::assertNull(const void* pointer, const std::string& pointerExpression, long lineNumber, const std::string& fileName)
|
||||
{
|
||||
if (pointer != NULL)
|
||||
throw CppUnitException(pointerExpression + " must be NULL", lineNumber, fileName);
|
||||
}
|
||||
|
||||
|
||||
void TestCase::fail (const std::string& message, long lineNumber, const std::string& fileName)
|
||||
{
|
||||
throw CppUnitException(std::string("fail: ") + message, lineNumber, fileName);
|
||||
}
|
||||
|
||||
|
||||
// Run the test and catch any exceptions that are triggered by it
|
||||
void TestCase::run(TestResult *result)
|
||||
{
|
||||
result->startTest(this);
|
||||
|
||||
setUp();
|
||||
try
|
||||
{
|
||||
runTest();
|
||||
}
|
||||
catch (CppUnitException& e)
|
||||
{
|
||||
CppUnitException* copy = new CppUnitException(e);
|
||||
result->addFailure(this, copy);
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
std::string msg(typeid(e).name());
|
||||
msg.append(": ");
|
||||
msg.append(e.what());
|
||||
result->addError(this, new CppUnitException(msg));
|
||||
|
||||
}
|
||||
#if !defined(_WIN32)
|
||||
catch (...)
|
||||
{
|
||||
CppUnitException *e = new CppUnitException ("unknown exception");
|
||||
result->addError (this, e);
|
||||
}
|
||||
#endif
|
||||
tearDown ();
|
||||
result->endTest(this);
|
||||
}
|
||||
|
||||
|
||||
// A default run method
|
||||
TestResult* TestCase::run()
|
||||
{
|
||||
TestResult* result = defaultResult();
|
||||
|
||||
run(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// All the work for runTest is deferred to subclasses
|
||||
void TestCase::runTest()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// Build a message about a failed equality check
|
||||
std::string TestCase::notEqualsMessage(long expected, long actual)
|
||||
{
|
||||
return "expected: " + estring(expected) + " but was: " + estring(actual);
|
||||
}
|
||||
|
||||
|
||||
// Build a message about a failed equality check
|
||||
std::string TestCase::notEqualsMessage(double expected, double actual)
|
||||
{
|
||||
return "expected: " + estring(expected) + " but was: " + estring(actual);
|
||||
}
|
||||
|
||||
|
||||
// Build a message about a failed equality check
|
||||
std::string TestCase::notEqualsMessage(const void* expected, const void* actual)
|
||||
{
|
||||
return "expected: " + estring(expected) + " but was: " + estring(actual);
|
||||
}
|
||||
|
||||
|
||||
// Build a message about a failed equality check
|
||||
std::string TestCase::notEqualsMessage(const std::string& expected, const std::string& actual)
|
||||
{
|
||||
return "expected: \"" + expected + "\" but was: \"" + actual + "\"";
|
||||
}
|
||||
|
||||
|
||||
} // namespace CppUnit
|
43
CppUnit/src/TestDecorator.cpp
Normal file
43
CppUnit/src/TestDecorator.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
//
|
||||
// TestDecorator.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/src/TestDecorator.cpp#1 $
|
||||
//
|
||||
|
||||
|
||||
#include "CppUnit/TestDecorator.h"
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
TestDecorator::TestDecorator(Test* test)
|
||||
{
|
||||
_test = test;
|
||||
}
|
||||
|
||||
|
||||
TestDecorator::~TestDecorator()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int TestDecorator::countTestCases()
|
||||
{
|
||||
return _test->countTestCases();
|
||||
}
|
||||
|
||||
|
||||
void TestDecorator::run(TestResult* result)
|
||||
{
|
||||
_test->run(result);
|
||||
}
|
||||
|
||||
|
||||
std::string TestDecorator::toString()
|
||||
{
|
||||
return _test->toString();
|
||||
}
|
||||
|
||||
|
||||
} // namespace CppUnit
|
22
CppUnit/src/TestFailure.cpp
Normal file
22
CppUnit/src/TestFailure.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
//
|
||||
// TestFailure.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/src/TestFailure.cpp#1 $
|
||||
//
|
||||
|
||||
|
||||
#include "CppUnit/TestFailure.h"
|
||||
#include "CppUnit/Test.h"
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
// Returns a short description of the failure.
|
||||
std::string TestFailure::toString()
|
||||
{
|
||||
return _failedTest->toString () + ": " + _thrownException->what();
|
||||
}
|
||||
|
||||
|
||||
} // namespace CppUnit
|
29
CppUnit/src/TestResult.cpp
Normal file
29
CppUnit/src/TestResult.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
//
|
||||
// TestResult.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/src/TestResult.cpp#1 $
|
||||
//
|
||||
|
||||
|
||||
#include "CppUnit/TestResult.h"
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
// Destroys a test result
|
||||
TestResult::~TestResult()
|
||||
{
|
||||
std::vector<TestFailure*>::iterator it;
|
||||
|
||||
for (it = _errors.begin(); it != _errors.end(); ++it)
|
||||
delete *it;
|
||||
|
||||
for (it = _failures.begin(); it != _failures.end(); ++it)
|
||||
delete *it;
|
||||
|
||||
delete _syncObject;
|
||||
}
|
||||
|
||||
|
||||
} // namespace CppUnit
|
181
CppUnit/src/TestRunner.cpp
Normal file
181
CppUnit/src/TestRunner.cpp
Normal file
@ -0,0 +1,181 @@
|
||||
//
|
||||
// TestRunner.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/src/TestRunner.cpp#1 $
|
||||
//
|
||||
|
||||
|
||||
#include "CppUnit/TestRunner.h"
|
||||
#include "CppUnit/Test.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "CppUnit/TextTestResult.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
TestRunner::TestRunner()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
TestRunner::~TestRunner()
|
||||
{
|
||||
for (Mappings::iterator it = _mappings.begin(); it != _mappings.end(); ++it)
|
||||
delete it->second;
|
||||
}
|
||||
|
||||
|
||||
void TestRunner::printBanner()
|
||||
{
|
||||
std::cout
|
||||
<< "Usage: driver [-all] [-print] [-wait] [name] ..." << std::endl
|
||||
<< " where name is the name of a test case class" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
bool TestRunner::run(const std::vector<std::string>& args)
|
||||
{
|
||||
std::string testCase;
|
||||
int numberOfTests = 0;
|
||||
bool success = true;
|
||||
bool all = false;
|
||||
bool wait = false;
|
||||
bool printed = false;
|
||||
|
||||
for (int i = 1; i < args.size(); i++)
|
||||
{
|
||||
const std::string& arg = args[i];
|
||||
if (arg == "-wait")
|
||||
{
|
||||
wait = true;
|
||||
continue;
|
||||
}
|
||||
else if (arg == "-all")
|
||||
{
|
||||
all = true;
|
||||
continue;
|
||||
}
|
||||
else if (arg == "-print")
|
||||
{
|
||||
for (Mappings::iterator it = _mappings.begin(); it != _mappings.end(); ++it)
|
||||
{
|
||||
print(it->first, it->second, 0);
|
||||
}
|
||||
printed = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!all)
|
||||
{
|
||||
testCase = arg;
|
||||
|
||||
if (testCase == "")
|
||||
{
|
||||
printBanner();
|
||||
return false;
|
||||
}
|
||||
|
||||
Test* testToRun = 0;
|
||||
for (Mappings::iterator it = _mappings.begin(); !testToRun && it != _mappings.end(); ++it)
|
||||
{
|
||||
testToRun = find(testCase, it->second, it->first);
|
||||
}
|
||||
if (testToRun)
|
||||
{
|
||||
if (!run(testToRun)) success = false;
|
||||
}
|
||||
numberOfTests++;
|
||||
|
||||
if (!testToRun)
|
||||
{
|
||||
std::cout << "Test " << testCase << " not found." << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (all)
|
||||
{
|
||||
for (Mappings::iterator it = _mappings.begin(); it != _mappings.end(); ++it)
|
||||
{
|
||||
if (!run(it->second)) success = false;
|
||||
numberOfTests++;
|
||||
}
|
||||
}
|
||||
|
||||
if (numberOfTests == 0 && !printed)
|
||||
{
|
||||
printBanner();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (wait)
|
||||
{
|
||||
std::cout << "<RETURN> to continue" << std::endl;
|
||||
std::cin.get();
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
bool TestRunner::run(Test* test)
|
||||
{
|
||||
TextTestResult result;
|
||||
|
||||
test->run(&result);
|
||||
std::cout << result << std::endl;
|
||||
|
||||
return result.wasSuccessful();
|
||||
}
|
||||
|
||||
|
||||
void TestRunner::addTest(const std::string& name, Test* test)
|
||||
{
|
||||
_mappings.push_back(Mapping(name, test));
|
||||
}
|
||||
|
||||
|
||||
void TestRunner::print(const std::string& name, Test* pTest, int indent)
|
||||
{
|
||||
for (int i = 0; i < indent; ++i)
|
||||
std::cout << " ";
|
||||
std::cout << name << std::endl;
|
||||
TestSuite* pSuite = dynamic_cast<TestSuite*>(pTest);
|
||||
if (pSuite)
|
||||
{
|
||||
const std::vector<Test*>& tests = pSuite->tests();
|
||||
for (std::vector<Test*>::const_iterator it = tests.begin(); it != tests.end(); ++it)
|
||||
{
|
||||
print((*it)->toString(), *it, indent + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Test* TestRunner::find(const std::string& name, Test* pTest, const std::string& testName)
|
||||
{
|
||||
if (testName.find(name) != std::string::npos)
|
||||
{
|
||||
return pTest;
|
||||
}
|
||||
else
|
||||
{
|
||||
TestSuite* pSuite = dynamic_cast<TestSuite*>(pTest);
|
||||
if (pSuite)
|
||||
{
|
||||
const std::vector<Test*>& tests = pSuite->tests();
|
||||
for (std::vector<Test*>::const_iterator it = tests.begin(); it != tests.end(); ++it)
|
||||
{
|
||||
Test* result = find(name, *it, (*it)->toString());
|
||||
if (result) return result;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace CppUnit
|
49
CppUnit/src/TestSuite.cpp
Normal file
49
CppUnit/src/TestSuite.cpp
Normal file
@ -0,0 +1,49 @@
|
||||
//
|
||||
// TestSuite.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/src/TestSuite.cpp#1 $
|
||||
//
|
||||
|
||||
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "CppUnit/TestResult.h"
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
// Deletes all tests in the suite.
|
||||
void TestSuite::deleteContents()
|
||||
{
|
||||
for (std::vector<Test*>::iterator it = _tests.begin(); it != _tests.end(); ++it)
|
||||
delete *it;
|
||||
}
|
||||
|
||||
|
||||
// Runs the tests and collects their result in a TestResult.
|
||||
void TestSuite::run(TestResult *result)
|
||||
{
|
||||
for (std::vector<Test*>::iterator it = _tests.begin(); it != _tests.end(); ++it)
|
||||
{
|
||||
if (result->shouldStop ())
|
||||
break;
|
||||
|
||||
Test *test = *it;
|
||||
test->run(result);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Counts the number of test cases that will be run by this test.
|
||||
int TestSuite::countTestCases()
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
for (std::vector<Test*>::iterator it = _tests.begin (); it != _tests.end (); ++it)
|
||||
count += (*it)->countTestCases();
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
} // namespace CppUnit
|
174
CppUnit/src/TextTestResult.cpp
Normal file
174
CppUnit/src/TextTestResult.cpp
Normal file
@ -0,0 +1,174 @@
|
||||
//
|
||||
// TextTestResult.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppUnit/src/TextTestResult.cpp#1 $
|
||||
//
|
||||
|
||||
|
||||
#include "CppUnit/TextTestResult.h"
|
||||
#include "CppUnit/CppUnitException.h"
|
||||
#include "CppUnit/Test.h"
|
||||
#include "CppUnit/estring.h"
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
void TextTestResult::addError(Test* test, CppUnitException* e)
|
||||
{
|
||||
TestResult::addError(test, e);
|
||||
std::cerr << "ERROR" << std::flush;
|
||||
}
|
||||
|
||||
|
||||
void TextTestResult::addFailure(Test* test, CppUnitException* e)
|
||||
{
|
||||
TestResult::addFailure(test, e);
|
||||
std::cerr << "FAILURE" << std::flush;
|
||||
}
|
||||
|
||||
|
||||
void TextTestResult::startTest(Test* test)
|
||||
{
|
||||
TestResult::startTest(test);
|
||||
std::cerr << "\n" << shortName(test->toString()) << ": ";
|
||||
}
|
||||
|
||||
|
||||
void TextTestResult::printErrors(std::ostream& stream)
|
||||
{
|
||||
if (testErrors() != 0)
|
||||
{
|
||||
stream << "\n";
|
||||
|
||||
if (testErrors() == 1)
|
||||
stream << "There was " << testErrors() << " error: " << std::endl;
|
||||
else
|
||||
stream << "There were " << testErrors() << " errors: " << std::endl;
|
||||
|
||||
int i = 1;
|
||||
for (std::vector<TestFailure*>::iterator it = errors().begin(); it != errors().end(); ++it)
|
||||
{
|
||||
TestFailure* failure = *it;
|
||||
CppUnitException* e = failure->thrownException();
|
||||
|
||||
stream << std::setw(2) << i
|
||||
<< ": "
|
||||
<< failure->failedTest()->toString() << "\n"
|
||||
<< " \"" << (e ? e->what() : "") << "\"\n"
|
||||
<< " in \""
|
||||
<< (e ? e->fileName() : std::string())
|
||||
<< "\", line ";
|
||||
if (e == 0)
|
||||
{
|
||||
stream << "0";
|
||||
}
|
||||
else
|
||||
{
|
||||
stream << e->lineNumber();
|
||||
if (e->data2LineNumber() != CppUnitException::CPPUNIT_UNKNOWNLINENUMBER)
|
||||
{
|
||||
stream << " data lines " << e->data1LineNumber()
|
||||
<< ", " << e->data2LineNumber();
|
||||
}
|
||||
else if (e->data1LineNumber() != CppUnitException::CPPUNIT_UNKNOWNLINENUMBER)
|
||||
{
|
||||
stream << " data line " << e->data1LineNumber();
|
||||
}
|
||||
}
|
||||
stream << "\n";
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TextTestResult::printFailures(std::ostream& stream)
|
||||
{
|
||||
if (testFailures() != 0)
|
||||
{
|
||||
stream << "\n";
|
||||
if (testFailures() == 1)
|
||||
stream << "There was " << testFailures() << " failure: " << std::endl;
|
||||
else
|
||||
stream << "There were " << testFailures() << " failures: " << std::endl;
|
||||
|
||||
int i = 1;
|
||||
|
||||
for (std::vector<TestFailure*>::iterator it = failures().begin(); it != failures().end(); ++it)
|
||||
{
|
||||
TestFailure* failure = *it;
|
||||
CppUnitException* e = failure->thrownException();
|
||||
|
||||
stream << std::setw(2) << i
|
||||
<< ": "
|
||||
<< failure->failedTest()->toString() << "\n"
|
||||
<< " \"" << (e ? e->what() : "") << "\"\n"
|
||||
<< " in \""
|
||||
<< (e ? e->fileName() : std::string())
|
||||
<< "\", line ";
|
||||
if (e == 0)
|
||||
{
|
||||
stream << "0";
|
||||
}
|
||||
else
|
||||
{
|
||||
stream << e->lineNumber();
|
||||
if (e->data2LineNumber() != CppUnitException::CPPUNIT_UNKNOWNLINENUMBER)
|
||||
{
|
||||
stream << " data lines "
|
||||
<< e->data1LineNumber()
|
||||
<< ", " << e->data2LineNumber();
|
||||
}
|
||||
else if (e->data1LineNumber() != CppUnitException::CPPUNIT_UNKNOWNLINENUMBER)
|
||||
{
|
||||
stream << " data line " << e->data1LineNumber();
|
||||
}
|
||||
}
|
||||
stream << "\n";
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TextTestResult::print(std::ostream& stream)
|
||||
{
|
||||
printHeader(stream);
|
||||
printErrors(stream);
|
||||
printFailures(stream);
|
||||
}
|
||||
|
||||
|
||||
void TextTestResult::printHeader(std::ostream& stream)
|
||||
{
|
||||
std::cout << "\n\n";
|
||||
if (wasSuccessful())
|
||||
std::cout << "OK ("
|
||||
<< runTests() << " tests)"
|
||||
<< std::endl;
|
||||
else
|
||||
std::cout << "!!!FAILURES!!!" << std::endl
|
||||
<< "Runs: "
|
||||
<< runTests ()
|
||||
<< " Failures: "
|
||||
<< testFailures ()
|
||||
<< " Errors: "
|
||||
<< testErrors ()
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
|
||||
std::string TextTestResult::shortName(const std::string& testName)
|
||||
{
|
||||
std::string::size_type pos = testName.rfind('.');
|
||||
if (pos != std::string::npos)
|
||||
return std::string(testName, pos + 1);
|
||||
else
|
||||
return testName;
|
||||
}
|
||||
|
||||
|
||||
} // namespace CppUnit
|
27
Data/Data.vmsbuild
Normal file
27
Data/Data.vmsbuild
Normal file
@ -0,0 +1,27 @@
|
||||
#
|
||||
# Data.vmsbuild
|
||||
#
|
||||
# $Id: //poco/1.3/Data/Data.vmsbuild#1 $
|
||||
#
|
||||
LIB=PocoData
|
||||
AbstractBinder
|
||||
AbstractBinding
|
||||
AbstractExtraction
|
||||
AbstractExtractor
|
||||
AbstractPreparation
|
||||
AbstractPrepare
|
||||
BLOB
|
||||
BLOBStream
|
||||
DataException
|
||||
Limit
|
||||
PooledSessionHolder
|
||||
PooledSessionImpl
|
||||
Range
|
||||
Session
|
||||
SessionFactory
|
||||
SessionImpl
|
||||
SessionInstantiator
|
||||
SessionPool
|
||||
Statement
|
||||
StatementCreator
|
||||
StatementImpl
|
30
Data/Data_VS71.sln
Normal file
30
Data/Data_VS71.sln
Normal file
@ -0,0 +1,30 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Data", "Data_VS71.vcproj", "{240E83C3-368D-11DB-9FBC-00123FC423B5}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestSuite", "testsuite\TestSuite_VS71.vcproj", "{24134877-368D-11DB-9FBC-00123FC423B5}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{240E83C3-368D-11DB-9FBC-00123FC423B5} = {240E83C3-368D-11DB-9FBC-00123FC423B5}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
debug_shared = debug_shared
|
||||
release_shared = release_shared
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{240E83C3-368D-11DB-9FBC-00123FC423B5}.debug_shared.ActiveCfg = debug_shared|Win32
|
||||
{240E83C3-368D-11DB-9FBC-00123FC423B5}.debug_shared.Build.0 = debug_shared|Win32
|
||||
{240E83C3-368D-11DB-9FBC-00123FC423B5}.release_shared.ActiveCfg = release_shared|Win32
|
||||
{240E83C3-368D-11DB-9FBC-00123FC423B5}.release_shared.Build.0 = release_shared|Win32
|
||||
{24134877-368D-11DB-9FBC-00123FC423B5}.debug_shared.ActiveCfg = debug_shared|Win32
|
||||
{24134877-368D-11DB-9FBC-00123FC423B5}.debug_shared.Build.0 = debug_shared|Win32
|
||||
{24134877-368D-11DB-9FBC-00123FC423B5}.release_shared.ActiveCfg = release_shared|Win32
|
||||
{24134877-368D-11DB-9FBC-00123FC423B5}.release_shared.Build.0 = release_shared|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
337
Data/Data_VS71.vcproj
Normal file
337
Data/Data_VS71.vcproj
Normal file
@ -0,0 +1,337 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="Data"
|
||||
ProjectGUID="{240e83c3-368d-11db-9fbc-00123fc423b5}"
|
||||
RootNamespace="Data"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="debug_shared|Win32"
|
||||
OutputDirectory="obj\debug_shared"
|
||||
IntermediateDirectory="obj\debug_shared"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".\include;..\Foundation\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;POCO_DLL;Data_EXPORTS"
|
||||
StringPooling="TRUE"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="TRUE"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundationd.lib"
|
||||
OutputFile="..\bin\PocoDatad.dll"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="..\bin\PocoDatad.pdb"
|
||||
SubSystem="1"
|
||||
OptimizeForWindows98="1"
|
||||
ImportLibrary="..\lib\PocoDatad.lib"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="release_shared|Win32"
|
||||
OutputDirectory="obj\release_shared"
|
||||
IntermediateDirectory="obj\release_shared"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="TRUE"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="TRUE"
|
||||
OptimizeForProcessor="3"
|
||||
AdditionalIncludeDirectories=".\include;..\Foundation\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;POCO_DLL;Data_EXPORTS"
|
||||
GeneratePreprocessedFile="0"
|
||||
KeepComments="FALSE"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="FALSE"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="0"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundation.lib"
|
||||
OutputFile="..\bin\PocoData.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\lib"
|
||||
GenerateDebugInformation="FALSE"
|
||||
ProgramDatabaseFile=""
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
OptimizeForWindows98="1"
|
||||
ImportLibrary="..\lib\PocoData.lib"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="DataCore"
|
||||
Filter="">
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\AbstractBinder.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\AbstractBinding.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\AbstractExtraction.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\AbstractExtractor.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\AbstractPreparation.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\AbstractPrepare.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\AbstractSessionImpl.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Binder.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Binding.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\BLOB.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\BLOBStream.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Column.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Common.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Data.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\DataException.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Extraction.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Limit.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\MetaColumn.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Prepare.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Range.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\RecordSet.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Session.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\SessionFactory.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\SessionImpl.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Connector.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Statement.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\StatementCreator.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\StatementImpl.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\TypeHandler.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\src\AbstractBinder.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\AbstractBinding.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\AbstractExtraction.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\AbstractExtractor.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\AbstractPreparation.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\AbstractPrepare.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\BLOB.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\BLOBStream.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\DataException.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Limit.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\MetaColumn.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Range.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\RecordSet.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Session.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\SessionFactory.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\SessionImpl.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Connector.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Statement.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\StatementCreator.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\StatementImpl.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="SessionPooling"
|
||||
Filter="">
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\PooledSessionHolder.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\PooledSessionImpl.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\SessionPool.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\src\PooledSessionHolder.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\PooledSessionImpl.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\SessionPool.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
28
Data/Data_VS80.sln
Normal file
28
Data/Data_VS80.sln
Normal file
@ -0,0 +1,28 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Data", "Data_VS80.vcproj", "{240E83C3-368D-11DB-9FBC-00123FC423B5}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestSuite", "testsuite\TestSuite_VS80.vcproj", "{24134877-368D-11DB-9FBC-00123FC423B5}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{240E83C3-368D-11DB-9FBC-00123FC423B5} = {240E83C3-368D-11DB-9FBC-00123FC423B5}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
debug_shared|Win32 = debug_shared|Win32
|
||||
release_shared|Win32 = release_shared|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{240E83C3-368D-11DB-9FBC-00123FC423B5}.debug_shared|Win32.ActiveCfg = debug_shared|Win32
|
||||
{240E83C3-368D-11DB-9FBC-00123FC423B5}.debug_shared|Win32.Build.0 = debug_shared|Win32
|
||||
{240E83C3-368D-11DB-9FBC-00123FC423B5}.release_shared|Win32.ActiveCfg = release_shared|Win32
|
||||
{240E83C3-368D-11DB-9FBC-00123FC423B5}.release_shared|Win32.Build.0 = release_shared|Win32
|
||||
{24134877-368D-11DB-9FBC-00123FC423B5}.debug_shared|Win32.ActiveCfg = debug_shared|Win32
|
||||
{24134877-368D-11DB-9FBC-00123FC423B5}.debug_shared|Win32.Build.0 = debug_shared|Win32
|
||||
{24134877-368D-11DB-9FBC-00123FC423B5}.release_shared|Win32.ActiveCfg = release_shared|Win32
|
||||
{24134877-368D-11DB-9FBC-00123FC423B5}.release_shared|Win32.Build.0 = release_shared|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
449
Data/Data_VS80.vcproj
Normal file
449
Data/Data_VS80.vcproj
Normal file
@ -0,0 +1,449 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="Data"
|
||||
ProjectGUID="{240E83C3-368D-11DB-9FBC-00123FC423B5}"
|
||||
RootNamespace="Data"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="debug_shared|Win32"
|
||||
OutputDirectory="obj\debug_shared"
|
||||
IntermediateDirectory="obj\debug_shared"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".\include;..\Foundation\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;POCO_DLL;Data_EXPORTS"
|
||||
StringPooling="true"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="true"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundationd.lib"
|
||||
OutputFile="..\bin\PocoDatad.dll"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="..\lib"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="..\bin\PocoDatad.pdb"
|
||||
SubSystem="1"
|
||||
OptimizeForWindows98="1"
|
||||
ImportLibrary="..\lib\PocoDatad.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="release_shared|Win32"
|
||||
OutputDirectory="obj\release_shared"
|
||||
IntermediateDirectory="obj\release_shared"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories=".\include;..\Foundation\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;POCO_DLL;Data_EXPORTS"
|
||||
GeneratePreprocessedFile="0"
|
||||
KeepComments="false"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="false"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="0"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundation.lib"
|
||||
OutputFile="..\bin\PocoData.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="..\lib"
|
||||
GenerateDebugInformation="false"
|
||||
ProgramDatabaseFile=""
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
OptimizeForWindows98="1"
|
||||
ImportLibrary="..\lib\PocoData.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="DataCore"
|
||||
>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\AbstractBinder.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\AbstractBinding.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\AbstractExtraction.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\AbstractExtractor.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\AbstractPreparation.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\AbstractPrepare.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\AbstractSessionImpl.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Binding.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\BLOB.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\BLOBStream.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Column.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Common.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Connector.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Data.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\DataException.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Extraction.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Limit.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\MetaColumn.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Prepare.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Range.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\RecordSet.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Session.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\SessionFactory.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\SessionImpl.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Statement.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\StatementCreator.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\StatementImpl.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\TypeHandler.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\AbstractBinder.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\AbstractBinding.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\AbstractExtraction.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\AbstractExtractor.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\AbstractPreparation.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\AbstractPrepare.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\BLOB.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\BLOBStream.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Connector.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\DataException.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Limit.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\MetaColumn.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Range.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\RecordSet.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Session.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\SessionFactory.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\SessionImpl.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Statement.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\StatementCreator.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\StatementImpl.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="SessionPooling"
|
||||
>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\PooledSessionHolder.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\PooledSessionImpl.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\SessionPool.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\PooledSessionHolder.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\PooledSessionImpl.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\SessionPool.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
22
Data/Makefile
Normal file
22
Data/Makefile
Normal file
@ -0,0 +1,22 @@
|
||||
#
|
||||
# Makefile
|
||||
#
|
||||
# $Id: //poco/1.3/Data/Makefile#2 $
|
||||
#
|
||||
# Makefile for Poco Data
|
||||
#
|
||||
|
||||
include $(POCO_BASE)/build/rules/global
|
||||
|
||||
objects = AbstractBinder AbstractBinding AbstractExtraction \
|
||||
AbstractExtractor AbstractPreparation AbstractPrepare \
|
||||
BLOB BLOBStream DataException Limit MetaColumn \
|
||||
PooledSessionHolder PooledSessionImpl \
|
||||
Range RecordSet Session SessionFactory SessionImpl \
|
||||
Connector SessionPool Statement StatementCreator StatementImpl
|
||||
|
||||
target = PocoData
|
||||
target_version = $(LIBVERSION)
|
||||
target_libs = PocoFoundation
|
||||
|
||||
include $(POCO_BASE)/build/rules/lib
|
25
Data/ODBC/Makefile
Normal file
25
Data/ODBC/Makefile
Normal file
@ -0,0 +1,25 @@
|
||||
#
|
||||
# Makefile
|
||||
#
|
||||
# $Id: //poco/Main/DataConnectors/ODBC/Makefile#2 $
|
||||
#
|
||||
# Makefile for Poco ODBC
|
||||
#
|
||||
|
||||
include $(POCO_BASE)/build/rules/global
|
||||
|
||||
ifeq ($(OSNAME),Darwin)
|
||||
SYSLIBS += -liodbc -liodbcinst
|
||||
else
|
||||
SYSLIBS += -lodbc -lodbcinst
|
||||
endif
|
||||
|
||||
objects = Binder ConnectionHandle DataTypes EnvironmentHandle \
|
||||
Extractor ODBCColumn ODBCException ODBCStatementImpl Parameter Preparation \
|
||||
SessionImpl Connector Utility
|
||||
|
||||
target = PocoODBC
|
||||
target_version = $(LIBVERSION)
|
||||
target_libs = PocoData PocoFoundation
|
||||
|
||||
include $(POCO_BASE)/build/rules/lib
|
17
Data/ODBC/ODBC.vmsbuild
Normal file
17
Data/ODBC/ODBC.vmsbuild
Normal file
@ -0,0 +1,17 @@
|
||||
#
|
||||
# ODBC.vmsbuild
|
||||
#
|
||||
# $Id: //poco/1.3/Data/ODBC/ODBC.vmsbuild#1 $
|
||||
#
|
||||
LIB=PocoODBC
|
||||
Binder
|
||||
Column
|
||||
DataTypes
|
||||
Extractor
|
||||
Handle
|
||||
ODBCException
|
||||
ODBCStatementImpl
|
||||
Preparation
|
||||
SessionImpl
|
||||
SessionInstantiator
|
||||
Utility
|
30
Data/ODBC/ODBC_VS71.sln
Normal file
30
Data/ODBC/ODBC_VS71.sln
Normal file
@ -0,0 +1,30 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestSuite", "testsuite\TestSuite_VS71.vcproj", "{1B30A91B-375F-11DB-837B-00123FC423B5}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{1B29820D-375F-11DB-837B-00123FC423B5} = {1B29820D-375F-11DB-837B-00123FC423B5}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ODBC", "ODBC_VS71.vcproj", "{1B29820D-375F-11DB-837B-00123FC423B5}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
debug_shared = debug_shared
|
||||
release_shared = release_shared
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{1B30A91B-375F-11DB-837B-00123FC423B5}.debug_shared.ActiveCfg = debug_shared|Win32
|
||||
{1B30A91B-375F-11DB-837B-00123FC423B5}.debug_shared.Build.0 = debug_shared|Win32
|
||||
{1B30A91B-375F-11DB-837B-00123FC423B5}.release_shared.ActiveCfg = release_shared|Win32
|
||||
{1B30A91B-375F-11DB-837B-00123FC423B5}.release_shared.Build.0 = release_shared|Win32
|
||||
{1B29820D-375F-11DB-837B-00123FC423B5}.debug_shared.ActiveCfg = debug_shared|Win32
|
||||
{1B29820D-375F-11DB-837B-00123FC423B5}.debug_shared.Build.0 = debug_shared|Win32
|
||||
{1B29820D-375F-11DB-837B-00123FC423B5}.release_shared.ActiveCfg = release_shared|Win32
|
||||
{1B29820D-375F-11DB-837B-00123FC423B5}.release_shared.Build.0 = release_shared|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
250
Data/ODBC/ODBC_VS71.vcproj
Normal file
250
Data/ODBC/ODBC_VS71.vcproj
Normal file
@ -0,0 +1,250 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="ODBC"
|
||||
ProjectGUID="{1B29820D-375F-11DB-837B-00123FC423B5}"
|
||||
RootNamespace="SQLite"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="debug_shared|Win32"
|
||||
OutputDirectory="obj\debug_shared"
|
||||
IntermediateDirectory="obj\debug_shared"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".\include;.\src;..\..\Foundation\include;..\..\Data\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;POCO_DLL;ODBC_EXPORTS;NO_TCL;THREADSAFE"
|
||||
StringPooling="TRUE"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="TRUE"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundationd.lib PocoDatad.lib"
|
||||
OutputFile="..\..\bin\PocoODBCd.dll"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\..\lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="..\..\bin\PocoODBCd.pdb"
|
||||
SubSystem="1"
|
||||
OptimizeForWindows98="1"
|
||||
ImportLibrary="..\..\lib\PocoODBCd.lib"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="release_shared|Win32"
|
||||
OutputDirectory="obj\release_shared"
|
||||
IntermediateDirectory="obj\release_shared"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="TRUE"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="TRUE"
|
||||
OptimizeForProcessor="3"
|
||||
AdditionalIncludeDirectories=".\include;.\src;..\..\Foundation\include;..\..\Data\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;POCO_DLL;ODBC_EXPORTS;NO_TCL;THREADSAFE"
|
||||
GeneratePreprocessedFile="0"
|
||||
KeepComments="FALSE"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="FALSE"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="0"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundation.lib PocoData.lib"
|
||||
OutputFile="..\..\bin\PocoODBC.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\..\lib"
|
||||
GenerateDebugInformation="FALSE"
|
||||
ProgramDatabaseFile=""
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
OptimizeForWindows98="1"
|
||||
ImportLibrary="..\..\lib\PocoODBC.lib"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="ODBC"
|
||||
Filter="">
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\Binder.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\ConnectionHandle.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\Connector.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\DataTypes.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\Diagnostics.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\EnvironmentHandle.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\Error.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\Extractor.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\Handle.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\ODBC.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\ODBC\ODBCColumn.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\ODBCException.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\ODBCStatementImpl.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\Parameter.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\Preparation.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\SessionImpl.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\Odbc\Utility.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\src\Binder.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ConnectionHandle.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Connector.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\DataTypes.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\EnvironmentHandle.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Extractor.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ODBCColumn.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ODBCException.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ODBCStatementImpl.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Parameter.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Preparation.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\SessionImpl.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Utility.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
28
Data/ODBC/ODBC_VS80.sln
Normal file
28
Data/ODBC/ODBC_VS80.sln
Normal file
@ -0,0 +1,28 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestSuite", "testsuite\TestSuite_VS80.vcproj", "{1B30A91B-375F-11DB-837B-00123FC423B5}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{1B29820D-375F-11DB-837B-00123FC423B5} = {1B29820D-375F-11DB-837B-00123FC423B5}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ODBC", "ODBC_VS80.vcproj", "{1B29820D-375F-11DB-837B-00123FC423B5}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
debug_shared|Win32 = debug_shared|Win32
|
||||
release_shared|Win32 = release_shared|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{1B30A91B-375F-11DB-837B-00123FC423B5}.debug_shared|Win32.ActiveCfg = debug_shared|Win32
|
||||
{1B30A91B-375F-11DB-837B-00123FC423B5}.debug_shared|Win32.Build.0 = debug_shared|Win32
|
||||
{1B30A91B-375F-11DB-837B-00123FC423B5}.release_shared|Win32.ActiveCfg = release_shared|Win32
|
||||
{1B30A91B-375F-11DB-837B-00123FC423B5}.release_shared|Win32.Build.0 = release_shared|Win32
|
||||
{1B29820D-375F-11DB-837B-00123FC423B5}.debug_shared|Win32.ActiveCfg = debug_shared|Win32
|
||||
{1B29820D-375F-11DB-837B-00123FC423B5}.debug_shared|Win32.Build.0 = debug_shared|Win32
|
||||
{1B29820D-375F-11DB-837B-00123FC423B5}.release_shared|Win32.ActiveCfg = release_shared|Win32
|
||||
{1B29820D-375F-11DB-837B-00123FC423B5}.release_shared|Win32.Build.0 = release_shared|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
341
Data/ODBC/ODBC_VS80.vcproj
Normal file
341
Data/ODBC/ODBC_VS80.vcproj
Normal file
@ -0,0 +1,341 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="ODBC"
|
||||
ProjectGUID="{1B29820D-375F-11DB-837B-00123FC423B5}"
|
||||
RootNamespace="SQLite"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="debug_shared|Win32"
|
||||
OutputDirectory="obj\debug_shared"
|
||||
IntermediateDirectory="obj\debug_shared"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".\include;.\src;..\..\Foundation\include;..\..\Data\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;POCO_DLL;ODBC_EXPORTS;NO_TCL;THREADSAFE"
|
||||
StringPooling="true"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="true"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundationd.lib PocoDatad.lib"
|
||||
OutputFile="..\..\bin\PocoODBCd.dll"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="..\..\lib"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="..\..\bin\PocoODBCd.pdb"
|
||||
SubSystem="1"
|
||||
OptimizeForWindows98="1"
|
||||
ImportLibrary="..\..\lib\PocoODBCd.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="release_shared|Win32"
|
||||
OutputDirectory="obj\release_shared"
|
||||
IntermediateDirectory="obj\release_shared"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories=".\include;.\src;..\..\Foundation\include;..\..\Data\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;POCO_DLL;ODBC_EXPORTS;NO_TCL;THREADSAFE"
|
||||
GeneratePreprocessedFile="0"
|
||||
KeepComments="false"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="false"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="0"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="PocoFoundation.lib PocoData.lib"
|
||||
OutputFile="..\..\bin\PocoODBC.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="..\..\lib"
|
||||
GenerateDebugInformation="false"
|
||||
ProgramDatabaseFile=""
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
OptimizeForWindows98="1"
|
||||
ImportLibrary="..\..\lib\PocoODBC.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="ODBC"
|
||||
>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\ODBC\Binder.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\ODBC\ConnectionHandle.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\ODBC\Connector.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\ODBC\DataTypes.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\ODBC\Diagnostics.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\ODBC\EnvironmentHandle.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\ODBC\Error.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\ODBC\Extractor.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\ODBC\Handle.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\ODBC\ODBC.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\ODBC\ODBCColumn.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\ODBC\ODBCException.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\ODBC\ODBCStatementImpl.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\ODBC\Parameter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\ODBC\Preparation.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\ODBC\SessionImpl.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\Data\ODBC\Utility.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\Binder.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ConnectionHandle.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Connector.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\DataTypes.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\EnvironmentHandle.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Extractor.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ODBCColumn.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ODBCException.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ODBCStatementImpl.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Parameter.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Preparation.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\SessionImpl.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Utility.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
280
Data/ODBC/include/Poco/Data/ODBC/Binder.h
Normal file
280
Data/ODBC/include/Poco/Data/ODBC/Binder.h
Normal file
@ -0,0 +1,280 @@
|
||||
//
|
||||
// Binder.h
|
||||
//
|
||||
// $Id: //poco/1.3/Data/ODBC/include/Poco/Data/ODBC/Binder.h#2 $
|
||||
//
|
||||
// Library: ODBC
|
||||
// Package: ODBC
|
||||
// Module: Binder
|
||||
//
|
||||
// Definition of the Binder class.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef DataConnectors_ODBC_Binder_INCLUDED
|
||||
#define DataConnectors_ODBC_Binder_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/AbstractBinder.h"
|
||||
#include "Poco/Data/BLOB.h"
|
||||
#include "Poco/Data/ODBC/Handle.h"
|
||||
#include "Poco/Data/ODBC/Parameter.h"
|
||||
#include "Poco/Data/ODBC/ODBCColumn.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Exception.h"
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <sqlext.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
class ODBC_API Binder: public Poco::Data::AbstractBinder
|
||||
/// Binds placeholders in the sql query to the provided values. Performs data types mapping.
|
||||
{
|
||||
public:
|
||||
enum ParameterBinding
|
||||
{
|
||||
PB_IMMEDIATE,
|
||||
PB_AT_EXEC
|
||||
};
|
||||
|
||||
Binder(const StatementHandle& rStmt,
|
||||
ParameterBinding dataBinding = PB_IMMEDIATE);
|
||||
/// Creates the Binder.
|
||||
|
||||
~Binder();
|
||||
/// Destroys the Binder.
|
||||
|
||||
void bind(std::size_t pos, const Poco::Int8& val);
|
||||
/// Binds an Int8.
|
||||
|
||||
void bind(std::size_t pos, const Poco::UInt8& val);
|
||||
/// Binds an UInt8.
|
||||
|
||||
void bind(std::size_t pos, const Poco::Int16& val);
|
||||
/// Binds an Int16.
|
||||
|
||||
void bind(std::size_t pos, const Poco::UInt16& val);
|
||||
/// Binds an UInt16.
|
||||
|
||||
void bind(std::size_t pos, const Poco::Int32& val);
|
||||
/// Binds an Int32.
|
||||
|
||||
void bind(std::size_t pos, const Poco::UInt32& val);
|
||||
/// Binds an UInt32.
|
||||
|
||||
void bind(std::size_t pos, const Poco::Int64& val);
|
||||
/// Binds an Int64.
|
||||
|
||||
void bind(std::size_t pos, const Poco::UInt64& val);
|
||||
/// Binds an UInt64.
|
||||
|
||||
void bind(std::size_t pos, const bool& val);
|
||||
/// Binds a boolean.
|
||||
|
||||
void bind(std::size_t pos, const float& val);
|
||||
/// Binds a float.
|
||||
|
||||
void bind(std::size_t pos, const double& val);
|
||||
/// Binds a double.
|
||||
|
||||
void bind(std::size_t pos, const char& val);
|
||||
/// Binds a single character.
|
||||
|
||||
void bind(std::size_t pos, const std::string& val);
|
||||
/// Binds a string.
|
||||
|
||||
void bind(std::size_t pos, const Poco::Data::BLOB& val);
|
||||
/// Binds a BLOB.
|
||||
|
||||
void setDataBinding(ParameterBinding binding);
|
||||
/// Set data binding type.
|
||||
|
||||
ParameterBinding getDataBinding() const;
|
||||
/// Return data binding type.
|
||||
|
||||
std::size_t dataSize(SQLPOINTER pAddr) const;
|
||||
/// Returns bound data size for parameter at specified position.
|
||||
|
||||
private:
|
||||
typedef std::map<SQLPOINTER, SQLLEN> SizeMap;
|
||||
|
||||
void bind(std::size_t pos, const char* const &pVal);
|
||||
/// Binds a const char ptr.
|
||||
/// This is a private no-op in this implementation
|
||||
/// due to security risk.
|
||||
|
||||
template <typename T>
|
||||
void bindImpl(std::size_t pos, T& val, SQLSMALLINT cDataType)
|
||||
{
|
||||
_lengthIndicator.push_back(0);
|
||||
_dataSize.insert(SizeMap::value_type((SQLPOINTER) &val, sizeof(T)));
|
||||
|
||||
int sqlDataType = Utility::sqlDataType(cDataType);
|
||||
|
||||
SQLUINTEGER columnSize = 0;
|
||||
SQLSMALLINT decimalDigits = 0;
|
||||
|
||||
// somewhat funky flow control, but not all
|
||||
// ODBC drivers will cooperate here
|
||||
try
|
||||
{
|
||||
Parameter p(_rStmt, pos);
|
||||
columnSize = (SQLUINTEGER) p.columnSize();
|
||||
decimalDigits = (SQLSMALLINT) p.decimalDigits();
|
||||
}
|
||||
catch (StatementException&)
|
||||
{
|
||||
try
|
||||
{
|
||||
ODBCColumn c(_rStmt, pos);
|
||||
columnSize = (SQLUINTEGER) c.length();
|
||||
decimalDigits = (SQLSMALLINT) c.precision();
|
||||
}
|
||||
catch (StatementException&) { }
|
||||
}
|
||||
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos,
|
||||
SQL_PARAM_INPUT,
|
||||
cDataType,
|
||||
sqlDataType,
|
||||
columnSize,
|
||||
decimalDigits,
|
||||
(SQLPOINTER) &val,
|
||||
0,
|
||||
_lengthIndicator.back())))
|
||||
{
|
||||
throw StatementException(_rStmt, "SQLBindParameter()");
|
||||
}
|
||||
}
|
||||
|
||||
const StatementHandle& _rStmt;
|
||||
std::vector<SQLLEN*> _lengthIndicator;
|
||||
SizeMap _dataSize;
|
||||
ParameterBinding _paramBinding;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline void Binder::bind(std::size_t pos, const Poco::Int8& val)
|
||||
{
|
||||
bindImpl(pos, val, SQL_C_STINYINT);
|
||||
}
|
||||
|
||||
|
||||
inline void Binder::bind(std::size_t pos, const Poco::UInt8& val)
|
||||
{
|
||||
bindImpl(pos, val, SQL_C_UTINYINT);
|
||||
}
|
||||
|
||||
|
||||
inline void Binder::bind(std::size_t pos, const Poco::Int16& val)
|
||||
{
|
||||
bindImpl(pos, val, SQL_C_SSHORT);
|
||||
}
|
||||
|
||||
|
||||
inline void Binder::bind(std::size_t pos, const Poco::UInt16& val)
|
||||
{
|
||||
bindImpl(pos, val, SQL_C_USHORT);
|
||||
}
|
||||
|
||||
|
||||
inline void Binder::bind(std::size_t pos, const Poco::UInt32& val)
|
||||
{
|
||||
bindImpl(pos, val, SQL_C_ULONG);
|
||||
}
|
||||
|
||||
|
||||
inline void Binder::bind(std::size_t pos, const Poco::Int32& val)
|
||||
{
|
||||
bindImpl(pos, val, SQL_C_SLONG);
|
||||
}
|
||||
|
||||
|
||||
inline void Binder::bind(std::size_t pos, const Poco::UInt64& val)
|
||||
{
|
||||
bindImpl(pos, val, SQL_C_UBIGINT);
|
||||
}
|
||||
|
||||
|
||||
inline void Binder::bind(std::size_t pos, const Poco::Int64& val)
|
||||
{
|
||||
bindImpl(pos, val, SQL_C_SBIGINT);
|
||||
}
|
||||
|
||||
|
||||
inline void Binder::bind(std::size_t pos, const float& val)
|
||||
{
|
||||
bindImpl(pos, val, SQL_C_FLOAT);
|
||||
}
|
||||
|
||||
|
||||
inline void Binder::bind(std::size_t pos, const double& val)
|
||||
{
|
||||
bindImpl(pos, val, SQL_C_DOUBLE);
|
||||
}
|
||||
|
||||
|
||||
inline void Binder::bind(std::size_t pos, const bool& val)
|
||||
{
|
||||
bindImpl(pos, val, Utility::boolDataType);
|
||||
}
|
||||
|
||||
|
||||
inline void Binder::bind(std::size_t pos, const char& val)
|
||||
{
|
||||
bindImpl(pos, val, SQL_C_STINYINT);
|
||||
}
|
||||
|
||||
|
||||
inline void Binder::setDataBinding(Binder::ParameterBinding binding)
|
||||
{
|
||||
_paramBinding = binding;
|
||||
}
|
||||
|
||||
|
||||
inline Binder::ParameterBinding Binder::getDataBinding() const
|
||||
{
|
||||
return _paramBinding;
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif // DataConnectors_ODBC_Binder_INCLUDED
|
118
Data/ODBC/include/Poco/Data/ODBC/ConnectionHandle.h
Normal file
118
Data/ODBC/include/Poco/Data/ODBC/ConnectionHandle.h
Normal file
@ -0,0 +1,118 @@
|
||||
//
|
||||
// ConnectionHandle.h
|
||||
//
|
||||
// $Id: //poco/1.3/Data/ODBC/include/Poco/Data/ODBC/ConnectionHandle.h#2 $
|
||||
//
|
||||
// Library: ODBC
|
||||
// Package: ODBC
|
||||
// Module: ConnectionHandle
|
||||
//
|
||||
// Definition of ConnectionHandle.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef ODBC_ConnectionHandle_INCLUDED
|
||||
#define ODBC_ConnectionHandle_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/ODBC/EnvironmentHandle.h"
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <sqltypes.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
class ODBC_API ConnectionHandle
|
||||
/// ODBC connection handle class
|
||||
{
|
||||
public:
|
||||
ConnectionHandle(EnvironmentHandle* pEnvironment = 0);
|
||||
/// Creates the ConnectionHandle.
|
||||
|
||||
~ConnectionHandle();
|
||||
/// Creates the ConnectionHandle.
|
||||
|
||||
operator const SQLHDBC& () const;
|
||||
/// Const conversion operator into reference to native type.
|
||||
|
||||
const SQLHDBC& handle() const;
|
||||
/// Returns const reference to handle;
|
||||
|
||||
private:
|
||||
operator SQLHDBC& ();
|
||||
/// Conversion operator into reference to native type.
|
||||
|
||||
SQLHDBC& handle();
|
||||
/// Returns reference to handle;
|
||||
|
||||
ConnectionHandle(const ConnectionHandle&);
|
||||
const ConnectionHandle& operator=(const ConnectionHandle&);
|
||||
|
||||
const EnvironmentHandle* _pEnvironment;
|
||||
SQLHDBC _hdbc;
|
||||
bool _ownsEnvironment;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline ConnectionHandle::operator const SQLHDBC& () const
|
||||
{
|
||||
return handle();
|
||||
}
|
||||
|
||||
|
||||
inline const SQLHDBC& ConnectionHandle::handle() const
|
||||
{
|
||||
return _hdbc;
|
||||
}
|
||||
|
||||
|
||||
inline ConnectionHandle::operator SQLHDBC& ()
|
||||
{
|
||||
return handle();
|
||||
}
|
||||
|
||||
|
||||
inline SQLHDBC& ConnectionHandle::handle()
|
||||
{
|
||||
return _hdbc;
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif
|
79
Data/ODBC/include/Poco/Data/ODBC/Connector.h
Normal file
79
Data/ODBC/include/Poco/Data/ODBC/Connector.h
Normal file
@ -0,0 +1,79 @@
|
||||
//
|
||||
// Connector.h
|
||||
//
|
||||
// $Id: //poco/1.3/Data/ODBC/include/Poco/Data/ODBC/Connector.h#1 $
|
||||
//
|
||||
// Library: ODBC
|
||||
// Package: ODBC
|
||||
// Module: Connector
|
||||
//
|
||||
// Definition of the Connector class.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef DataConnectors_ODBC_Connector_INCLUDED
|
||||
#define DataConnectors_ODBC_Connector_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/Connector.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
class ODBC_API Connector: public Poco::Data::Connector
|
||||
/// Connector instantiates SqLite SessionImpl objects.
|
||||
{
|
||||
public:
|
||||
static const std::string KEY;
|
||||
/// Keyword for creating ODBC sessions
|
||||
|
||||
Connector();
|
||||
/// Creates the Connector.
|
||||
|
||||
~Connector();
|
||||
/// Destroys the Connector.
|
||||
|
||||
Poco::AutoPtr<Poco::Data::SessionImpl> createSession(const std::string& connectionString);
|
||||
/// Creates a ODBC SessionImpl object and initializes it with the given connectionString.
|
||||
|
||||
static void registerConnector();
|
||||
/// Registers the Connector under the Keyword Connector::KEY at the Poco::Data::SessionFactory
|
||||
|
||||
static void unregisterConnector();
|
||||
/// Unregisters the Connector under the Keyword Connector::KEY at the Poco::Data::SessionFactory
|
||||
};
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif // DataConnectors_ODBC_Connector_INCLUDED
|
84
Data/ODBC/include/Poco/Data/ODBC/DataTypes.h
Normal file
84
Data/ODBC/include/Poco/Data/ODBC/DataTypes.h
Normal file
@ -0,0 +1,84 @@
|
||||
//
|
||||
// DataTypes.h
|
||||
//
|
||||
// $Id: //poco/1.3/Data/ODBC/include/Poco/Data/ODBC/DataTypes.h#2 $
|
||||
//
|
||||
// Library: ODBC
|
||||
// Package: ODBC
|
||||
// Module: DataTypes
|
||||
//
|
||||
// Definition of DataTypes.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef ODBC_DataTypes_INCLUDED
|
||||
#define ODBC_DataTypes_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include <map>
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <sqlext.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
class ODBC_API DataTypes
|
||||
/// C <==> SQL datatypes mapping utility class.
|
||||
{
|
||||
public:
|
||||
typedef std::map<int, int> DataTypeMap;
|
||||
typedef DataTypeMap::value_type ValueType;
|
||||
|
||||
DataTypes();
|
||||
/// Creates the DataTypes.
|
||||
|
||||
~DataTypes();
|
||||
/// Destroys the DataTypes.
|
||||
|
||||
int cDataType(int sqlDataType) const;
|
||||
/// Returns C data type corresponding to supplied SQL data type.
|
||||
|
||||
int sqlDataType(int cDataType) const;
|
||||
/// Returns SQL data type corresponding to supplied C data type.
|
||||
|
||||
private:
|
||||
DataTypeMap _cDataTypes;
|
||||
DataTypeMap _sqlDataTypes;
|
||||
};
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif
|
249
Data/ODBC/include/Poco/Data/ODBC/Diagnostics.h
Normal file
249
Data/ODBC/include/Poco/Data/ODBC/Diagnostics.h
Normal file
@ -0,0 +1,249 @@
|
||||
//
|
||||
// Diagnostics.h
|
||||
//
|
||||
// $Id: //poco/1.3/Data/ODBC/include/Poco/Data/ODBC/Diagnostics.h#2 $
|
||||
//
|
||||
// Library: ODBC
|
||||
// Package: ODBC
|
||||
// Module: Diagnostics
|
||||
//
|
||||
// Definition of Diagnostics.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef ODBC_Diagnostics_INCLUDED
|
||||
#define ODBC_Diagnostics_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include <vector>
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <sqlext.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
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 with corresponding
|
||||
/// fields are populated and the object is ready for querying on various diagnostic fields.
|
||||
{
|
||||
public:
|
||||
|
||||
static const unsigned int SQL_STATE_SIZE = SQL_SQLSTATE_SIZE + 1;
|
||||
static const unsigned int SQL_MESSAGE_LENGTH = SQL_MAX_MESSAGE_LENGTH + 1;
|
||||
static const unsigned int SQL_NAME_LENGTH = 128;
|
||||
static const std::string DATA_TRUNCATED;
|
||||
|
||||
struct DiagnosticFields
|
||||
{
|
||||
/// SQLGetDiagRec fields
|
||||
POCO_SQLCHAR _sqlState[SQL_STATE_SIZE];
|
||||
POCO_SQLCHAR _message[SQL_MESSAGE_LENGTH];
|
||||
SQLINTEGER _nativeError;
|
||||
};
|
||||
|
||||
typedef std::vector<DiagnosticFields> FieldVec;
|
||||
typedef typename FieldVec::const_iterator Iterator;
|
||||
|
||||
explicit Diagnostics(H& rHandle): _rHandle(rHandle)
|
||||
/// Creates and initializes the Diagnostics.
|
||||
{
|
||||
memset(_connectionName, 0, sizeof(_connectionName));
|
||||
memset(_serverName, 0, sizeof(_serverName));
|
||||
diagnostics();
|
||||
}
|
||||
|
||||
~Diagnostics()
|
||||
/// Destroys the Diagnostics.
|
||||
{
|
||||
}
|
||||
|
||||
std::string sqlState(int index) const
|
||||
/// Returns SQL state.
|
||||
{
|
||||
poco_assert (index < count());
|
||||
return std::string((char*) _fields[index]._sqlState);
|
||||
}
|
||||
|
||||
std::string message(int index) const
|
||||
/// Returns error message.
|
||||
{
|
||||
poco_assert (index < count());
|
||||
return std::string((char*) _fields[index]._message);
|
||||
}
|
||||
|
||||
long nativeError(int index) const
|
||||
/// Returns native error code.
|
||||
{
|
||||
poco_assert (index < count());
|
||||
return _fields[index]._nativeError;
|
||||
}
|
||||
|
||||
std::string connectionName() const
|
||||
/// 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.
|
||||
{
|
||||
return std::string((char*) _connectionName);
|
||||
}
|
||||
|
||||
std::string serverName() const
|
||||
/// Returns the server name.
|
||||
/// If the connection has not been established, server name defaults to NONE.
|
||||
/// If server name is not applicable for query context (such as when querying environment handle),
|
||||
/// connection name defaults to NOT_APPLICABLE.
|
||||
{
|
||||
return std::string((char*) _serverName);
|
||||
}
|
||||
|
||||
int count() const
|
||||
/// Returns the number of contained diagnostic records.
|
||||
{
|
||||
return (int) _fields.size();
|
||||
}
|
||||
|
||||
void reset()
|
||||
/// Resets the diagnostic fields container.
|
||||
{
|
||||
_fields.clear();
|
||||
}
|
||||
|
||||
const FieldVec& fields() const
|
||||
{
|
||||
return _fields;
|
||||
}
|
||||
|
||||
const Iterator begin() const
|
||||
{
|
||||
return _fields.begin();
|
||||
}
|
||||
|
||||
const Iterator end() const
|
||||
{
|
||||
return _fields.end();
|
||||
}
|
||||
|
||||
const Diagnostics& diagnostics()
|
||||
{
|
||||
DiagnosticFields df;
|
||||
SQLSMALLINT count = 1;
|
||||
SQLSMALLINT messageLength = 0;
|
||||
static const std::string& none = "None";
|
||||
static const std::string& na = "Not applicable";
|
||||
|
||||
reset();
|
||||
|
||||
while (!Utility::isError(SQLGetDiagRec(handleType,
|
||||
_rHandle,
|
||||
count,
|
||||
df._sqlState,
|
||||
&df._nativeError,
|
||||
df._message,
|
||||
SQL_MESSAGE_LENGTH,
|
||||
&messageLength)))
|
||||
{
|
||||
if (1 == count)
|
||||
{
|
||||
poco_assert (sizeof(_connectionName) > none.length());
|
||||
poco_assert (sizeof(_connectionName) > na.length());
|
||||
poco_assert (sizeof(_serverName) > none.length());
|
||||
poco_assert (sizeof(_serverName) > na.length());
|
||||
|
||||
// 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,
|
||||
_rHandle,
|
||||
count,
|
||||
SQL_DIAG_CONNECTION_NAME,
|
||||
_connectionName,
|
||||
SQL_NAME_LENGTH,
|
||||
&messageLength)))
|
||||
memcpy(_connectionName, none.c_str(), none.length());
|
||||
else if (0 == _connectionName[0])
|
||||
memcpy(_connectionName, na.c_str(), na.length());
|
||||
|
||||
if (Utility::isError(SQLGetDiagField(handleType,
|
||||
_rHandle,
|
||||
count,
|
||||
SQL_DIAG_SERVER_NAME,
|
||||
_serverName,
|
||||
SQL_NAME_LENGTH,
|
||||
&messageLength)))
|
||||
memcpy(_serverName, none.c_str(), none.length());
|
||||
else if (0 == _serverName[0])
|
||||
memcpy(_serverName, na.c_str(), na.length());
|
||||
}
|
||||
|
||||
_fields.push_back(df);
|
||||
|
||||
memset(df._sqlState, 0, SQL_STATE_SIZE);
|
||||
memset(df._message, 0, SQL_MESSAGE_LENGTH);
|
||||
df._nativeError = 0;
|
||||
|
||||
++count;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Diagnostics();
|
||||
|
||||
/// SQLGetDiagField fields
|
||||
POCO_SQLCHAR _connectionName[SQL_NAME_LENGTH];
|
||||
POCO_SQLCHAR _serverName[SQL_NAME_LENGTH];
|
||||
|
||||
/// Diagnostics container
|
||||
FieldVec _fields;
|
||||
|
||||
/// Context handle
|
||||
H& _rHandle;
|
||||
};
|
||||
|
||||
|
||||
typedef Diagnostics<SQLHENV, SQL_HANDLE_ENV> EnvironmentDiagnostics;
|
||||
typedef Diagnostics<SQLHDBC, SQL_HANDLE_DBC> ConnectionDiagnostics;
|
||||
typedef Diagnostics<SQLHSTMT, SQL_HANDLE_STMT> StatementDiagnostics;
|
||||
typedef Diagnostics<SQLHDESC, SQL_HANDLE_DESC> DescriptorDiagnostics;
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif
|
116
Data/ODBC/include/Poco/Data/ODBC/EnvironmentHandle.h
Normal file
116
Data/ODBC/include/Poco/Data/ODBC/EnvironmentHandle.h
Normal file
@ -0,0 +1,116 @@
|
||||
//
|
||||
// EnvironmentHandle.h
|
||||
//
|
||||
// $Id: //poco/1.3/Data/ODBC/include/Poco/Data/ODBC/EnvironmentHandle.h#2 $
|
||||
//
|
||||
// Library: ODBC
|
||||
// Package: ODBC
|
||||
// Module: EnvironmentHandle
|
||||
//
|
||||
// Definition of EnvironmentHandle.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef ODBC_EnvironmentHandle_INCLUDED
|
||||
#define ODBC_EnvironmentHandle_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <sqltypes.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
class ODBC_API EnvironmentHandle
|
||||
/// ODBC environment handle class
|
||||
{
|
||||
public:
|
||||
EnvironmentHandle();
|
||||
/// Creates the EnvironmentHandle.
|
||||
|
||||
~EnvironmentHandle();
|
||||
/// Destroys the EnvironmentHandle.
|
||||
|
||||
operator const SQLHENV& () const;
|
||||
/// Const conversion operator into reference to native type.
|
||||
|
||||
const SQLHENV& handle() const;
|
||||
/// Returns const reference to handle.
|
||||
|
||||
private:
|
||||
operator SQLHENV& ();
|
||||
/// Conversion operator into reference to native type.
|
||||
|
||||
SQLHENV& handle();
|
||||
/// Returns reference to handle.
|
||||
|
||||
EnvironmentHandle(const EnvironmentHandle&);
|
||||
const EnvironmentHandle& operator=(const EnvironmentHandle&);
|
||||
|
||||
SQLHENV _henv;
|
||||
bool _isOwner;
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// inlines
|
||||
///
|
||||
inline EnvironmentHandle::operator const SQLHENV& () const
|
||||
{
|
||||
return handle();
|
||||
}
|
||||
|
||||
|
||||
inline const SQLHENV& EnvironmentHandle::handle() const
|
||||
{
|
||||
return _henv;
|
||||
}
|
||||
|
||||
|
||||
inline EnvironmentHandle::operator SQLHENV& ()
|
||||
{
|
||||
return handle();
|
||||
}
|
||||
|
||||
|
||||
inline SQLHENV& EnvironmentHandle::handle()
|
||||
{
|
||||
return _henv;
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif
|
146
Data/ODBC/include/Poco/Data/ODBC/Error.h
Normal file
146
Data/ODBC/include/Poco/Data/ODBC/Error.h
Normal file
@ -0,0 +1,146 @@
|
||||
//
|
||||
// Error.h
|
||||
//
|
||||
// $Id: //poco/1.3/Data/ODBC/include/Poco/Data/ODBC/Error.h#2 $
|
||||
//
|
||||
// Library: ODBC
|
||||
// Package: ODBC
|
||||
// Module: Error
|
||||
//
|
||||
// Definition of Error.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef ODBC_Error_INCLUDED
|
||||
#define ODBC_Error_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Data/ODBC/Diagnostics.h"
|
||||
#include "Poco/Format.h"
|
||||
#include <vector>
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <sqlext.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
template <typename H, SQLSMALLINT handleType>
|
||||
class Error
|
||||
/// Class encapsulating ODBC diagnostic record collection. Collection is generated
|
||||
/// during construction. Class provides access and string generation for the collection
|
||||
/// as well as individual diagnostic records.
|
||||
{
|
||||
public:
|
||||
explicit Error(H handle) : _diagnostics(handle)
|
||||
/// Creates the Error.
|
||||
{
|
||||
}
|
||||
|
||||
~Error()
|
||||
/// Destroys the Error.
|
||||
{
|
||||
}
|
||||
|
||||
const Diagnostics<H, handleType>& diagnostics()
|
||||
/// Returns the associated diagnostics.
|
||||
{
|
||||
return _diagnostics;
|
||||
}
|
||||
|
||||
int count() const
|
||||
/// Returns the count of diagnostic records.
|
||||
{
|
||||
return (int) _diagnostics.count();
|
||||
}
|
||||
|
||||
std::string& toString(int index, std::string& str) const
|
||||
/// Generates the string for the diagnostic record.
|
||||
{
|
||||
if ((index < 0) || (index > (count() - 1)))
|
||||
return str;
|
||||
|
||||
std::string s;
|
||||
format(s,
|
||||
"===========================\n"
|
||||
"ODBC Diagnostic record #%d:\n"
|
||||
"===========================\n"
|
||||
"SQLSTATE = %s\nNative Error Code = %ld\n%s\n\n",
|
||||
index + 1,
|
||||
_diagnostics.sqlState(index),
|
||||
_diagnostics.nativeError(index),
|
||||
_diagnostics.message(index));
|
||||
|
||||
str.append(s);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string toString() const
|
||||
/// Generates the string for the diagnostic record collection.
|
||||
{
|
||||
std::string str;
|
||||
|
||||
format(str,
|
||||
"Connection:%s\nServer:%s\n",
|
||||
_diagnostics.connectionName(),
|
||||
_diagnostics.serverName());
|
||||
|
||||
std::string s;
|
||||
for (int i = 0; i < count(); ++i)
|
||||
{
|
||||
s.clear();
|
||||
str.append(toString(i, s));
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
private:
|
||||
Error();
|
||||
|
||||
Diagnostics<H, handleType> _diagnostics;
|
||||
};
|
||||
|
||||
|
||||
typedef Error<SQLHENV, SQL_HANDLE_ENV> EnvironmentError;
|
||||
typedef Error<SQLHDBC, SQL_HANDLE_DBC> ConnectionError;
|
||||
typedef Error<SQLHSTMT, SQL_HANDLE_STMT> StatementError;
|
||||
typedef Error<SQLHSTMT, SQL_HANDLE_DESC> DescriptorError;
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif
|
201
Data/ODBC/include/Poco/Data/ODBC/Extractor.h
Normal file
201
Data/ODBC/include/Poco/Data/ODBC/Extractor.h
Normal file
@ -0,0 +1,201 @@
|
||||
//
|
||||
// Extractor.h
|
||||
//
|
||||
// $Id: //poco/1.3/Data/ODBC/include/Poco/Data/ODBC/Extractor.h#2 $
|
||||
//
|
||||
// Library: ODBC
|
||||
// Package: ODBC
|
||||
// Module: Extractor
|
||||
//
|
||||
// Definition of the Extractor class.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef DataConnectors_ODBC_Extractor_INCLUDED
|
||||
#define DataConnectors_ODBC_Extractor_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/AbstractExtractor.h"
|
||||
#include "Poco/Data/ODBC/Preparation.h"
|
||||
#include "Poco/Data/ODBC/ODBCColumn.h"
|
||||
#include "Poco/Data/ODBC/Error.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include <map>
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <sqltypes.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
class ODBC_API Extractor: public Poco::Data::AbstractExtractor
|
||||
/// Extracts and converts data values from the result row returned by ODBC.
|
||||
/// If NULL is received, the incoming val value is not changed and false is returned
|
||||
{
|
||||
public:
|
||||
Extractor(const StatementHandle& rStmt,
|
||||
Preparation& rPreparation);
|
||||
/// Creates the Extractor.
|
||||
|
||||
~Extractor();
|
||||
/// Destroys the Extractor.
|
||||
|
||||
bool extract(std::size_t pos, Poco::Int8& val);
|
||||
/// Extracts an Int8.
|
||||
|
||||
bool extract(std::size_t pos, Poco::UInt8& val);
|
||||
/// Extracts an UInt8.
|
||||
|
||||
bool extract(std::size_t pos, Poco::Int16& val);
|
||||
/// Extracts an Int16.
|
||||
|
||||
bool extract(std::size_t pos, Poco::UInt16& val);
|
||||
/// Extracts an UInt16.
|
||||
|
||||
bool extract(std::size_t pos, Poco::Int32& val);
|
||||
/// Extracts an Int32.
|
||||
|
||||
bool extract(std::size_t pos, Poco::UInt32& val);
|
||||
/// Extracts an UInt32.
|
||||
|
||||
bool extract(std::size_t pos, Poco::Int64& val);
|
||||
/// Extracts an Int64.
|
||||
|
||||
bool extract(std::size_t pos, Poco::UInt64& val);
|
||||
/// Extracts an UInt64.
|
||||
|
||||
bool extract(std::size_t pos, bool& val);
|
||||
/// Extracts a boolean.
|
||||
|
||||
bool extract(std::size_t pos, float& val);
|
||||
/// Extracts a float.
|
||||
|
||||
bool extract(std::size_t pos, double& val);
|
||||
/// Extracts a double.
|
||||
|
||||
bool extract(std::size_t pos, char& val);
|
||||
/// Extracts a single character.
|
||||
|
||||
bool extract(std::size_t pos, std::string& val);
|
||||
/// Extracts a string.
|
||||
|
||||
bool extract(std::size_t pos, Poco::Data::BLOB& val);
|
||||
/// Extracts a BLOB.
|
||||
|
||||
bool extract(std::size_t pos, Poco::Any& val);
|
||||
/// Extracts an Any.
|
||||
|
||||
void setDataExtraction(Preparation::DataExtraction ext);
|
||||
/// Set data extraction mode.
|
||||
|
||||
Preparation::DataExtraction getDataExtraction() const;
|
||||
/// Returns data extraction mode.
|
||||
|
||||
private:
|
||||
static const int CHUNK_SIZE = 1024;
|
||||
/// Amount of data retrieved in one SQLGetData() request when doing manual extract.
|
||||
|
||||
static const std::string FLD_SIZE_EXCEEDED_FMT;
|
||||
/// String format for the exception message when the field size is exceeded.
|
||||
|
||||
void checkDataSize(std::size_t size);
|
||||
/// This check is only performed for bound data
|
||||
/// retrieval from variable length columns.
|
||||
/// The reason for this check is to ensure we can
|
||||
/// accept the value ODBC driver is supplying
|
||||
/// (i.e. the bound buffer is large enough to receive
|
||||
/// the returned value)
|
||||
|
||||
template<typename T>
|
||||
bool extractBoundImpl(std::size_t pos, T& val)
|
||||
{
|
||||
poco_assert (typeid(T) == _rPreparation[pos].type());
|
||||
val = *AnyCast<T>(&_rPreparation[pos]);
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool extractManualImpl(std::size_t pos, T& val, SQLSMALLINT cType)
|
||||
{
|
||||
SQLRETURN rc = 0;
|
||||
SQLLEN len = 0;
|
||||
T value = (T) 0;
|
||||
|
||||
rc = SQLGetData(_rStmt,
|
||||
(SQLUSMALLINT) pos,
|
||||
cType, //C data type
|
||||
&value, //returned value
|
||||
0, //buffer length (ignored)
|
||||
&len); //length indicator
|
||||
|
||||
//for fixed-length data, buffer must be large enough
|
||||
//otherwise, driver may write past the end
|
||||
poco_assert_dbg (len <= sizeof(T));
|
||||
|
||||
if (Utility::isError(rc))
|
||||
throw StatementException(_rStmt, "SQLGetData()");
|
||||
|
||||
if (SQL_NULL_DATA == len) val = (T) 0;
|
||||
else val = value;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const StatementHandle& _rStmt;
|
||||
Preparation& _rPreparation;
|
||||
Preparation::DataExtraction _dataExtraction;
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// inlines
|
||||
///
|
||||
|
||||
|
||||
inline void Extractor::setDataExtraction(Preparation::DataExtraction ext)
|
||||
{
|
||||
_rPreparation.setDataExtraction(_dataExtraction = ext);
|
||||
}
|
||||
|
||||
|
||||
inline Preparation::DataExtraction Extractor::getDataExtraction() const
|
||||
{
|
||||
return _dataExtraction;
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif // DataConnectors_ODBC_Extractor_INCLUDED
|
126
Data/ODBC/include/Poco/Data/ODBC/Handle.h
Normal file
126
Data/ODBC/include/Poco/Data/ODBC/Handle.h
Normal file
@ -0,0 +1,126 @@
|
||||
//
|
||||
// Handle.h
|
||||
//
|
||||
// $Id: //poco/1.3/Data/ODBC/include/Poco/Data/ODBC/Handle.h#2 $
|
||||
//
|
||||
// Library: ODBC
|
||||
// Package: ODBC
|
||||
// Module: Handle
|
||||
//
|
||||
// Definition of Handle.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef ODBC_Handle_INCLUDED
|
||||
#define ODBC_Handle_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/ODBC/EnvironmentHandle.h"
|
||||
#include "Poco/Data/ODBC/ConnectionHandle.h"
|
||||
#include "Poco/Data/ODBC/ODBCException.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <sqltypes.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
template <typename H, SQLSMALLINT handleType>
|
||||
class Handle
|
||||
/// ODBC handle class template
|
||||
{
|
||||
public:
|
||||
Handle(const ConnectionHandle& rConnection):
|
||||
_rConnection(rConnection),
|
||||
_handle(0)
|
||||
/// Creates the Handle.
|
||||
{
|
||||
if (Utility::isError(SQLAllocHandle(handleType,
|
||||
_rConnection,
|
||||
&_handle)))
|
||||
{
|
||||
throw ODBCException("Could not allocate statement handle.");
|
||||
}
|
||||
}
|
||||
|
||||
~Handle()
|
||||
/// Destroys the Handle.
|
||||
{
|
||||
SQLRETURN rc = SQLFreeHandle(handleType, _handle);
|
||||
poco_assert (!Utility::isError(rc));
|
||||
}
|
||||
|
||||
operator const H& () const
|
||||
/// Const conversion operator into reference to native type.
|
||||
{
|
||||
return handle();
|
||||
}
|
||||
|
||||
const H& handle() const
|
||||
/// Returns const reference to native type.
|
||||
{
|
||||
return _handle;
|
||||
}
|
||||
|
||||
private:
|
||||
Handle(const Handle&);
|
||||
const Handle& operator=(const Handle&);
|
||||
|
||||
operator H& ()
|
||||
/// Conversion operator into reference to native type.
|
||||
{
|
||||
return handle();
|
||||
}
|
||||
|
||||
H& handle()
|
||||
/// Returns reference to native type.
|
||||
{
|
||||
return _handle;
|
||||
}
|
||||
|
||||
const ConnectionHandle& _rConnection;
|
||||
H _handle;
|
||||
|
||||
friend class ODBCStatementImpl;
|
||||
};
|
||||
|
||||
|
||||
typedef Handle<SQLHSTMT, SQL_HANDLE_STMT> StatementHandle;
|
||||
typedef Handle<SQLHDESC, SQL_HANDLE_DESC> DescriptorHandle;
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif
|
95
Data/ODBC/include/Poco/Data/ODBC/ODBC.h
Normal file
95
Data/ODBC/include/Poco/Data/ODBC/ODBC.h
Normal file
@ -0,0 +1,95 @@
|
||||
//
|
||||
// ODBC.h
|
||||
//
|
||||
// $Id: //poco/1.3/Data/ODBC/include/Poco/Data/ODBC/ODBC.h#2 $
|
||||
//
|
||||
// Library: ODBC
|
||||
// Package: ODBC
|
||||
// Module: ODBC
|
||||
//
|
||||
// Basic definitions for the Poco ODBC library.
|
||||
// This file must be the first file included by every other ODBC
|
||||
// header file.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef ODBC_ODBC_INCLUDED
|
||||
#define ODBC_ODBC_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
|
||||
|
||||
//
|
||||
// The following block is the standard way of creating macros which make exporting
|
||||
// from a DLL simpler. All files within this DLL are compiled with the ODBC_EXPORTS
|
||||
// symbol defined on the command line. this symbol should not be defined on any project
|
||||
// that uses this DLL. This way any other project whose source files include this file see
|
||||
// ODBC_API functions as being imported from a DLL, wheras this DLL sees symbols
|
||||
// defined with this macro as being exported.
|
||||
//
|
||||
#if defined(_WIN32) && defined(POCO_DLL)
|
||||
#if defined(ODBC_EXPORTS)
|
||||
#define ODBC_API __declspec(dllexport)
|
||||
#else
|
||||
#define ODBC_API __declspec(dllimport)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(ODBC_API)
|
||||
#define ODBC_API
|
||||
#endif
|
||||
|
||||
|
||||
#define POCO_SQLCHAR SQLCHAR
|
||||
|
||||
|
||||
//
|
||||
// Automatically link Data library.
|
||||
//
|
||||
#if defined(_MSC_VER)
|
||||
#if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(ODBC_EXPORTS)
|
||||
#if defined(POCO_DLL)
|
||||
#if defined(_DEBUG)
|
||||
#pragma comment(lib, "PocoODBCd.lib")
|
||||
#else
|
||||
#pragma comment(lib, "PocoODBC.lib")
|
||||
#endif
|
||||
#else
|
||||
#if defined(_DEBUG)
|
||||
#pragma comment(lib, "PocoODBCmtd.lib")
|
||||
#else
|
||||
#pragma comment(lib, "PocoODBCmt.lib")
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#endif // ODBC_ODBC_INCLUDED
|
111
Data/ODBC/include/Poco/Data/ODBC/ODBCColumn.h
Normal file
111
Data/ODBC/include/Poco/Data/ODBC/ODBCColumn.h
Normal file
@ -0,0 +1,111 @@
|
||||
//
|
||||
// ODBCColumn.h
|
||||
//
|
||||
// $Id: //poco/1.3/Data/ODBC/include/Poco/Data/ODBC/ODBCColumn.h#2 $
|
||||
//
|
||||
// Library: ODBC
|
||||
// Package: ODBC
|
||||
// Module: ODBCColumn
|
||||
//
|
||||
// Definition of ODBCColumn.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef ODBC_ODBCColumn_INCLUDED
|
||||
#define ODBC_ODBCColumn_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/ODBC/Error.h"
|
||||
#include "Poco/Data/ODBC/Handle.h"
|
||||
#include "Poco/Data/ODBC/ODBCException.h"
|
||||
#include "Poco/Data/MetaColumn.h"
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <sqlext.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
class ODBC_API ODBCColumn: public MetaColumn
|
||||
{
|
||||
public:
|
||||
explicit ODBCColumn(const StatementHandle& rStmt, std::size_t position);
|
||||
/// Creates the ODBCColumn.
|
||||
|
||||
~ODBCColumn();
|
||||
/// Destroys the ODBCColumn.
|
||||
|
||||
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.
|
||||
/// This information is returned from the SQL_DESC_LENGTH record field of the IRD.
|
||||
|
||||
private:
|
||||
ODBCColumn();
|
||||
|
||||
static const int NAME_BUFFER_LENGTH = 2048;
|
||||
|
||||
struct ColumnDescription
|
||||
{
|
||||
POCO_SQLCHAR name[NAME_BUFFER_LENGTH];
|
||||
SQLSMALLINT nameBufferLength;
|
||||
SQLSMALLINT dataType;
|
||||
SQLULEN size;
|
||||
SQLSMALLINT decimalDigits;
|
||||
SQLSMALLINT isNullable;
|
||||
};
|
||||
|
||||
void init();
|
||||
void getDescription();
|
||||
|
||||
Poco::Int32 _dataLength;
|
||||
const StatementHandle& _rStmt;
|
||||
ColumnDescription _columnDesc;
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// inlines
|
||||
///
|
||||
inline std::size_t ODBCColumn::dataLength() const
|
||||
{
|
||||
return _dataLength;
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif
|
152
Data/ODBC/include/Poco/Data/ODBC/ODBCException.h
Normal file
152
Data/ODBC/include/Poco/Data/ODBC/ODBCException.h
Normal file
@ -0,0 +1,152 @@
|
||||
//
|
||||
// ODBCException.h
|
||||
//
|
||||
// $Id: //poco/1.3/Data/ODBC/include/Poco/Data/ODBC/ODBCException.h#2 $
|
||||
//
|
||||
// Library: ODBC
|
||||
// Package: ODBC
|
||||
// Module: ODBCException
|
||||
//
|
||||
// Definition of ODBCException.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef ODBC_ODBCException_INCLUDED
|
||||
#define ODBC_ODBCException_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Data/ODBC/Diagnostics.h"
|
||||
#include "Poco/Data/ODBC/Error.h"
|
||||
#include "Poco/Data/DataException.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
POCO_DECLARE_EXCEPTION(ODBC_API, ODBCException, Poco::Data::DataException)
|
||||
POCO_DECLARE_EXCEPTION(ODBC_API, InsufficientStorageException, ODBCException)
|
||||
POCO_DECLARE_EXCEPTION(ODBC_API, UnknownDataLengthException, ODBCException)
|
||||
POCO_DECLARE_EXCEPTION(ODBC_API, DataTruncatedException, ODBCException)
|
||||
|
||||
|
||||
template <class H, SQLSMALLINT handleType>
|
||||
class HandleException: public ODBCException
|
||||
{
|
||||
public:
|
||||
HandleException(const H& handle): _error(handle)
|
||||
{
|
||||
}
|
||||
|
||||
HandleException(const H& handle, const std::string& msg):
|
||||
ODBCException(msg),
|
||||
_error(handle)
|
||||
{
|
||||
}
|
||||
|
||||
HandleException(const H& handle, const std::string& msg, const std::string& arg):
|
||||
ODBCException(msg, arg),
|
||||
_error(handle)
|
||||
{
|
||||
}
|
||||
|
||||
HandleException(const H& handle, const std::string& msg, const Poco::Exception& exc):
|
||||
ODBCException(msg, exc),
|
||||
_error(handle)
|
||||
{
|
||||
}
|
||||
|
||||
HandleException(const HandleException& exc):
|
||||
ODBCException(exc),
|
||||
_error(exc._error)
|
||||
{
|
||||
}
|
||||
|
||||
~HandleException() throw()
|
||||
{
|
||||
}
|
||||
|
||||
HandleException& operator = (const HandleException& exc)
|
||||
{
|
||||
HandleException::operator = (exc);
|
||||
return *this;
|
||||
}
|
||||
|
||||
const char* name() const throw()
|
||||
{
|
||||
|
||||
return "ODBC handle exception";
|
||||
}
|
||||
|
||||
const char* className() const throw()
|
||||
{
|
||||
return typeid(*this).name();
|
||||
}
|
||||
|
||||
Poco::Exception* clone() const
|
||||
{
|
||||
return new HandleException(*this);
|
||||
}
|
||||
|
||||
void rethrow() const
|
||||
{
|
||||
throw *this;
|
||||
}
|
||||
|
||||
const Diagnostics<H, handleType>& diagnostics()
|
||||
{
|
||||
return _error.diagnostics();
|
||||
}
|
||||
|
||||
std::string toString() const
|
||||
{
|
||||
std::stringstream os;
|
||||
os << "ODBC Error: " << what() << std::endl
|
||||
<< "===================" << std::endl
|
||||
<< _error.toString() << std::endl ;
|
||||
return os.str();
|
||||
}
|
||||
|
||||
private:
|
||||
Error<H, handleType> _error;
|
||||
};
|
||||
|
||||
|
||||
typedef HandleException<SQLHENV, SQL_HANDLE_ENV> EnvironmentException;
|
||||
typedef HandleException<SQLHDBC, SQL_HANDLE_DBC> ConnectionException;
|
||||
typedef HandleException<SQLHSTMT, SQL_HANDLE_STMT> StatementException;
|
||||
typedef HandleException<SQLHDESC, SQL_HANDLE_DESC> DescriptorException;
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif
|
193
Data/ODBC/include/Poco/Data/ODBC/ODBCStatementImpl.h
Normal file
193
Data/ODBC/include/Poco/Data/ODBC/ODBCStatementImpl.h
Normal file
@ -0,0 +1,193 @@
|
||||
//
|
||||
// ODBCStatementImpl.h
|
||||
//
|
||||
// $Id: //poco/1.3/Data/ODBC/include/Poco/Data/ODBC/ODBCStatementImpl.h#3 $
|
||||
//
|
||||
// Library: ODBC
|
||||
// Package: ODBC
|
||||
// Module: ODBCStatementImpl
|
||||
//
|
||||
// Definition of the ODBCStatementImpl class.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef DataConnectors_ODBC_ODBCStatementImpl_INCLUDED
|
||||
#define DataConnectors_ODBC_ODBCStatementImpl_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/ODBC/SessionImpl.h"
|
||||
#include "Poco/Data/ODBC/Binder.h"
|
||||
#include "Poco/Data/ODBC/Extractor.h"
|
||||
#include "Poco/Data/ODBC/Preparation.h"
|
||||
#include "Poco/Data/ODBC/ODBCColumn.h"
|
||||
#include "Poco/Data/StatementImpl.h"
|
||||
#include "Poco/Data/Column.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
#include "Poco/Format.h"
|
||||
#include <sstream>
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <sqltypes.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
class ODBC_API ODBCStatementImpl: public Poco::Data::StatementImpl
|
||||
/// Implements statement functionality needed for ODBC
|
||||
{
|
||||
public:
|
||||
typedef std::vector<ODBCColumn*> ColumnPtrVec;
|
||||
|
||||
ODBCStatementImpl(SessionImpl& rSession);
|
||||
/// Creates the ODBCStatementImpl.
|
||||
|
||||
~ODBCStatementImpl();
|
||||
/// Destroys the ODBCStatementImpl.
|
||||
|
||||
protected:
|
||||
Poco::UInt32 columnsReturned() const;
|
||||
/// Returns number of columns returned by query.
|
||||
|
||||
const MetaColumn& metaColumn(Poco::UInt32 pos) const;
|
||||
/// Returns column meta data.
|
||||
|
||||
bool hasNext();
|
||||
/// Returns true if a call to next() will return data.
|
||||
|
||||
void next();
|
||||
/// Retrieves the next row from the resultset.
|
||||
/// Will throw, if the resultset is empty.
|
||||
|
||||
bool canBind() const;
|
||||
/// Returns true if a valid statement is set and we can bind.
|
||||
|
||||
void compileImpl();
|
||||
/// Compiles the statement, doesn't bind yet
|
||||
|
||||
void bindImpl();
|
||||
/// Binds parameters
|
||||
|
||||
AbstractExtractor& extractor();
|
||||
/// Returns the concrete extractor used by the statement.
|
||||
|
||||
AbstractBinder& binder();
|
||||
/// Returns the concrete binder used by the statement.
|
||||
|
||||
std::string nativeSQL();
|
||||
/// Returns the SQL string as modified by the driver.
|
||||
|
||||
private:
|
||||
typedef Poco::Data::AbstractBindingVec Bindings;
|
||||
typedef Poco::Data::AbstractExtractionVec Extractions;
|
||||
|
||||
static const std::string INVALID_CURSOR_STATE;
|
||||
|
||||
void clear();
|
||||
/// Closes the cursor and resets indicator variables.
|
||||
|
||||
bool hasData() const;
|
||||
/// Returns true if statement returns data.
|
||||
|
||||
bool nextRowReady() const;
|
||||
/// 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.
|
||||
|
||||
void fillColumns();
|
||||
void checkError(SQLRETURN rc, const std::string& msg="");
|
||||
|
||||
SessionImpl& _rSession;
|
||||
const StatementHandle _stmt;
|
||||
Poco::SharedPtr<Preparation> _pPreparation;
|
||||
Poco::SharedPtr<Binder> _pBinder;
|
||||
Poco::SharedPtr<Extractor> _pExtractor;
|
||||
bool _stepCalled;
|
||||
int _nextResponse;
|
||||
ColumnPtrVec _columnPtrs;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline AbstractExtractor& ODBCStatementImpl::extractor()
|
||||
{
|
||||
poco_assert_dbg (_pExtractor);
|
||||
return *_pExtractor;
|
||||
}
|
||||
|
||||
|
||||
inline AbstractBinder& ODBCStatementImpl::binder()
|
||||
{
|
||||
poco_assert_dbg (_pBinder);
|
||||
return *_pBinder;
|
||||
}
|
||||
|
||||
|
||||
inline Poco::UInt32 ODBCStatementImpl::columnsReturned() const
|
||||
{
|
||||
poco_assert_dbg (_pPreparation);
|
||||
return (Poco::UInt32) _pPreparation->columns();
|
||||
}
|
||||
|
||||
|
||||
inline bool ODBCStatementImpl::hasData() const
|
||||
{
|
||||
poco_assert_dbg (_pPreparation);
|
||||
return (_pPreparation->columns() > 0);
|
||||
}
|
||||
|
||||
|
||||
inline bool ODBCStatementImpl::nextRowReady() const
|
||||
{
|
||||
return (!Utility::isError(_nextResponse));
|
||||
}
|
||||
|
||||
|
||||
inline const MetaColumn& ODBCStatementImpl::metaColumn(Poco::UInt32 pos) const
|
||||
{
|
||||
std::size_t sz = _columnPtrs.size();
|
||||
|
||||
if (0 == sz || pos > sz - 1)
|
||||
throw InvalidAccessException(format("Invalid column number: %u", pos));
|
||||
|
||||
return *_columnPtrs[pos];
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif // DataConnectors_ODBC_ODBCStatementImpl_INCLUDED
|
135
Data/ODBC/include/Poco/Data/ODBC/Parameter.h
Normal file
135
Data/ODBC/include/Poco/Data/ODBC/Parameter.h
Normal file
@ -0,0 +1,135 @@
|
||||
//
|
||||
// Parameter.h
|
||||
//
|
||||
// $Id: //poco/1.3/Data/ODBC/include/Poco/Data/ODBC/Parameter.h#2 $
|
||||
//
|
||||
// Library: ODBC
|
||||
// Package: ODBC
|
||||
// Module: Parameter
|
||||
//
|
||||
// Definition of Parameter.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef ODBC_Parameter_INCLUDED
|
||||
#define ODBC_Parameter_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/ODBC/Handle.h"
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <sqlext.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
class ODBC_API Parameter
|
||||
{
|
||||
public:
|
||||
explicit Parameter(const StatementHandle& rStmt, std::size_t colNum);
|
||||
/// Creates the Parameter.
|
||||
|
||||
~Parameter();
|
||||
/// Destroys the Parameter.
|
||||
|
||||
std::size_t number() const;
|
||||
/// Returns the column number.
|
||||
|
||||
std::size_t dataType() const;
|
||||
/// Returns the SQL data type.
|
||||
|
||||
std::size_t columnSize() const;
|
||||
/// 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
|
||||
/// of the corresponding parameter as defined by the data source.
|
||||
|
||||
bool isNullable() const;
|
||||
/// Returns true if column allows null values, false otherwise.
|
||||
|
||||
private:
|
||||
Parameter();
|
||||
|
||||
static const int BUFFER_LENGTH = 2048;
|
||||
|
||||
void init();
|
||||
|
||||
SQLSMALLINT _dataType;
|
||||
SQLULEN _columnSize;
|
||||
SQLSMALLINT _decimalDigits;
|
||||
SQLSMALLINT _isNullable;
|
||||
|
||||
const StatementHandle& _rStmt;
|
||||
std::size_t _number;
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// inlines
|
||||
///
|
||||
inline std::size_t Parameter::number() const
|
||||
{
|
||||
return _number;
|
||||
}
|
||||
|
||||
|
||||
inline std::size_t Parameter::dataType() const
|
||||
{
|
||||
return _dataType;
|
||||
}
|
||||
|
||||
|
||||
inline std::size_t Parameter::columnSize() const
|
||||
{
|
||||
return _columnSize;
|
||||
}
|
||||
|
||||
|
||||
inline std::size_t Parameter::decimalDigits() const
|
||||
{
|
||||
return _decimalDigits;
|
||||
}
|
||||
|
||||
|
||||
inline bool Parameter::isNullable() const
|
||||
{
|
||||
return SQL_NULLABLE == _isNullable;
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif
|
363
Data/ODBC/include/Poco/Data/ODBC/Preparation.h
Normal file
363
Data/ODBC/include/Poco/Data/ODBC/Preparation.h
Normal file
@ -0,0 +1,363 @@
|
||||
//
|
||||
// Preparation.h
|
||||
//
|
||||
// $Id: //poco/1.3/Data/ODBC/include/Poco/Data/ODBC/Preparation.h#2 $
|
||||
//
|
||||
// Library: Data
|
||||
// Package: DataCore
|
||||
// Module: Preparation
|
||||
//
|
||||
// Definition of the Preparation class.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef DataConnectors_ODBC_Preparation_INCLUDED
|
||||
#define DataConnectors_ODBC_Preparation_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/ODBC/Handle.h"
|
||||
#include "Poco/Data/ODBC/ODBCColumn.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Data/AbstractPreparation.h"
|
||||
#include "Poco/Data/BLOB.h"
|
||||
#include "Poco/Any.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
#include <vector>
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <sqlext.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
class BLOB;
|
||||
|
||||
|
||||
class ODBC_API Preparation : public AbstractPreparation
|
||||
/// Class used for database preparation where we first have to register all data types
|
||||
/// with respective memory output locations before extracting data.
|
||||
/// Extraction works in two-phases: first prepare is called once, then extract n-times.
|
||||
/// In ODBC, SQLBindCol/SQLFetch is the preferred method of data retrieval (SQLGetData is available,
|
||||
/// however with numerous driver implementation dependent limitations). In order to fit this functionality
|
||||
/// into Poco DataConnectors framework, every ODBC SQL statement instantiates its own Preparation object.
|
||||
/// This is done once per statement execution (from StatementImpl::bindImpl()).
|
||||
///
|
||||
/// Preparation object is used to :
|
||||
///
|
||||
/// 1) Prepare SQL statement.
|
||||
/// 2) Provide and contain the memory locations where retrieved values are placed during recordset iteration.
|
||||
/// 3) Keep count of returned number of columns with their respective datatypes and sizes.
|
||||
///
|
||||
/// Notes:
|
||||
///
|
||||
/// - Value datatypes in this interface prepare() calls serve only for the purpose of type distinction.
|
||||
/// - Preparation keeps its own std::vector<Any> buffer for fetched data to be later retrieved by Extractor.
|
||||
/// - prepare() methods should not be called when extraction mode is DE_MANUAL
|
||||
///
|
||||
{
|
||||
public:
|
||||
enum DataExtraction
|
||||
{
|
||||
DE_MANUAL,
|
||||
DE_BOUND
|
||||
};
|
||||
|
||||
Preparation(const StatementHandle& rStmt,
|
||||
const std::string& statement,
|
||||
std::size_t maxFieldSize,
|
||||
DataExtraction dataExtraction = DE_BOUND);
|
||||
/// Creates the Preparation.
|
||||
|
||||
~Preparation();
|
||||
/// Destroys the Preparation.
|
||||
|
||||
void prepare(std::size_t pos, Poco::Int8);
|
||||
/// Prepares an Int8.
|
||||
|
||||
void prepare(std::size_t pos, Poco::UInt8);
|
||||
/// Prepares an UInt8.
|
||||
|
||||
void prepare(std::size_t pos, Poco::Int16);
|
||||
/// Prepares an Int16.
|
||||
|
||||
void prepare(std::size_t pos, Poco::UInt16);
|
||||
/// Prepares an UInt16.
|
||||
|
||||
void prepare(std::size_t pos, Poco::Int32);
|
||||
/// Prepares an Int32.
|
||||
|
||||
void prepare(std::size_t pos, Poco::UInt32);
|
||||
/// Prepares an UInt32.
|
||||
|
||||
void prepare(std::size_t pos, Poco::Int64);
|
||||
/// Prepares an Int64.
|
||||
|
||||
void prepare(std::size_t pos, Poco::UInt64);
|
||||
/// Prepares an UInt64.
|
||||
|
||||
void prepare(std::size_t pos, bool);
|
||||
/// Prepares a boolean.
|
||||
|
||||
void prepare(std::size_t pos, float);
|
||||
/// Prepares a float.
|
||||
|
||||
void prepare(std::size_t pos, double);
|
||||
/// Prepares a double.
|
||||
|
||||
void prepare(std::size_t pos, char);
|
||||
/// Prepares a single character.
|
||||
|
||||
void prepare(std::size_t pos, const std::string&);
|
||||
/// Prepares a string.
|
||||
|
||||
void prepare(std::size_t pos, const Poco::Data::BLOB&);
|
||||
/// Prepares a BLOB.
|
||||
|
||||
void prepare(std::size_t pos, const Poco::Any&);
|
||||
/// Prepares an Any.
|
||||
|
||||
std::size_t columns() const;
|
||||
/// Returns the number of columns.
|
||||
|
||||
Poco::Any& operator [] (std::size_t pos);
|
||||
/// Returns reference to column data.
|
||||
|
||||
void setMaxFieldSize(std::size_t size);
|
||||
/// Sets maximum supported field size.
|
||||
|
||||
std::size_t getMaxFieldSize() const;
|
||||
// Returns maximum supported field size.
|
||||
|
||||
std::size_t maxDataSize(std::size_t pos) const;
|
||||
/// Returns max supported size for column at position pos.
|
||||
/// Returned length for variable length fields is the one
|
||||
/// supported by this implementation, not the underlying DB.
|
||||
|
||||
std::size_t actualDataSize(std::size_t pos) const;
|
||||
/// Returns the returned length. This is usually
|
||||
/// equal to the column size, except for variable length fields
|
||||
/// (BLOB and variable length strings).
|
||||
|
||||
void setDataExtraction(DataExtraction ext);
|
||||
/// Set data extraction mode.
|
||||
|
||||
DataExtraction getDataExtraction() const;
|
||||
/// Returns data extraction mode.
|
||||
|
||||
private:
|
||||
template <typename T>
|
||||
void preparePOD(std::size_t pos, SQLSMALLINT valueType)
|
||||
{
|
||||
poco_assert (DE_BOUND == _dataExtraction);
|
||||
poco_assert (pos > 0 && pos <= _pValues.size());
|
||||
|
||||
std::size_t dataSize = sizeof(T);
|
||||
|
||||
_pValues[pos-1] = new Poco::Any(T());
|
||||
_pLengths[pos-1] = new SQLLEN;
|
||||
*_pLengths[pos-1] = 0;
|
||||
|
||||
T* pVal = AnyCast<T>(_pValues[pos-1]);
|
||||
|
||||
poco_assert_dbg (pVal);
|
||||
|
||||
if (Utility::isError(SQLBindCol(_rStmt,
|
||||
(SQLUSMALLINT) pos,
|
||||
valueType,
|
||||
(SQLPOINTER) pVal,
|
||||
(SQLINTEGER) dataSize,
|
||||
_pLengths[pos-1])))
|
||||
{
|
||||
throw StatementException(_rStmt, "SQLBindCol()");
|
||||
}
|
||||
}
|
||||
|
||||
void prepareRaw(std::size_t pos, SQLSMALLINT valueType, std::size_t size);
|
||||
|
||||
const StatementHandle& _rStmt;
|
||||
std::vector<Poco::Any*> _pValues;
|
||||
std::vector<SQLLEN*> _pLengths;
|
||||
std::size_t _maxFieldSize;
|
||||
DataExtraction _dataExtraction;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline void Preparation::prepare(std::size_t pos, Poco::Int8)
|
||||
{
|
||||
preparePOD<Poco::Int8>(pos, SQL_C_STINYINT);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, Poco::UInt8)
|
||||
{
|
||||
preparePOD<Poco::UInt8>(pos, SQL_C_UTINYINT);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, Poco::Int16)
|
||||
{
|
||||
preparePOD<Poco::Int16>(pos, SQL_C_SSHORT);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, Poco::UInt16)
|
||||
{
|
||||
preparePOD<Poco::UInt16>(pos, SQL_C_USHORT);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, Poco::Int32)
|
||||
{
|
||||
preparePOD<Poco::Int32>(pos, SQL_C_SLONG);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, Poco::UInt32)
|
||||
{
|
||||
preparePOD<Poco::UInt32>(pos, SQL_C_ULONG);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, Poco::Int64)
|
||||
{
|
||||
preparePOD<Poco::Int64>(pos, SQL_C_SBIGINT);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, Poco::UInt64)
|
||||
{
|
||||
preparePOD<Poco::UInt64>(pos, SQL_C_UBIGINT);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, bool)
|
||||
{
|
||||
preparePOD<bool>(pos, Utility::boolDataType);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, float)
|
||||
{
|
||||
preparePOD<float>(pos, SQL_C_FLOAT);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, double)
|
||||
{
|
||||
preparePOD<double>(pos, SQL_C_DOUBLE);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, char)
|
||||
{
|
||||
preparePOD<char>(pos, SQL_C_STINYINT);
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, const std::string&)
|
||||
{
|
||||
prepareRaw(pos, SQL_C_CHAR, maxDataSize(pos));
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::prepare(std::size_t pos, const Poco::Data::BLOB&)
|
||||
{
|
||||
prepareRaw(pos, SQL_C_BINARY, maxDataSize(pos));
|
||||
}
|
||||
|
||||
|
||||
inline std::size_t Preparation::columns() const
|
||||
{
|
||||
return _pValues.size();
|
||||
}
|
||||
|
||||
|
||||
inline std::size_t Preparation::maxDataSize(std::size_t pos) const
|
||||
{
|
||||
poco_assert (pos > 0 && pos <= _pValues.size());
|
||||
|
||||
std::size_t sz = 0;
|
||||
std::size_t maxsz = getMaxFieldSize();
|
||||
|
||||
try
|
||||
{
|
||||
sz = ODBCColumn(_rStmt, pos).length();
|
||||
}
|
||||
catch (StatementException&)
|
||||
{
|
||||
}
|
||||
if (!sz || sz > maxsz) sz = maxsz;
|
||||
return sz;
|
||||
}
|
||||
|
||||
|
||||
inline std::size_t Preparation::actualDataSize(std::size_t pos) const
|
||||
{
|
||||
poco_assert (pos > 0 && pos <= _pValues.size());
|
||||
poco_assert (_pLengths[pos-1]);
|
||||
|
||||
return *_pLengths[pos-1];
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::setMaxFieldSize(std::size_t size)
|
||||
{
|
||||
_maxFieldSize = size;
|
||||
}
|
||||
|
||||
|
||||
inline std::size_t Preparation::getMaxFieldSize() const
|
||||
{
|
||||
return _maxFieldSize;
|
||||
}
|
||||
|
||||
|
||||
inline void Preparation::setDataExtraction(Preparation::DataExtraction ext)
|
||||
{
|
||||
_dataExtraction = ext;
|
||||
}
|
||||
|
||||
|
||||
inline Preparation::DataExtraction Preparation::getDataExtraction() const
|
||||
{
|
||||
return _dataExtraction;
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif // DataConnectors_ODBC_Preparation_INCLUDED
|
205
Data/ODBC/include/Poco/Data/ODBC/SessionImpl.h
Normal file
205
Data/ODBC/include/Poco/Data/ODBC/SessionImpl.h
Normal file
@ -0,0 +1,205 @@
|
||||
//
|
||||
// SessionImpl.h
|
||||
//
|
||||
// $Id: //poco/1.3/Data/ODBC/include/Poco/Data/ODBC/SessionImpl.h#3 $
|
||||
//
|
||||
// Library: ODBC
|
||||
// Package: ODBC
|
||||
// Module: SessionImpl
|
||||
//
|
||||
// Definition of the SessionImpl class.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef DataConnectors_ODBC_SessionImpl_INCLUDED
|
||||
#define DataConnectors_ODBC_SessionImpl_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/ODBC/Binder.h"
|
||||
#include "Poco/Data/ODBC/Handle.h"
|
||||
#include "Poco/Data/ODBC/ODBCException.h"
|
||||
#include "Poco/Data/AbstractSessionImpl.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <sqltypes.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
class ODBC_API SessionImpl: public Poco::Data::AbstractSessionImpl<SessionImpl>
|
||||
/// Implements SessionImpl interface
|
||||
{
|
||||
public:
|
||||
SessionImpl(const std::string& fileName,
|
||||
Poco::Any maxFieldSize = std::size_t(1024),
|
||||
bool enforceCapability=false,
|
||||
bool autoBind=false,
|
||||
bool autoExtract=false);
|
||||
/// Creates the SessionImpl. Opens a connection to the database
|
||||
|
||||
~SessionImpl();
|
||||
/// Destroys the SessionImpl.
|
||||
|
||||
Poco::Data::StatementImpl* createStatementImpl();
|
||||
/// Returns an ODBC StatementImpl
|
||||
|
||||
void begin();
|
||||
/// Starts a transaction
|
||||
|
||||
void commit();
|
||||
/// Commits and ends a transaction
|
||||
|
||||
void rollback();
|
||||
/// Aborts a transaction
|
||||
|
||||
void close();
|
||||
/// Closes the connection
|
||||
|
||||
bool isConnected();
|
||||
/// Returns true iff session is connected.
|
||||
|
||||
bool isTransaction();
|
||||
/// Returns true iff a transaction is in progress.
|
||||
|
||||
void setEnforceCapability(const std::string&, bool val);
|
||||
/// Configures session to enforce driver capability check
|
||||
/// after connection.
|
||||
/// If capability check is enforced and driver is not capable,
|
||||
/// connection is terminated.
|
||||
/// Since some drivers do not cooperate, the default behavior
|
||||
/// is not checking capability.
|
||||
|
||||
bool getEnforceCapability(const std::string& name="");
|
||||
/// Returns the driver capability check configuration value.
|
||||
|
||||
bool canTransact();
|
||||
/// Returns true if connection is transaction-capable.
|
||||
|
||||
void autoCommit(const std::string&, bool val);
|
||||
/// Sets autocommit property for the session.
|
||||
|
||||
bool isAutoCommit(const std::string& name="");
|
||||
/// Returns autocommit property value.
|
||||
|
||||
void autoBind(const std::string&, bool val);
|
||||
/// Sets automatic binding for the session.
|
||||
|
||||
bool isAutoBind(const std::string& name="");
|
||||
/// Returns true if binding is automatic for this session.
|
||||
|
||||
void autoExtract(const std::string&, bool val);
|
||||
/// Sets automatic extraction for the session.
|
||||
|
||||
bool isAutoExtract(const std::string& name="");
|
||||
/// Returns true if extraction is automatic for this session.
|
||||
|
||||
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="");
|
||||
/// Returns the max field size (the default used when column size is unknown).
|
||||
|
||||
int maxStatementLength();
|
||||
/// Returns maximum length of SQL statement allowed by driver.
|
||||
|
||||
const ConnectionHandle& dbc() const;
|
||||
/// Returns the connection handle.
|
||||
|
||||
private:
|
||||
static const int FUNCTIONS = SQL_API_ODBC3_ALL_FUNCTIONS_SIZE;
|
||||
|
||||
void open();
|
||||
/// Opens a connection to the Database
|
||||
|
||||
bool isCapable();
|
||||
/// Returns true if driver supports specified function, or if
|
||||
/// specified function is zero, all required functions.
|
||||
|
||||
void checkError(SQLRETURN rc, const std::string& msg="");
|
||||
|
||||
std::string _connect;
|
||||
const ConnectionHandle _db;
|
||||
Poco::Any _maxFieldSize;
|
||||
bool _enforceCapability;
|
||||
bool _autoBind;
|
||||
bool _autoExtract;
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// inlines
|
||||
///
|
||||
inline void SessionImpl::checkError(SQLRETURN rc, const std::string& msg)
|
||||
{
|
||||
if (Utility::isError(rc))
|
||||
throw ConnectionException(_db, msg);
|
||||
}
|
||||
|
||||
|
||||
inline const ConnectionHandle& SessionImpl::dbc() const
|
||||
{
|
||||
return _db;
|
||||
}
|
||||
|
||||
|
||||
inline void SessionImpl::commit()
|
||||
{
|
||||
if (!isAutoCommit())
|
||||
checkError(SQLEndTran(SQL_HANDLE_DBC, _db, SQL_COMMIT));
|
||||
}
|
||||
|
||||
|
||||
inline void SessionImpl::rollback()
|
||||
{
|
||||
if (!isAutoCommit())
|
||||
checkError(SQLEndTran(SQL_HANDLE_DBC, _db, SQL_ROLLBACK));
|
||||
}
|
||||
|
||||
|
||||
inline void SessionImpl::setMaxFieldSize(const std::string& rName, const Poco::Any& rValue)
|
||||
{
|
||||
_maxFieldSize = rValue;
|
||||
}
|
||||
|
||||
|
||||
inline Poco::Any SessionImpl::getMaxFieldSize(const std::string& rName)
|
||||
{
|
||||
return _maxFieldSize;
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif // DataConnectors_ODBC_SessionImpl_INCLUDED
|
129
Data/ODBC/include/Poco/Data/ODBC/Utility.h
Normal file
129
Data/ODBC/include/Poco/Data/ODBC/Utility.h
Normal file
@ -0,0 +1,129 @@
|
||||
//
|
||||
// Utility.h
|
||||
//
|
||||
// $Id: //poco/1.3/Data/ODBC/include/Poco/Data/ODBC/Utility.h#2 $
|
||||
//
|
||||
// Library: ODBC
|
||||
// Package: ODBC
|
||||
// Module: Utility
|
||||
//
|
||||
// Definition of Utility.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef ODBC_Utility_INCLUDED
|
||||
#define ODBC_Utility_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/ODBC/DataTypes.h"
|
||||
#include <sstream>
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <sqltypes.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
class ODBC_API Utility
|
||||
/// Various utility functions
|
||||
{
|
||||
public:
|
||||
typedef std::map<std::string, std::string> DSNMap;
|
||||
typedef DSNMap DriverMap;
|
||||
|
||||
static bool isError(SQLRETURN rc);
|
||||
/// Returns true if return code is error
|
||||
|
||||
static DriverMap& drivers(DriverMap& driverMap);
|
||||
/// Returns driver-attributes map of available ODBC drivers.
|
||||
|
||||
static DSNMap& dataSources(DSNMap& dsnMap);
|
||||
/// Returns DSN-description map of available ODBC data sources.
|
||||
|
||||
template<typename MapType, typename KeyArgType, typename ValueArgType>
|
||||
static typename MapType::iterator mapInsert(MapType& m, const KeyArgType& k, const ValueArgType& v)
|
||||
/// Utility map "insert or replace" function (from S. Meyers: Effective STL, Item 24)
|
||||
{
|
||||
typename MapType::iterator lb = m.lower_bound(k);
|
||||
if (lb != m.end() && !(m.key_comp()(k, lb->first)))
|
||||
{
|
||||
lb->second = v;
|
||||
return lb;
|
||||
}
|
||||
else
|
||||
{
|
||||
typedef typename MapType::value_type MVT;
|
||||
return m.insert(lb, MVT(k,v));
|
||||
}
|
||||
}
|
||||
|
||||
static int cDataType(int sqlDataType);
|
||||
/// Returns C data type corresponding to supplied SQL data type.
|
||||
|
||||
static int sqlDataType(int cDataType);
|
||||
/// Returns SQL data type corresponding to supplied C data type.
|
||||
|
||||
static const SQLSMALLINT boolDataType;
|
||||
/// ODBC size for bool data type.
|
||||
|
||||
private:
|
||||
static const DataTypes _dataTypes;
|
||||
/// C <==> SQL data type mapping
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// inlines
|
||||
///
|
||||
inline bool Utility::isError(SQLRETURN rc)
|
||||
{
|
||||
return (0 != (rc & (~1)));
|
||||
}
|
||||
|
||||
|
||||
inline int Utility::cDataType(int sqlDataType)
|
||||
{
|
||||
return _dataTypes.cDataType(sqlDataType);
|
||||
}
|
||||
|
||||
|
||||
inline int Utility::sqlDataType(int cDataType)
|
||||
{
|
||||
return _dataTypes.sqlDataType(cDataType);
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
|
||||
|
||||
#endif
|
138
Data/ODBC/src/Binder.cpp
Normal file
138
Data/ODBC/src/Binder.cpp
Normal file
@ -0,0 +1,138 @@
|
||||
//
|
||||
// Binder.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/Data/ODBC/src/Binder.cpp#2 $
|
||||
//
|
||||
// Library: ODBC
|
||||
// Package: ODBC
|
||||
// Module: Binder
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/Binder.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Data/BLOB.h"
|
||||
#include "Poco/Data/ODBC/ODBCException.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include <sql.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
Binder::Binder(const StatementHandle& rStmt, Binder::ParameterBinding dataBinding):
|
||||
_rStmt(rStmt),
|
||||
_paramBinding(dataBinding)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Binder::~Binder()
|
||||
{
|
||||
std::vector<SQLLEN*>::iterator it = _lengthIndicator.begin();
|
||||
std::vector<SQLLEN*>::iterator itEnd = _lengthIndicator.end();
|
||||
for(; it != itEnd; ++it) delete *it;
|
||||
}
|
||||
|
||||
|
||||
void Binder::bind(std::size_t pos, const std::string& val)
|
||||
{
|
||||
SQLINTEGER size = (SQLINTEGER) val.size();
|
||||
SQLLEN* pLenIn = new SQLLEN;
|
||||
*pLenIn = SQL_NTS;
|
||||
|
||||
if (PB_AT_EXEC == _paramBinding)
|
||||
*pLenIn = SQL_LEN_DATA_AT_EXEC(size);
|
||||
|
||||
_lengthIndicator.push_back(pLenIn);
|
||||
_dataSize.insert(SizeMap::value_type((SQLPOINTER) val.c_str(), size));
|
||||
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos,
|
||||
SQL_PARAM_INPUT,
|
||||
SQL_C_CHAR,
|
||||
SQL_LONGVARCHAR,
|
||||
(SQLUINTEGER) size,
|
||||
0,
|
||||
(SQLPOINTER) val.c_str(),
|
||||
(SQLINTEGER) size,
|
||||
_lengthIndicator.back())))
|
||||
{
|
||||
throw StatementException(_rStmt,
|
||||
"SQLBindParameter()");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Binder::bind(std::size_t pos, const Poco::Data::BLOB& val)
|
||||
{
|
||||
SQLINTEGER size = (SQLINTEGER) val.size();
|
||||
SQLLEN* pLenIn = new SQLLEN;
|
||||
*pLenIn = size;
|
||||
|
||||
if (PB_AT_EXEC == _paramBinding)
|
||||
*pLenIn = SQL_LEN_DATA_AT_EXEC(size);
|
||||
|
||||
_lengthIndicator.push_back(pLenIn);
|
||||
_dataSize.insert(SizeMap::value_type((SQLPOINTER) val.rawContent(), size));
|
||||
|
||||
if (Utility::isError(SQLBindParameter(_rStmt,
|
||||
(SQLUSMALLINT) pos,
|
||||
SQL_PARAM_INPUT,
|
||||
SQL_C_BINARY,
|
||||
SQL_LONGVARBINARY,
|
||||
(SQLUINTEGER) size,
|
||||
0,
|
||||
(SQLPOINTER) val.rawContent(),
|
||||
(SQLINTEGER) size,
|
||||
_lengthIndicator.back())))
|
||||
{
|
||||
throw StatementException(_rStmt,
|
||||
"SQLBindParameter()");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::size_t Binder::dataSize(SQLPOINTER pAddr) const
|
||||
{
|
||||
SizeMap::const_iterator it = _dataSize.find(pAddr);
|
||||
if (it != _dataSize.end()) return it->second;
|
||||
|
||||
throw NotFoundException("Requested data size not found.");
|
||||
}
|
||||
|
||||
|
||||
void Binder::bind(std::size_t pos, const char* const &pVal)
|
||||
{
|
||||
//no-op
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
72
Data/ODBC/src/ConnectionHandle.cpp
Normal file
72
Data/ODBC/src/ConnectionHandle.cpp
Normal file
@ -0,0 +1,72 @@
|
||||
//
|
||||
// ConnectionHandle.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/Data/ODBC/src/ConnectionHandle.cpp#2 $
|
||||
//
|
||||
// Library: ODBC
|
||||
// Package: ODBC
|
||||
// Module: ConnectionHandle
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ConnectionHandle.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Data/ODBC/ODBCException.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
ConnectionHandle::ConnectionHandle(EnvironmentHandle* pEnvironment):
|
||||
_pEnvironment(pEnvironment ? pEnvironment : new EnvironmentHandle),
|
||||
_hdbc(SQL_NULL_HDBC),
|
||||
_ownsEnvironment(pEnvironment ? false : true)
|
||||
{
|
||||
if (Utility::isError(SQLAllocHandle(SQL_HANDLE_DBC,
|
||||
_pEnvironment->handle(),
|
||||
&_hdbc)))
|
||||
{
|
||||
throw ODBCException("Could not allocate connection handle.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ConnectionHandle::~ConnectionHandle()
|
||||
{
|
||||
SQLDisconnect(_hdbc);
|
||||
SQLRETURN rc = SQLFreeHandle(SQL_HANDLE_DBC, _hdbc);
|
||||
|
||||
if (_ownsEnvironment) delete _pEnvironment;
|
||||
|
||||
poco_assert (!Utility::isError(rc));
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
78
Data/ODBC/src/Connector.cpp
Normal file
78
Data/ODBC/src/Connector.cpp
Normal file
@ -0,0 +1,78 @@
|
||||
//
|
||||
// Connector.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/Data/ODBC/src/Connector.cpp#1 $
|
||||
//
|
||||
// Library: ODBC
|
||||
// Package: ODBC
|
||||
// Module: Connector
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/Connector.h"
|
||||
#include "Poco/Data/ODBC/SessionImpl.h"
|
||||
#include "Poco/Data/SessionFactory.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
const std::string Connector::KEY("ODBC");
|
||||
|
||||
|
||||
Connector::Connector()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Connector::~Connector()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Poco::AutoPtr<Poco::Data::SessionImpl> Connector::createSession(const std::string& connectionString)
|
||||
{
|
||||
return Poco::AutoPtr<Poco::Data::SessionImpl>(new SessionImpl(connectionString));
|
||||
}
|
||||
|
||||
|
||||
void Connector::registerConnector()
|
||||
{
|
||||
Poco::Data::SessionFactory::instance().add(KEY, new Connector());
|
||||
}
|
||||
|
||||
|
||||
void Connector::unregisterConnector()
|
||||
{
|
||||
Poco::Data::SessionFactory::instance().remove(KEY);
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
118
Data/ODBC/src/DataTypes.cpp
Normal file
118
Data/ODBC/src/DataTypes.cpp
Normal file
@ -0,0 +1,118 @@
|
||||
//
|
||||
// DataTypes.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/Data/ODBC/src/DataTypes.cpp#2 $
|
||||
//
|
||||
// Library: ODBC
|
||||
// Package: ODBC
|
||||
// Module: DataTypes
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/DataTypes.h"
|
||||
#include "Poco/Format.h"
|
||||
#include "Poco/Exception.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
DataTypes::DataTypes()
|
||||
{
|
||||
_cDataTypes.insert(ValueType(SQL_CHAR, SQL_C_CHAR));
|
||||
_cDataTypes.insert(ValueType(SQL_VARCHAR, SQL_C_CHAR));
|
||||
_cDataTypes.insert(ValueType(SQL_LONGVARCHAR, SQL_C_CHAR));
|
||||
_cDataTypes.insert(ValueType(SQL_DECIMAL, SQL_C_SLONG));
|
||||
_cDataTypes.insert(ValueType(SQL_NUMERIC, SQL_C_DOUBLE));
|
||||
_cDataTypes.insert(ValueType(SQL_BIT, SQL_C_BIT));
|
||||
_cDataTypes.insert(ValueType(SQL_TINYINT, SQL_C_STINYINT));
|
||||
_cDataTypes.insert(ValueType(SQL_SMALLINT, SQL_C_SSHORT));
|
||||
_cDataTypes.insert(ValueType(SQL_INTEGER, SQL_C_SLONG));
|
||||
_cDataTypes.insert(ValueType(SQL_BIGINT, SQL_C_SBIGINT));
|
||||
_cDataTypes.insert(ValueType(SQL_REAL, SQL_C_FLOAT));
|
||||
_cDataTypes.insert(ValueType(SQL_FLOAT, SQL_C_DOUBLE));
|
||||
_cDataTypes.insert(ValueType(SQL_DOUBLE, SQL_C_DOUBLE));
|
||||
_cDataTypes.insert(ValueType(SQL_BINARY, SQL_C_BINARY));
|
||||
_cDataTypes.insert(ValueType(SQL_VARBINARY, SQL_C_BINARY));
|
||||
_cDataTypes.insert(ValueType(SQL_LONGVARBINARY, SQL_C_BINARY));
|
||||
_cDataTypes.insert(ValueType(SQL_TYPE_DATE, SQL_C_TYPE_DATE));
|
||||
_cDataTypes.insert(ValueType(SQL_TYPE_TIME, SQL_C_TYPE_TIME));
|
||||
_cDataTypes.insert(ValueType(SQL_TYPE_TIMESTAMP, SQL_C_TYPE_TIMESTAMP));
|
||||
|
||||
_sqlDataTypes.insert(ValueType(SQL_C_CHAR, SQL_LONGVARCHAR));
|
||||
_sqlDataTypes.insert(ValueType(SQL_C_BIT, SQL_BIT));
|
||||
_sqlDataTypes.insert(ValueType(SQL_C_TINYINT, SQL_TINYINT));
|
||||
_sqlDataTypes.insert(ValueType(SQL_C_STINYINT, SQL_TINYINT));
|
||||
_sqlDataTypes.insert(ValueType(SQL_C_UTINYINT, SQL_TINYINT));
|
||||
_sqlDataTypes.insert(ValueType(SQL_C_SHORT, SQL_SMALLINT));
|
||||
_sqlDataTypes.insert(ValueType(SQL_C_SSHORT, SQL_SMALLINT));
|
||||
_sqlDataTypes.insert(ValueType(SQL_C_USHORT, SQL_SMALLINT));
|
||||
_sqlDataTypes.insert(ValueType(SQL_C_LONG, SQL_INTEGER));
|
||||
_sqlDataTypes.insert(ValueType(SQL_C_SLONG, SQL_INTEGER));
|
||||
_sqlDataTypes.insert(ValueType(SQL_C_ULONG, SQL_INTEGER));
|
||||
_sqlDataTypes.insert(ValueType(SQL_C_SBIGINT, SQL_BIGINT));
|
||||
_sqlDataTypes.insert(ValueType(SQL_C_UBIGINT, SQL_BIGINT));
|
||||
_sqlDataTypes.insert(ValueType(SQL_C_FLOAT, SQL_REAL));
|
||||
_sqlDataTypes.insert(ValueType(SQL_C_DOUBLE, SQL_DOUBLE));
|
||||
_sqlDataTypes.insert(ValueType(SQL_C_BINARY, SQL_LONGVARBINARY));
|
||||
_sqlDataTypes.insert(ValueType(SQL_C_TYPE_DATE, SQL_TYPE_DATE));
|
||||
_sqlDataTypes.insert(ValueType(SQL_C_TYPE_TIME, SQL_TYPE_TIME));
|
||||
_sqlDataTypes.insert(ValueType(SQL_C_TYPE_TIMESTAMP, SQL_TYPE_TIMESTAMP));
|
||||
}
|
||||
|
||||
|
||||
DataTypes::~DataTypes()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int DataTypes::cDataType(int sqlDataType) const
|
||||
{
|
||||
DataTypeMap::const_iterator it = _cDataTypes.find(sqlDataType);
|
||||
|
||||
if (_cDataTypes.end() == it)
|
||||
throw NotFoundException(format("C data type not found for SQL data type: %d", sqlDataType));
|
||||
|
||||
return it->second;
|
||||
}
|
||||
|
||||
|
||||
int DataTypes::sqlDataType(int cDataType) const
|
||||
{
|
||||
DataTypeMap::const_iterator it = _sqlDataTypes.find(cDataType);
|
||||
|
||||
if (_sqlDataTypes.end() == it)
|
||||
throw NotFoundException(format("SQL data type not found for C data type: %d", cDataType));
|
||||
|
||||
return it->second;
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
69
Data/ODBC/src/EnvironmentHandle.cpp
Normal file
69
Data/ODBC/src/EnvironmentHandle.cpp
Normal file
@ -0,0 +1,69 @@
|
||||
//
|
||||
// EnvironmentHandle.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/Data/ODBC/src/EnvironmentHandle.cpp#2 $
|
||||
//
|
||||
// Library: ODBC
|
||||
// Package: ODBC
|
||||
// Module: EnvironmentHandle
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/EnvironmentHandle.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Data/ODBC/ODBCException.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
EnvironmentHandle::EnvironmentHandle(): _henv(SQL_NULL_HENV)
|
||||
{
|
||||
if (Utility::isError(SQLAllocHandle(SQL_HANDLE_ENV,
|
||||
SQL_NULL_HANDLE,
|
||||
&_henv)) ||
|
||||
Utility::isError(SQLSetEnvAttr(_henv,
|
||||
SQL_ATTR_ODBC_VERSION,
|
||||
(SQLPOINTER) SQL_OV_ODBC3,
|
||||
0)))
|
||||
{
|
||||
throw ODBCException("Could not initialize environment.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
EnvironmentHandle::~EnvironmentHandle()
|
||||
{
|
||||
SQLRETURN rc = SQLFreeHandle(SQL_HANDLE_ENV, _henv);
|
||||
poco_assert (!Utility::isError(rc));
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
381
Data/ODBC/src/Extractor.cpp
Normal file
381
Data/ODBC/src/Extractor.cpp
Normal file
@ -0,0 +1,381 @@
|
||||
//
|
||||
// Extractor.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/Data/ODBC/src/Extractor.cpp#2 $
|
||||
//
|
||||
// Library: ODBC
|
||||
// Package: ODBC
|
||||
// Module: Extractor
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/Extractor.h"
|
||||
#include "Poco/Data/ODBC/ODBCColumn.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Data/ODBC/ODBCException.h"
|
||||
#include "Poco/Data/BLOB.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include <memory>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
const std::string Extractor::FLD_SIZE_EXCEEDED_FMT = "Specified data size (%z bytes) "
|
||||
"exceeds maximum value (%z).\n"
|
||||
"Use Session.setProperty(\"maxFieldSize\", value) "
|
||||
"to increase the maximum allowed data size\n";
|
||||
|
||||
|
||||
Extractor::Extractor(const StatementHandle& rStmt,
|
||||
Preparation& rPreparation):
|
||||
_rStmt(rStmt),
|
||||
_rPreparation(rPreparation),
|
||||
_dataExtraction(rPreparation.getDataExtraction())
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Extractor::~Extractor()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
bool Extractor::extractBoundImpl<std::string>(std::size_t pos, std::string& val)
|
||||
{
|
||||
std::size_t dataSize = _rPreparation.actualDataSize(pos);
|
||||
SharedPtr<char>& sp = RefAnyCast<SharedPtr<char> >(_rPreparation[pos]);
|
||||
std::size_t len = strlen(sp);
|
||||
if (len < dataSize) dataSize = len;
|
||||
checkDataSize(dataSize);
|
||||
val.assign(sp, dataSize);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
bool Extractor::extractBoundImpl<Poco::Data::BLOB>(std::size_t pos, Poco::Data::BLOB& val)
|
||||
{
|
||||
std::size_t dataSize = _rPreparation.actualDataSize(pos);
|
||||
checkDataSize(dataSize);
|
||||
SharedPtr<char>& sp = RefAnyCast<SharedPtr<char> >(_rPreparation[pos]);
|
||||
val.assignRaw(sp, dataSize);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
bool Extractor::extractManualImpl<std::string>(std::size_t pos, std::string& val, SQLSMALLINT cType)
|
||||
{
|
||||
std::size_t maxSize = _rPreparation.getMaxFieldSize();
|
||||
std::size_t fetchedSize = 0;
|
||||
std::size_t totalSize = 0;
|
||||
|
||||
SQLLEN len;
|
||||
std::auto_ptr<char> apChar(new char[CHUNK_SIZE]);
|
||||
char* pChar = apChar.get();
|
||||
SQLRETURN rc = 0;
|
||||
val.clear();
|
||||
|
||||
do
|
||||
{
|
||||
memset(pChar, 0, CHUNK_SIZE);
|
||||
len = 0;
|
||||
rc = SQLGetData(_rStmt,
|
||||
(SQLUSMALLINT) pos,
|
||||
cType, //C data type
|
||||
pChar, //returned value
|
||||
CHUNK_SIZE, //buffer length
|
||||
&len); //length indicator
|
||||
|
||||
if (SQL_NO_DATA != rc && Utility::isError(rc))
|
||||
throw StatementException(_rStmt, "SQLGetData()");
|
||||
|
||||
if (SQL_NO_TOTAL == len)//unknown length, throw
|
||||
throw UnknownDataLengthException("Could not determine returned data length.");
|
||||
|
||||
if (SQL_NO_DATA == rc || SQL_NULL_DATA == len || !len)
|
||||
break;
|
||||
|
||||
fetchedSize = len > CHUNK_SIZE ? CHUNK_SIZE : len;
|
||||
totalSize += fetchedSize;
|
||||
if (totalSize <= maxSize) val.append(pChar, fetchedSize);
|
||||
else throw DataException(format(FLD_SIZE_EXCEEDED_FMT,
|
||||
fetchedSize,
|
||||
maxSize));
|
||||
|
||||
}while (true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
bool Extractor::extractManualImpl<Poco::Data::BLOB>(std::size_t pos,
|
||||
Poco::Data::BLOB& val,
|
||||
SQLSMALLINT cType)
|
||||
{
|
||||
std::size_t maxSize = _rPreparation.getMaxFieldSize();
|
||||
std::size_t fetchedSize = 0;
|
||||
std::size_t totalSize = 0;
|
||||
|
||||
SQLLEN len;
|
||||
std::auto_ptr<char> apChar(new char[CHUNK_SIZE]);
|
||||
char* pChar = apChar.get();
|
||||
SQLRETURN rc = 0;
|
||||
val.clear();
|
||||
|
||||
do
|
||||
{
|
||||
memset(pChar, 0, CHUNK_SIZE);
|
||||
len = 0;
|
||||
rc = SQLGetData(_rStmt,
|
||||
(SQLUSMALLINT) pos,
|
||||
cType, //C data type
|
||||
pChar, //returned value
|
||||
CHUNK_SIZE, //buffer length
|
||||
&len); //length indicator
|
||||
|
||||
if (SQL_NO_DATA != rc && Utility::isError(rc))
|
||||
throw StatementException(_rStmt, "SQLGetData()");
|
||||
|
||||
if (SQL_NO_TOTAL == len)//unknown length, throw
|
||||
throw UnknownDataLengthException("Could not determine returned data length.");
|
||||
|
||||
if (SQL_NO_DATA == rc || SQL_NULL_DATA == len || !len)
|
||||
break;
|
||||
|
||||
fetchedSize = len > CHUNK_SIZE ? CHUNK_SIZE : len;
|
||||
totalSize += fetchedSize;
|
||||
if (totalSize <= maxSize) val.appendRaw(pChar, fetchedSize);
|
||||
else throw DataException(format(FLD_SIZE_EXCEEDED_FMT,
|
||||
fetchedSize,
|
||||
maxSize));
|
||||
|
||||
}while (true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Poco::Int32& val)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, SQL_C_SLONG);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Poco::Int64& val)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, SQL_C_SBIGINT);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, double& val)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, SQL_C_DOUBLE);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::string& val)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, SQL_C_CHAR);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Poco::Data::BLOB& val)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, SQL_C_BINARY);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Poco::Int8& val)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, SQL_C_STINYINT);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Poco::UInt8& val)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, SQL_C_UTINYINT);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Poco::Int16& val)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, SQL_C_SSHORT);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Poco::UInt16& val)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, SQL_C_USHORT);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Poco::UInt32& val)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, SQL_C_ULONG);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Poco::UInt64& val)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, SQL_C_SBIGINT);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, bool& val)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, Utility::boolDataType);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, float& val)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, SQL_C_FLOAT);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, char& val)
|
||||
{
|
||||
if (Preparation::DE_MANUAL == _dataExtraction)
|
||||
return extractManualImpl(pos, val, SQL_C_STINYINT);
|
||||
else
|
||||
return extractBoundImpl(pos, val);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Poco::Any& val)
|
||||
{
|
||||
ODBCColumn column(_rStmt, pos);
|
||||
|
||||
switch (column.type())
|
||||
{
|
||||
case MetaColumn::FDT_INT8:
|
||||
{ Poco::Int8 i = 0; extract(pos, i); val = i; return true; }
|
||||
|
||||
case MetaColumn::FDT_UINT8:
|
||||
{ Poco::UInt8 i = 0; extract(pos, i); val = i; return true; }
|
||||
|
||||
case MetaColumn::FDT_INT16:
|
||||
{ Poco::Int16 i = 0; extract(pos, i); val = i; return true; }
|
||||
|
||||
case MetaColumn::FDT_UINT16:
|
||||
{ Poco::UInt16 i = 0; extract(pos, i); val = i; return true; }
|
||||
|
||||
case MetaColumn::FDT_INT32:
|
||||
{ Poco::Int32 i = 0; extract(pos, i); val = i; return true; }
|
||||
|
||||
case MetaColumn::FDT_UINT32:
|
||||
{ Poco::UInt32 i = 0; extract(pos, i); val = i; return true; }
|
||||
|
||||
case MetaColumn::FDT_INT64:
|
||||
{ Poco::Int64 i = 0; extract(pos, i); val = i; return true; }
|
||||
|
||||
case MetaColumn::FDT_UINT64:
|
||||
{ Poco::UInt64 i = 0; extract(pos, i); val = i; return true; }
|
||||
|
||||
case MetaColumn::FDT_BOOL:
|
||||
{ bool b; extract(pos, b); val = b; return true; }
|
||||
|
||||
case MetaColumn::FDT_FLOAT:
|
||||
{ float f; extract(pos, f); val = f; return true; }
|
||||
|
||||
case MetaColumn::FDT_DOUBLE:
|
||||
{ double d; extract(pos, d); val = d; return true; }
|
||||
|
||||
case MetaColumn::FDT_STRING:
|
||||
{ std::string s; extract(pos, s); val = s; return true; }
|
||||
|
||||
case MetaColumn::FDT_BLOB:
|
||||
{ Poco::Data::BLOB b; extract(pos, b); val = b; return true; }
|
||||
|
||||
default:
|
||||
throw DataFormatException("Unsupported data type.");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void Extractor::checkDataSize(std::size_t size)
|
||||
{
|
||||
std::size_t maxSize = _rPreparation.getMaxFieldSize();
|
||||
if (size > maxSize)
|
||||
{
|
||||
throw DataException(format(FLD_SIZE_EXCEEDED_FMT,
|
||||
size,
|
||||
maxSize));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
134
Data/ODBC/src/ODBCColumn.cpp
Normal file
134
Data/ODBC/src/ODBCColumn.cpp
Normal file
@ -0,0 +1,134 @@
|
||||
//
|
||||
// ODBCColumn.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/Data/ODBC/src/ODBCColumn.cpp#3 $
|
||||
//
|
||||
// Library: ODBC
|
||||
// Package: ODBC
|
||||
// Module: ODBCColumn
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBCColumn.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
ODBCColumn::ODBCColumn(const StatementHandle& rStmt, std::size_t position) :
|
||||
MetaColumn(position),
|
||||
_rStmt(rStmt)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
ODBCColumn::~ODBCColumn()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void ODBCColumn::getDescription()
|
||||
{
|
||||
memset(_columnDesc.name, 0, NAME_BUFFER_LENGTH);
|
||||
_columnDesc.nameBufferLength = 0;
|
||||
_columnDesc.dataType = 0;
|
||||
_columnDesc.size = 0;
|
||||
_columnDesc.decimalDigits = 0;
|
||||
_columnDesc.isNullable = 0;
|
||||
|
||||
if (Utility::isError(SQLDescribeCol(_rStmt,
|
||||
(SQLUSMALLINT) position() + 1, // ODBC columns are 1-based
|
||||
_columnDesc.name,
|
||||
NAME_BUFFER_LENGTH,
|
||||
&_columnDesc.nameBufferLength,
|
||||
&_columnDesc.dataType,
|
||||
&_columnDesc.size,
|
||||
&_columnDesc.decimalDigits,
|
||||
&_columnDesc.isNullable)))
|
||||
{
|
||||
throw StatementException(_rStmt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ODBCColumn::init()
|
||||
{
|
||||
getDescription();
|
||||
|
||||
if (Utility::isError(SQLColAttribute(_rStmt,
|
||||
(SQLUSMALLINT) position() + 1, // ODBC columns are 1-based
|
||||
SQL_DESC_LENGTH,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
reinterpret_cast<long int*>(&_dataLength))))
|
||||
{
|
||||
throw StatementException(_rStmt);
|
||||
}
|
||||
|
||||
setName(std::string((char*) _columnDesc.name));
|
||||
setLength(_columnDesc.size);
|
||||
setPrecision(_columnDesc.decimalDigits);
|
||||
setNullable(SQL_NULLABLE == _columnDesc.isNullable);
|
||||
switch(_columnDesc.dataType)
|
||||
{
|
||||
case SQL_CHAR:
|
||||
case SQL_VARCHAR:
|
||||
case SQL_LONGVARCHAR:
|
||||
setType(MetaColumn::FDT_STRING); break;
|
||||
case SQL_TINYINT:
|
||||
setType(MetaColumn::FDT_INT8); break;
|
||||
case SQL_SMALLINT:
|
||||
setType(MetaColumn::FDT_INT16); break;
|
||||
case SQL_INTEGER:
|
||||
case SQL_DECIMAL:
|
||||
setType(MetaColumn::FDT_INT32); break;
|
||||
case SQL_BIGINT:
|
||||
setType(MetaColumn::FDT_INT64); break;
|
||||
case SQL_NUMERIC:
|
||||
case SQL_DOUBLE:
|
||||
case SQL_FLOAT:
|
||||
setType(MetaColumn::FDT_DOUBLE); break;
|
||||
case SQL_REAL:
|
||||
setType(MetaColumn::FDT_FLOAT); break;
|
||||
case SQL_BINARY:
|
||||
case SQL_VARBINARY:
|
||||
case SQL_LONGVARBINARY:
|
||||
case -98:// IBM DB2 non-standard type
|
||||
setType(MetaColumn::FDT_BLOB); break;
|
||||
default:
|
||||
throw DataFormatException("Unsupported data type.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
52
Data/ODBC/src/ODBCException.cpp
Normal file
52
Data/ODBC/src/ODBCException.cpp
Normal file
@ -0,0 +1,52 @@
|
||||
//
|
||||
// ODBCException.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/Data/ODBC/src/ODBCException.cpp#2 $
|
||||
//
|
||||
// Library: ODBC
|
||||
// Package: ODBC
|
||||
// Module: ODBCException
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBCException.h"
|
||||
#include <typeinfo>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
POCO_IMPLEMENT_EXCEPTION(ODBCException, Poco::Data::DataException, "Generic ODBC error")
|
||||
POCO_IMPLEMENT_EXCEPTION(InsufficientStorageException, ODBCException, "Insufficient storage error")
|
||||
POCO_IMPLEMENT_EXCEPTION(UnknownDataLengthException, ODBCException, "Unknown length of remaining data error")
|
||||
POCO_IMPLEMENT_EXCEPTION(DataTruncatedException, ODBCException, "Variable length character or binary data truncated")
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
323
Data/ODBC/src/ODBCStatementImpl.cpp
Normal file
323
Data/ODBC/src/ODBCStatementImpl.cpp
Normal file
@ -0,0 +1,323 @@
|
||||
//
|
||||
// ODBCStatementImpl.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/Data/ODBC/src/ODBCStatementImpl.cpp#3 $
|
||||
//
|
||||
// Library: ODBC
|
||||
// Package: ODBC
|
||||
// Module: ODBCStatementImpl
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBCStatementImpl.h"
|
||||
#include "Poco/Data/ODBC/Handle.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Data/ODBC/ODBCException.h"
|
||||
#include "Poco/Data/AbstractPrepare.h"
|
||||
#include <sql.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
const std::string ODBCStatementImpl::INVALID_CURSOR_STATE = "24000";
|
||||
|
||||
|
||||
ODBCStatementImpl::ODBCStatementImpl(SessionImpl& rSession):
|
||||
_rSession(rSession),
|
||||
_stmt(_rSession.dbc()),
|
||||
_stepCalled(false),
|
||||
_nextResponse(0)
|
||||
{
|
||||
checkError(SQLSetStmtAttr(_stmt,
|
||||
SQL_CURSOR_TYPE,
|
||||
(SQLPOINTER) SQL_CURSOR_FORWARD_ONLY,
|
||||
0),
|
||||
"SQLSetStmtAttr(SQL_CURSOR_TYPE, SQL_CURSOR_FORWARD_ONLY)");
|
||||
|
||||
if (_rSession.getFeature("autoBind"))
|
||||
{
|
||||
SQLSetStmtAttr(_stmt,
|
||||
SQL_ATTR_PARAM_BIND_TYPE,
|
||||
(SQLPOINTER) SQL_PARAM_BIND_BY_COLUMN,
|
||||
0);
|
||||
}
|
||||
else
|
||||
{
|
||||
SQLSetStmtAttr(_stmt,
|
||||
SQL_ATTR_ROW_ARRAY_SIZE,
|
||||
(SQLPOINTER) 1,
|
||||
0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ODBCStatementImpl::~ODBCStatementImpl()
|
||||
{
|
||||
ColumnPtrVec::iterator it = _columnPtrs.begin();
|
||||
ColumnPtrVec::iterator itEnd = _columnPtrs.end();
|
||||
for(; it != itEnd; ++it) delete *it;
|
||||
}
|
||||
|
||||
|
||||
void ODBCStatementImpl::compileImpl()
|
||||
{
|
||||
_stepCalled = false;
|
||||
_nextResponse = 0;
|
||||
|
||||
std::string statement(toString());
|
||||
if (statement.empty())
|
||||
throw ODBCException("Empty statements are illegal");
|
||||
|
||||
Preparation::DataExtraction ext = _rSession.getFeature("autoExtract") ?
|
||||
Preparation::DE_BOUND : Preparation::DE_MANUAL;
|
||||
|
||||
std::size_t maxFieldSize = AnyCast<std::size_t>(_rSession.getProperty("maxFieldSize"));
|
||||
_pPreparation = new Preparation(_stmt,
|
||||
statement,
|
||||
maxFieldSize,
|
||||
ext);
|
||||
|
||||
Binder::ParameterBinding bind = _rSession.getFeature("autoBind") ?
|
||||
Binder::PB_IMMEDIATE : Binder::PB_AT_EXEC;
|
||||
|
||||
_pBinder = new Binder(_stmt, bind);
|
||||
_pExtractor = new Extractor(_stmt, *_pPreparation);
|
||||
|
||||
bool dataAvailable = hasData();
|
||||
if (dataAvailable && !extractions().size())
|
||||
{
|
||||
fillColumns();
|
||||
makeExtractors(columnsReturned());
|
||||
}
|
||||
|
||||
if (Preparation::DE_BOUND == ext && dataAvailable)
|
||||
{
|
||||
std::size_t pos = 1;
|
||||
Extractions& extracts = extractions();
|
||||
Extractions::iterator it = extracts.begin();
|
||||
Extractions::iterator itEnd = extracts.end();
|
||||
for (; it != itEnd; ++it)
|
||||
{
|
||||
AbstractPrepare* pAP = (*it)->createPrepareObject(_pPreparation, pos);
|
||||
pAP->prepare();
|
||||
pos += (*it)->numOfColumnsHandled();
|
||||
delete pAP;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool ODBCStatementImpl::canBind() const
|
||||
{
|
||||
if (!bindings().empty())
|
||||
return (*bindings().begin())->canBind();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void ODBCStatementImpl::bindImpl()
|
||||
{
|
||||
clear();
|
||||
Bindings& binds = bindings();
|
||||
if (!binds.empty())
|
||||
{
|
||||
std::size_t pos = 1;
|
||||
|
||||
Bindings::iterator it = binds.begin();
|
||||
Bindings::iterator itEnd = binds.end();
|
||||
for (; it != itEnd && (*it)->canBind(); ++it)
|
||||
{
|
||||
(*it)->bind(pos);
|
||||
pos += (*it)->numOfColumnsHandled();
|
||||
}
|
||||
}
|
||||
|
||||
SQLRETURN rc = SQLExecute(_stmt);
|
||||
|
||||
if (SQL_NEED_DATA == rc) putData();
|
||||
else checkError(rc, "SQLExecute()");
|
||||
}
|
||||
|
||||
|
||||
void ODBCStatementImpl::putData()
|
||||
{
|
||||
SQLPOINTER pParam = 0;
|
||||
SQLRETURN rc = SQLParamData(_stmt, &pParam);
|
||||
|
||||
do
|
||||
{
|
||||
poco_assert_dbg (pParam);
|
||||
|
||||
SQLINTEGER dataSize = (SQLINTEGER) _pBinder->dataSize(pParam);
|
||||
|
||||
if (Utility::isError(SQLPutData(_stmt, pParam, dataSize)))
|
||||
throw StatementException(_stmt, "SQLPutData()");
|
||||
}while (SQL_NEED_DATA == (rc = SQLParamData(_stmt, &pParam)));
|
||||
|
||||
checkError(rc, "SQLParamData()");
|
||||
}
|
||||
|
||||
|
||||
void ODBCStatementImpl::clear()
|
||||
{
|
||||
SQLRETURN rc = SQLCloseCursor(_stmt);
|
||||
if (Utility::isError(rc))
|
||||
{
|
||||
StatementError err(_stmt);
|
||||
bool ignoreError = false;
|
||||
|
||||
const StatementDiagnostics& diagnostics = err.diagnostics();
|
||||
//ignore "Invalid cursor state" error
|
||||
//(returned by 3.x drivers when cursor is not opened)
|
||||
for (int i = 0; i < diagnostics.count(); ++i)
|
||||
{
|
||||
if (ignoreError =
|
||||
(INVALID_CURSOR_STATE == std::string(diagnostics.sqlState(i))))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ignoreError)
|
||||
throw StatementException(_stmt, "SQLCloseCursor()");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool ODBCStatementImpl::hasNext()
|
||||
{
|
||||
if (hasData())
|
||||
{
|
||||
if (_stepCalled)
|
||||
return _stepCalled = nextRowReady();
|
||||
|
||||
_stepCalled = true;
|
||||
_nextResponse = SQLFetch(_stmt);
|
||||
|
||||
if (!nextRowReady())
|
||||
return false;
|
||||
else
|
||||
if (Utility::isError(_nextResponse))
|
||||
checkError(_nextResponse, "SQLFetch()");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void ODBCStatementImpl::next()
|
||||
{
|
||||
if (nextRowReady())
|
||||
{
|
||||
poco_assert (columnsExtracted() == _pPreparation->columns());
|
||||
|
||||
Extractions& extracts = extractions();
|
||||
Extractions::iterator it = extracts.begin();
|
||||
Extractions::iterator itEnd = extracts.end();
|
||||
std::size_t pos = 1;
|
||||
for (; it != itEnd; ++it)
|
||||
{
|
||||
(*it)->extract(pos);
|
||||
pos += (*it)->numOfColumnsHandled();
|
||||
}
|
||||
_stepCalled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw StatementException(_stmt,
|
||||
std::string("Iterator Error: trying to access the next value"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string ODBCStatementImpl::nativeSQL()
|
||||
{
|
||||
std::string statement = toString();
|
||||
|
||||
//Hopefully, double the original statement length is enough.
|
||||
//If it is not, the total available length is indicated in the retlen parameter,
|
||||
//which is in turn used to resize the buffer and request the native SQL again.
|
||||
SQLINTEGER length = (SQLINTEGER) statement.size() * 2;
|
||||
|
||||
char* pNative = 0;
|
||||
SQLINTEGER retlen = length;
|
||||
do
|
||||
{
|
||||
delete [] pNative;
|
||||
pNative = new char[retlen];
|
||||
memset(pNative, 0, retlen);
|
||||
length = retlen;
|
||||
if (Utility::isError(SQLNativeSql(_rSession.dbc(),
|
||||
(POCO_SQLCHAR*) statement.c_str(),
|
||||
(SQLINTEGER) statement.size(),
|
||||
(POCO_SQLCHAR*) pNative,
|
||||
length,
|
||||
&retlen)))
|
||||
{
|
||||
delete [] pNative;
|
||||
throw ConnectionException(_rSession.dbc(), "SQLNativeSql()");
|
||||
}
|
||||
++retlen;//accomodate for terminating '\0'
|
||||
}while (retlen > length);
|
||||
|
||||
std::string sql(pNative);
|
||||
delete [] pNative;
|
||||
return sql;
|
||||
}
|
||||
|
||||
|
||||
void ODBCStatementImpl::checkError(SQLRETURN rc, const std::string& msg)
|
||||
{
|
||||
if (Utility::isError(rc))
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << std::endl << "Requested SQL statement: " << toString() << std::endl;
|
||||
os << "Native SQL statement: " << nativeSQL() << std::endl;
|
||||
std::string str(msg); str += os.str();
|
||||
|
||||
throw StatementException(_stmt, str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ODBCStatementImpl::fillColumns()
|
||||
{
|
||||
Poco::UInt32 colCount = columnsReturned();
|
||||
|
||||
for (int i = 0; i < colCount; ++i)
|
||||
_columnPtrs.push_back(new ODBCColumn(_stmt, i));
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
75
Data/ODBC/src/Parameter.cpp
Normal file
75
Data/ODBC/src/Parameter.cpp
Normal file
@ -0,0 +1,75 @@
|
||||
//
|
||||
// Parameter.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/Data/ODBC/src/Parameter.cpp#2 $
|
||||
//
|
||||
// Library: ODBC
|
||||
// Package: ODBC
|
||||
// Module: Parameter
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/Parameter.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Data/ODBC/Error.h"
|
||||
#include "Poco/Data/ODBC/ODBCException.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
Parameter::Parameter(const StatementHandle& rStmt, std::size_t colNum) :
|
||||
_rStmt(rStmt),
|
||||
_number(colNum)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
Parameter::~Parameter()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void Parameter::init()
|
||||
{
|
||||
if (Utility::isError(SQLDescribeParam(_rStmt,
|
||||
(SQLUSMALLINT) _number,
|
||||
&_dataType,
|
||||
&_columnSize,
|
||||
&_decimalDigits,
|
||||
&_isNullable)))
|
||||
{
|
||||
throw StatementException(_rStmt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
169
Data/ODBC/src/Preparation.cpp
Normal file
169
Data/ODBC/src/Preparation.cpp
Normal file
@ -0,0 +1,169 @@
|
||||
//
|
||||
// Preparation.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/Data/ODBC/src/Preparation.cpp#2 $
|
||||
//
|
||||
// Library: Data
|
||||
// Package: DataCore
|
||||
// Module: Preparation
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/Preparation.h"
|
||||
#include "Poco/Data/ODBC/ODBCColumn.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
Preparation::Preparation(const StatementHandle& rStmt,
|
||||
const std::string& statement,
|
||||
std::size_t maxFieldSize,
|
||||
DataExtraction dataExtraction):
|
||||
_rStmt(rStmt),
|
||||
_maxFieldSize(maxFieldSize),
|
||||
_dataExtraction(dataExtraction)
|
||||
{
|
||||
POCO_SQLCHAR* pStr = (POCO_SQLCHAR*) statement.c_str();
|
||||
if (Utility::isError(SQLPrepare(_rStmt, pStr, (SQLINTEGER) statement.length())))
|
||||
throw StatementException(_rStmt);
|
||||
|
||||
SQLSMALLINT nCol;
|
||||
if (Utility::isError(SQLNumResultCols(_rStmt, &nCol)))
|
||||
throw StatementException(_rStmt);
|
||||
|
||||
if (nCol)
|
||||
{
|
||||
_pValues.resize(nCol, 0);
|
||||
_pLengths.resize(nCol, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Preparation::~Preparation()
|
||||
{
|
||||
std::vector<SQLLEN*>::iterator itLen = _pLengths.begin();
|
||||
std::vector<SQLLEN*>::iterator itLenEnd = _pLengths.end();
|
||||
for (; itLen != itLenEnd; ++itLen) delete *itLen;
|
||||
|
||||
std::vector<Poco::Any*>::iterator itVal = _pValues.begin();
|
||||
std::vector<Poco::Any*>::iterator itValEnd = _pValues.end();
|
||||
for (; itVal != itValEnd; ++itVal) delete *itVal;
|
||||
}
|
||||
|
||||
|
||||
Poco::Any& Preparation::operator [] (std::size_t pos)
|
||||
{
|
||||
poco_assert (pos > 0 && pos <= _pValues.size());
|
||||
|
||||
return *_pValues[pos-1];
|
||||
}
|
||||
|
||||
|
||||
void Preparation::prepareRaw(std::size_t pos, SQLSMALLINT valueType, std::size_t size)
|
||||
{
|
||||
poco_assert (DE_BOUND == _dataExtraction);
|
||||
poco_assert (pos > 0 && pos <= _pValues.size());
|
||||
|
||||
char* pChr = new char[size];
|
||||
poco_assert_dbg (pChr);
|
||||
memset(pChr, 0, size);
|
||||
|
||||
SharedPtr<char> sp = pChr;
|
||||
_pValues[pos-1] = new Any(sp);
|
||||
_pLengths[pos-1] = new SQLLEN;
|
||||
*_pLengths[pos-1] = (SQLLEN) size;
|
||||
|
||||
if (Utility::isError(SQLBindCol(_rStmt,
|
||||
(SQLUSMALLINT) pos,
|
||||
valueType,
|
||||
(SQLPOINTER) pChr,
|
||||
(SQLINTEGER) size,
|
||||
_pLengths[pos-1])))
|
||||
{
|
||||
throw StatementException(_rStmt, "SQLBindCol()");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Preparation::prepare(std::size_t pos, const Poco::Any&)
|
||||
{
|
||||
ODBCColumn col(_rStmt, pos);
|
||||
|
||||
switch (col.type())
|
||||
{
|
||||
case MetaColumn::FDT_INT8:
|
||||
return preparePOD<Poco::Int8>(pos, SQL_C_STINYINT);
|
||||
|
||||
case MetaColumn::FDT_UINT8:
|
||||
return preparePOD<Poco::UInt8>(pos, SQL_C_UTINYINT);
|
||||
|
||||
case MetaColumn::FDT_INT16:
|
||||
return preparePOD<Poco::Int16>(pos, SQL_C_SSHORT);
|
||||
|
||||
case MetaColumn::FDT_UINT16:
|
||||
return preparePOD<Poco::UInt16>(pos, SQL_C_USHORT);
|
||||
|
||||
case MetaColumn::FDT_INT32:
|
||||
return preparePOD<Poco::Int32>(pos, SQL_C_SLONG);
|
||||
|
||||
case MetaColumn::FDT_UINT32:
|
||||
return preparePOD<Poco::UInt32>(pos, SQL_C_ULONG);
|
||||
|
||||
case MetaColumn::FDT_INT64:
|
||||
return preparePOD<Poco::Int64>(pos, SQL_C_SBIGINT);
|
||||
|
||||
case MetaColumn::FDT_UINT64:
|
||||
return preparePOD<Poco::UInt64>(pos, SQL_C_UBIGINT);
|
||||
|
||||
case MetaColumn::FDT_BOOL:
|
||||
return preparePOD<bool>(pos, Utility::boolDataType);
|
||||
|
||||
case MetaColumn::FDT_FLOAT:
|
||||
return preparePOD<float>(pos, SQL_C_FLOAT);
|
||||
|
||||
case MetaColumn::FDT_DOUBLE:
|
||||
return preparePOD<float>(pos, SQL_C_DOUBLE);
|
||||
|
||||
case MetaColumn::FDT_STRING:
|
||||
return prepareRaw(pos, SQL_C_CHAR, maxDataSize(pos));
|
||||
|
||||
case MetaColumn::FDT_BLOB:
|
||||
return prepareRaw(pos, SQL_C_BINARY, maxDataSize(pos));
|
||||
|
||||
default:
|
||||
throw DataFormatException("Unsupported data type.");
|
||||
}
|
||||
|
||||
prepareRaw(pos, SQL_C_BINARY, maxDataSize(pos));
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
297
Data/ODBC/src/SessionImpl.cpp
Normal file
297
Data/ODBC/src/SessionImpl.cpp
Normal file
@ -0,0 +1,297 @@
|
||||
//
|
||||
// SessionImpl.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/Data/ODBC/src/SessionImpl.cpp#3 $
|
||||
//
|
||||
// Library: ODBC
|
||||
// Package: ODBC
|
||||
// Module: SessionImpl
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/SessionImpl.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Data/ODBC/ODBCStatementImpl.h"
|
||||
#include "Poco/Data/ODBC/Error.h"
|
||||
#include "Poco/Data/ODBC/ODBCException.h"
|
||||
#include <sqlext.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
SessionImpl::SessionImpl(const std::string& connect,
|
||||
Poco::Any maxFieldSize,
|
||||
bool enforceCapability,
|
||||
bool autoBind,
|
||||
bool autoExtract):
|
||||
_connect(connect),
|
||||
_maxFieldSize(maxFieldSize),
|
||||
_enforceCapability(enforceCapability),
|
||||
_autoBind(autoBind),
|
||||
_autoExtract(autoExtract)
|
||||
{
|
||||
open();
|
||||
}
|
||||
|
||||
|
||||
SessionImpl::~SessionImpl()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
|
||||
Poco::Data::StatementImpl* SessionImpl::createStatementImpl()
|
||||
{
|
||||
return new ODBCStatementImpl(*this);
|
||||
}
|
||||
|
||||
|
||||
void SessionImpl::begin()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void SessionImpl::open()
|
||||
{
|
||||
POCO_SQLCHAR connectOutput[512] = {0};
|
||||
SQLSMALLINT result;
|
||||
|
||||
if (Utility::isError(SQLDriverConnect(_db
|
||||
, NULL
|
||||
,(POCO_SQLCHAR*) _connect.c_str()
|
||||
,(SQLSMALLINT) SQL_NTS
|
||||
, connectOutput
|
||||
, sizeof(connectOutput)
|
||||
, &result
|
||||
, SQL_DRIVER_NOPROMPT)))
|
||||
{
|
||||
ConnectionException exc(_db);
|
||||
close();
|
||||
throw exc;
|
||||
}
|
||||
|
||||
addFeature("enforceCapability",
|
||||
&SessionImpl::setEnforceCapability,
|
||||
&SessionImpl::getEnforceCapability);
|
||||
|
||||
addFeature("autoCommit",
|
||||
&SessionImpl::autoCommit,
|
||||
&SessionImpl::isAutoCommit);
|
||||
|
||||
addFeature("autoBind",
|
||||
&SessionImpl::autoBind,
|
||||
&SessionImpl::isAutoBind);
|
||||
|
||||
addFeature("autoExtract",
|
||||
&SessionImpl::autoExtract,
|
||||
&SessionImpl::isAutoExtract);
|
||||
|
||||
addProperty("maxFieldSize",
|
||||
&SessionImpl::setMaxFieldSize,
|
||||
&SessionImpl::getMaxFieldSize);
|
||||
|
||||
if (_enforceCapability && !isCapable())
|
||||
{
|
||||
close();
|
||||
throw ODBCException("Connection closed "
|
||||
"(capability enforcement required but not all required functions supported).");
|
||||
}
|
||||
|
||||
SQLSetConnectAttr(_db, SQL_ATTR_QUIET_MODE, 0, 0);
|
||||
|
||||
if (!canTransact()) autoCommit("", true);
|
||||
}
|
||||
|
||||
|
||||
bool SessionImpl::canTransact()
|
||||
{
|
||||
SQLUSMALLINT ret;
|
||||
checkError(SQLGetInfo(_db, SQL_TXN_CAPABLE, &ret, 0, 0),
|
||||
"Failed to obtain transaction capability info.");
|
||||
|
||||
return (SQL_TC_NONE != ret);
|
||||
}
|
||||
|
||||
|
||||
void SessionImpl::autoCommit(const std::string&, bool val)
|
||||
{
|
||||
checkError(SQLSetConnectAttr(_db,
|
||||
SQL_ATTR_AUTOCOMMIT,
|
||||
val ? (SQLPOINTER) SQL_AUTOCOMMIT_ON :
|
||||
(SQLPOINTER) SQL_AUTOCOMMIT_OFF,
|
||||
0), "Failed to set automatic commit.");
|
||||
}
|
||||
|
||||
|
||||
bool SessionImpl::isAutoCommit(const std::string&)
|
||||
{
|
||||
Poco::UInt32 value = 0;
|
||||
|
||||
checkError(SQLGetConnectAttr(_db,
|
||||
SQL_ATTR_AUTOCOMMIT,
|
||||
&value,
|
||||
0,
|
||||
0));
|
||||
|
||||
return (0 != value);
|
||||
}
|
||||
|
||||
|
||||
bool SessionImpl::isConnected()
|
||||
{
|
||||
Poco::UInt32 value = 0;
|
||||
|
||||
if (Utility::isError(SQLGetConnectAttr(_db,
|
||||
SQL_ATTR_CONNECTION_DEAD,
|
||||
&value,
|
||||
0,
|
||||
0)))
|
||||
return false;
|
||||
|
||||
return (0 == value);
|
||||
}
|
||||
|
||||
|
||||
bool SessionImpl::isTransaction()
|
||||
{
|
||||
Poco::UInt32 value = 0;
|
||||
|
||||
checkError(SQLGetConnectAttr(_db,
|
||||
SQL_ATTR_AUTOCOMMIT,
|
||||
&value,
|
||||
0,
|
||||
0));
|
||||
|
||||
return (0 == value);
|
||||
}
|
||||
|
||||
|
||||
void SessionImpl::close()
|
||||
{
|
||||
if (!isConnected()) return;
|
||||
|
||||
commit();
|
||||
checkError(SQLDisconnect(_db));
|
||||
}
|
||||
|
||||
|
||||
bool SessionImpl::isCapable()
|
||||
{
|
||||
SQLUSMALLINT exists[FUNCTIONS] = {0};
|
||||
|
||||
if (Utility::isError(SQLGetFunctions(_db, SQL_API_ODBC3_ALL_FUNCTIONS, exists)))
|
||||
{
|
||||
throw ConnectionException(_db,
|
||||
"SQLGetFunctions(SQL_API_ODBC3_ALL_FUNCTIONS)");
|
||||
}
|
||||
|
||||
return
|
||||
exists[SQL_API_SQLBINDPARAMETER] &&
|
||||
exists[SQL_API_SQLBINDCOL] &&
|
||||
exists[SQL_API_SQLGETDATA] &&
|
||||
exists[SQL_API_SQLPUTDATA] &&
|
||||
exists[SQL_API_SQLPARAMDATA] &&
|
||||
exists[SQL_API_SQLDESCRIBECOL] &&
|
||||
exists[SQL_API_SQLDESCRIBEPARAM] &&
|
||||
exists[SQL_API_SQLGETINFO] &&
|
||||
exists[SQL_API_SQLGETDIAGREC] &&
|
||||
exists[SQL_API_SQLGETDIAGFIELD] &&
|
||||
exists[SQL_API_SQLPREPARE] &&
|
||||
exists[SQL_API_SQLEXECUTE] &&
|
||||
exists[SQL_API_SQLEXECDIRECT] &&
|
||||
exists[SQL_API_SQLFETCH] &&
|
||||
exists[SQL_API_SQLNUMRESULTCOLS] &&
|
||||
exists[SQL_API_SQLALLOCHANDLE] &&
|
||||
exists[SQL_API_SQLFREEHANDLE] &&
|
||||
exists[SQL_API_SQLCLOSECURSOR] &&
|
||||
exists[SQL_API_SQLSETCONNECTATTR] &&
|
||||
exists[SQL_API_SQLSETSTMTATTR] &&
|
||||
exists[SQL_API_SQLENDTRAN] &&
|
||||
exists[SQL_API_SQLNATIVESQL] &&
|
||||
exists[SQL_API_SQLCOLATTRIBUTE];
|
||||
}
|
||||
|
||||
|
||||
int SessionImpl::maxStatementLength()
|
||||
{
|
||||
SQLUINTEGER info;
|
||||
SQLRETURN rc = 0;
|
||||
if (Utility::isError(rc = SQLGetInfo(_db,
|
||||
SQL_MAXIMUM_STATEMENT_LENGTH,
|
||||
(SQLPOINTER) &info,
|
||||
0,
|
||||
0)))
|
||||
{
|
||||
throw ConnectionException(_db,
|
||||
"SQLGetInfo(SQL_MAXIMUM_STATEMENT_LENGTH)");
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
void SessionImpl::setEnforceCapability(const std::string&, bool val)
|
||||
{
|
||||
_enforceCapability = val;
|
||||
}
|
||||
|
||||
|
||||
bool SessionImpl::getEnforceCapability(const std::string&)
|
||||
{
|
||||
return _enforceCapability;
|
||||
}
|
||||
|
||||
|
||||
void SessionImpl::autoBind(const std::string&, bool val)
|
||||
{
|
||||
_autoBind = val;
|
||||
}
|
||||
|
||||
|
||||
bool SessionImpl::isAutoBind(const std::string& name)
|
||||
{
|
||||
return _autoBind;
|
||||
}
|
||||
|
||||
|
||||
void SessionImpl::autoExtract(const std::string&, bool val)
|
||||
{
|
||||
_autoExtract = val;
|
||||
}
|
||||
|
||||
|
||||
bool SessionImpl::isAutoExtract(const std::string& name)
|
||||
{
|
||||
return _autoExtract;
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
125
Data/ODBC/src/Utility.cpp
Normal file
125
Data/ODBC/src/Utility.cpp
Normal file
@ -0,0 +1,125 @@
|
||||
//
|
||||
// Utility.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/Data/ODBC/src/Utility.cpp#2 $
|
||||
//
|
||||
// Library: ODBC
|
||||
// Package: ODBC
|
||||
// Module: Utility
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Data/ODBC/Handle.h"
|
||||
#include "Poco/Data/ODBC/ODBCException.h"
|
||||
#include "Poco/NumberFormatter.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
const DataTypes Utility::_dataTypes;
|
||||
const SQLSMALLINT Utility::boolDataType = (sizeof(bool) <= sizeof(char)) ? SQL_C_TINYINT :
|
||||
(sizeof(bool) == sizeof(short)) ? SQL_C_SHORT : SQL_C_LONG;
|
||||
|
||||
|
||||
Utility::DriverMap& Utility::drivers(Utility::DriverMap& driverMap)
|
||||
{
|
||||
static const EnvironmentHandle henv;
|
||||
const int length = sizeof(POCO_SQLCHAR) * 512;
|
||||
|
||||
POCO_SQLCHAR desc[length];
|
||||
memset(desc, 0, length);
|
||||
SQLSMALLINT len1 = length;
|
||||
POCO_SQLCHAR attr[length];
|
||||
memset(attr, 0, length);
|
||||
SQLSMALLINT len2 = length;
|
||||
RETCODE rc = 0;
|
||||
|
||||
while (!Utility::isError(rc = SQLDrivers(henv,
|
||||
SQL_FETCH_NEXT,
|
||||
desc,
|
||||
length,
|
||||
&len1,
|
||||
attr,
|
||||
len2,
|
||||
&len2)))
|
||||
{
|
||||
driverMap.insert(DSNMap::value_type(std::string((char *) desc),
|
||||
std::string((char *) attr)));
|
||||
memset(desc, 0, length);
|
||||
memset(attr, 0, length);
|
||||
len2 = length;
|
||||
}
|
||||
|
||||
if (SQL_NO_DATA != rc)
|
||||
throw EnvironmentError(henv);
|
||||
|
||||
return driverMap;
|
||||
}
|
||||
|
||||
|
||||
Utility::DSNMap& Utility::dataSources(Utility::DSNMap& dsnMap)
|
||||
{
|
||||
static const EnvironmentHandle henv;
|
||||
const int length = sizeof(POCO_SQLCHAR) * 512;
|
||||
const int dsnLength = sizeof(POCO_SQLCHAR) * (SQL_MAX_DSN_LENGTH + 1);
|
||||
|
||||
POCO_SQLCHAR dsn[dsnLength];
|
||||
memset(dsn, 0, dsnLength);
|
||||
SQLSMALLINT len1 = sizeof(POCO_SQLCHAR) * SQL_MAX_DSN_LENGTH;
|
||||
POCO_SQLCHAR desc[length];
|
||||
memset(desc, 0, length);
|
||||
SQLSMALLINT len2 = length;
|
||||
RETCODE rc = 0;
|
||||
|
||||
while (!Utility::isError(rc = SQLDataSources(henv,
|
||||
SQL_FETCH_NEXT,
|
||||
dsn,
|
||||
SQL_MAX_DSN_LENGTH,
|
||||
&len1,
|
||||
desc,
|
||||
len2,
|
||||
&len2)))
|
||||
{
|
||||
dsnMap.insert(DSNMap::value_type(std::string((char *) dsn), std::string((char *) desc)));
|
||||
memset(dsn, 0, dsnLength);
|
||||
memset(desc, 0, length);
|
||||
len2 = length;
|
||||
}
|
||||
|
||||
if (SQL_NO_DATA != rc)
|
||||
throw EnvironmentError(henv);
|
||||
|
||||
return dsnMap;
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
25
Data/ODBC/testsuite/Makefile
Normal file
25
Data/ODBC/testsuite/Makefile
Normal file
@ -0,0 +1,25 @@
|
||||
#
|
||||
# Makefile
|
||||
#
|
||||
# $Id: //poco/1.3/Data/ODBC/testsuite/Makefile#1 $
|
||||
#
|
||||
# Makefile for Poco SQLite testsuite
|
||||
#
|
||||
|
||||
include $(POCO_BASE)/build/rules/global
|
||||
|
||||
ifeq ($(OSNAME),Darwin)
|
||||
SYSLIBS += -liodbc -liodbcinst
|
||||
else
|
||||
SYSLIBS += -lodbc -lodbcinst
|
||||
endif
|
||||
|
||||
objects = ODBCTestSuite Driver \
|
||||
ODBCDB2Test ODBCMySQLTest ODBCOracleTest \
|
||||
ODBCPostgreSQLTest ODBCSQLiteTest SQLExecutor
|
||||
|
||||
target = testrunner
|
||||
target_version = 1
|
||||
target_libs = PocoODBC PocoData PocoFoundation CppUnit
|
||||
|
||||
include $(POCO_BASE)/build/rules/exec
|
9
Data/ODBC/testsuite/TestSuite.vmsbuild
Normal file
9
Data/ODBC/testsuite/TestSuite.vmsbuild
Normal file
@ -0,0 +1,9 @@
|
||||
#
|
||||
# TestSuite.vmsbuild
|
||||
#
|
||||
# $Id: //poco/1.3/Data/ODBC/testsuite/TestSuite.vmsbuild#1 $
|
||||
#
|
||||
EXE=TestRunner
|
||||
SQLiteTestSuite
|
||||
Driver
|
||||
SQLiteTest
|
227
Data/ODBC/testsuite/TestSuite_VS71.vcproj
Normal file
227
Data/ODBC/testsuite/TestSuite_VS71.vcproj
Normal file
@ -0,0 +1,227 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="TestSuite"
|
||||
ProjectGUID="{1b30a91b-375f-11db-837b-00123fc423b5}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="debug_shared|Win32"
|
||||
OutputDirectory="obj\debug_shared"
|
||||
IntermediateDirectory="obj\debug_shared"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\include;..\..\..\Foundation\include;..\..\..\CppUnit\include;..\..\..\CppUnit\WinTestRunner\include;..\..\..\Data\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="TRUE"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="CppUnitd.lib WinTestRunnerd.lib PocoFoundationd.lib PocoDatad.lib PocoODBCd.lib odbc32.lib odbccp32.lib"
|
||||
OutputFile="bin/TestSuited.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="bin/TestSuited.pdb"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="release_shared|Win32"
|
||||
OutputDirectory="obj\release_shared"
|
||||
IntermediateDirectory="obj\release_shared"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="TRUE"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="TRUE"
|
||||
OptimizeForWindowsApplication="TRUE"
|
||||
AdditionalIncludeDirectories="..\include;..\..\..\Foundation\include;..\..\..\CppUnit\include;..\..\..\CppUnit\WinTestRunner\include;..\..\..\Data\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="FALSE"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
ForceConformanceInForLoopScope="TRUE"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="CppUnit.lib WinTestRunner.lib PocoFoundation.lib PocoData.lib PocoODBC.lib odbc32.lib odbccp32.lib"
|
||||
OutputFile="bin/TestSuite.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="FALSE"
|
||||
ProgramDatabaseFile=""
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="ODBC"
|
||||
Filter="">
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\src\ODBCAccessTest.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ODBCDB2Test.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ODBCMySQLTest.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ODBCOracleTest.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ODBCPostgreSQLTest.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ODBCSQLiteTest.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ODBCSQLServerTest.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\SQLExecutor.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\src\ODBCAccessTest.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ODBCDB2Test.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ODBCMySQLTest.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ODBCOracleTest.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ODBCPostgreSQLTest.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ODBCSQLiteTest.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ODBCSQLServerTest.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\SQLExecutor.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="_Suite"
|
||||
Filter="">
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\src\ODBCTestSuite.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\src\ODBCTestSuite.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="_Driver"
|
||||
Filter="">
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\src\WinDriver.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
307
Data/ODBC/testsuite/TestSuite_VS80.vcproj
Normal file
307
Data/ODBC/testsuite/TestSuite_VS80.vcproj
Normal file
@ -0,0 +1,307 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="TestSuite"
|
||||
ProjectGUID="{1B30A91B-375F-11DB-837B-00123FC423B5}"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="debug_shared|Win32"
|
||||
OutputDirectory="obj\debug_shared"
|
||||
IntermediateDirectory="obj\debug_shared"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\include;..\..\..\Foundation\include;..\..\..\CppUnit\include;..\..\..\CppUnit\WinTestRunner\include;..\..\..\Data\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="true"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="CppUnitd.lib WinTestRunnerd.lib PocoFoundationd.lib PocoODBCd.lib PocoDatad.lib odbc32.lib odbccp32.lib"
|
||||
OutputFile="bin/TestSuited.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="bin/TestSuited.pdb"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="release_shared|Win32"
|
||||
OutputDirectory="obj\release_shared"
|
||||
IntermediateDirectory="obj\release_shared"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="4"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories="..\include;..\..\..\Foundation\include;..\..\..\CppUnit\include;..\..\..\CppUnit\WinTestRunner\include;..\..\..\Data\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="false"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="CppUnit.lib WinTestRunner.lib PocoFoundation.lib PocoODBC.lib PocoData.lib odbc32.lib odbccp32.lib"
|
||||
OutputFile="bin/TestSuite.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\..\lib"
|
||||
GenerateDebugInformation="false"
|
||||
ProgramDatabaseFile=""
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="ODBC"
|
||||
>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\ODBCAccessTest.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ODBCDB2Test.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ODBCMySQLTest.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ODBCOracleTest.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ODBCPostgreSQLTest.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ODBCSQLiteTest.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ODBCSQLServerTest.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\SQLExecutor.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\ODBCAccessTest.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ODBCDB2Test.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ODBCMySQLTest.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ODBCOracleTest.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ODBCPostgreSQLTest.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ODBCSQLiteTest.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ODBCSQLServerTest.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\SQLExecutor.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="_Suite"
|
||||
>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\ODBCTestSuite.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\ODBCTestSuite.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="_Driver"
|
||||
>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\WinDriver.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
39
Data/ODBC/testsuite/src/Driver.cpp
Normal file
39
Data/ODBC/testsuite/src/Driver.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
//
|
||||
// Driver.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/Data/ODBC/testsuite/src/Driver.cpp#2 $
|
||||
//
|
||||
// Console-based test driver for Poco SQLite.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "CppUnit/TestRunner.h"
|
||||
#include "ODBCTestSuite.h"
|
||||
|
||||
|
||||
CppUnitMain(ODBCTestSuite)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user