mirror of
https://github.com/nushell/nushell.git
synced 2025-05-30 06:39:33 +02:00
Revert query
command to query db
(#6200)
This commit is contained in:
parent
a83bd4ab20
commit
1086fbe9b5
@ -13,17 +13,17 @@ pub struct QueryDb;
|
|||||||
|
|
||||||
impl Command for QueryDb {
|
impl Command for QueryDb {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"query"
|
"query db"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn signature(&self) -> Signature {
|
fn signature(&self) -> Signature {
|
||||||
Signature::build(self.name())
|
Signature::build(self.name())
|
||||||
.required(
|
.required(
|
||||||
"query",
|
"SQL",
|
||||||
SyntaxShape::String,
|
SyntaxShape::String,
|
||||||
"SQL to execute against the database",
|
"SQL to execute against the database",
|
||||||
)
|
)
|
||||||
.input_type(Type::Custom("database".into()))
|
.input_type(Type::Any)
|
||||||
.output_type(Type::Any)
|
.output_type(Type::Any)
|
||||||
.category(Category::Custom("database".into()))
|
.category(Category::Custom("database".into()))
|
||||||
}
|
}
|
||||||
@ -34,8 +34,8 @@ impl Command for QueryDb {
|
|||||||
|
|
||||||
fn examples(&self) -> Vec<Example> {
|
fn examples(&self) -> Vec<Example> {
|
||||||
vec![Example {
|
vec![Example {
|
||||||
description: "Execute a query statement using the database connection",
|
description: "Execute SQL against a SQLite database",
|
||||||
example: r#"open foo.db | into db | query "SELECT * FROM Bar""#,
|
example: r#"open foo.db | query db "SELECT * FROM Bar""#,
|
||||||
result: None,
|
result: None,
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,7 @@ fn can_query_single_table() {
|
|||||||
cwd: "tests/fixtures/formats", pipeline(
|
cwd: "tests/fixtures/formats", pipeline(
|
||||||
r#"
|
r#"
|
||||||
open sample.db
|
open sample.db
|
||||||
| into db
|
| query db "select * from strings"
|
||||||
| query "select * from strings"
|
|
||||||
| where x =~ ell
|
| where x =~ ell
|
||||||
| length
|
| length
|
||||||
"#
|
"#
|
||||||
@ -24,8 +23,7 @@ fn invalid_sql_fails() {
|
|||||||
cwd: "tests/fixtures/formats", pipeline(
|
cwd: "tests/fixtures/formats", pipeline(
|
||||||
r#"
|
r#"
|
||||||
open sample.db
|
open sample.db
|
||||||
| into db
|
| query db "select *asdfasdf"
|
||||||
| query "select *asdfasdf"
|
|
||||||
"#
|
"#
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -38,7 +36,7 @@ fn invalid_input_fails() {
|
|||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: "tests/fixtures/formats", pipeline(
|
cwd: "tests/fixtures/formats", pipeline(
|
||||||
r#"
|
r#"
|
||||||
"foo" | into db | query "select * from asdf"
|
"foo" | query db "select * from asdf"
|
||||||
"#
|
"#
|
||||||
));
|
));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user