BOOL CTest::Save( const std::vector<CTemp> & vTemps )
try
{CString strSql = _T("INSERT INTO ");
strSql += GetTableName();
strSql += _T(" (Name \
Color) \
VALUES(?, ?);");
m_pStmt->BeginTransaction();
m_pStmt->Sql(strSql);
int size = vTemps.size();
for (int i = 0; i < size; i++)
{
const CTemp &info = vTemp[i];
m_pStmt->BindString16(1, info.name);
m_pStmt->BindInt(2, info.color);
m_pStmt->Execute();
m_pStmt->Reset();
}
m_pStmt->FreeQuery();
m_pStmt->CommitTransaction();
return TRUE;
}
catch(SQLiteException & exception)
{
m_pStmt->RollbackTransaction();
return FALSE;
}