mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-14 23:07:56 +02:00
use std::size_t in Data interfaces (may break some code on 64-bit platforms)
This commit is contained in:
@@ -226,9 +226,9 @@ void Binder::bind(std::size_t pos, const NullData&, Direction dir)
|
||||
}
|
||||
|
||||
|
||||
size_t Binder::size() const
|
||||
std::size_t Binder::size() const
|
||||
{
|
||||
return _bindArray.size();
|
||||
return static_cast<std::size_t>(_bindArray.size());
|
||||
}
|
||||
|
||||
|
||||
@@ -245,7 +245,7 @@ MYSQL_BIND* Binder::getBindArray() const
|
||||
|
||||
/*void Binder::updateDates()
|
||||
{
|
||||
for (size_t i = 0; i < _dates.size(); i++)
|
||||
for (std::size_t i = 0; i < _dates.size(); i++)
|
||||
{
|
||||
switch (_dates[i].mt.time_type)
|
||||
{
|
||||
@@ -282,7 +282,7 @@ void Binder::realBind(std::size_t pos, enum_field_types type, const void* buffer
|
||||
{
|
||||
if (pos >= _bindArray.size())
|
||||
{
|
||||
size_t s = _bindArray.size();
|
||||
std::size_t s = static_cast<std::size_t>(_bindArray.size());
|
||||
_bindArray.resize(pos + 1);
|
||||
|
||||
std::memset(&_bindArray[s], 0, sizeof(MYSQL_BIND) * (_bindArray.size() - s));
|
||||
|
@@ -250,7 +250,7 @@ void Extractor::reset()
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::realExtractFixed(std::size_t pos, enum_field_types type, void* buffer, size_t length)
|
||||
bool Extractor::realExtractFixed(std::size_t pos, enum_field_types type, void* buffer, std::size_t length)
|
||||
{
|
||||
MYSQL_BIND bind = {0};
|
||||
my_bool isNull = 0;
|
||||
|
@@ -55,19 +55,19 @@ MySQLStatementImpl::~MySQLStatementImpl()
|
||||
}
|
||||
|
||||
|
||||
Poco::UInt32 MySQLStatementImpl::columnsReturned() const
|
||||
std::size_t MySQLStatementImpl::columnsReturned() const
|
||||
{
|
||||
return _metadata.columnsReturned();
|
||||
}
|
||||
|
||||
|
||||
Poco::UInt32 MySQLStatementImpl::affectedRowCount() const
|
||||
std::size_t MySQLStatementImpl::affectedRowCount() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
const MetaColumn& MySQLStatementImpl::metaColumn(Poco::UInt32 pos) const
|
||||
const MetaColumn& MySQLStatementImpl::metaColumn(std::size_t pos) const
|
||||
{
|
||||
return _metadata.metaColumn(pos);
|
||||
}
|
||||
@@ -100,7 +100,7 @@ bool MySQLStatementImpl::hasNext()
|
||||
}
|
||||
|
||||
|
||||
Poco::UInt32 MySQLStatementImpl::next()
|
||||
std::size_t MySQLStatementImpl::next()
|
||||
{
|
||||
if (!hasNext())
|
||||
throw StatementException("No data received");
|
||||
@@ -151,7 +151,7 @@ void MySQLStatementImpl::compileImpl()
|
||||
void MySQLStatementImpl::bindImpl()
|
||||
{
|
||||
Poco::Data::AbstractBindingVec& binds = bindings();
|
||||
size_t pos = 0;
|
||||
std::size_t pos = 0;
|
||||
Poco::Data::AbstractBindingVec::iterator it = binds.begin();
|
||||
Poco::Data::AbstractBindingVec::iterator itEnd = binds.end();
|
||||
for (; it != itEnd && (*it)->canBind(); ++it)
|
||||
|
@@ -67,7 +67,7 @@ namespace
|
||||
MYSQL_RES* h;
|
||||
};
|
||||
|
||||
size_t fieldSize(const MYSQL_FIELD& field)
|
||||
std::size_t fieldSize(const MYSQL_FIELD& field)
|
||||
/// Convert field MySQL-type and field MySQL-length to actual field length
|
||||
{
|
||||
switch (field.type)
|
||||
@@ -171,13 +171,13 @@ void ResultMetadata::init(MYSQL_STMT* stmt)
|
||||
return;
|
||||
}
|
||||
|
||||
size_t count = mysql_num_fields(h);
|
||||
std::size_t count = mysql_num_fields(h);
|
||||
MYSQL_FIELD* fields = mysql_fetch_fields(h);
|
||||
|
||||
size_t commonSize = 0;
|
||||
std::size_t commonSize = 0;
|
||||
_columns.reserve(count);
|
||||
|
||||
{for (size_t i = 0; i < count; i++)
|
||||
{for (std::size_t i = 0; i < count; i++)
|
||||
{
|
||||
_columns.push_back(MetaColumn(
|
||||
i, // position
|
||||
@@ -196,9 +196,9 @@ void ResultMetadata::init(MYSQL_STMT* stmt)
|
||||
_lengths.resize(count);
|
||||
_isNull.resize(count);
|
||||
|
||||
size_t offset = 0;
|
||||
std::size_t offset = 0;
|
||||
|
||||
{for (size_t i = 0; i < count; i++)
|
||||
{for (std::size_t i = 0; i < count; i++)
|
||||
{
|
||||
std::memset(&_row[i], 0, sizeof(MYSQL_BIND));
|
||||
|
||||
@@ -227,17 +227,17 @@ MYSQL_BIND* ResultMetadata::row()
|
||||
return &_row[0];
|
||||
}
|
||||
|
||||
size_t ResultMetadata::length(size_t pos) const
|
||||
std::size_t ResultMetadata::length(std::size_t pos) const
|
||||
{
|
||||
return _lengths[pos];
|
||||
}
|
||||
|
||||
const unsigned char* ResultMetadata::rawData(size_t pos) const
|
||||
const unsigned char* ResultMetadata::rawData(std::size_t pos) const
|
||||
{
|
||||
return reinterpret_cast<const unsigned char*>(_row[pos].buffer);
|
||||
}
|
||||
|
||||
bool ResultMetadata::isNull(size_t pos) const
|
||||
bool ResultMetadata::isNull(std::size_t pos) const
|
||||
{
|
||||
return (_isNull[pos] != 0);
|
||||
}
|
||||
|
@@ -36,7 +36,6 @@
|
||||
|
||||
#include "Poco/Data/MySQL/SessionImpl.h"
|
||||
#include "Poco/Data/MySQL/MySQLStatementImpl.h"
|
||||
#include "Poco/Data/MySQL/StatementExecutor.h"
|
||||
#include "Poco/Data/Session.h"
|
||||
#include "Poco/NumberParser.h"
|
||||
#include "Poco/String.h"
|
||||
|
@@ -81,7 +81,7 @@ void StatementExecutor::prepare(const std::string& query)
|
||||
}
|
||||
|
||||
|
||||
void StatementExecutor::bindParams(MYSQL_BIND* params, size_t count)
|
||||
void StatementExecutor::bindParams(MYSQL_BIND* params, std::size_t count)
|
||||
{
|
||||
if (_state < STMT_COMPILED)
|
||||
throw StatementException("Satement is not compiled yet");
|
||||
@@ -132,7 +132,7 @@ bool StatementExecutor::fetch()
|
||||
}
|
||||
|
||||
|
||||
bool StatementExecutor::fetchColumn(size_t n, MYSQL_BIND *bind)
|
||||
bool StatementExecutor::fetchColumn(std::size_t n, MYSQL_BIND *bind)
|
||||
{
|
||||
if (_state < STMT_EXECUTED)
|
||||
throw StatementException("Satement is not executed yet");
|
||||
|
Reference in New Issue
Block a user