Skip to content

Commit

Permalink
fix: improve column type info (#347)
Browse files Browse the repository at this point in the history
  • Loading branch information
Weakky authored Jul 19, 2024
1 parent b197032 commit 0e2897a
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 4 deletions.
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)]
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

0 comments on commit 0e2897a

Please sign in to comment.