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

Stickers and integer values #1894

Closed
jcorporation opened this issue Nov 6, 2023 · 1 comment
Closed

Stickers and integer values #1894

jcorporation opened this issue Nov 6, 2023 · 1 comment

Comments

@jcorporation
Copy link
Member

I use stickers to save song playback statistics and ratings. All this values are integers, e.g. the playCount. MPD can save values in the sticker database only as string. Converting the integers to strings and saving them is not the problem.

The problem exists in the query interface:

  • The = operator works as expected for integers.
  • But for the supported > and < this does not work as an user will expect this.

Example:

  • I have the 468 48 53 as values for a sticker named playCount.
  • SQL select: select value from sticker where name="playCount" and value > 5;
  • This returns only 53 as the operator does not work in a numeric context

Possible solutions for this:

  • Leave the schema untouched
  • Add new api to emit sql selects with casts: select value from sticker where name="elapsed" and cast(value as int) > 5
  • Add a int column to the schema
  • Add new api to set and retrieve the int values

I am happy to contribute code to solve the problem.

@MaxKellermann: Which solution would you prefer?

jcorporation added a commit to jcorporation/MPD that referenced this issue Nov 7, 2023
The two new compare operators "gt" and "lt" are casting the values to int.

Sort supports:
- uri: sort by uri
- value: sort by value as string
- value_int: casts value to int

This is an attempt to fix MusicPlayerDaemon#1894.
jcorporation added a commit to jcorporation/MPD that referenced this issue Nov 7, 2023
The two new compare operators "gt" and "lt" are casting the values to int.

Sort supports:
- uri: sort by uri
- value: sort by value as string
- value_int: casts value to int

This is an attempt to fix MusicPlayerDaemon#1894.
@jcorporation
Copy link
Member Author

#1895 implements the cast solution.

jcorporation added a commit to jcorporation/MPD that referenced this issue Nov 8, 2023
The two new compare operators "gt" and "lt" are casting the values to int.

Sort supports:
- uri: sort by uri
- value: sort by value as string
- value_int: casts value to int

This is an attempt to fix MusicPlayerDaemon#1894.
jcorporation added a commit to jcorporation/MPD that referenced this issue Nov 23, 2023
The two new compare operators "gt" and "lt" are casting the values to int.

Sort supports:
- uri: sort by uri
- value: sort by value as string
- value_int: casts value to int

This is an attempt to fix MusicPlayerDaemon#1894.
jcorporation added a commit to jcorporation/MPD that referenced this issue Nov 23, 2023
The two new compare operators "gt" and "lt" are casting the values to int.

Sort supports:
- uri: sort by uri
- value: sort by value as string
- value_int: casts value to int

This is an attempt to fix MusicPlayerDaemon#1894.
jcorporation added a commit to jcorporation/MPD that referenced this issue Dec 12, 2023
The two new compare operators "gt" and "lt" are casting the values to int.

Sort supports:
- uri: sort by uri
- value: sort by value as string
- value_int: casts value to int

This is an attempt to fix MusicPlayerDaemon#1894.
jcorporation added a commit to jcorporation/MPD that referenced this issue Dec 12, 2023
The two new compare operators "gt" and "lt" are casting the values to int.

Sort supports:
- uri: sort by uri
- value: sort by value as string
- value_int: casts value to int

Closes MusicPlayerDaemon#1894
jcorporation added a commit to jcorporation/MPD that referenced this issue Dec 20, 2023
The two new compare operators "gt" and "lt" are casting the values to int.

Sort supports:
- uri: sort by uri
- value: sort by value as string
- value_int: casts value to int

Closes MusicPlayerDaemon#1894
jcorporation added a commit to jcorporation/MPD that referenced this issue Dec 21, 2023
The two new compare operators "gt" and "lt" are casting the values to int.

Sort supports:
- uri: sort by uri
- value: sort by value as string
- value_int: casts value to int

Closes MusicPlayerDaemon#1894
jcorporation added a commit to jcorporation/MPD that referenced this issue Jan 3, 2024
The two new compare operators "gt" and "lt" are casting the values to int.

Sort supports:
- uri: sort by uri
- value: sort by value as string
- value_int: casts value to int

Closes MusicPlayerDaemon#1894
jcorporation added a commit to jcorporation/MPD that referenced this issue Jan 7, 2024
The two new compare operators "gt" and "lt" are casting the values to int.

Sort supports:
- uri: sort by uri
- value: sort by value as string
- value_int: casts value to int

Closes MusicPlayerDaemon#1894
jcorporation added a commit to jcorporation/MPD that referenced this issue Jan 16, 2024
The three new compare operators "eq", "gt" and "lt" are casting the values to int.

Sort supports:
- uri: sort by uri
- value: sort by value as string
- value_int: casts value to int

Closes MusicPlayerDaemon#1894
jcorporation added a commit to jcorporation/MPD that referenced this issue Jan 16, 2024
The three new compare operators "eq", "gt" and "lt" are casting the values to int.

Sort supports:
- uri: sort by uri
- value: sort by value as string
- value_int: casts value to int

Closes MusicPlayerDaemon#1894
jcorporation added a commit to jcorporation/MPD that referenced this issue Jan 16, 2024
The three new compare operators "eq", "gt" and "lt" are casting the values to int.

Sort supports:
- uri: sort by uri
- value: sort by value as string
- value_int: casts value to int

Closes MusicPlayerDaemon#1894
jcorporation added a commit to jcorporation/MPD that referenced this issue Jan 18, 2024
The three new compare operators "eq", "gt" and "lt" are casting the values to int.

Sort supports:
- uri: sort by uri
- value: sort by value as string
- value_int: casts value to int

Closes MusicPlayerDaemon#1894
jcorporation added a commit to jcorporation/MPD that referenced this issue Feb 15, 2024
The three new compare operators "eq", "gt" and "lt" are casting the values to int.

Sort supports:
- uri: sort by uri
- value: sort by value as string
- value_int: casts value to int

Closes MusicPlayerDaemon#1894
jcorporation added a commit to jcorporation/MPD that referenced this issue Feb 15, 2024
The three new compare operators "eq", "gt" and "lt" are casting the values to int.

Sort supports:
- uri: sort by uri
- value: sort by value as string
- value_int: casts value to int

Closes MusicPlayerDaemon#1894
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

No branches or pull requests

1 participant