-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: remove async & kipdb * chore: codefmt * chore: codefmt * docs: add llvm
- Loading branch information
Showing
94 changed files
with
3,139 additions
and
2,914 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,20 @@ | ||
use fnck_sql::db::DataBaseBuilder; | ||
use fnck_sql::errors::DatabaseError; | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<(), DatabaseError> { | ||
let database = DataBaseBuilder::path("./transaction").build().await?; | ||
let mut tx_1 = database.new_transaction().await?; | ||
fn main() -> Result<(), DatabaseError> { | ||
let database = DataBaseBuilder::path("./transaction").build()?; | ||
let mut tx_1 = database.new_transaction()?; | ||
|
||
let _ = tx_1 | ||
.run("create table if not exists t1 (c1 int primary key, c2 int)") | ||
.await?; | ||
let _ = tx_1.run("insert into t1 values(0, 0), (1, 1)").await?; | ||
let _ = tx_1.run("create table if not exists t1 (c1 int primary key, c2 int)")?; | ||
let _ = tx_1.run("insert into t1 values(0, 0), (1, 1)")?; | ||
|
||
assert!(database.run("select * from t1").await.is_err()); | ||
assert!(database.run("select * from t1").is_err()); | ||
|
||
tx_1.commit().await?; | ||
tx_1.commit()?; | ||
|
||
assert!(database.run("select * from t1").await.is_ok()); | ||
assert!(database.run("select * from t1").is_ok()); | ||
|
||
let _ = database.run("drop table t1").await?; | ||
let _ = database.run("drop table t1")?; | ||
|
||
Ok(()) | ||
} |
Oops, something went wrong.