A problem is that You runs this code for every record. Change this code and run it for group of records (ie. every 100 records) something like this :
QString query
= TableQueries
::insertDataQuery();
db.transaction();//begin of transaction
db_query.prepare(query);
bool exec = false;
for( int i = 0; i < Id_list.size(); i++ )
{
int pos = 0;
db_query.bindValue(pos++, Id_list.at(i));
db_query.bindValue(pos++, date_list.at(i));
db_query.bindValue(pos++, time_list.at(i));
db_query.bindValue(pos++, value_list.at(i));
exec = db_query.exec();
if( !exec )
break;
}
if( exec )
db.commit();
else
db.rollback();
QString query = TableQueries::insertDataQuery();
db.transaction();//begin of transaction
db_query.prepare(query);
bool exec = false;
for( int i = 0; i < Id_list.size(); i++ )
{
int pos = 0;
db_query.bindValue(pos++, Id_list.at(i));
db_query.bindValue(pos++, date_list.at(i));
db_query.bindValue(pos++, time_list.at(i));
db_query.bindValue(pos++, value_list.at(i));
exec = db_query.exec();
if( !exec )
break;
}
if( exec )
db.commit();
else
db.rollback();
To copy to clipboard, switch view to plain text mode
Remember that this is some idea not working code.
Bookmarks