diff options
author | Arno <arno@disconnect.de> | 2018-12-05 10:05:26 +0100 |
---|---|---|
committer | Arno <arno@disconnect.de> | 2018-12-05 10:05:26 +0100 |
commit | 6677a69a4254b73a91571808bd569337ecd40e39 (patch) | |
tree | f86a6b0f1aefbbc303cdec364d209c9e4c29bdf9 | |
parent | a1f93b2434ae34272419d54d875e21be0329a946 (diff) | |
download | SheMov-6677a69a4254b73a91571808bd569337ecd40e39.tar.gz SheMov-6677a69a4254b73a91571808bd569337ecd40e39.tar.bz2 SheMov-6677a69a4254b73a91571808bd569337ecd40e39.zip |
Fix creating new series
Well, there is something fishy going on. I have no idea why that commit
is needed there, but during debugging I also noticed that on the final
commit() the database complains that there's no transaction in progress.
Well, this works, but I don't know how to debug this further :(
-rw-r--r-- | newmoviewizard.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/newmoviewizard.cpp b/newmoviewizard.cpp index 790f2a0..8cd9936 100644 --- a/newmoviewizard.cpp +++ b/newmoviewizard.cpp @@ -55,11 +55,12 @@ void NewMovieWizard::accept(){ insertSeriesQ.prepare("INSERT INTO series (tseries_name) VALUES(:name)"); insertSeriesQ.bindValue(":name", seriesName); if(insertSeriesQ.exec()){ - seriesIdQ.bindValue(":value", seriesName); - seriesIdQ.exec(); - while(seriesIdQ.next()){ - seriesId = seriesIdQ.value(0).toInt(); + QSqlQuery curval("SELECT currval('series_iseries_id__seq')", db); + while(curval.next()){ + seriesId = curval.value(0).toInt(); } + db.commit(); + db.transaction(); }else{ QMessageBox::critical(this, tr("Error"), tr("Failed to create series!")); db.rollback(); |