I have a problem with Poco::Data::MySql::ResultMetadata::adjustColumnSizeToFit(std::size_t pos) since versione 1.12.1.
The original implementation it's
void ResultMetadata::adjustColumnSizeToFit(std::size_t pos)
{
std::free(_buffer[pos]);
_buffer[pos] = (char*) std::calloc(_lengths[pos], sizeof(char));
_row[pos].buffer = _buffer[pos];
_row[pos].buffer_length = _lengths[pos];
}
This implementation give me a problem of accesso violation in function
bool StatementExecutor::fetch()
{
if (_state < STMT_EXECUTED)
throw StatementException("Statement is not executed yet");
int res = mysql_stmt_fetch(_pHandle); <---ACCESS VIOLATION
// we have specified zero buffers for BLOBs, so DATA_TRUNCATED is normal in this case
if ((res != 0) && (res != MYSQL_NO_DATA) && (res != MYSQL_DATA_TRUNCATED))
throw StatementException("mysql_stmt_fetch error", _pHandle, _query);
return (res == 0) || (res == MYSQL_DATA_TRUNCATED);
}
Tha is a result of a simply Select like this:
std::string sQuery = "SELECT DateTime,SensorType,SensorValue,Description FROM system_stats WHERE SensorType IN (6) AND DateTime>1785497698191598 AND DateTime<1785501298191598 ORDER BY DateTime ASC";
std::vector<Poco::Tuple<Poco::Int64, Poco::Int64, Poco::Int64, std::string>> sysStatsResults;
sLogsDB << sQuery, Poco::Data::Keywords::into(sysStatsResults), Poco::Data::Keywords::now;
so I think quite standard stuff (fields are BIGINT BIGINT BIGINT TEXT
if I rewrite the function like this
void ResultMetadata::adjustColumnSizeToFit(std::size_t pos)
{
if (_row[pos].buffer_length > 0) return;
if (_buffer[pos] != nullptr) std::free(_buffer[pos]);
_buffer[pos] = (char*) std::calloc(_lengths[pos], sizeof(char));
if (_buffer[pos] == nullptr) _lengths[pos] = 0;
_row[pos].buffer = _buffer[pos];
_row[pos].buffer_length = _lengths[pos];
}
Select is working, I don't know why no one else has ever get this problem, but I can't figure out if can be my code problem
I have a problem with Poco::Data::MySql::ResultMetadata::adjustColumnSizeToFit(std::size_t pos) since versione 1.12.1.
The original implementation it's
This implementation give me a problem of accesso violation in function
Tha is a result of a simply Select like this:
so I think quite standard stuff (fields are BIGINT BIGINT BIGINT TEXT
if I rewrite the function like this
Select is working, I don't know why no one else has ever get this problem, but I can't figure out if can be my code problem