void LocalDiscoveryTracker::startSyncPartialDiscovery() { if (lcLocalDiscoveryTracker().isDebugEnabled()) { QByteArrayList paths; for (auto &path : _localDiscoveryPaths) paths.append(path); qCDebug(lcLocalDiscoveryTracker) << "partial discovery with paths: " << paths; } _previousLocalDiscoveryPaths = std::move(_localDiscoveryPaths); _localDiscoveryPaths.clear(); }
void SqliteTableModel::fetchData(unsigned int from, unsigned to) { int currentsize = m_data.size(); QString sLimitQuery; if(m_sQuery.startsWith("PRAGMA", Qt::CaseInsensitive) || m_sQuery.startsWith("EXPLAIN", Qt::CaseInsensitive)) { sLimitQuery = m_sQuery; } else { // Remove trailing trailing semicolon QString queryTemp = rtrimChar(m_sQuery, ';'); // If the query ends with a LIMIT statement take it as it is, if not append our own LIMIT part for lazy population if(queryTemp.contains(QRegExp("LIMIT\\s+\\d+\\s*(,\\s*\\d+\\s*)?$", Qt::CaseInsensitive))) sLimitQuery = queryTemp; else sLimitQuery = QString("%1 LIMIT %2, %3;").arg(queryTemp).arg(from).arg(to-from); } m_db->logSQL(sLimitQuery, kLogMsg_App); QByteArray utf8Query = sLimitQuery.toUtf8(); sqlite3_stmt *stmt; int status = sqlite3_prepare_v2(m_db->_db, utf8Query, utf8Query.size(), &stmt, NULL); if(SQLITE_OK == status) { while(sqlite3_step(stmt) == SQLITE_ROW) { QByteArrayList rowdata; for (int i = 0; i < m_headers.size(); ++i) rowdata.append(QByteArray(static_cast<const char*>(sqlite3_column_blob(stmt, i)), sqlite3_column_bytes(stmt, i))); m_data.push_back(rowdata); } } sqlite3_finalize(stmt); beginInsertRows(QModelIndex(), currentsize, m_data.size()-1); endInsertRows(); }