Skip to content

Commit

Permalink
feat: improve type inference for sqlite (typedsql) (#4976)
Browse files Browse the repository at this point in the history
  • Loading branch information
Weakky authored Aug 12, 2024
1 parent d33dcc5 commit 44f753d
Show file tree
Hide file tree
Showing 10 changed files with 427 additions and 34 deletions.
153 changes: 138 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion quaint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ optional = true
branch = "vendored-openssl"

[dependencies.rusqlite]
version = "0.29"
version = "0.31"
features = ["chrono", "column_decltype"]
optional = true

Expand Down
3 changes: 3 additions & 0 deletions quaint/src/connector/column_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ pub enum ColumnType {
DateArray,
TimeArray,

Null,

Unknown,
}

Expand Down Expand Up @@ -82,6 +84,7 @@ impl std::fmt::Display for ColumnType {
ColumnType::DateArray => write!(f, "date-array"),
ColumnType::TimeArray => write!(f, "time-array"),

ColumnType::Null => write!(f, "null"),
ColumnType::Unknown => write!(f, "unknown"),
}
}
Expand Down
2 changes: 1 addition & 1 deletion query-engine/query-engine-c-abi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ chrono.workspace = true
quaint = { path = "../../quaint", default-features = false, features = [
"sqlite",
] }
rusqlite = "0.29"
rusqlite = "0.31"
uuid.workspace = true
thiserror = "1"
connection-string.workspace = true
Expand Down
3 changes: 2 additions & 1 deletion schema-engine/connectors/sql-schema-connector/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ either = "1.6"
sqlformat = "0.2.1"
sqlparser = "0.32.0"
versions = "6.1.0"

sqlx-sqlite = { version = "0.8.0" }
sqlx-core = "0.8.0"
[dev-dependencies]
expect-test = "1"
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ impl Connection {
.map(|p| p.set_typ(ColumnType::Unknown))
.collect();

Ok(parsed)
} else {
Ok(parsed)
return Ok(parsed);
}

Ok(parsed)
}

pub(super) async fn apply_migration_script(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,9 @@ impl SqlFlavour for SqliteFlavour {
sql: &'a str,
) -> BoxFuture<'a, ConnectorResult<quaint::connector::ParsedRawQuery>> {
tracing::debug!(sql, query_type = "parse_raw_query");
ready(with_connection(&mut self.state, |_, conn| conn.parse_raw_query(sql)))
ready(with_connection(&mut self.state, |params, conn| {
conn.parse_raw_query(sql, params)
}))
}

fn introspect(
Expand Down
Loading

0 comments on commit 44f753d

Please sign in to comment.