C++ (Qt)foreach(QString tmp, filenames) { QFile file(tmp); if (!file.open(QFile::ReadOnly)) qDebug() << "cant open file"; QXmlQuery query; query.bindVariable("inputDocument", &file); query.setQuery(queryString); if (!query.isValid()) { RED_DEBUG; qDebug("Hi, i'm error"); RESET_COLORIZED_DEBUG; } QString query_result; if (query.evaluateTo(&query_result)) { QStringList values = query_result.trimmed().split("*"); if (values.size() != 10) { YELLOW_DEBUG; qDebug("wrong number of values"); RESET_COLORIZED_DEBUG; } else { sqlQuery.prepare("INSERT INTO data (fname, regnumb, person, " "type, period, date, kind, correction, numb, ammount) " "VALUES (:fname, :regnumb, :person, :type, :period, " ":date, :kind, :correction, :numb, :ammount)"); for (int i=0; i<10; i++) { sqlQuery.bindValue(i, values.at(i)); } if (!sqlQuery.exec()) { RED_DEBUG; qDebug("sql query not executed"); RESET_COLORIZED_DEBUG; } } } else { RED_DEBUG; qDebug() << "xmlquery error"; RESET_COLORIZED_DEBUG; } file.close(); }
==27934== All heap blocks were freed -- no leaks are possible
QFile file(tmp); if (!file.open(QFile::ReadOnly)) qDebug() << "cant open file"; QXmlQuery query; query.bindVariable("inputDocument", &file); query.setQuery(queryString);
‘class QXmlQuery’ has no member named ‘deleteLater’