mirror of
https://github.com/pocoproject/poco.git
synced 2025-11-26 00:40:05 +01:00
Any and DynamicAny out and io
This commit is contained in:
@@ -35,6 +35,8 @@
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Poco/String.h"
|
||||
#include "Poco/Format.h"
|
||||
#include "Poco/Any.h"
|
||||
#include "Poco/DynamicAny.h"
|
||||
#include "Poco/Tuple.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include "Poco/Data/Common.h"
|
||||
@@ -56,6 +58,9 @@ using ODBC::StatementException;
|
||||
using ODBC::StatementDiagnostics;
|
||||
using Poco::format;
|
||||
using Poco::Tuple;
|
||||
using Poco::Any;
|
||||
using Poco::AnyCast;
|
||||
using Poco::DynamicAny;
|
||||
using Poco::NotFoundException;
|
||||
|
||||
|
||||
@@ -958,6 +963,77 @@ void ODBCDB2Test::testStoredProcedure()
|
||||
}
|
||||
|
||||
|
||||
void ODBCDB2Test::testStoredProcedureAny()
|
||||
{
|
||||
if (!_pSession) fail ("Test not available.");
|
||||
|
||||
for (int k = 0; k < 8;)
|
||||
{
|
||||
_pSession->setFeature("autoBind", bindValues[k]);
|
||||
_pSession->setFeature("autoExtract", bindValues[k+1]);
|
||||
|
||||
Any i = 2;
|
||||
Any j = 0;
|
||||
|
||||
*_pSession << "CREATE PROCEDURE storedProcedure(inParam INTEGER, OUT outParam INTEGER) "
|
||||
"BEGIN "
|
||||
" SET outParam = inParam*inParam; "
|
||||
"END" , now;
|
||||
|
||||
*_pSession << "{call storedProcedure(?, ?)}", in(i), out(j), now;
|
||||
assert(4 == AnyCast<int>(j));
|
||||
*_pSession << "DROP PROCEDURE storedProcedure;", now;
|
||||
|
||||
*_pSession << "CREATE PROCEDURE storedProcedure(INOUT ioParam INTEGER) "
|
||||
"BEGIN "
|
||||
" SET ioParam = ioParam*ioParam; "
|
||||
"END" , now;
|
||||
|
||||
i = 2;
|
||||
*_pSession << "{call storedProcedure(?)}", io(i), now;
|
||||
assert(4 == AnyCast<int>(i));
|
||||
dropObject("PROCEDURE", "storedProcedure");
|
||||
|
||||
k += 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ODBCDB2Test::testStoredProcedureDynamicAny()
|
||||
{
|
||||
if (!_pSession) fail ("Test not available.");
|
||||
|
||||
for (int k = 0; k < 8;)
|
||||
{
|
||||
_pSession->setFeature("autoBind", bindValues[k]);
|
||||
|
||||
DynamicAny i = 2;
|
||||
DynamicAny j = 0;
|
||||
|
||||
*_pSession << "CREATE PROCEDURE storedProcedure(inParam INTEGER, OUT outParam INTEGER) "
|
||||
"BEGIN "
|
||||
" SET outParam = inParam*inParam; "
|
||||
"END" , now;
|
||||
|
||||
*_pSession << "{call storedProcedure(?, ?)}", in(i), out(j), now;
|
||||
assert(4 == j);
|
||||
*_pSession << "DROP PROCEDURE storedProcedure;", now;
|
||||
|
||||
*_pSession << "CREATE PROCEDURE storedProcedure(INOUT ioParam INTEGER) "
|
||||
"BEGIN "
|
||||
" SET ioParam = ioParam*ioParam; "
|
||||
"END" , now;
|
||||
|
||||
i = 2;
|
||||
*_pSession << "{call storedProcedure(?)}", io(i), now;
|
||||
assert(4 == i);
|
||||
dropObject("PROCEDURE", "storedProcedure");
|
||||
|
||||
k += 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ODBCDB2Test::testStoredFunction()
|
||||
{
|
||||
if (!_pSession) fail ("Test not available.");
|
||||
@@ -1375,6 +1451,8 @@ CppUnit::Test* ODBCDB2Test::suite()
|
||||
CppUnit_addTest(pSuite, ODBCDB2Test, testInternalExtraction);
|
||||
CppUnit_addTest(pSuite, ODBCDB2Test, testInternalStorageType);
|
||||
CppUnit_addTest(pSuite, ODBCDB2Test, testStoredProcedure);
|
||||
CppUnit_addTest(pSuite, ODBCDB2Test, testStoredProcedureAny);
|
||||
CppUnit_addTest(pSuite, ODBCDB2Test, testStoredProcedureDynamicAny);
|
||||
CppUnit_addTest(pSuite, ODBCDB2Test, testStoredFunction);
|
||||
CppUnit_addTest(pSuite, ODBCDB2Test, testNull);
|
||||
CppUnit_addTest(pSuite, ODBCDB2Test, testRowIterator);
|
||||
|
||||
Reference in New Issue
Block a user