mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-27 11:06:50 +01:00
- SQL logging channel and archiving strategy
- row formatting refactored - affected row count for insert, delete and update returned from Statement::execute() - internal SQL string formatting capability using Poco::format()
This commit is contained in:
@@ -43,14 +43,7 @@ namespace Poco {
|
||||
namespace Data {
|
||||
|
||||
|
||||
RowFormatter::RowFormatter(std::streamsize width):
|
||||
_width(width)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
RowFormatter::RowFormatter(const std::string& prefix, const std::string& postfix):
|
||||
_width(DEFAULT_COLUMN_WIDTH),
|
||||
_prefix(prefix),
|
||||
_postfix(postfix)
|
||||
{
|
||||
@@ -62,44 +55,4 @@ RowFormatter::~RowFormatter()
|
||||
}
|
||||
|
||||
|
||||
std::string& RowFormatter::formatNames(const NameVecPtr pNames, std::string& formattedNames) const
|
||||
{
|
||||
std::ostringstream str;
|
||||
std::string line(_width * pNames->size(), '-');
|
||||
|
||||
NameVec::const_iterator it = pNames->begin();
|
||||
NameVec::const_iterator end = pNames->end();
|
||||
for (; it != end; ++it)
|
||||
{
|
||||
str << std::left << std::setw(_width) << *it;
|
||||
}
|
||||
str << std::endl << line << std::endl;
|
||||
|
||||
return formattedNames = str.str();
|
||||
}
|
||||
|
||||
|
||||
std::string& RowFormatter::formatValues(const ValueVec& vals, std::string& formattedValues) const
|
||||
{
|
||||
std::ostringstream str;
|
||||
|
||||
ValueVec::const_iterator it = vals.begin();
|
||||
ValueVec::const_iterator end = vals.end();
|
||||
for (; it != end; ++it)
|
||||
{
|
||||
if (it->isNumeric())
|
||||
{
|
||||
str << std::right
|
||||
<< std::fixed
|
||||
<< std::setprecision(2);
|
||||
}
|
||||
else str << std::left;
|
||||
|
||||
str << std::setw(_width) << it->convert<std::string>();
|
||||
}
|
||||
str << std::endl;
|
||||
|
||||
return formattedValues = str.str();
|
||||
}
|
||||
|
||||
} } // namespace Poco::Data
|
||||
|
||||
Reference in New Issue
Block a user