bool QDBModel::transaction()
{
QSqlDatabase db = QSqlDatabase::database();
if ( !db.open() ) {
QMessageBox::critical( 0,
qApp->tr( "Cannot open database" ),
qApp->tr( "Unable to establish a database connection." ),
QMessageBox::Cancel );
return false;
} else {
//bool flag = db.transaction();
bool flag = db.driver()->beginTransaction();
qDebug() << db.lastError();
return flag;
//return db.transaction();
}
}