cpp-exception

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// use runtime_error throw information
if (SQLITE_OK != iRet)
{
string strErr = fmt::format("statement has exception. errCode={}.errMsg={}", iRet, sqlite3_errmsg(m_pDb));
throw std::runtime_error(strErr);
}
else
{
m_flag |= FLAG_STMT_PREPARED;
return 0;
}

// catch information write to log file
try
{
m_spSqlite->statement(L"SELECT * FROM t_geometric_coeff;");
while (0 == m_spSqlite->execStep())
{
int id = m_spSqlite->getColumn(0);
wstring name = m_spSqlite->getColumn(1);
wstring notes = m_spSqlite->getColumn(2);
double dbValue = m_spSqlite->getColumn(3);
}
}
catch (std::exception& e)
{
g_logger->error("save geometric coeff failed. err={}", e.what());
}
坚持原创技术分享,您的支持将鼓励我继续创作!