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

with_param #159

Merged
merged 3 commits into from
Nov 21, 2024
Merged

with_param #159

merged 3 commits into from
Nov 21, 2024

Conversation

serprex
Copy link
Member

@serprex serprex commented Sep 24, 2024

Small wrapper around with_option for impl Serialize + Bind

@serprex serprex requested review from loyd and slvrtrn September 24, 2024 13:37
@serprex serprex force-pushed the with-param branch 2 times, most recently from 8891fb7 to 32382c9 Compare September 24, 2024 13:46
@serprex serprex changed the title With param with_param Sep 24, 2024
@serprex serprex force-pushed the with-param branch 2 times, most recently from edbd788 to abf96dd Compare September 24, 2024 13:55
@slvrtrn
Copy link
Contributor

slvrtrn commented Sep 24, 2024

Aside from the simpler types, the following needs testing:

  • Arrays, Maps, Tuples (e.g., common container types that make sense to use in this context).
  • DateTime/DateTime64 (IIRC, it requires a specific format like 2022-05-02 13:25:55.123456789, i.e. not exactly ISO timestamp)
  • Numeric and named enums
  • \t, \r, \n, single quotes, backslashes in the bound strings
  • Strings with UTF8 symbols
  • Nulls

I'd maybe also not mix it with .with_option method; the proposal from @mshustov looks better IMO (see this comment) - we can add the param_ prefix ourselves internally.

@serprex serprex force-pushed the with-param branch 2 times, most recently from 135598b to 70aa220 Compare September 24, 2024 14:35
@serprex
Copy link
Member Author

serprex commented Sep 24, 2024

So already found issue with basic tests. String Bind serializes to 'string' with quotes which is correct when interpolating into query string, but for server side parameters the string should be unquoted

Note once a string is contained it is expected to be quoted in params: ClickHouse/clickhouse-connect#159

@serprex serprex force-pushed the with-param branch 4 times, most recently from 5466a0e to 19ba376 Compare September 26, 2024 02:29
src/lib.rs Outdated Show resolved Hide resolved
@loyd
Copy link
Collaborator

loyd commented Sep 29, 2024

We also need tests for UUID (probably, with the human-readable mode it works already). Also, for some implementation of DecimalX (the fixnum crate for instance).

And need to add some examples.

src/query.rs Outdated Show resolved Hide resolved
src/query.rs Outdated Show resolved Hide resolved
src/query.rs Outdated Show resolved Hide resolved
src/query.rs Outdated Show resolved Hide resolved
@serprex serprex force-pushed the with-param branch 4 times, most recently from 2eaaa70 to 759a7e0 Compare October 2, 2024 18:04
@mshustov mshustov requested a review from loyd October 29, 2024 18:12
@slvrtrn
Copy link
Contributor

slvrtrn commented Nov 4, 2024

@loyd, I'd like to merge this one. WDYT?

@serprex serprex merged commit da27018 into main Nov 21, 2024
5 of 6 checks passed
@mshustov mshustov deleted the with-param branch December 3, 2024 09:00
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.

3 participants