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: improve column type info #347

Merged
merged 7 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ url = "2.2.2"
reqwest = "0.11.10"
paste = "1.0"
indicatif = "0.17"
chrono = "0.4"
chrono = "0.4.38"
indoc = "1.0.7"

[package.metadata.docs.rs]
Expand Down
14 changes: 12 additions & 2 deletions src/row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,21 @@ impl From<&TypeInfo> for ColumnType {
},
TypeInfo::VarLenSized(cx) => match cx.r#type() {
VarLenType::Guid => Self::Guid,
VarLenType::Intn => Self::Intn,
VarLenType::Intn => match cx.len() {
1 => Self::Int1,
2 => Self::Int2,
4 => Self::Int4,
8 => Self::Int8,
_ => Self::Intn,
},
VarLenType::Bitn => Self::Bitn,
VarLenType::Decimaln => Self::Decimaln,
VarLenType::Numericn => Self::Numericn,
VarLenType::Floatn => Self::Floatn,
VarLenType::Floatn => match cx.len() {
4 => Self::Float4,
8 => Self::Float8,
_ => Self::Floatn,
},
VarLenType::Money => Self::Money,
VarLenType::Datetimen => Self::Datetimen,
#[cfg(feature = "tds73")]
Expand Down
2 changes: 2 additions & 0 deletions src/tds/codec/token/token_feature_ext_ack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ pub struct TokenFeatureExtAck {
}

#[derive(Debug)]
#[allow(dead_code)]
Copy link
Contributor Author

@Weakky Weakky Jul 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these are clippy fixes coming from Rust 1.79.0. I don't want to remove all of this code until we give tiberius proper attention again.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, github's mentioning a bunch of clippy warnings in files that weren't in this PR, I guess those are also to be left until this happens

pub enum FedAuthAck {
SecurityToken { nonce: Option<[u8; 32]> },
}

#[derive(Debug)]
#[allow(dead_code)]
pub enum FeatureAck {
FedAuth(FedAuthAck),
}
Expand Down
1 change: 1 addition & 0 deletions src/tds/codec/token/token_return_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use super::BaseMetaDataColumn;
use crate::{tds::codec::ColumnData, Error, SqlReadBytes};

#[derive(Debug)]
#[allow(dead_code)]
pub struct TokenReturnValue {
pub param_ordinal: u16,
pub param_name: String,
Expand Down
1 change: 1 addition & 0 deletions src/tds/stream/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use std::{convert::TryFrom, sync::Arc};
use tracing::{event, Level};

#[derive(Debug)]
#[allow(dead_code)]
pub enum ReceivedToken {
NewResultset(Arc<TokenColMetaData<'static>>),
Row(TokenRow<'static>),
Expand Down
2 changes: 1 addition & 1 deletion tests/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2678,7 +2678,7 @@ where
let col = meta.columns().first();

assert_eq!(Some("col"), col.map(|c| c.name()));
assert_eq!(Some(ColumnType::Intn), col.map(|c| c.column_type()));
assert_eq!(Some(ColumnType::Int4), col.map(|c| c.column_type()));
}
}

Expand Down
Loading