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

Add sql char length functions #4134

Merged
merged 2 commits into from
May 5, 2023

Conversation

griffio
Copy link
Contributor

@griffio griffio commented May 4, 2023

Adding sql function char length functions for completeness to MySql and HSql.

Sqlite only supports length and is inherited already from the AnsiSql dialect.

  • Mysql supports length as returning count of bytes
  • HSql supports length as returning count of characters
  • Both support char_length and character_length
  • Add Sql test fixtures
  • Add Integration tests
  • Hsql uses in memory database for testing and create schema file is run multiple times
    • added shutdown=true to close database between tests

@griffio
Copy link
Contributor Author

griffio commented May 4, 2023

👺 I think the current failure needs a retry as build is quite lengthy and transient errors can occur. 🎲

locally tests passed - but double checking 🔀

Hsql supports LENGTH, CHAR_LENGTH, CHARACTER_LENGTH and are synonymous.

All functions return a BIGINT value that measures the length of the string in characters.

There appeared to be an issue in running HsqlTest where the schema is created each test.
Appending “;shutdown=true” to the connection string closes the in memory database.
MySql supports LENGTH, CHAR_LENGTH, CHARACTER_LENGTH.

LENGTH returns the count of bytes.
CHAR_LENGTH, CHARACTER_LENGTH return count of characters

Note: AnsiSqlTypeResolver provides ‘length’ function
@griffio griffio force-pushed the add-sql-char-length-functions branch from 049e392 to 0f5a486 Compare May 5, 2023 07:37
@griffio
Copy link
Contributor Author

griffio commented May 5, 2023

♻️ Rebased with latest to trigger another build

@hfhbd
Copy link
Collaborator

hfhbd commented May 5, 2023

Thanks.

@hfhbd hfhbd merged commit 3015b7d into cashapp:master May 5, 2023
@griffio griffio deleted the add-sql-char-length-functions branch May 5, 2023 19:14
hfhbd pushed a commit that referenced this pull request May 19, 2023
* Add Hsql char length function

Hsql supports LENGTH, CHAR_LENGTH, CHARACTER_LENGTH and are synonymous.

All functions return a BIGINT value that measures the length of the string in characters.

There appeared to be an issue in running HsqlTest where the schema is created each test.
Appending “;shutdown=true” to the connection string closes the in memory database.

* Add MySql character length functions

MySql supports LENGTH, CHAR_LENGTH, CHARACTER_LENGTH.

LENGTH returns the count of bytes.
CHAR_LENGTH, CHARACTER_LENGTH return count of characters

Note: AnsiSqlTypeResolver provides ‘length’ function
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