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

fix(sqlite/any): encode bool as integer #2620

Merged

Conversation

saiintbrisson
Copy link
Contributor

@saiintbrisson saiintbrisson commented Jul 14, 2023

Encodes boolean data types as integers when using the AnyConnection. This is a partial fix.
It is still not possible to query_as::<_, (bool,)>. AnyRow expects the bool type info to be
BOOLEAN but SQLite returns INTEGER.

An option is to modify the impl Type<Any> for bool

impl Type<Any> for bool {
fn type_info() -> AnyTypeInfo {
AnyTypeInfo {
kind: AnyTypeInfoKind::Bool,
}
}
}

and override the default compatible function to accept both AnyTypeInfo::Bool and AnyTypeInfo::Integer,
but this could lead to unintended problems when using other drivers that have a boolean data type.

Partially fixes #2592.

@saiintbrisson saiintbrisson changed the title fix(sqlite): encode bool as integer fix(sqlite/any): encode bool as integer Jul 14, 2023
@abonander abonander merged commit 3662bda into launchbadge:main Jul 14, 2023
57 checks passed
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.

Any connection panics: "BUG: missing mapping for Bool(true)"
2 participants