Skip to content

Commit e232bc1

Browse files
cursoragentlovasoa
andcommitted
Checkpoint before follow-up message
Co-authored-by: contact <[email protected]>
1 parent bf3a5b7 commit e232bc1

File tree

2 files changed

+5
-22
lines changed

2 files changed

+5
-22
lines changed

sqlx-core/src/odbc/connection/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fn create_column(stmt: &mut PreparedStatement, index: u16) -> OdbcColumn {
4040
}
4141
}
4242

43-
trait ColumnNameDecode {
43+
pub(super) trait ColumnNameDecode {
4444
fn decode_or_default(self, index: u16) -> String;
4545
}
4646

@@ -56,7 +56,7 @@ impl ColumnNameDecode for Vec<u16> {
5656
}
5757
}
5858

59-
fn decode_column_name<T: ColumnNameDecode>(name: T, index: u16) -> String {
59+
pub(super) fn decode_column_name<T: ColumnNameDecode>(name: T, index: u16) -> String {
6060
name.decode_or_default(index)
6161
}
6262

sqlx-core/src/odbc/connection/odbc_bridge.rs

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
use crate::error::Error;
1+
THIS SHOULD BE A LINTER ERRORuse crate::error::Error;
22
use crate::odbc::{
33
connection::MaybePrepared, OdbcArgumentValue, OdbcArguments, OdbcColumn, OdbcQueryResult,
44
OdbcRow, OdbcTypeInfo,
55
};
6+
use crate::odbc::connection::decode_column_name;
67
use either::Either;
78
use flume::{SendError, Sender};
89
use odbc_api::handles::{AsStatementRef, Statement};
@@ -139,25 +140,7 @@ where
139140
}
140141
}
141142

142-
trait ColumnNameDecode {
143-
fn decode_or_default(self, index: u16) -> String;
144-
}
145-
146-
impl ColumnNameDecode for Vec<u8> {
147-
fn decode_or_default(self, index: u16) -> String {
148-
String::from_utf8(self).unwrap_or_else(|_| format!("col{}", index - 1))
149-
}
150-
}
151-
152-
impl ColumnNameDecode for Vec<u16> {
153-
fn decode_or_default(self, index: u16) -> String {
154-
String::from_utf16(&self).unwrap_or_else(|_| format!("col{}", index - 1))
155-
}
156-
}
157-
158-
fn decode_column_name<T: ColumnNameDecode>(name: T, index: u16) -> String {
159-
name.decode_or_default(index)
160-
}
143+
// decode_column_name is provided by connection/mod.rs
161144

162145
fn stream_rows<C>(cursor: &mut C, columns: &[OdbcColumn], tx: &ExecuteSender) -> Result<bool, Error>
163146
where

0 commit comments

Comments
 (0)