struct MapObj { int64_t fk_user_id; int64_t f_datasId; int64_t f_datasType; string f_datas; }; MapObj mapObj;
Statement select(*m_spDbSrc->m_spSession); select << "select fk_user_id,f_datasId,f_datasType,f_datas from t_ui_map", into(mapObj.fk_user_id),into(mapObj.f_datasId),into(mapObj.f_datasType),into(mapObj.f_datas), range(0, 1);
try { m_spDbDest->m_spSession->begin(); while (!select.done()) { select.execute(); *m_spDbDest->m_spSession << "insert into t_ui_map (fk_user_id,f_datasId,f_datasType,f_datas) values (?,?,?,?);", useRef(mapObj.fk_user_id), useRef(mapObj.f_datasId), useRef(mapObj.f_datasType), useRef(mapObj.f_datas), now; } m_spDbDest->m_spSession->commit(); } catch (const Poco::Exception& ex) { m_spDbDest->m_spSession->rollback(); g_logger->error("checkDbDataTable: create data table failed. {}", ex.displayText()); }
|