Changeset c129da26 for src


Ignore:
Timestamp:
04/12/10 14:38:00 (12 years ago)
Author:
kirilma <kirilma@…>
Branches:
master, qt5
Children:
cdc7679
Parents:
77e06ae
Message:

fix event insert or update

  • add error reporting for queries
  • actually run check query
  • properly get conference_is from event
  • fix checking of non-empty result
  • fix insert query
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sql/sqlengine.cpp

    r77e06ae rc129da26  
    162162            QSqlQuery check_event_query;
    163163            check_event_query.prepare("SELECT * FROM EVENT WHERE xid_conference = :xid_conference AND id = :id");
    164             check_event_query.bindValue(":xid_conference", aEvent["xid_conference"]);
     164            check_event_query.bindValue(":xid_conference", aEvent["conference_id"]);
    165165            check_event_query.bindValue(":id", aEvent["id"]);
    166             if (check_event_query.isActive() and check_event_query.isSelect() and check_event_query.first()) {
     166            if (!check_event_query.exec()) {
     167                qWarning() << "check event failed, conference id:" << aEvent["xid_conference"]
     168                        << "event id:" << aEvent["id"]
     169                        << "error:" << check_event_query.lastError()
     170                        ;
     171                return;
     172            }
     173            if (check_event_query.isActive() and check_event_query.isSelect() and check_event_query.next()) {
    167174                event_exists = true;
    168175            }
     
    187194                            " (xid_conference, id, start, duration, xid_track, type, "
    188195                                " language, tag, title, subtitle, abstract, description) "
    189                             " VALUES (:xid_conference, :id, :start, :duration, :xid_track "
     196                            " VALUES (:xid_conference, :id, :start, :duration, :xid_track, :type, "
    190197                                ":language, :tag, :title, :subtitle, :abstract, :description)");
    191198        }
     
    199206            result.bindValue(QString(":") + prop_name, aEvent[prop_name]);
    200207        }
    201         result.exec();
     208        if (!result.exec()) {
     209            qWarning() << "event insert/update failed:" << result.lastError();
     210        }
    202211    }
    203212}
Note: See TracChangeset for help on using the changeset viewer.