94 |
94 |
95 if (id >= 0) { |
95 if (id >= 0) { |
96 query.prepare("SELECT * FROM recipes WHERE record = :recno"); |
96 query.prepare("SELECT * FROM recipes WHERE record = :recno"); |
97 query.bindValue(":recno", id); |
97 query.bindValue(":recno", id); |
98 query.exec(); |
98 query.exec(); |
99 query.first(); |
99 if (! query.first()) { |
|
100 qDebug() << "EditRecipe seek error record" << id; |
|
101 QMessageBox::warning(this, tr("Database error"), tr("MySQL error: record %1 not found").arg(id)); |
|
102 this->done(QDialog::Rejected); // At this stage, this doesn't work because the dialog is not yet visible. |
|
103 return; |
|
104 } |
100 |
105 |
101 QSqlRecord rec = query.record(); |
106 QSqlRecord rec = query.record(); |
102 for (int i = 0; i < rec.count(); i++) |
107 for (int i = 0; i < rec.count(); i++) |
103 qDebug() << i << rec.fieldName(i) << query.value(i); |
108 qDebug() << i << rec.fieldName(i) << query.value(i); |
104 |
109 |