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

refactor: standard database functions #985

Merged
merged 15 commits into from
Feb 18, 2025
Merged

Conversation

patricebender
Copy link
Member

@patricebender patricebender commented Jan 21, 2025

  • factor out SQLite specific functions from base class
  • HANAService also requires db-service/cql-functions and then also supports floor, ceiling, average
  • kill totalseconds
  • (later) cql-functions in the db-service becomes sql-functions and a new interface cql-functions is added containing the set of functions which shall be implemented by the dbs themselves this would enable also overwriting/re-using cql-functions for non-sql dbs

- [] factor out SQLite specific functions from base class
- [] align jsdoc with capire
- [] `cql-functions` in the db-service becomes `sql-functions`
     and a new interface `cql-functions` is added containing
     the set of functions which shall be implemented by the dbs themselves
     this would enable also overwriting/re-using `cql-functions` for non-sql dbs
* @param {string} y right timestamp
* @returns {string}
* Generates SQL statement for the current date
* @param {string} [p] - Optional parameter
Copy link
Contributor

Choose a reason for hiding this comment

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

is p allowed according to ANSI SQL ? My understanding is that p is only allowed by certain databases.

Copy link
Member Author

Choose a reason for hiding this comment

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

No, at least not for current_date (I didn't add this in this PR though),

this and excerpt from ANSI SQL 2003:

<current date value function> ::= CURRENT_DATE

<current time value function> ::=
CURRENT_TIME [ <left paren> <time precision> <right paren> ]

<current local time value function> ::=
LOCALTIME [ <left paren> <time precision> <right paren> ]

<current timestamp value function> ::=
CURRENT_TIMESTAMP [ <left paren> <timestamp precision> <right paren> ]

<current local timestamp value function> ::=
LOCALTIMESTAMP [ <left paren> <timestamp precision> <right paren> ]

Looks like the precision is ok for the others. I would then remove it from current_date would you agree?

@patricebender patricebender enabled auto-merge (squash) February 18, 2025 18:54
@patricebender patricebender merged commit 3211c9c into main Feb 18, 2025
6 checks passed
@patricebender patricebender deleted the patrice/refactor-functs branch February 18, 2025 19:02
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