error: invalid initialization of non-const reference of type 'int&' from a temporary of type 'int'
class HostsInfo{public: void readInfo (std::istream &);...};Вызываю:a.readInfo (std::ifstream stream ("settings.ts"));
std::ifstream stream ("settings.ts");a.readInfo (stream);
{ //начало, скажем функции ... { //наш дополнительный блок std::ifstream stream ("settings.ts"); a.readInfo (stream); } ...}
for (int i=0; i < listPrice.size(); i++) { QString hotel = QString::fromUtf8((const char *)listPrice.at(i).hotel); QString room = QString::fromUtf8((const char *)listPrice.at(i).room); QString place = QString::fromUtf8((const char *)listPrice.at(i).place); QString meal = QString::fromUtf8((const char *)listPrice.at(i).meal); QString night = QString::fromUtf8((const char *)listPrice.at(i).night); QString checkin = QString::fromUtf8((const char *)listPrice.at(i).checkin); unsigned int ts = QDateTime::fromString(checkin, "yyyyMMdd").toTime_t(); QString price = QString::fromUtf8((const char *)listPrice.at(i).price); qList << QString("INSERT INTO price (hotel, room, place, meal, night, checkin, price) VALUES (%1,%2,%3,%4,%5,'%6',%7);").arg(hotel).arg(room).arg(place).arg(meal).arg(night).arg(ts).arg(price); }
QString query = "INSERT INTO price (hotel, room, place, meal, night, checkin, price) VALUES (";query += hotel;query += ",";query += room;query += ",";query += place;query += ",";query += meal;query += ",";query += night;query += ",";query += ts;query += ",";query += price;query += ");";
void QSqlQuery::bindValue ()
QSqlQuery query; query.prepare("INSERT INTO person (id, forename, surname) " "VALUES (:id, :forename, :surname)"); query.bindValue(":id", 1001); query.bindValue(":forename", "Bart"); query.bindValue(":surname", "Simpson"); query.exec(); query.bindValue(":id", 1002); query.bindValue(":forename", "Vasya"); query.bindValue(":surname", "Pupkin"); query.exec();