Modify the Result class

This commit is contained in:
antao 2019-01-15 13:21:40 +08:00
parent 0b4fd04228
commit 7ae8f58bb8
5 changed files with 5 additions and 11 deletions

View File

@ -158,7 +158,7 @@ class Field
Field(const Row &row, Row::size_type columnNum) noexcept;
private:
Result _result;
const Result _result;
};
template <>
std::string Field::as<std::string>() const;

View File

@ -76,8 +76,6 @@ class Result
row_size_type columns() const noexcept;
/// Name of column with this number (throws exception if it doesn't exist)
const char *columnName(row_size_type number) const;
const std::string &errorDescription() const { return _errString; }
void setError(const std::string &description) { _errString = description; }
size_type affectedRows() const noexcept;
@ -88,8 +86,7 @@ class Result
private:
ResultImplPtr _resultPtr;
std::string _errString;
friend class Field;
friend class Row;
/// Number of given column (throws exception if it doesn't exist).

View File

@ -55,7 +55,7 @@ class Row
ConstReverseIterator crend() const;
private:
Result _result;
const Result _result;
protected:
friend class Field;

View File

@ -114,7 +114,6 @@ Result::size_type Result::size() const noexcept
void Result::swap(Result &other) noexcept
{
_resultPtr.swap(other._resultPtr);
_errString.swap(other._errString);
}
Result::row_size_type Result::columns() const noexcept
{

View File

@ -9,11 +9,9 @@ using namespace drogon::orm;
int main()
{
trantor::Logger::setLogLevel(trantor::Logger::TRACE);
drogon::app().createDbClient("sqlite3", "", 0, "", "", "", 3, "test.db");
//auto clientPtr = DbClient::newSqlite3Client("filename=test.db", 3);
auto clientPtr = DbClient::newSqlite3Client("filename=test.db", 3);
sleep(1);
auto clientPtr = app().getDbClient();
LOG_DEBUG << "start!";
// *clientPtr << "Drop table groups;" << Mode::Blocking >>
// [](const Result &r) {