Skip to content

Implement new DB changes API#1138

Open
fvacek wants to merge 2 commits into
mainfrom
new-db-chng-api
Open

Implement new DB changes API#1138
fvacek wants to merge 2 commits into
mainfrom
new-db-chng-api

Conversation

@fvacek
Copy link
Copy Markdown
Collaborator

@fvacek fvacek commented May 3, 2026

I'm not able to finish #1069 in near future, but DB cange API is finished already.

@lukaskett please check if this API fits also needs of O-feed

Usage example:

QObject::connect(&app, &Application::dbRecChng, &app, [](const qf::core::sql::RecChng &recchng) {
	auto dump_map = [](const QVariantMap &m) {
		QStringList rows;
		for (const auto &[k, v] : m.asKeyValueRange()) {
			rows << QStringLiteral("%1 -> %2").arg(k).arg(v.toString());
		}
		return rows.join('\n');
	};
	qfInfo() << "REC-CHNG table:" << recchng.table
			 << "op:" << qf::core::sql::RecChng::recopToString(recchng.op)
			 << "id:" << recchng.id
			 << "record:" << dump_map(recchng.record);
});

@fvacek fvacek requested a review from lukaskett May 3, 2026 19:10
@fvacek fvacek self-assigned this May 3, 2026
@lukaskett
Copy link
Copy Markdown
Collaborator

I'm not able to finish #1069 in near future, but DB cange API is finished already.

@lukaskett please check if this API fits also needs of O-feed

Usage example:

QObject::connect(&app, &Application::dbRecChng, &app, [](const qf::core::sql::RecChng &recchng) {
	auto dump_map = [](const QVariantMap &m) {
		QStringList rows;
		for (const auto &[k, v] : m.asKeyValueRange()) {
			rows << QStringLiteral("%1 -> %2").arg(k).arg(v.toString());
		}
		return rows.join('\n');
	};
	qfInfo() << "REC-CHNG table:" << recchng.table
			 << "op:" << qf::core::sql::RecChng::recopToString(recchng.op)
			 << "id:" << recchng.id
			 << "record:" << dump_map(recchng.record);
});

Thanks for details, I'll check it and let you know.

@fvacek fvacek requested a review from arnost00 May 3, 2026 19:56
@lukaskett
Copy link
Copy Markdown
Collaborator

@fvacek
Notes:

  • table competitors is not supporting RecChng, Super::saveData() in CompetitorDocument is still used
  • direct table edits (e.g. Runs tab) are not detected, RunsTableModel::postRow() is used
  • changes from another pc in the network is not detected (it's just local QT signal)

I'm not sure we're on the same page. I expected it to work like the existing database events, but with the difference that it would handle the actual data changes rather than just the competitor IDs.

As far as I understand, this change isn't currently much more suitable for OFeed than the existing database events.

@lukaskett
Copy link
Copy Markdown
Collaborator

Related #1063

@fvacek
Copy link
Copy Markdown
Collaborator Author

fvacek commented May 11, 2026

* table `competitors` is not supporting **RecChng**, `Super::saveData()` in `CompetitorDocument` is still used

@lukaskett
This is not clear to me, what is not working.
image

@fvacek
Copy link
Copy Markdown
Collaborator Author

fvacek commented May 11, 2026

@lukaskett

changes from another pc in the network is not detected (it's just local QT signal)

Changes are not currently propagated to other QE instances. My understanding is that o-feed is interested on local changes, which are sent to o-feed and then distributed via o-feed service to other clients.

@lukaskett
Copy link
Copy Markdown
Collaborator

@lukaskett This is not clear to me, what is not working. image

sorry, i overlooked, it works.

@lukaskett
Copy link
Copy Markdown
Collaborator

Changes are not currently propagated to other QE instances. My understanding is that o-feed is interested on local changes, which are sent to o-feed and then distributed via o-feed service to other clients.

Yes, but that would require the OFeed service to be running on every QE instance. The idea was to have one pc for sending changes to OFeed (and process changes from other origins), which is more robust than having to manage the service on every QE instance in my point of view.

@fvacek
Copy link
Copy Markdown
Collaborator Author

fvacek commented May 12, 2026

Changes are not currently propagated to other QE instances. My understanding is that o-feed is interested on local changes, which are sent to o-feed and then distributed via o-feed service to other clients.

Yes, but that would require the OFeed service to be running on every QE instance. The idea was to have one pc for sending changes to OFeed (and process changes from other origins), which is more robust than having to manage the service on every QE instance in my point of view.

Well, I can add DB_EVENT for this, but I rather like to make short meeting with you to make things clear.

fvacek added 2 commits May 13, 2026 22:14
Usage example:

QObject::connect(&app, &Application::dbRecChng, &app, [](const qf::core::sql::RecChng &recchng) {
	auto dump_map = [](const QVariantMap &m) {
		QStringList rows;
		for (const auto &[k, v] : m.asKeyValueRange()) {
			rows << QStringLiteral("%1 -> %2").arg(k).arg(v.toString());
		}
		return rows.join('\n');
	};
	qfInfo() << "REC-CHNG table:" << recchng.table
			 << "op:" << qf::core::sql::RecChng::recopToString(recchng.op)
			 << "id:" << recchng.id
			 << "record:" << dump_map(recchng.record);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants