Skip to content

Commit

Permalink
fix(session): PROMPT_SQL unwrap (#445)
Browse files Browse the repository at this point in the history
  • Loading branch information
sundy-li authored Jul 4, 2024
1 parent fbb976e commit 5794c05
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cli/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ impl Session {
let rows = conn.query_iter(PROMPT_SQL).await;
match rows {
Ok(mut rows) => {
while let Some(row) = rows.next().await {
let name: (String,) = row.unwrap().try_into().unwrap();
while let Some(Ok(row)) = rows.next().await {
let name: (String,) = row.try_into().unwrap();
keywords.push(name.0);
}
}
Expand Down
1 change: 1 addition & 0 deletions cli/tests/http/05-stream.result
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
27 changes: 27 additions & 0 deletions cli/tests/http/05-stream.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
## uncomment these when QUERY_DATABEND_ENTERPRISE_LICENSE env is set

# cat <<SQL | ${BENDSQL}
# CREATE DATABASE IF NOT EXISTS stream_test;

# CREATE OR REPLACE TABLE stream_test.abc
# (
# title VARCHAR,
# author VARCHAR,
# date VARCHAR
# );

# CREATE OR REPLACE STREAM stream_test.s on table stream_test.abc;
# SQL

# cat <<SQL | ${BENDSQL} -D stream_test
# DROP TABLE abc
# SQL

cat <<SQL | ${BENDSQL} -D stream_test
select 1;
SQL

cat <<SQL | ${BENDSQL}
DROP DATABASE IF EXISTS stream_test;
SQL

0 comments on commit 5794c05

Please sign in to comment.