sqlite query without collect (#6217)

This commit is contained in:
Fernando Herrera 2022-08-02 21:29:02 +01:00 committed by GitHub
parent 233afebdf0
commit e7958bebac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -366,16 +366,21 @@ impl CustomValue for SQLiteDatabase {
}
fn to_base_value(&self, span: Span) -> Result<Value, ShellError> {
let db = open_sqlite_db(self.connection.as_path(span)?, span)?;
read_entire_sqlite_db(db, span).map_err(|e| {
ShellError::GenericError(
"Failed to read from SQLite database".into(),
e.to_string(),
Some(span),
None,
Vec::new(),
)
})
match self.statement {
None => {
let db = open_sqlite_db(self.connection.as_path(span)?, span)?;
read_entire_sqlite_db(db, span).map_err(|e| {
ShellError::GenericError(
"Failed to read from SQLite database".into(),
e.to_string(),
Some(span),
None,
Vec::new(),
)
})
}
Some(_) => self.collect(span),
}
}
fn as_any(&self) -> &dyn std::any::Any {