mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-12 18:20:26 +01:00
#3153: Poco::Data::ODBC [N]VARCHAR(MAX) wrong maxDataSize() result
This commit is contained in:
parent
9e36cea203
commit
7b44480486
@ -25,10 +25,10 @@ namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
|
||||
Preparator::Preparator(const StatementHandle& rStmt,
|
||||
const std::string& statement,
|
||||
Preparator::Preparator(const StatementHandle& rStmt,
|
||||
const std::string& statement,
|
||||
std::size_t maxFieldSize,
|
||||
DataExtraction dataExtraction):
|
||||
DataExtraction dataExtraction):
|
||||
_rStmt(rStmt),
|
||||
_maxFieldSize(maxFieldSize),
|
||||
_dataExtraction(dataExtraction)
|
||||
@ -39,7 +39,7 @@ Preparator::Preparator(const StatementHandle& rStmt,
|
||||
}
|
||||
|
||||
|
||||
Preparator::Preparator(const Preparator& other):
|
||||
Preparator::Preparator(const Preparator& other):
|
||||
_rStmt(other._rStmt),
|
||||
_maxFieldSize(other._maxFieldSize),
|
||||
_dataExtraction(other._dataExtraction)
|
||||
@ -151,14 +151,14 @@ std::size_t Preparator::maxDataSize(std::size_t pos) const
|
||||
std::size_t sz = 0;
|
||||
std::size_t maxsz = getMaxFieldSize();
|
||||
|
||||
try
|
||||
try
|
||||
{
|
||||
ODBCMetaColumn mc(_rStmt, pos);
|
||||
sz = mc.length();
|
||||
|
||||
// accomodate for terminating zero (non-bulk only!)
|
||||
MetaColumn::ColumnDataType type = mc.type();
|
||||
if (!isBulk() && ((ODBCMetaColumn::FDT_WSTRING == type) || (ODBCMetaColumn::FDT_STRING == type))) ++sz;
|
||||
if (sz && !isBulk() && ((ODBCMetaColumn::FDT_WSTRING == type) || (ODBCMetaColumn::FDT_STRING == type))) ++sz;
|
||||
}
|
||||
catch (StatementException&) { }
|
||||
|
||||
@ -194,11 +194,11 @@ void Preparator::prepareBoolArray(std::size_t pos, SQLSMALLINT valueType, std::s
|
||||
_lenLengths[pos].resize(length);
|
||||
_varLengthArrays.insert(IndexMap::value_type(pos, DT_BOOL_ARRAY));
|
||||
|
||||
if (Utility::isError(SQLBindCol(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
valueType,
|
||||
(SQLPOINTER) pArray,
|
||||
(SQLINTEGER) sizeof(bool),
|
||||
if (Utility::isError(SQLBindCol(_rStmt,
|
||||
(SQLUSMALLINT) pos + 1,
|
||||
valueType,
|
||||
(SQLPOINTER) pArray,
|
||||
(SQLINTEGER) sizeof(bool),
|
||||
&_lenLengths[pos][0])))
|
||||
{
|
||||
throw StatementException(_rStmt, "SQLBindCol()");
|
||||
|
Loading…
Reference in New Issue
Block a user