mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-13 10:32:57 +01:00
Sun Studio ODBC compile fixes
This commit is contained in:
parent
fafec95355
commit
4fe33a7c49
@ -82,8 +82,8 @@ public:
|
||||
explicit Diagnostics(H& rHandle): _rHandle(rHandle)
|
||||
/// Creates and initializes the Diagnostics.
|
||||
{
|
||||
memset(_connectionName, 0, sizeof(_connectionName));
|
||||
memset(_serverName, 0, sizeof(_serverName));
|
||||
std::memset(_connectionName, 0, sizeof(_connectionName));
|
||||
std::memset(_serverName, 0, sizeof(_serverName));
|
||||
diagnostics();
|
||||
}
|
||||
|
||||
@ -192,13 +192,13 @@ public:
|
||||
{
|
||||
std::size_t len = sizeof(_connectionName) > none.length() ?
|
||||
none.length() : sizeof(_connectionName) - 1;
|
||||
memcpy(_connectionName, none.c_str(), len);
|
||||
std::memcpy(_connectionName, none.c_str(), len);
|
||||
}
|
||||
else if (0 == _connectionName[0])
|
||||
{
|
||||
std::size_t len = sizeof(_connectionName) > na.length() ?
|
||||
na.length() : sizeof(_connectionName) - 1;
|
||||
memcpy(_connectionName, na.c_str(), len);
|
||||
std::memcpy(_connectionName, na.c_str(), len);
|
||||
}
|
||||
|
||||
if (Utility::isError(SQLGetDiagField(handleType,
|
||||
@ -211,20 +211,20 @@ public:
|
||||
{
|
||||
std::size_t len = sizeof(_serverName) > none.length() ?
|
||||
none.length() : sizeof(_serverName) - 1;
|
||||
memcpy(_serverName, none.c_str(), len);
|
||||
std::memcpy(_serverName, none.c_str(), len);
|
||||
}
|
||||
else if (0 == _serverName[0])
|
||||
{
|
||||
std::size_t len = sizeof(_serverName) > na.length() ?
|
||||
na.length() : sizeof(_serverName) - 1;
|
||||
memcpy(_serverName, na.c_str(), len);
|
||||
std::memcpy(_serverName, na.c_str(), len);
|
||||
}
|
||||
}
|
||||
|
||||
_fields.push_back(df);
|
||||
|
||||
memset(df._sqlState, 0, SQL_STATE_SIZE);
|
||||
memset(df._message, 0, SQL_MESSAGE_LENGTH);
|
||||
std::memset(df._sqlState, 0, SQL_STATE_SIZE);
|
||||
std::memset(df._message, 0, SQL_MESSAGE_LENGTH);
|
||||
df._nativeError = 0;
|
||||
|
||||
++count;
|
||||
|
@ -403,7 +403,7 @@ void Binder::synchronize()
|
||||
StringMap::iterator it = _strings.begin();
|
||||
StringMap::iterator end = _strings.end();
|
||||
for(; it != end; ++it)
|
||||
it->second->assign(it->first, strlen(it->first));
|
||||
it->second->assign(it->first, std::strlen(it->first));
|
||||
}
|
||||
}
|
||||
|
||||
@ -519,8 +519,8 @@ void Binder::setParamSetSize(std::size_t length)
|
||||
{
|
||||
if (0 == _paramSetSize)
|
||||
{
|
||||
if (Utility::isError(SQLSetStmtAttr(_rStmt, SQL_ATTR_PARAM_BIND_TYPE, SQL_PARAM_BIND_BY_COLUMN, SQL_IS_UINTEGER)) ||
|
||||
Utility::isError(SQLSetStmtAttr(_rStmt, SQL_ATTR_PARAMSET_SIZE, (SQLPOINTER) length, SQL_IS_UINTEGER)))
|
||||
if (Utility::isError(Poco::Data::ODBC::SQLSetStmtAttr(_rStmt, SQL_ATTR_PARAM_BIND_TYPE, SQL_PARAM_BIND_BY_COLUMN, SQL_IS_UINTEGER)) ||
|
||||
Utility::isError(Poco::Data::ODBC::SQLSetStmtAttr(_rStmt, SQL_ATTR_PARAMSET_SIZE, (SQLPOINTER) length, SQL_IS_UINTEGER)))
|
||||
throw StatementException(_rStmt, "SQLSetStmtAttr()");
|
||||
|
||||
_paramSetSize = static_cast<SQLINTEGER>(length);
|
||||
|
@ -74,7 +74,7 @@ bool Extractor::extractBoundImpl<std::string>(std::size_t pos, std::string& val)
|
||||
|
||||
std::size_t dataSize = _rPreparation.actualDataSize(pos);
|
||||
char* sp = AnyCast<char*>(_rPreparation[pos]);
|
||||
std::size_t len = strlen(sp);
|
||||
std::size_t len = std::strlen(sp);
|
||||
if (len < dataSize) dataSize = len;
|
||||
checkDataSize(dataSize);
|
||||
val.assign(sp, dataSize);
|
||||
@ -377,7 +377,7 @@ bool Extractor::extractManualImpl<std::string>(std::size_t pos, std::string& val
|
||||
|
||||
do
|
||||
{
|
||||
memset(pChar, 0, CHUNK_SIZE);
|
||||
std::memset(pChar, 0, CHUNK_SIZE);
|
||||
len = 0;
|
||||
rc = SQLGetData(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
@ -433,7 +433,7 @@ bool Extractor::extractManualImpl<Poco::Data::BLOB>(std::size_t pos,
|
||||
|
||||
do
|
||||
{
|
||||
memset(pChar, 0, CHUNK_SIZE);
|
||||
std::memset(pChar, 0, CHUNK_SIZE);
|
||||
len = 0;
|
||||
rc = SQLGetData(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
|
@ -58,14 +58,14 @@ ODBCMetaColumn::~ODBCMetaColumn()
|
||||
|
||||
void ODBCMetaColumn::getDescription()
|
||||
{
|
||||
memset(_columnDesc.name, 0, NAME_BUFFER_LENGTH);
|
||||
std::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,
|
||||
if (Utility::isError(Poco::Data::ODBC::SQLDescribeCol(_rStmt,
|
||||
(SQLUSMALLINT) position() + 1, // ODBC columns are 1-based
|
||||
_columnDesc.name,
|
||||
NAME_BUFFER_LENGTH,
|
||||
@ -84,7 +84,7 @@ void ODBCMetaColumn::init()
|
||||
{
|
||||
getDescription();
|
||||
|
||||
if (Utility::isError(SQLColAttribute(_rStmt,
|
||||
if (Utility::isError(Poco::Data::ODBC::SQLColAttribute(_rStmt,
|
||||
(SQLUSMALLINT) position() + 1, // ODBC columns are 1-based
|
||||
SQL_DESC_LENGTH,
|
||||
0,
|
||||
|
@ -181,7 +181,7 @@ void ODBCStatementImpl::doPrepare()
|
||||
Poco::UInt32 limit = getExtractionLimit();
|
||||
if (limit == Limit::LIMIT_UNLIMITED)
|
||||
throw InvalidArgumentException("Bulk operation not allowed without limit.");
|
||||
checkError(SQLSetStmtAttr(_stmt, SQL_ATTR_ROW_ARRAY_SIZE, (SQLPOINTER) limit, 0),
|
||||
checkError(Poco::Data::ODBC::SQLSetStmtAttr(_stmt, SQL_ATTR_ROW_ARRAY_SIZE, (SQLPOINTER) limit, 0),
|
||||
"SQLSetStmtAttr(SQL_ATTR_ROW_ARRAY_SIZE)");
|
||||
}
|
||||
|
||||
@ -386,7 +386,7 @@ std::string ODBCStatementImpl::nativeSQL()
|
||||
{
|
||||
delete [] pNative;
|
||||
pNative = new char[retlen];
|
||||
memset(pNative, 0, retlen);
|
||||
std::memset(pNative, 0, retlen);
|
||||
length = retlen;
|
||||
if (Utility::isError(SQLNativeSql(_rConnection,
|
||||
(SQLCHAR*) statement.c_str(),
|
||||
|
@ -52,7 +52,7 @@ Preparation::Preparation(const StatementHandle& rStmt,
|
||||
_dataExtraction(dataExtraction)
|
||||
{
|
||||
SQLCHAR* pStr = (SQLCHAR*) statement.c_str();
|
||||
if (Utility::isError(SQLPrepare(_rStmt, pStr, (SQLINTEGER) statement.length())))
|
||||
if (Utility::isError(Poco::Data::ODBC::SQLPrepare(_rStmt, pStr, (SQLINTEGER) statement.length())))
|
||||
throw StatementException(_rStmt);
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ void SessionImpl::open()
|
||||
SQLCHAR connectOutput[512] = {0};
|
||||
SQLSMALLINT result;
|
||||
|
||||
if (Utility::isError(SQLDriverConnect(_db
|
||||
if (Utility::isError(Poco::Data::ODBC::SQLDriverConnect(_db
|
||||
, NULL
|
||||
,(SQLCHAR*) _connect.c_str()
|
||||
,(SQLSMALLINT) SQL_NTS
|
||||
@ -120,7 +120,7 @@ void SessionImpl::open()
|
||||
&SessionImpl::setMaxFieldSize,
|
||||
&SessionImpl::getMaxFieldSize);
|
||||
|
||||
SQLSetConnectAttr(_db, SQL_ATTR_QUIET_MODE, 0, 0);
|
||||
Poco::Data::ODBC::SQLSetConnectAttr(_db, SQL_ATTR_QUIET_MODE, 0, 0);
|
||||
|
||||
if (!canTransact()) autoCommit("", true);
|
||||
}
|
||||
@ -129,7 +129,7 @@ void SessionImpl::open()
|
||||
bool SessionImpl::canTransact()
|
||||
{
|
||||
SQLUSMALLINT ret;
|
||||
checkError(SQLGetInfo(_db, SQL_TXN_CAPABLE, &ret, 0, 0),
|
||||
checkError(Poco::Data::ODBC::SQLGetInfo(_db, SQL_TXN_CAPABLE, &ret, 0, 0),
|
||||
"Failed to obtain transaction capability info.");
|
||||
|
||||
return (SQL_TC_NONE != ret);
|
||||
@ -138,7 +138,7 @@ bool SessionImpl::canTransact()
|
||||
|
||||
void SessionImpl::autoCommit(const std::string&, bool val)
|
||||
{
|
||||
checkError(SQLSetConnectAttr(_db,
|
||||
checkError(Poco::Data::ODBC::SQLSetConnectAttr(_db,
|
||||
SQL_ATTR_AUTOCOMMIT,
|
||||
val ? (SQLPOINTER) SQL_AUTOCOMMIT_ON :
|
||||
(SQLPOINTER) SQL_AUTOCOMMIT_OFF,
|
||||
@ -150,7 +150,7 @@ bool SessionImpl::isAutoCommit(const std::string&)
|
||||
{
|
||||
Poco::UInt32 value = 0;
|
||||
|
||||
checkError(SQLGetConnectAttr(_db,
|
||||
checkError(Poco::Data::ODBC::SQLGetConnectAttr(_db,
|
||||
SQL_ATTR_AUTOCOMMIT,
|
||||
&value,
|
||||
0,
|
||||
@ -164,7 +164,7 @@ bool SessionImpl::isConnected()
|
||||
{
|
||||
Poco::UInt32 value = 0;
|
||||
|
||||
if (Utility::isError(SQLGetConnectAttr(_db,
|
||||
if (Utility::isError(Poco::Data::ODBC::SQLGetConnectAttr(_db,
|
||||
SQL_ATTR_CONNECTION_DEAD,
|
||||
&value,
|
||||
0,
|
||||
@ -179,7 +179,7 @@ bool SessionImpl::isTransaction()
|
||||
{
|
||||
Poco::UInt32 value = 0;
|
||||
|
||||
checkError(SQLGetConnectAttr(_db,
|
||||
checkError(Poco::Data::ODBC::SQLGetConnectAttr(_db,
|
||||
SQL_ATTR_AUTOCOMMIT,
|
||||
&value,
|
||||
0,
|
||||
@ -206,7 +206,7 @@ int SessionImpl::maxStatementLength()
|
||||
{
|
||||
SQLUINTEGER info;
|
||||
SQLRETURN rc = 0;
|
||||
if (Utility::isError(rc = SQLGetInfo(_db,
|
||||
if (Utility::isError(rc = Poco::Data::ODBC::SQLGetInfo(_db,
|
||||
SQL_MAXIMUM_STATEMENT_LENGTH,
|
||||
(SQLPOINTER) &info,
|
||||
0,
|
||||
|
@ -56,14 +56,14 @@ Utility::DriverMap& Utility::drivers(Utility::DriverMap& driverMap)
|
||||
const int length = sizeof(SQLCHAR) * 512;
|
||||
|
||||
SQLCHAR desc[length];
|
||||
memset(desc, 0, length);
|
||||
std::memset(desc, 0, length);
|
||||
SQLSMALLINT len1 = length;
|
||||
SQLCHAR attr[length];
|
||||
memset(attr, 0, length);
|
||||
std::memset(attr, 0, length);
|
||||
SQLSMALLINT len2 = length;
|
||||
RETCODE rc = 0;
|
||||
|
||||
while (!Utility::isError(rc = SQLDrivers(henv,
|
||||
while (!Utility::isError(rc = Poco::Data::ODBC::SQLDrivers(henv,
|
||||
SQL_FETCH_NEXT,
|
||||
desc,
|
||||
length,
|
||||
@ -74,8 +74,8 @@ Utility::DriverMap& Utility::drivers(Utility::DriverMap& driverMap)
|
||||
{
|
||||
driverMap.insert(DSNMap::value_type(std::string((char *) desc),
|
||||
std::string((char *) attr)));
|
||||
memset(desc, 0, length);
|
||||
memset(attr, 0, length);
|
||||
std::memset(desc, 0, length);
|
||||
std::memset(attr, 0, length);
|
||||
len2 = length;
|
||||
}
|
||||
|
||||
@ -93,14 +93,14 @@ Utility::DSNMap& Utility::dataSources(Utility::DSNMap& dsnMap)
|
||||
const int dsnLength = sizeof(SQLCHAR) * (SQL_MAX_DSN_LENGTH + 1);
|
||||
|
||||
SQLCHAR dsn[dsnLength];
|
||||
memset(dsn, 0, dsnLength);
|
||||
std::memset(dsn, 0, dsnLength);
|
||||
SQLSMALLINT len1 = sizeof(SQLCHAR) * SQL_MAX_DSN_LENGTH;
|
||||
SQLCHAR desc[length];
|
||||
memset(desc, 0, length);
|
||||
std::memset(desc, 0, length);
|
||||
SQLSMALLINT len2 = length;
|
||||
RETCODE rc = 0;
|
||||
|
||||
while (!Utility::isError(rc = SQLDataSources(henv,
|
||||
while (!Utility::isError(rc = Poco::Data::ODBC::SQLDataSources(henv,
|
||||
SQL_FETCH_NEXT,
|
||||
dsn,
|
||||
SQL_MAX_DSN_LENGTH,
|
||||
@ -110,8 +110,8 @@ Utility::DSNMap& Utility::dataSources(Utility::DSNMap& dsnMap)
|
||||
&len2)))
|
||||
{
|
||||
dsnMap.insert(DSNMap::value_type(std::string((char *) dsn), std::string((char *) desc)));
|
||||
memset(dsn, 0, dsnLength);
|
||||
memset(desc, 0, length);
|
||||
std::memset(dsn, 0, dsnLength);
|
||||
std::memset(desc, 0, length);
|
||||
len2 = length;
|
||||
}
|
||||
|
||||
@ -125,7 +125,7 @@ Utility::DSNMap& Utility::dataSources(Utility::DSNMap& dsnMap)
|
||||
void Utility::dateTimeSync(Poco::DateTime& dt, const SQL_TIMESTAMP_STRUCT& ts)
|
||||
{
|
||||
double msec = ts.fraction/1000000;
|
||||
double usec = 1000 * (msec - floor(msec));
|
||||
double usec = 1000 * (msec - std::floor(msec));
|
||||
|
||||
dt.assign(ts.year,
|
||||
ts.month,
|
||||
@ -133,8 +133,8 @@ void Utility::dateTimeSync(Poco::DateTime& dt, const SQL_TIMESTAMP_STRUCT& ts)
|
||||
ts.hour,
|
||||
ts.minute,
|
||||
ts.second,
|
||||
(int) floor(msec),
|
||||
(int) floor(usec));
|
||||
(int) std::floor(msec),
|
||||
(int) std::floor(usec));
|
||||
}
|
||||
|
||||
|
||||
|
@ -467,7 +467,7 @@ void SQLExecutor::bareboneODBCTest(const std::string& dbConnString,
|
||||
SQLLEN lengths[6] = { 0 };
|
||||
fourth = 0;
|
||||
fifth = 0.0f;
|
||||
memset(&sixth, 0, sizeof(sixth));
|
||||
std::memset(&sixth, 0, sizeof(sixth));
|
||||
|
||||
if (SQLExecutor::DE_BOUND == extractMode)
|
||||
{
|
||||
@ -594,9 +594,9 @@ void SQLExecutor::bareboneODBCTest(const std::string& dbConnString,
|
||||
poco_odbc_check_stmt (rc, hstmt);
|
||||
}
|
||||
|
||||
assert (0 == strncmp(str[0].c_str(), chr[0], str[0].size()));
|
||||
assert (0 == strncmp(str[1].c_str(), chr[1], str[1].size()));
|
||||
assert (0 == strncmp(str[2].c_str(), chr[2], str[2].size()));
|
||||
assert (0 == std::strncmp(str[0].c_str(), chr[0], str[0].size()));
|
||||
assert (0 == std::strncmp(str[1].c_str(), chr[1], str[1].size()));
|
||||
assert (0 == std::strncmp(str[2].c_str(), chr[2], str[2].size()));
|
||||
assert (4 == fourth);
|
||||
assert (1.5 == fifth);
|
||||
|
||||
|
@ -91,15 +91,14 @@ inline Poco::UInt32 Bulk::size() const
|
||||
namespace Keywords {
|
||||
|
||||
|
||||
template <typename T>
|
||||
inline Bulk bulk(const T& limit)
|
||||
inline Bulk bulk(const Limit& limit = Limit(Limit::LIMIT_UNLIMITED, false, false))
|
||||
/// Convenience function for creation of bulk.
|
||||
{
|
||||
return Bulk(limit);
|
||||
}
|
||||
|
||||
|
||||
inline void bulk(char)
|
||||
inline void bulk()
|
||||
/// Dummy bulk function. Used for bulk binding creation
|
||||
/// (see BulkBinding) and bulk extraction signalling to Statement.
|
||||
{
|
||||
@ -109,7 +108,7 @@ inline void bulk(char)
|
||||
} // namespace Keywords
|
||||
|
||||
|
||||
typedef void (*BulkFnType)(char);
|
||||
typedef void (*BulkFnType)();
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
LIMIT_UNLIMITED = 0xffffffffu
|
||||
};
|
||||
|
||||
Limit(Poco::UInt32 value, bool hardLimit, bool isLowerLimit);
|
||||
Limit(Poco::UInt32 value, bool hardLimit = false, bool isLowerLimit = false);
|
||||
/// Creates the Limit.
|
||||
///
|
||||
/// Value contains the upper row hint, if hardLimit is set to true, the limit acts as a hard
|
||||
|
Loading…
Reference in New Issue
Block a user