mirror of
https://github.com/launchbadge/sqlx
synced 2024-09-20 14:21:57 +00:00
cockroachdb fix for macro (#1386)
This commit is contained in:
parent
38435ca647
commit
774880d17c
2 changed files with 22 additions and 6 deletions
|
@ -399,13 +399,16 @@ SELECT oid FROM pg_catalog.pg_type WHERE typname ILIKE $1
|
|||
.fetch_all(&mut *self)
|
||||
.await?;
|
||||
|
||||
// patch up our null inference with data from EXPLAIN
|
||||
let nullable_patch = self
|
||||
.nullables_from_explain(stmt_id, meta.parameters.len())
|
||||
.await?;
|
||||
// if it's cockroachdb skip this step #1248
|
||||
if !self.stream.parameter_statuses.contains_key("crdb_version") {
|
||||
// patch up our null inference with data from EXPLAIN
|
||||
let nullable_patch = self
|
||||
.nullables_from_explain(stmt_id, meta.parameters.len())
|
||||
.await?;
|
||||
|
||||
for (nullable, patch) in nullables.iter_mut().zip(nullable_patch) {
|
||||
*nullable = patch.or(*nullable);
|
||||
for (nullable, patch) in nullables.iter_mut().zip(nullable_patch) {
|
||||
*nullable = patch.or(*nullable);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(nullables)
|
||||
|
|
|
@ -47,3 +47,16 @@ fn bench_decode_parameter_status(b: &mut test::Bencher) {
|
|||
ParameterStatus::decode(test::black_box(Bytes::from_static(DATA))).unwrap();
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_decode_parameter_status_response() {
|
||||
const PARAMETER_STATUS_RESPONSE: &[u8] = b"crdb_version\0CockroachDB CCL v21.1.0 (x86_64-unknown-linux-gnu, built 2021/05/17 13:49:40, go1.15.11)\0";
|
||||
|
||||
let message = ParameterStatus::decode(Bytes::from(PARAMETER_STATUS_RESPONSE)).unwrap();
|
||||
|
||||
assert_eq!(message.name, "crdb_version");
|
||||
assert_eq!(
|
||||
message.value,
|
||||
"CockroachDB CCL v21.1.0 (x86_64-unknown-linux-gnu, built 2021/05/17 13:49:40, go1.15.11)"
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue