Skip to content

Commit 8158c7c

Browse files
authored
Remove features extra_check and column_decltype (#548)
- `extra_check` was only used inside an ignored test. - `column_decltype` was never finished. `column_decltype()` panics, and users can get column names via `column_names()` and types via `column_type()`. - There's a comment in Cargo.toml suggesting both features may be removed. While this is technically a breaking change, nobody could have used those features for anything in practice.
2 parents 4c1d2ef + 24d5483 commit 8158c7c

File tree

4 files changed

+1
-56
lines changed

4 files changed

+1
-56
lines changed

crates/duckdb/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ extensions-full = ["json", "parquet", "vtab-full"]
3232
buildtime_bindgen = ["libduckdb-sys/buildtime_bindgen"]
3333
modern-full = ["chrono", "serde_json", "url", "r2d2", "uuid", "polars"]
3434
polars = ["dep:polars", "dep:polars-arrow"]
35-
# FIXME: These were added to make clippy happy: these features appear unused and should perhaps be removed
36-
column_decltype = []
37-
extra_check = []
3835
# Warning: experimental feature
3936
loadable-extension = ["libduckdb-sys/loadable-extension"]
4037

crates/duckdb/src/column.rs

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -140,52 +140,12 @@ impl Statement<'_> {
140140
pub fn column_type(&self, idx: usize) -> DataType {
141141
self.stmt.column_type(idx)
142142
}
143-
144-
/// Returns a slice describing the columns of the result of the query.
145-
///
146-
/// If associated DB schema can be altered concurrently, you should make
147-
/// sure that current statement has already been stepped once before
148-
/// calling this method.
149-
#[cfg(feature = "column_decltype")]
150-
pub fn columns(&self) -> Vec<Column<'_>> {
151-
let n = self.column_count();
152-
let mut cols = Vec::with_capacity(n);
153-
for i in 0..n {
154-
let name = self.column_name_unwrap(i);
155-
let slice = self.stmt.column_decltype(i);
156-
let decl_type =
157-
slice.map(|s| str::from_utf8(s.to_bytes()).expect("Invalid UTF-8 sequence in column declaration"));
158-
cols.push(Column { name, decl_type });
159-
}
160-
cols
161-
}
162143
}
163144

164145
#[cfg(test)]
165146
mod test {
166147
use crate::{Connection, Result};
167148

168-
#[test]
169-
#[cfg(feature = "column_decltype")]
170-
fn test_columns() -> Result<()> {
171-
use super::Column;
172-
173-
let db = Connection::open_in_memory()?;
174-
let query = db.prepare("SELECT * FROM sqlite_master")?;
175-
let columns = query.columns();
176-
let column_names: Vec<&str> = columns.iter().map(Column::name).collect();
177-
assert_eq!(
178-
column_names.as_slice(),
179-
&["type", "name", "tbl_name", "rootpage", "sql"]
180-
);
181-
let column_types: Vec<Option<&str>> = columns.iter().map(Column::decl_type).collect();
182-
assert_eq!(
183-
&column_types[..3],
184-
&[Some("VARCHAR"), Some("VARCHAR"), Some("VARCHAR"),]
185-
);
186-
Ok(())
187-
}
188-
189149
#[test]
190150
fn test_column_name_in_error() -> Result<()> {
191151
use crate::{types::Type, Error};

crates/duckdb/src/pragma.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -359,12 +359,6 @@ mod test {
359359
#[ignore]
360360
fn test_locking_mode() -> Result<()> {
361361
let db = Connection::open_in_memory()?;
362-
let r = db.pragma_update(None, "locking_mode", &"exclusive");
363-
if cfg!(feature = "extra_check") {
364-
r.unwrap_err();
365-
} else {
366-
r?;
367-
}
368-
Ok(())
362+
db.pragma_update(None, "locking_mode", &"exclusive")
369363
}
370364
}

crates/duckdb/src/raw_statement.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,12 +215,6 @@ impl RawStatement {
215215
self.schema.clone().unwrap()
216216
}
217217

218-
#[inline]
219-
#[allow(dead_code)]
220-
pub fn column_decltype(&self, _idx: usize) -> Option<&CStr> {
221-
panic!("not implemented")
222-
}
223-
224218
#[inline]
225219
pub fn column_name(&self, idx: usize) -> Option<&String> {
226220
if idx >= self.column_count() {

0 commit comments

Comments
 (0)