mirror of
				https://github.com/Telecominfraproject/wlan-cloud-lib-poco.git
				synced 2025-10-30 02:02:30 +00:00 
			
		
		
		
	#3153: Poco::Data::ODBC [N]VARCHAR(MAX) wrong maxDataSize() result
This commit is contained in:
		| @@ -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()"); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Günter Obiltschnig
					Günter Obiltschnig