Skip to content

vef: Add Statement Events Capability#645

Open
malone-at-work wants to merge 2 commits into
mainfrom
maloney/query_hook/1
Open

vef: Add Statement Events Capability#645
malone-at-work wants to merge 2 commits into
mainfrom
maloney/query_hook/1

Conversation

@malone-at-work

Copy link
Copy Markdown
Member

Read-only query hooks are called at one of five times with relevant metadata:

A) Session connect
B) Before query is parsed
C) After query is parsed
D) Before query exection
E) After query execution
F) Session disconnect

Only (E) after query execution is implemented in this change.

Read-only query hooks are called at one of five times with relevant
metadata:

A) Session connect
B) Before query is parsed
C) After query is parsed
D) Before query exection
E) After query execution
F) Session disconnect

Only (E) after query execution is implemented in this change.
bool in_transaction;

// SQL command as a lowercase string (e.g. "select", "insert",
// "create_table"). Stable across MySQL version rebases. NULL if unknown.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/rebases//

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

// The pointed-to string has static lifetime and need not be copied.
const char *sql_command;

// Default schema (USE <db>), or NULL if none selected.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You talk about lifetime above; what's the lifetime if not commented?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All are now commented. We should probably have an ABI-wide standard.

extern "C" {
#endif

// Preview capability: "vsql::preview::query_hook"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, my biggest comment is about related functionality and how we want to organize.

AIUI, there are some things called "query hooks" that are on the critical path: I want to rewrite a query has to be on the critical path.

Then some might just be for info. "I want to know this happened".

The latter is perhaps more similar to "OpenTelemetry".

Is it worth thinking at all about hooks that, if they don't work, fail the query, vs. hooks that record info? Which is this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of discussion offline. Renamed to statement events.

@malone-at-work malone-at-work changed the title vef: Add Query Hook Capability vef: Add Statement Events Capability Jun 10, 2026
@malone-at-work malone-at-work force-pushed the maloney/query_hook/1 branch 2 times, most recently from c596f93 to 71a3c16 Compare June 10, 2026 19:51
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