Diagnostics fix and Linux test fixes

This commit is contained in:
Aleksandar Fabijanic 2007-05-23 23:07:52 +00:00
parent 55b22cc271
commit cb7394bb6d
6 changed files with 43 additions and 22 deletions

View File

@ -162,8 +162,8 @@ public:
DiagnosticFields df;
SQLSMALLINT count = 1;
SQLSMALLINT messageLength = 0;
static const std::string& none = "None";
static const std::string& na = "Not applicable";
const std::string none = "None";
const std::string na = "Not applicable";
reset();
@ -178,11 +178,6 @@ public:
{
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)
@ -191,22 +186,38 @@ public:
count,
SQL_DIAG_CONNECTION_NAME,
_connectionName,
SQL_NAME_LENGTH,
sizeof(_connectionName),
&messageLength)))
memcpy(_connectionName, none.c_str(), none.length());
{
std::size_t len = sizeof(_connectionName) > none.length() ?
none.length() : sizeof(_connectionName) - 1;
memcpy(_connectionName, none.c_str(), len);
}
else if (0 == _connectionName[0])
memcpy(_connectionName, na.c_str(), na.length());
{
std::size_t len = sizeof(_connectionName) > na.length() ?
na.length() : sizeof(_connectionName) - 1;
memcpy(_connectionName, na.c_str(), len);
}
if (Utility::isError(SQLGetDiagField(handleType,
_rHandle,
count,
SQL_DIAG_SERVER_NAME,
_serverName,
SQL_NAME_LENGTH,
sizeof(_serverName),
&messageLength)))
memcpy(_serverName, none.c_str(), none.length());
{
std::size_t len = sizeof(_serverName) > none.length() ?
none.length() : sizeof(_serverName) - 1;
memcpy(_serverName, none.c_str(), len);
}
else if (0 == _serverName[0])
memcpy(_serverName, na.c_str(), na.length());
{
std::size_t len = sizeof(_serverName) > na.length() ?
na.length() : sizeof(_serverName) - 1;
memcpy(_serverName, na.c_str(), len);
}
}
_fields.push_back(df);

View File

@ -870,7 +870,11 @@ bool ODBCMySQLTest::init(const std::string& driver, const std::string& dsn)
CppUnit::Test* ODBCMySQLTest::suite()
{
#ifdef POCO_OS_FAMILY_WINDOWS
if (init("MySQL ODBC 3.51 Driver", "PocoDataMySQLTest"))
#else
if (init("MySQL", "PocoDataMySQLTest"))
#endif
{
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("ODBCMySQLTest");

View File

@ -48,9 +48,10 @@ class ODBCMySQLTest: public CppUnit::TestCase
/// MySQL ODBC test class
/// Tested:
///
/// Driver | DB | OS
/// ----------------+---------------------------+------------------------------------------
/// 03.51.12.00 | MySQL 5.0.27-community-nt | MS Windows XP Professional x64 v.2003/SP1
/// Driver | DB | OS | Driver Manager
/// ----------------+---------------------------+-------------------------------------------+---------------------
/// 03.51.12.00 | MySQL 5.0.27-community-nt | MS Windows XP Professional x64 v.2003/SP1 | 3.526.3959.0
/// 3.51.11.-6 | MySQL 5.0.27-community-nt | Ubuntu 7.04 (2.6.20-15-generic #2 SMP) | unixODBC 2.2.11.-13
///
{

View File

@ -48,10 +48,11 @@ class ODBCPostgreSQLTest: public CppUnit::TestCase
/// PostgreSQL ODBC test class
/// Tested:
///
/// Driver | DB | OS | Notes
/// ------------+-------------------+-------------------------------------------+--------------------------------
/// 07.03.02.60 | PostgreSQL 7.4.6 | MS Windows XP Professional x64 v.2003/SP1 | BLOB fails (missing 'lo' module)
/// 08.01.02.00 | PostgreSQL 8.1.5-1| MS Windows XP Professional x64 v.2003/SP1 |
/// Driver | DB | OS | Driver Manager |Notes
/// --------------+-------------------+-------------------------------------------+--------------------+--------------------------
/// 07.03.02.60 | PostgreSQL 7.4.6 | MS Windows XP Professional x64 v.2003/SP1 | 3.526.3959.0 | BLOB fails (missing 'lo')
/// 08.01.02.00 | PostgreSQL 8.1.5-1| MS Windows XP Professional x64 v.2003/SP1 | 3.526.3959.0 |
/// 1:08.01.0200-2| PostgreSQL 8.1.5-1| Ubuntu 7.04 (2.6.20-15-generic #2 SMP) | unixODBC 2.2.11.-13|
///
{
public:

View File

@ -847,7 +847,8 @@ bool ODBCSQLServerTest::canConnect(const std::string& driver, const std::string&
"UID=test;"
"PWD=test;"
"DATABASE=test;"
"SERVER=(local);", driver);
"SERVER=localhost;"
"PORT=1433;", driver);
return true;
}
@ -891,7 +892,11 @@ bool ODBCSQLServerTest::init(const std::string& driver, const std::string& dsn)
CppUnit::Test* ODBCSQLServerTest::suite()
{
#ifdef POCO_OS_FAMILY_WINDOWS
if (init("SQL Server", "PocoDataSQLServerTest"))
#else
if (init("FreeTDS", "PocoDataSQLServerTest"))
#endif
{
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("ODBCSQLServerTest");

View File

@ -169,7 +169,6 @@ SQLExecutor::SQLExecutor(const std::string& name, Poco::Data::Session* pSession)
SQLExecutor::~SQLExecutor()
{
ODBC::Connector::unregisterConnector();
}