Databend Driver

Databend unified SQL client for RestAPI and FlightSQL

crates.io License

usage

exec

```rust use databenddriver::newconnection;

let dsn = "databend://root:@localhost:8000/default?sslmode=disable"; let conn = new_connection(dsn).unwrap();

let sqlcreate = "CREATE TABLE books ( title VARCHAR, author VARCHAR, date Date );"; conn.exec(sqlcreate).await.unwrap(); let sqlinsert = "INSERT INTO books VALUES ('The Little Prince', 'Antoine de Saint-Exupéry', '1943-04-06');"; conn.exec(sqlinsert).await.unwrap(); ```

query row

rust let row = conn.query_row("SELECT * FROM books;").await.unwrap(); let (title,author,date): (String,String,i32) = row.unwrap().try_into().unwrap(); println!("{} {} {}", title, author, date);

query iter

rust let mut rows = conn.query_iter("SELECT * FROM books;").await.unwrap(); while let Some(row) = rows.next().await { let (title,author,date): (String,String,chrono::NaiveDate) = row.unwrap().try_into().unwrap(); println!("{} {} {}", title, author, date); }