mirror of
https://github.com/pocoproject/poco.git
synced 2025-11-23 13:32:11 +01:00
wrong field size calculation in ODBC code #1659 and other develop backports
This commit is contained in:
@@ -38,12 +38,13 @@ using Poco::Tuple;
|
||||
using Poco::NotFoundException;
|
||||
|
||||
|
||||
#define MYSQL_ODBC_DRIVER "MySQL ODBC 5.2 Driver"
|
||||
#define MYSQL_ODBC_DRIVER "MySQL ODBC 5.3 Unicode Driver"
|
||||
#define MYSQL_DSN "PocoDataMySQLTest"
|
||||
#define MYSQL_SERVER POCO_ODBC_TEST_DATABASE_SERVER
|
||||
#define MYSQL_DB "test"
|
||||
#define MYSQL_UID "root"
|
||||
#define MYSQL_PWD "poco"
|
||||
#define MYSQL_DB "test"
|
||||
|
||||
|
||||
ODBCTest::SessionPtr ODBCMySQLTest::_pSession;
|
||||
@@ -52,6 +53,7 @@ std::string ODBCMySQLTest::_driver = MYSQL_ODBC_DRIVER;
|
||||
std::string ODBCMySQLTest::_dsn = MYSQL_DSN;
|
||||
std::string ODBCMySQLTest::_uid = MYSQL_UID;
|
||||
std::string ODBCMySQLTest::_pwd = MYSQL_PWD;
|
||||
std::string ODBCMySQLTest::_db = MYSQL_DB;
|
||||
std::string ODBCMySQLTest::_connectString = "DRIVER={" MYSQL_ODBC_DRIVER "};"
|
||||
"DATABASE=" MYSQL_DB ";"
|
||||
"SERVER=" MYSQL_SERVER ";"
|
||||
@@ -162,7 +164,7 @@ void ODBCMySQLTest::testNull()
|
||||
recreateNullsTable("NOT NULL");
|
||||
_pSession->setFeature("autoBind", bindValue(i));
|
||||
_pSession->setFeature("autoExtract", bindValue(i+1));
|
||||
_pExecutor->notNulls("HYT00");
|
||||
_pExecutor->notNulls("HY000");
|
||||
i += 2;
|
||||
}
|
||||
|
||||
@@ -410,7 +412,7 @@ void ODBCMySQLTest::recreateLogTable()
|
||||
|
||||
CppUnit::Test* ODBCMySQLTest::suite()
|
||||
{
|
||||
if ((_pSession = init(_driver, _dsn, _uid, _pwd, _connectString)))
|
||||
if ((_pSession = init(_driver, _dsn, _uid, _pwd, _connectString, _db)))
|
||||
{
|
||||
std::cout << "*** Connected to [" << _driver << "] test database." << std::endl;
|
||||
|
||||
@@ -444,7 +446,7 @@ CppUnit::Test* ODBCMySQLTest::suite()
|
||||
CppUnit_addTest(pSuite, ODBCMySQLTest, testLimitPrepare);
|
||||
CppUnit_addTest(pSuite, ODBCMySQLTest, testLimitZero);
|
||||
CppUnit_addTest(pSuite, ODBCMySQLTest, testPrepare);
|
||||
//CppUnit_addTest(pSuite, ODBCMySQLTest, testBulk);
|
||||
CppUnit_addTest(pSuite, ODBCMySQLTest, testBulk);
|
||||
CppUnit_addTest(pSuite, ODBCMySQLTest, testBulkPerformance);
|
||||
CppUnit_addTest(pSuite, ODBCMySQLTest, testSetSimple);
|
||||
CppUnit_addTest(pSuite, ODBCMySQLTest, testSetComplex);
|
||||
|
||||
@@ -71,6 +71,7 @@ private:
|
||||
static std::string _dsn;
|
||||
static std::string _uid;
|
||||
static std::string _pwd;
|
||||
static std::string _db;
|
||||
static std::string _connectString;
|
||||
};
|
||||
|
||||
|
||||
@@ -41,11 +41,11 @@ using Poco::DynamicAny;
|
||||
using Poco::DateTime;
|
||||
|
||||
|
||||
#define ORACLE_ODBC_DRIVER "Oracle in XE"
|
||||
#define ORACLE_ODBC_DRIVER "Oracle in OraDB12Home1"
|
||||
#define ORACLE_DSN "PocoDataOracleTest"
|
||||
#define ORACLE_SERVER POCO_ODBC_TEST_DATABASE_SERVER
|
||||
#define ORACLE_PORT "1521"
|
||||
#define ORACLE_SID "XE"
|
||||
#define ORACLE_SID "ORCL"
|
||||
#define ORACLE_UID "poco"
|
||||
#define ORACLE_PWD "poco"
|
||||
|
||||
|
||||
@@ -59,11 +59,11 @@ using Poco::DateTime;
|
||||
#define POSTGRESQL_PORT "5432"
|
||||
#define POSTGRESQL_DB "postgres"
|
||||
#define POSTGRESQL_UID "postgres"
|
||||
#define POSTGRESQL_PWD "postgres"
|
||||
#define POSTGRESQL_VERSION "9.3"
|
||||
#define POSTGRESQL_PWD "poco"
|
||||
#define POSTGRESQL_VERSION "10"
|
||||
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
const std::string ODBCPostgreSQLTest::_libDir = "C:\\\\Program Files\\\\PostgreSQL\\\\" POSTGRESQL_VERSION "\\\\lib\\\\";
|
||||
const std::string ODBCPostgreSQLTest::_libDir = "C:\\\\Program Files\\\\PostgreSQL\\\\pg" POSTGRESQL_VERSION "\\\\lib\\\\";
|
||||
#else
|
||||
const std::string ODBCPostgreSQLTest::_libDir = "/usr/local/pgsql/lib/";
|
||||
#endif
|
||||
@@ -353,7 +353,7 @@ void ODBCPostgreSQLTest::configurePLPgSQL()
|
||||
|
||||
}catch(StatementException& ex)
|
||||
{
|
||||
if (7 != ex.diagnostics().nativeError(0))
|
||||
if (1 != ex.diagnostics().nativeError(0))
|
||||
throw;
|
||||
}
|
||||
|
||||
@@ -374,7 +374,7 @@ void ODBCPostgreSQLTest::dropObject(const std::string& type, const std::string&
|
||||
StatementDiagnostics::Iterator it = flds.begin();
|
||||
for (; it != flds.end(); ++it)
|
||||
{
|
||||
if (7 == it->_nativeError)//(table does not exist)
|
||||
if (1 == it->_nativeError)//(table does not exist)
|
||||
{
|
||||
ignoreError = true;
|
||||
break;
|
||||
@@ -665,13 +665,15 @@ CppUnit::Test* ODBCPostgreSQLTest::suite()
|
||||
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testAsync);
|
||||
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testAny);
|
||||
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testDynamicAny);
|
||||
//neither pSQL ODBC nor Mammoth drivers support multiple results properly
|
||||
//CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testMultipleResults);
|
||||
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testMultipleResults);
|
||||
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testSQLChannel);
|
||||
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testSQLLogger);
|
||||
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testSessionTransaction);
|
||||
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testTransaction);
|
||||
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testTransactor);
|
||||
// (postgres bug?)
|
||||
// local session claims to be capable of reading uncommitted changes,
|
||||
// but fails to do so
|
||||
//CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testTransaction);
|
||||
//CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testTransactor);
|
||||
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testNullable);
|
||||
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testUnicode);
|
||||
CppUnit_addTest(pSuite, ODBCPostgreSQLTest, testReconnect);
|
||||
|
||||
@@ -402,7 +402,7 @@ void SQLExecutor::bareboneODBCTest(const std::string& dbConnString,
|
||||
sixth.day = 18;
|
||||
sixth.hour = 5;
|
||||
sixth.minute = 34;
|
||||
sixth.second = 59;
|
||||
sixth.second = 58;
|
||||
// Fraction support is limited to milliseconds due to MS SQL Server limitation
|
||||
// see http://support.microsoft.com/kb/263872
|
||||
sixth.fraction = 997000000;
|
||||
@@ -693,9 +693,15 @@ void SQLExecutor::bareboneODBCTest(const std::string& dbConnString,
|
||||
{
|
||||
assert (5 == sixth.hour);
|
||||
assert (34 == sixth.minute);
|
||||
assert (59 == sixth.second);
|
||||
if (sixth.fraction)//MySQL does not support fraction
|
||||
assert (997000000 == sixth.fraction);
|
||||
if (sixth.fraction) // MySQL rounds fraction
|
||||
{
|
||||
assert(58 == sixth.second);
|
||||
assert(997000000 == sixth.fraction);
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(59 == sixth.second);
|
||||
}
|
||||
}
|
||||
|
||||
rc = SQLCloseCursor(hstmt);
|
||||
|
||||
Reference in New Issue
Block a user