Add auto completion for math functions#2631
Merged
MKleusberg merged 2 commits intosqlitebrowser:masterfrom Mar 16, 2021
Merged
Conversation
Math functions are introduced from sqlite 3.35. Refer https://www.sqlite.org/lang_mathfunc.html FYI, it need to compile sqlite with -DSQLITE_ENABLE_MATH_FUNCTIONS
justinclift
reviewed
Mar 15, 2021
src/SqlUiLexer.cpp
Outdated
| << "first_value" + tr("(expr) This built-in window function calculates the window frame for each row in the same way as an aggregate window function. It returns the value of expr evaluated against the first row in the window frame for each row.") | ||
| << "last_value" + tr("(expr) This built-in window function calculates the window frame for each row in the same way as an aggregate window function. It returns the value of expr evaluated against the last row in the window frame for each row.") | ||
| << "nth_value" + tr("(expr,N) This built-in window function calculates the window frame for each row in the same way as an aggregate window function. It returns the value of expr evaluated against the row N of the window frame. Rows are numbered within the window frame starting from 1 in the order defined by the ORDER BY clause if one is present, or in arbitrary order otherwise. If there is no Nth row in the partition, then NULL is returned.") | ||
| // Math functions introduced from SQLite 3.3.5 |
Contributor
Author
There was a problem hiding this comment.
typo. good catch :)
Member
|
Seems like a good idea in concept. Am kind of wondering if there should be a check for the running SQLite version though, before enabling them? |
Math function can be used when sqlite is equal or higher than 3.35 and compiled with SQLITE_ENABLE_MATH_FUNCTIONS. When sqlite is compiled with SQLITE_OMIT_COMPILEOPTION_DIAGS, there is no way to check the compile options. In this case, we'll check only the sqlite version. Otherwise, it will check whether sqlite was built with SQLITE_ENABLE_MATH_FUNCTIONS.
Member
|
@lucydodo @MKleusberg @mgrojo This seems like a good idea to me. Hopefully someone has time to review it. 😄 |
Member
|
Awesome! Thank you very much, @neozest! This is very much appreciated 😄 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Math functions are introduced from sqlite 3.35.
Refer https://www.sqlite.org/lang_mathfunc.html
FYI, it need to be compiled with -DSQLITE_ENABLE_MATH_FUNCTIONS.