|
1 | | -use crate::error::Error; |
| 1 | +THIS SHOULD BE A LINTER ERRORuse crate::error::Error; |
2 | 2 | use crate::odbc::{ |
3 | 3 | connection::MaybePrepared, OdbcArgumentValue, OdbcArguments, OdbcColumn, OdbcQueryResult, |
4 | 4 | OdbcRow, OdbcTypeInfo, |
5 | 5 | }; |
| 6 | +use crate::odbc::connection::decode_column_name; |
6 | 7 | use either::Either; |
7 | 8 | use flume::{SendError, Sender}; |
8 | 9 | use odbc_api::handles::{AsStatementRef, Statement}; |
@@ -139,25 +140,7 @@ where |
139 | 140 | } |
140 | 141 | } |
141 | 142 |
|
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 |
161 | 144 |
|
162 | 145 | fn stream_rows<C>(cursor: &mut C, columns: &[OdbcColumn], tx: &ExecuteSender) -> Result<bool, Error> |
163 | 146 | where |
|
0 commit comments