cleared some 64-bit warnings and test failures

This commit is contained in:
Alex Fabijanic
2014-05-13 04:06:00 -05:00
parent 0a61d7a2b9
commit 609a35578c
12 changed files with 43 additions and 31 deletions

View File

@@ -610,7 +610,7 @@ private:
for (; lIt != lEnd; ++lIt, ++cIt) for (; lIt != lEnd; ++lIt, ++cIt)
{ {
SQLLEN sz = static_cast<SQLLEN>(cIt->size()); SQLLEN sz = static_cast<SQLLEN>(cIt->size());
if (sz > size) size = sz; if (sz > size) size = static_cast<SQLINTEGER>(sz);
*lIt = sz; *lIt = sz;
} }

View File

@@ -233,7 +233,8 @@ bool Extractor::extractManualImpl<std::string>(std::size_t pos, std::string& val
std::size_t totalSize = 0; std::size_t totalSize = 0;
SQLLEN len; SQLLEN len;
Poco::Buffer<char> apChar(CHUNK_SIZE); const int bufSize = CHUNK_SIZE;
Poco::Buffer<char> apChar(bufSize);
char* pChar = apChar.begin(); char* pChar = apChar.begin();
SQLRETURN rc = 0; SQLRETURN rc = 0;
@@ -242,13 +243,13 @@ bool Extractor::extractManualImpl<std::string>(std::size_t pos, std::string& val
do do
{ {
std::memset(pChar, 0, CHUNK_SIZE); std::memset(pChar, 0, bufSize);
len = 0; len = 0;
rc = SQLGetData(_rStmt, rc = SQLGetData(_rStmt,
(SQLUSMALLINT) pos + 1, (SQLUSMALLINT) pos + 1,
cType, //C data type cType, //C data type
pChar, //returned value pChar, //returned value
CHUNK_SIZE, //buffer length bufSize, //buffer length
&len); //length indicator &len); //length indicator
if (SQL_NO_DATA != rc && Utility::isError(rc)) if (SQL_NO_DATA != rc && Utility::isError(rc))
@@ -289,7 +290,8 @@ bool Extractor::extractManualImpl<Poco::Data::CLOB>(std::size_t pos,
std::size_t totalSize = 0; std::size_t totalSize = 0;
SQLLEN len; SQLLEN len;
Poco::Buffer<char> apChar(CHUNK_SIZE); const int bufSize = CHUNK_SIZE;
Poco::Buffer<char> apChar(bufSize);
char* pChar = apChar.begin(); char* pChar = apChar.begin();
SQLRETURN rc = 0; SQLRETURN rc = 0;
@@ -298,13 +300,13 @@ bool Extractor::extractManualImpl<Poco::Data::CLOB>(std::size_t pos,
do do
{ {
std::memset(pChar, 0, CHUNK_SIZE); std::memset(pChar, 0, bufSize);
len = 0; len = 0;
rc = SQLGetData(_rStmt, rc = SQLGetData(_rStmt,
(SQLUSMALLINT) pos + 1, (SQLUSMALLINT) pos + 1,
cType, //C data type cType, //C data type
pChar, //returned value pChar, //returned value
CHUNK_SIZE, //buffer length bufSize, //buffer length
&len); //length indicator &len); //length indicator
_lengths[pos] += len; _lengths[pos] += len;

View File

@@ -38,10 +38,18 @@ using Poco::DateTime;
#ifdef POCO_ODBC_USE_MAMMOTH_NG #ifdef POCO_ODBC_USE_MAMMOTH_NG
#define POSTGRESQL_ODBC_DRIVER "Mammoth ODBCng Beta" #define POSTGRESQL_ODBC_DRIVER "Mammoth ODBCng Beta"
#elif defined (POCO_ODBC_UNICODE) #elif defined (POCO_ODBC_UNICODE)
#define POSTGRESQL_ODBC_DRIVER "PostgreSQL ODBC Driver(UNICODE)" #ifdef POCO_PTR_IS_64_BIT
#define POSTGRESQL_ODBC_DRIVER "PostgreSQL Unicode(x64)"
#else
#define POSTGRESQL_ODBC_DRIVER "PostgreSQL Unicode"
#endif
#define POSTGRESQL_DSN "PocoDataPgSQLTestW" #define POSTGRESQL_DSN "PocoDataPgSQLTestW"
#else #else
#define POSTGRESQL_ODBC_DRIVER "PostgreSQL ODBC Driver(ANSI)" #ifdef POCO_PTR_IS_64_BIT
#define POSTGRESQL_ODBC_DRIVER "PostgreSQL ANSI(x64)"
#else
#define POSTGRESQL_ODBC_DRIVER "PostgreSQL ANSI"
#endif
#define POSTGRESQL_DSN "PocoDataPgSQLTest" #define POSTGRESQL_DSN "PocoDataPgSQLTest"
#endif #endif
@@ -50,7 +58,7 @@ using Poco::DateTime;
#define POSTGRESQL_DB "postgres" #define POSTGRESQL_DB "postgres"
#define POSTGRESQL_UID "postgres" #define POSTGRESQL_UID "postgres"
#define POSTGRESQL_PWD "postgres" #define POSTGRESQL_PWD "postgres"
#define POSTGRESQL_VERSION "9.2" #define POSTGRESQL_VERSION "9.3"
#ifdef POCO_OS_FAMILY_WINDOWS #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\\\\" POSTGRESQL_VERSION "\\\\lib\\\\";

View File

@@ -81,7 +81,7 @@ using Poco::DateTime;
#endif #endif
#define MS_SQL_SERVER_DSN "PocoDataSQLServerTest" #define MS_SQL_SERVER_DSN "PocoDataSQLServerTest"
#define MS_SQL_SERVER_SERVER POCO_ODBC_TEST_DATABASE_SERVER #define MS_SQL_SERVER_SERVER POCO_ODBC_TEST_DATABASE_SERVER "\\SQLEXPRESS"
#define MS_SQL_SERVER_PORT "1433" #define MS_SQL_SERVER_PORT "1433"
#define MS_SQL_SERVER_DB "poco" #define MS_SQL_SERVER_DB "poco"
#define MS_SQL_SERVER_UID "poco" #define MS_SQL_SERVER_UID "poco"

View File

@@ -350,7 +350,7 @@ void SQLExecutor::bareboneODBCTest(const std::string& dbConnString,
rc = SQLFetch(hstmt); rc = SQLFetch(hstmt);
assert (SQL_SUCCEEDED(rc) || SQL_NO_DATA == rc); assert (SQL_SUCCEEDED(rc) || SQL_NO_DATA == rc);
SQLINTEGER dateTimeColSize = 0; SQLULEN dateTimeColSize = 0;
SQLSMALLINT dateTimeDecDigits = 0; SQLSMALLINT dateTimeDecDigits = 0;
if (SQL_SUCCEEDED(rc)) if (SQL_SUCCEEDED(rc))
{ {
@@ -611,7 +611,7 @@ void SQLExecutor::bareboneODBCTest(const std::string& dbConnString,
if (SQLExecutor::DE_MANUAL == extractMode) if (SQLExecutor::DE_MANUAL == extractMode)
{ {
SQLINTEGER len = lengths[0] = 0; SQLLEN len = lengths[0] = 0;
while (SQL_SUCCESS_WITH_INFO == (rc = SQLGetData(hstmt, while (SQL_SUCCESS_WITH_INFO == (rc = SQLGetData(hstmt,
(SQLUSMALLINT) 1, (SQLUSMALLINT) 1,
SQL_C_CHAR, SQL_C_CHAR,
@@ -1463,7 +1463,7 @@ void SQLExecutor::insertSingleBulk()
for (x = 0; x < 100; ++x) for (x = 0; x < 100; ++x)
{ {
int i = stmt.execute(); std::size_t i = stmt.execute();
assert (1 == i); assert (1 == i);
} }
int count = 0; int count = 0;

View File

@@ -160,7 +160,7 @@ void SQLiteStatementImpl::bindImpl()
return; return;
} }
int availableCount = 0; std::size_t availableCount = 0;
Bindings::difference_type bindCount = 0; Bindings::difference_type bindCount = 0;
Bindings::iterator it = _bindBegin; Bindings::iterator it = _bindBegin;
for (; it != bindEnd; ++it) for (; it != bindEnd; ++it)

View File

@@ -31,12 +31,14 @@ class Data_API Limit
/// Limit stores information how many rows a query should return. /// Limit stores information how many rows a query should return.
{ {
public: public:
typedef Poco::UInt32 SizeT;
enum Type enum Type
{ {
LIMIT_UNLIMITED = 0xffffffffu LIMIT_UNLIMITED = ~((SizeT) 0)
}; };
Limit(Poco::UInt32 value, bool hardLimit = false, bool isLowerLimit = false); Limit(SizeT value, bool hardLimit = false, bool isLowerLimit = false);
/// Creates the Limit. /// Creates the Limit.
/// ///
/// Value contains the upper row hint, if hardLimit is set to true, the limit acts as a hard /// Value contains the upper row hint, if hardLimit is set to true, the limit acts as a hard
@@ -48,7 +50,7 @@ public:
~Limit(); ~Limit();
/// Destroys the Limit. /// Destroys the Limit.
Poco::UInt32 value() const; SizeT value() const;
/// Returns the value of the limit /// Returns the value of the limit
bool isHardLimit() const; bool isHardLimit() const;
@@ -64,9 +66,9 @@ public:
/// Inequality operator. /// Inequality operator.
private: private:
Poco::UInt32 _value; SizeT _value;
bool _hardLimit; bool _hardLimit;
bool _isLowerLimit; bool _isLowerLimit;
}; };

View File

@@ -32,7 +32,7 @@ class Data_API Range
/// Range stores information how many rows a query should return. /// Range stores information how many rows a query should return.
{ {
public: public:
Range(Poco::UInt32 lowValue, Poco::UInt32 upValue, bool hardLimit); Range(Limit::SizeT lowValue, Limit::SizeT upValue, bool hardLimit);
/// Creates the Range. lowValue must be smaller equal than upValue /// Creates the Range. lowValue must be smaller equal than upValue
~Range(); ~Range();
@@ -72,7 +72,7 @@ template <typename T>
Limit limit(T lim, bool hard = false) Limit limit(T lim, bool hard = false)
/// Creates an upperLimit /// Creates an upperLimit
{ {
return Limit(static_cast<Poco::UInt32>(lim), hard, false); return Limit(static_cast<Limit::SizeT>(lim), hard, false);
} }
@@ -86,14 +86,14 @@ Limit upperLimit(T lim, bool hard = false)
template <typename T> template <typename T>
Limit lowerLimit(T lim) Limit lowerLimit(T lim)
{ {
return Limit(static_cast<Poco::UInt32>(lim), true, true); return Limit(static_cast<Limit::SizeT>(lim), true, true);
} }
template <typename T> template <typename T>
Range range(T low, T upp, bool hard = false) Range range(T low, T upp, bool hard = false)
{ {
return Range(static_cast<Poco::UInt32>(low), static_cast<Poco::UInt32>(upp), hard); return Range(static_cast<Limit::SizeT>(low), static_cast<Limit::SizeT>(upp), hard);
} }

View File

@@ -209,7 +209,7 @@ protected:
void fixupExtraction(); void fixupExtraction();
/// Sets the AbstractExtractor at the extractors. /// Sets the AbstractExtractor at the extractors.
std::size_t getExtractionLimit(); Limit::SizeT getExtractionLimit();
/// Returns the extraction limit value. /// Returns the extraction limit value.
const Limit& extractionLimit() const; const Limit& extractionLimit() const;
@@ -552,7 +552,7 @@ inline std::size_t StatementImpl::currentDataSet() const
} }
inline std::size_t StatementImpl::getExtractionLimit() inline Limit::SizeT StatementImpl::getExtractionLimit()
{ {
return _extrLimit.value(); return _extrLimit.value();
} }

View File

@@ -21,7 +21,7 @@ namespace Poco {
namespace Data { namespace Data {
Limit::Limit(Poco::UInt32 value, bool hardLimit, bool isLowerLimit): Limit::Limit(SizeT value, bool hardLimit, bool isLowerLimit) :
_value(value), _value(value),
_hardLimit(hardLimit), _hardLimit(hardLimit),
_isLowerLimit(isLowerLimit) _isLowerLimit(isLowerLimit)

View File

@@ -25,7 +25,7 @@ namespace Data {
using namespace Keywords; using namespace Keywords;
Range::Range(Poco::UInt32 lowValue, Poco::UInt32 upValue, bool hardLimit): Range::Range(Limit::SizeT lowValue, Limit::SizeT upValue, bool hardLimit) :
_lower(lowerLimit(lowValue)), _lower(lowerLimit(lowValue)),
_upper(upperLimit(upValue, hardLimit)) _upper(upperLimit(upValue, hardLimit))
{ {

View File

@@ -46,7 +46,7 @@ const std::string StatementImpl::UNKNOWN = "unknown";
StatementImpl::StatementImpl(SessionImpl& rSession): StatementImpl::StatementImpl(SessionImpl& rSession):
_state(ST_INITIALIZED), _state(ST_INITIALIZED),
_extrLimit(upperLimit((std::size_t) Limit::LIMIT_UNLIMITED, false)), _extrLimit(upperLimit(Limit::LIMIT_UNLIMITED, false)),
_lowerLimit(0), _lowerLimit(0),
_rSession(rSession), _rSession(rSession),
_storage(STORAGE_UNKNOWN_IMPL), _storage(STORAGE_UNKNOWN_IMPL),
@@ -221,7 +221,7 @@ void StatementImpl::setExtractionLimit(const Limit& extrLimit)
void StatementImpl::setBulkExtraction(const Bulk& b) void StatementImpl::setBulkExtraction(const Bulk& b)
{ {
std::size_t limit = getExtractionLimit(); Limit::SizeT limit = getExtractionLimit();
if (Limit::LIMIT_UNLIMITED != limit && b.size() != limit) if (Limit::LIMIT_UNLIMITED != limit && b.size() != limit)
throw InvalidArgumentException("Can not set limit for statement."); throw InvalidArgumentException("Can not set limit for statement.");