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

Sqlite Collation Support #446

Merged
merged 7 commits into from
Jul 4, 2020
Merged

Sqlite Collation Support #446

merged 7 commits into from
Jul 4, 2020

Conversation

agentsim
Copy link
Contributor

Adds a method create_collation to SqliteConnection.
Adds a unit test confirming the collation works as expected.

Adds a method create_collation to SqliteConnection.
Adds a unit test confirming the collation works as expected.
@agentsim
Copy link
Contributor Author

Per the comments in #430, this adds the method directly on SqliteConnection.
The implementation is essentially a direct copy of what rusqlite did. I put the method in a separate module, collation, that seemed to be similar to the approach taken with other methods on SqliteConnection.

I had some trouble with the unit test, I'm not sure the why I coded it is best.

sqlx-core/src/sqlite/connection/collation.rs Outdated Show resolved Hide resolved
sqlx-core/src/sqlite/connection/collation.rs Outdated Show resolved Hide resolved
sqlx-core/src/sqlite/connection/collation.rs Outdated Show resolved Hide resolved
sqlx-core/src/sqlite/connection/collation.rs Outdated Show resolved Hide resolved
sqlx-core/src/sqlite/connection/mod.rs Outdated Show resolved Hide resolved
sqlx-core/src/sqlite/connection/mod.rs Outdated Show resolved Hide resolved
@agentsim agentsim requested a review from mehcode June 30, 2020 16:36
@agentsim
Copy link
Contributor Author

agentsim commented Jul 3, 2020

@mehcode @abonander I think this is ready to be merged. The CI failures appear to come from existing code in the master branch.

@mehcode mehcode merged commit 7810f7d into launchbadge:master Jul 4, 2020
@mehcode
Copy link
Member

mehcode commented Jul 4, 2020

👍 Thanks for seeing this through

@jeremymarch
Copy link

Is it possible to create a collation for a Sqlite Pool? Or only a single connection?

@abonander
Copy link
Collaborator

In the version we just released this week, you can configure collations on SqliteConnectOptions which when used with a pool will create those collations on all connections created by the pool: https://docs.rs/sqlx/latest/sqlx/sqlite/struct.SqliteConnectOptions.html#method.collation

@jeremymarch
Copy link

Perfect! Thanks so much!

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.

4 participants