QString sql = this->createInsertSql(table, field); query.prepare(sql); this->bindValues(query, field); if (!query.exec()) { throw ErrorHandler((quint16)ERROR_SQL_EXECUTE, query.lastError().text(), QString(__FILE__), __LINE__); }
QString sql = "SELECT " + DbTableField::instance()->getFieldsAsSQL(TABLE_ORDER, "to1") + ", " + DbTableField::instance()->getFieldsAsSQL(TABLE_ORDER_STATUS, "tos1") + ", " + DbTableField::instance()->getFieldsAsSQL(TABLE_USER_DRIVER, "tud1") + ", " + DbTableField::instance()->getFieldsAsSQL(TABLE_USER_MANAGER, "tum1") + ", " + DbTableField::instance()->getFieldsAsSQL(TABLE_USER_MANAGER, "tum2") + ", " + DbTableField::instance()->getFieldsAsSQL(TABLE_USER_MANAGER, "tum3") + ", " + DbTableField::instance()->getFieldsAsSQL(TABLE_PHONE, "tp1") + ", " + DbTableField::instance()->getFieldsAsSQL(TABLE_PHONE, "tp2") + " FROM " + TABLE_ORDER + " to1" + " JOIN " + TABLE_ORDER_STATUS + " tos1 ON to1.status_id = tos1.id" + " JOIN " + TABLE_USER_MANAGER + " tum1 ON tum1.id = to1.created_by" + " JOIN " + TABLE_PHONE + " tp1 ON tp1.id = to1.phone_id" + " LEFT JOIN " + TABLE_USER_DRIVER + " tud1 ON tud1.id = to1.driver_id" + " LEFT JOIN " + TABLE_PHONE + " tp2 ON tp2.id = tud1.phone_id" + " LEFT JOIN " + TABLE_USER_MANAGER + " tum2 ON tum2.id = to1.driver_set_by" + " LEFT JOIN " + TABLE_USER_MANAGER + " tum3 ON tum3.id = to1.client_called_by" + " WHERE to1.booking_time > ? AND to1.booking_time < current_timestamp" + " ORDER BY tos1.sort_order DESC, to1.updated_at DESC, to1.created_at DESC"; query.prepare(sql); query.bindValue(0, m_Filter.getValueByField("booking_time").value().toDateTime().toString(Qt::ISODate)); if (!query.exec()) { throw ErrorHandler((quint16)ERROR_SQL_EXECUTE, query.lastError().text(), QString(__FILE__), __LINE__); }