Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Syntactic sugar" for user-defined function calls #1247

Merged
merged 12 commits into from
Nov 15, 2023

Conversation

trueqbit
Copy link
Collaborator

It is possible to define the expression of a user-defined function call as a variable, which improves readability and "feels" like calling an SQL function.

E.g.

struct IdFunc {
    int operator()(int arg) { return arg; }
};
constexpr auto id_func = func<IdFunc>;

// nice:
select(id_func(42));
// instead of:
select(func<IdFunc>(42));

Also in this PR:

  • Fixed a potential crash at the point of calling a user-defined scalar function from the SQLite callback.
  • Fixed a potential crash at the point of calling the finalizer of a user-defined aggregate function from the SQLite callback.
  • Fixed a memory leak that occurred everytime when deleting or cleaning up user-defined functions.
  • Improved naming of variables related to the handling of user-defined functions.
  • Delete user-defined functions only after successfully hitting sqlite3.
  • Corrected requirement of storage_t<>.count<>().
  • Improved compilation times under C++14.

@trueqbit trueqbit requested a review from fnc12 November 14, 2023 23:01
@trueqbit trueqbit merged commit 8243dc5 into fnc12:dev Nov 15, 2023
1 check passed
@trueqbit trueqbit deleted the function_syntactic_sugar branch December 24, 2023 13:21
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