From 01b3e6b832e06cabf8fa00c45442bef1153312af Mon Sep 17 00:00:00 2001 From: Kould <2435992353@qq.com> Date: Mon, 29 Jan 2024 03:09:52 +0800 Subject: [PATCH] Rename: KipSQL -> FnckSQL (#119) * docs: KipSQL -> FnckSQL * docs: KipSQL -> FnckSQL * code fmt --- Cargo.toml | 4 +- README.md | 54 +++++++------- benchmarks/query_benchmark.rs | 26 +++---- examples/hello_world.rs | 10 +-- examples/transaction.rs | 2 +- src/db.rs | 102 ++++++++++++++------------- src/execution/volcano/dml/analyze.rs | 2 +- src/main.rs | 24 ++++--- src/storage/kip.rs | 16 ++--- tests/sqllogictest/Cargo.toml | 2 +- tests/sqllogictest/src/lib.rs | 4 +- tests/sqllogictest/src/main.rs | 4 +- 12 files changed, 129 insertions(+), 121 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3215198f..b62692fa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,11 @@ # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [package] -name = "kip-sql" +name = "fnck_sql" version = "0.0.1-alpha.9" edition = "2021" authors = ["Kould ", "Xwg "] -description = "build the SQL layer of KipDB database" +description = "Fast Insert OLTP SQL DBMS" license = "Apache-2.0" repository = "https://github.com/KipData/KipSQL" readme = "README.md" diff --git a/README.md b/README.md index f14a3aed..d9d5c445 100755 --- a/README.md +++ b/README.md @@ -1,17 +1,19 @@
 Built by @KipData
 
-██╗  ██╗██╗██████╗ ███████╗ ██████╗ ██╗
-██║ ██╔╝██║██╔══██╗██╔════╝██╔═══██╗██║
-█████╔╝ ██║██████╔╝███████╗██║   ██║██║
-██╔═██╗ ██║██╔═══╝ ╚════██║██║▄▄ ██║██║
-     ██║  ██╗██║██║     ███████║╚██████╔╝███████╗
-     ╚═╝  ╚═╝╚═╝╚═╝     ╚══════╝ ╚══▀▀═╝ ╚══════╝
+
+███████╗███╗   ██╗ ██████╗██╗  ██╗    ███████╗ ██████╗ ██╗     
+██╔════╝████╗  ██║██╔════╝██║ ██╔╝    ██╔════╝██╔═══██╗██║     
+█████╗  ██╔██╗ ██║██║     █████╔╝     ███████╗██║   ██║██║     
+██╔══╝  ██║╚██╗██║██║     ██╔═██╗     ╚════██║██║▄▄ ██║██║     
+██║     ██║ ╚████║╚██████╗██║  ██╗    ███████║╚██████╔╝███████╗
+╚═╝     ╚═╝  ╚═══╝ ╚═════╝╚═╝  ╚═╝    ╚══════╝ ╚══▀▀═╝ ╚══════╝
+
 -----------------------------------
-Embedded SQL DBMS
+🖕
 

- The Lightweight Embedded OLTP Open-source Database + Lightweight DBMS

@@ -29,17 +31,16 @@ Embedded SQL DBMS

-### What is KipSQL +### What is FnckSQL -KipSQL is designed to allow small Rust projects to reduce external dependencies and get rid of heavy database maintenance, -so that the Rust application itself can provide SQL storage capabilities. +FnckSQL individual developers independently implemented LSM KV-based SQL DBMS out of hobby. This SQL database will prove to you that anyone can write a database (even the core author cannot find a job). If you are also a database-related Enthusiastic, let us give this "beautiful" industry a middle finger🖕. -Welcome to our WebSite, Power By KipSQL: **http://www.kipdata.site/** +Welcome to our WebSite, Power By FnckSQL: **http://www.kipdata.site/** ### Quick Started Clone the repository ``` shell -git clone https://github.com/KipData/KipSQL.git +git clone https://github.com/KipData/fncksql.git ``` Install rust toolchain first. @@ -50,7 +51,7 @@ Example ```sql create table blog (id int primary key, title varchar unique); -insert into blog (id, title) values (0, 'KipSQL'), (1, 'KipDB'), (2, 'KipBlog'); +insert into blog (id, title) values (0, 'FnckSQL'), (1, 'KipDB'); update blog set title = 'KipData' where id = 2; @@ -64,9 +65,9 @@ truncate table blog; drop table blog; ``` -Using KipSQL in code +Using FnckSQL in code ```rust -let kipsql = Database::with_kipdb("./data").await?; +let fnck_sql = Database::with_kipdb("./data").await?; let tupes = db.run("select * from t1").await?; ``` @@ -105,18 +106,14 @@ implement_from_tuple!( - Codegen on LuaJIT: `features = ["codegen_execute"]` - MVCC Transaction - Optimistic -- SQL field options - - not null - - null +- Field options + - [not] null - unique - primary key - SQL where options - - is null - - is not null - - like - - not like - - in - - not in + - is [not] null + - [not] like + - [not] in - Supports index type - Unique Index - Supports multiple primary key types @@ -128,7 +125,12 @@ implement_from_tuple!( - UInteger - Bigint - UBigint + - Float + - Double - Varchar + - Date + - DateTime + - Decimal - DDL - Create - [x] Table @@ -177,7 +179,7 @@ implement_from_tuple!( ## License -KipSQL uses the [Apache 2.0 license][1] to strike a balance between +FnckSQL uses the [Apache 2.0 license][1] to strike a balance between open contributions and allowing you to use the software however you want. [1]: diff --git a/benchmarks/query_benchmark.rs b/benchmarks/query_benchmark.rs index a15b181f..c899b7e3 100644 --- a/benchmarks/query_benchmark.rs +++ b/benchmarks/query_benchmark.rs @@ -1,10 +1,10 @@ use criterion::{criterion_group, criterion_main, Criterion}; +use fnck_sql::db::{Database, DatabaseError}; +use fnck_sql::execution::volcano; +use fnck_sql::storage::kip::KipStorage; +use fnck_sql::storage::Storage; use indicatif::{ProgressBar, ProgressStyle}; use itertools::Itertools; -use kip_sql::db::{Database, DatabaseError}; -use kip_sql::execution::volcano; -use kip_sql::storage::kip::KipStorage; -use kip_sql::storage::Storage; use sqlite::Error; use std::cell::RefCell; use std::fs; @@ -12,12 +12,14 @@ use std::path::Path; use std::sync::Arc; const QUERY_CASE: &'static str = "select * from t1 where c1 = 1000"; -const QUERY_BENCH_KIPSQL_PATH: &'static str = "./kipsql_bench"; +const QUERY_BENCH_FNCK_SQL_PATH: &'static str = "./fncksql_bench"; const QUERY_BENCH_SQLITE_PATH: &'static str = "./sqlite_bench"; const TABLE_ROW_NUM: u64 = 2_00_000; -async fn init_kipsql_query_bench() -> Result<(), DatabaseError> { - let database = Database::with_kipdb(QUERY_BENCH_KIPSQL_PATH).await.unwrap(); +async fn init_fncksql_query_bench() -> Result<(), DatabaseError> { + let database = Database::with_kipdb(QUERY_BENCH_FNCK_SQL_PATH) + .await + .unwrap(); database .run("create table t1 (c1 int primary key, c2 int)") .await?; @@ -84,16 +86,16 @@ fn query_on_execute(c: &mut Criterion) { init_sqlite_query_bench().unwrap(); } - if !path_exists_and_is_directory(QUERY_BENCH_KIPSQL_PATH) { + if !path_exists_and_is_directory(QUERY_BENCH_FNCK_SQL_PATH) { println!( - "KipSQL: The table is not initialized and data insertion is started. => {}", + "FnckSQL: The table is not initialized and data insertion is started. => {}", TABLE_ROW_NUM ); - init_kipsql_query_bench().await.unwrap(); + init_fncksql_query_bench().await.unwrap(); } - Database::::with_kipdb(QUERY_BENCH_KIPSQL_PATH) + Database::::with_kipdb(QUERY_BENCH_FNCK_SQL_PATH) .await .unwrap() }); @@ -140,7 +142,7 @@ fn query_on_execute(c: &mut Criterion) { }); } - c.bench_function(format!("KipSQL: {}", QUERY_CASE).as_str(), |b| { + c.bench_function(format!("FnckSQL: {}", QUERY_CASE).as_str(), |b| { b.to_async(&rt).iter(|| async { let _tuples = database.run(QUERY_CASE).await.unwrap(); }) diff --git a/examples/hello_world.rs b/examples/hello_world.rs index d78012bd..5f0d091c 100644 --- a/examples/hello_world.rs +++ b/examples/hello_world.rs @@ -1,9 +1,9 @@ +use fnck_sql::db::{Database, DatabaseError}; +use fnck_sql::implement_from_tuple; +use fnck_sql::types::tuple::Tuple; +use fnck_sql::types::value::DataValue; +use fnck_sql::types::LogicalType; use itertools::Itertools; -use kip_sql::db::{Database, DatabaseError}; -use kip_sql::implement_from_tuple; -use kip_sql::types::tuple::Tuple; -use kip_sql::types::value::DataValue; -use kip_sql::types::LogicalType; #[derive(Default, Debug, PartialEq)] struct MyStruct { diff --git a/examples/transaction.rs b/examples/transaction.rs index a3d90573..67888e6a 100644 --- a/examples/transaction.rs +++ b/examples/transaction.rs @@ -1,4 +1,4 @@ -use kip_sql::db::{Database, DatabaseError}; +use fnck_sql::db::{Database, DatabaseError}; #[tokio::main] async fn main() -> Result<(), DatabaseError> { diff --git a/src/db.rs b/src/db.rs index 2aeedb3e..7b5671e7 100644 --- a/src/db.rs +++ b/src/db.rs @@ -313,10 +313,10 @@ mod test { #[tokio::test] async fn test_transaction_sql() -> Result<(), DatabaseError> { let temp_dir = TempDir::new().expect("unable to create temporary working directory"); - let kipsql = Database::with_kipdb(temp_dir.path()).await?; + let fnck_sql = Database::with_kipdb(temp_dir.path()).await?; - let mut tx_1 = kipsql.new_transaction().await?; - let mut tx_2 = kipsql.new_transaction().await?; + let mut tx_1 = fnck_sql.new_transaction().await?; + let mut tx_2 = fnck_sql.new_transaction().await?; let _ = tx_1 .run("create table t1 (a int primary key, b int)") @@ -407,30 +407,30 @@ mod test { async fn _test_crud_sql(query_execute: QueryExecute) -> Result>, DatabaseError> { let mut results = Vec::new(); let temp_dir = TempDir::new().expect("unable to create temporary working directory"); - let kipsql = Database::with_kipdb(temp_dir.path()).await?; + let fnck_sql = Database::with_kipdb(temp_dir.path()).await?; - let _ = kipsql.run_on_query("create table t1 (a int primary key, b int unique null, k int, z varchar unique null)", query_execute).await?; - let _ = kipsql + let _ = fnck_sql.run_on_query("create table t1 (a int primary key, b int unique null, k int, z varchar unique null)", query_execute).await?; + let _ = fnck_sql .run_on_query( "create table t2 (c int primary key, d int unsigned null, e datetime)", query_execute, ) .await?; - let _ = kipsql.run_on_query("insert into t1 (a, b, k, z) values (-99, 1, 1, 'k'), (-1, 2, 2, 'i'), (5, 3, 2, 'p'), (29, 4, 2, 'db')", query_execute).await?; - let _ = kipsql.run_on_query("insert into t2 (d, c, e) values (2, 1, '2021-05-20 21:00:00'), (3, 4, '2023-09-10 00:00:00')", query_execute).await?; - let _ = kipsql + let _ = fnck_sql.run_on_query("insert into t1 (a, b, k, z) values (-99, 1, 1, 'k'), (-1, 2, 2, 'i'), (5, 3, 2, 'p'), (29, 4, 2, 'db')", query_execute).await?; + let _ = fnck_sql.run_on_query("insert into t2 (d, c, e) values (2, 1, '2021-05-20 21:00:00'), (3, 4, '2023-09-10 00:00:00')", query_execute).await?; + let _ = fnck_sql .run_on_query( "create table t3 (a int primary key, b decimal(4,2))", query_execute, ) .await?; - let _ = kipsql + let _ = fnck_sql .run_on_query( "insert into t3 (a, b) values (1, 1111), (2, 2.01), (3, 3.00)", query_execute, ) .await?; - let _ = kipsql + let _ = fnck_sql .run_on_query( "insert into t3 (a, b) values (4, 4444), (5, 5222), (6, 1.00)", query_execute, @@ -438,159 +438,159 @@ mod test { .await?; println!("show tables:"); - let tuples_show_tables = kipsql.run_on_query("show tables", query_execute).await?; + let tuples_show_tables = fnck_sql.run_on_query("show tables", query_execute).await?; println!("{}", create_table(&tuples_show_tables)); results.push(tuples_show_tables); println!("full t1:"); - let tuples_full_fields_t1 = kipsql + let tuples_full_fields_t1 = fnck_sql .run_on_query("select * from t1", query_execute) .await?; println!("{}", create_table(&tuples_full_fields_t1)); results.push(tuples_full_fields_t1); println!("full t2:"); - let tuples_full_fields_t2 = kipsql + let tuples_full_fields_t2 = fnck_sql .run_on_query("select * from t2", query_execute) .await?; println!("{}", create_table(&tuples_full_fields_t2)); results.push(tuples_full_fields_t2); println!("projection_and_filter:"); - let tuples_projection_and_filter = kipsql + let tuples_projection_and_filter = fnck_sql .run_on_query("select a from t1 where b > 1", query_execute) .await?; println!("{}", create_table(&tuples_projection_and_filter)); results.push(tuples_projection_and_filter); println!("projection_and_sort:"); - let tuples_projection_and_sort = kipsql + let tuples_projection_and_sort = fnck_sql .run_on_query("select * from t1 order by a, b", query_execute) .await?; println!("{}", create_table(&tuples_projection_and_sort)); results.push(tuples_projection_and_sort); println!("like t1 1:"); - let tuples_like_1_t1 = kipsql + let tuples_like_1_t1 = fnck_sql .run_on_query("select * from t1 where z like '%k'", query_execute) .await?; println!("{}", create_table(&tuples_like_1_t1)); results.push(tuples_like_1_t1); println!("like t1 2:"); - let tuples_like_2_t1 = kipsql + let tuples_like_2_t1 = fnck_sql .run_on_query("select * from t1 where z like '_b'", query_execute) .await?; println!("{}", create_table(&tuples_like_2_t1)); results.push(tuples_like_2_t1); println!("not like t1:"); - let tuples_not_like_t1 = kipsql + let tuples_not_like_t1 = fnck_sql .run_on_query("select * from t1 where z not like '_b'", query_execute) .await?; println!("{}", create_table(&tuples_not_like_t1)); results.push(tuples_not_like_t1); println!("in t1:"); - let tuples_in_t1 = kipsql + let tuples_in_t1 = fnck_sql .run_on_query("select * from t1 where a in (5, 29)", query_execute) .await?; println!("{}", create_table(&tuples_in_t1)); results.push(tuples_in_t1); println!("not in t1:"); - let tuples_not_in_t1 = kipsql + let tuples_not_in_t1 = fnck_sql .run_on_query("select * from t1 where a not in (5, 29)", query_execute) .await?; println!("{}", create_table(&tuples_not_in_t1)); results.push(tuples_not_in_t1); println!("limit:"); - let tuples_limit = kipsql + let tuples_limit = fnck_sql .run_on_query("select * from t1 limit 1 offset 1", query_execute) .await?; println!("{}", create_table(&tuples_limit)); results.push(tuples_limit); println!("inner join:"); - let tuples_inner_join = kipsql + let tuples_inner_join = fnck_sql .run_on_query("select * from t1 inner join t2 on a = c", query_execute) .await?; println!("{}", create_table(&tuples_inner_join)); results.push(tuples_inner_join); println!("left join:"); - let tuples_left_join = kipsql + let tuples_left_join = fnck_sql .run_on_query("select * from t1 left join t2 on a = c", query_execute) .await?; println!("{}", create_table(&tuples_left_join)); results.push(tuples_left_join); println!("right join:"); - let tuples_right_join = kipsql + let tuples_right_join = fnck_sql .run_on_query("select * from t1 right join t2 on a = c", query_execute) .await?; println!("{}", create_table(&tuples_right_join)); results.push(tuples_right_join); println!("full join:"); - let tuples_full_join = kipsql + let tuples_full_join = fnck_sql .run_on_query("select * from t1 full join t2 on a = c", query_execute) .await?; println!("{}", create_table(&tuples_full_join)); results.push(tuples_full_join); println!("count agg:"); - let tuples_count_agg = kipsql + let tuples_count_agg = fnck_sql .run_on_query("select count(d) from t2", query_execute) .await?; println!("{}", create_table(&tuples_count_agg)); results.push(tuples_count_agg); println!("count wildcard agg:"); - let tuples_count_wildcard_agg = kipsql + let tuples_count_wildcard_agg = fnck_sql .run_on_query("select count(*) from t2", query_execute) .await?; println!("{}", create_table(&tuples_count_wildcard_agg)); results.push(tuples_count_wildcard_agg); println!("count distinct agg:"); - let tuples_count_distinct_agg = kipsql + let tuples_count_distinct_agg = fnck_sql .run_on_query("select count(distinct d) from t2", query_execute) .await?; println!("{}", create_table(&tuples_count_distinct_agg)); results.push(tuples_count_distinct_agg); println!("sum agg:"); - let tuples_sum_agg = kipsql + let tuples_sum_agg = fnck_sql .run_on_query("select sum(d) from t2", query_execute) .await?; println!("{}", create_table(&tuples_sum_agg)); results.push(tuples_sum_agg); println!("sum distinct agg:"); - let tuples_sum_distinct_agg = kipsql + let tuples_sum_distinct_agg = fnck_sql .run_on_query("select sum(distinct d) from t2", query_execute) .await?; println!("{}", create_table(&tuples_sum_distinct_agg)); results.push(tuples_sum_distinct_agg); println!("avg agg:"); - let tuples_avg_agg = kipsql + let tuples_avg_agg = fnck_sql .run_on_query("select avg(d) from t2", query_execute) .await?; println!("{}", create_table(&tuples_avg_agg)); results.push(tuples_avg_agg); println!("min_max agg:"); - let tuples_min_max_agg = kipsql + let tuples_min_max_agg = fnck_sql .run_on_query("select min(d), max(d) from t2", query_execute) .await?; println!("{}", create_table(&tuples_min_max_agg)); results.push(tuples_min_max_agg); println!("group agg:"); - let tuples_group_agg = kipsql + let tuples_group_agg = fnck_sql .run_on_query( "select c, max(d) from t2 group by c having c = 1", query_execute, @@ -599,14 +599,14 @@ mod test { println!("{}", create_table(&tuples_group_agg)); println!("alias:"); - let tuples_group_agg = kipsql + let tuples_group_agg = fnck_sql .run_on_query("select c as o from t2", query_execute) .await?; println!("{}", create_table(&tuples_group_agg)); results.push(tuples_group_agg); println!("alias agg:"); - let tuples_group_agg = kipsql + let tuples_group_agg = fnck_sql .run_on_query( "select c, max(d) as max_d from t2 group by c having c = 1", query_execute, @@ -616,14 +616,14 @@ mod test { results.push(tuples_group_agg); println!("time max:"); - let tuples_time_max = kipsql + let tuples_time_max = fnck_sql .run_on_query("select max(e) as max_time from t2", query_execute) .await?; println!("{}", create_table(&tuples_time_max)); results.push(tuples_time_max); println!("time where:"); - let tuples_time_where_t2 = kipsql + let tuples_time_where_t2 = fnck_sql .run_on_query( "select (c + 1) from t2 where e > '2021-05-20'", query_execute, @@ -632,45 +632,45 @@ mod test { println!("{}", create_table(&tuples_time_where_t2)); results.push(tuples_time_where_t2); - assert!(kipsql + assert!(fnck_sql .run_on_query("select max(d) from t2 group by c", query_execute) .await .is_err()); println!("distinct t1:"); - let tuples_distinct_t1 = kipsql + let tuples_distinct_t1 = fnck_sql .run_on_query("select distinct b, k from t1", query_execute) .await?; println!("{}", create_table(&tuples_distinct_t1)); results.push(tuples_distinct_t1); println!("update t1 with filter:"); - let _ = kipsql + let _ = fnck_sql .run_on_query("update t1 set b = 0 where b = 1", query_execute) .await?; println!("after t1:"); - let update_after_full_t1 = kipsql + let update_after_full_t1 = fnck_sql .run_on_query("select * from t1", query_execute) .await?; println!("{}", create_table(&update_after_full_t1)); results.push(update_after_full_t1); println!("insert overwrite t1:"); - let _ = kipsql + let _ = fnck_sql .run_on_query( "insert overwrite t1 (a, b, k) values (-99, 1, 0)", query_execute, ) .await?; println!("after t1:"); - let insert_overwrite_after_full_t1 = kipsql + let insert_overwrite_after_full_t1 = fnck_sql .run_on_query("select * from t1", query_execute) .await?; println!("{}", create_table(&insert_overwrite_after_full_t1)); results.push(insert_overwrite_after_full_t1); - assert!(kipsql + assert!(fnck_sql .run_on_query( "insert overwrite t1 (a, b, k) values (-1, 1, 0)", query_execute @@ -679,24 +679,26 @@ mod test { .is_err()); println!("delete t1 with filter:"); - let _ = kipsql + let _ = fnck_sql .run_on_query("delete from t1 where b = 0", query_execute) .await?; println!("after t1:"); - let delete_after_full_t1 = kipsql + let delete_after_full_t1 = fnck_sql .run_on_query("select * from t1", query_execute) .await?; println!("{}", create_table(&delete_after_full_t1)); results.push(delete_after_full_t1); println!("trun_on_querycate t1:"); - let _ = kipsql.run_on_query("truncate t1", query_execute).await?; + let _ = fnck_sql.run_on_query("truncate t1", query_execute).await?; println!("drop t1:"); - let _ = kipsql.run_on_query("drop table t1", query_execute).await?; + let _ = fnck_sql + .run_on_query("drop table t1", query_execute) + .await?; println!("decimal:"); - let tuples_decimal = kipsql + let tuples_decimal = fnck_sql .run_on_query("select * from t3", query_execute) .await?; println!("{}", create_table(&tuples_decimal)); diff --git a/src/execution/volcano/dml/analyze.rs b/src/execution/volcano/dml/analyze.rs index 98d75148..b8904c42 100644 --- a/src/execution/volcano/dml/analyze.rs +++ b/src/execution/volcano/dml/analyze.rs @@ -17,7 +17,7 @@ use std::sync::Arc; use std::time::{SystemTime, UNIX_EPOCH}; const DEFAULT_NUM_OF_BUCKETS: usize = 100; -const DEFAULT_COLUMN_METAS_PATH: &'static str = "kipsql_column_metas"; +const DEFAULT_COLUMN_METAS_PATH: &'static str = "fnck_sql_column_metas"; pub struct Analyze { table_name: TableName, diff --git a/src/main.rs b/src/main.rs index ecfe085a..3d632f42 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,16 +1,18 @@ use clap::Parser; -use kip_sql::db::Database; -use kip_sql::types::tuple::create_table; +use fnck_sql::db::Database; +use fnck_sql::types::tuple::create_table; use std::error::Error; use std::{env, io}; pub(crate) const BANNER: &str = " -██╗ ██╗██╗██████╗ ███████╗ ██████╗ ██╗ -██║ ██╔╝██║██╔══██╗██╔════╝██╔═══██╗██║ -█████╔╝ ██║██████╔╝███████╗██║ ██║██║ -██╔═██╗ ██║██╔═══╝ ╚════██║██║▄▄ ██║██║ -██║ ██╗██║██║ ███████║╚██████╔╝███████╗ -╚═╝ ╚═╝╚═╝╚═╝ ╚══════╝ ╚══▀▀═╝ ╚══════╝"; +███████╗███╗ ██╗ ██████╗██╗ ██╗ ███████╗ ██████╗ ██╗ +██╔════╝████╗ ██║██╔════╝██║ ██╔╝ ██╔════╝██╔═══██╗██║ +█████╗ ██╔██╗ ██║██║ █████╔╝ ███████╗██║ ██║██║ +██╔══╝ ██║╚██╗██║██║ ██╔═██╗ ╚════██║██║▄▄ ██║██║ +██║ ██║ ╚████║╚██████╗██║ ██╗ ███████║╚██████╔╝███████╗ +╚═╝ ╚═╝ ╚═══╝ ╚═════╝╚═╝ ╚═╝ ╚══════╝ ╚══▀▀═╝ ╚══════╝ + +"; pub const BLOOM: &str = " _ ._ _ , _ ._ @@ -24,7 +26,6 @@ pub const BLOOM: &str = " _____________/_ __ \\_____________ "; -/// KipSQL is a embedded database #[derive(Parser, Debug)] #[command(author, version, about, long_about = None)] struct Args { @@ -37,13 +38,14 @@ struct Args { async fn main() -> Result<(), Box> { let args = Args::parse(); println!("{} \nVersion: {}\n", BANNER, env!("CARGO_PKG_VERSION")); - println!(":) Welcome to the KipSQL, Please input sql.\n"); + println!(":) Welcome to the FnckSQL🖕\n"); println!("Tips🔞: "); println!("1. input \"quit\" to shutdown"); println!( "2. all data is in the \'{}\' folder in the directory where the application is run", args.path ); + println!("If you want to customize the location of the data directory, please add parameters: \"-- --path './knck_sql/data'\""); server_run(args.path).await?; Ok(()) } @@ -52,7 +54,7 @@ async fn server_run(path: String) -> Result<(), Box> { let db = Database::with_kipdb(path).await?; loop { - println!("> 👇👇🏻👇🏼👇🏽👇🏾👇🏿 <"); + println!("> 🖕🖕🏻🖕🏼🖕🏼🖕🏾🖕🏿 <"); let mut input = String::new(); io::stdin().read_line(&mut input)?; diff --git a/src/storage/kip.rs b/src/storage/kip.rs index 197248b6..ade2cf5d 100644 --- a/src/storage/kip.rs +++ b/src/storage/kip.rs @@ -588,13 +588,13 @@ mod test { #[tokio::test] async fn test_index_iter_pk() -> Result<(), DatabaseError> { let temp_dir = TempDir::new().expect("unable to create temporary working directory"); - let kipsql = Database::with_kipdb(temp_dir.path()).await?; + let fnck_sql = Database::with_kipdb(temp_dir.path()).await?; - let _ = kipsql.run("create table t1 (a int primary key)").await?; - let _ = kipsql + let _ = fnck_sql.run("create table t1 (a int primary key)").await?; + let _ = fnck_sql .run("insert into t1 (a) values (0), (1), (2), (3), (4)") .await?; - let transaction = kipsql.storage.transaction().await?; + let transaction = fnck_sql.storage.transaction().await?; let table = transaction .table(Arc::new("t1".to_string())) @@ -648,14 +648,14 @@ mod test { #[tokio::test] async fn test_read_by_index() -> Result<(), DatabaseError> { let temp_dir = TempDir::new().expect("unable to create temporary working directory"); - let kipsql = Database::with_kipdb(temp_dir.path()).await?; - let _ = kipsql + let fnck_sql = Database::with_kipdb(temp_dir.path()).await?; + let _ = fnck_sql .run("create table t1 (a int primary key, b int unique)") .await?; - let _ = kipsql + let _ = fnck_sql .run("insert into t1 (a, b) values (0, 0), (1, 1), (2, 2)") .await?; - let transaction = kipsql.storage.transaction().await.unwrap(); + let transaction = fnck_sql.storage.transaction().await.unwrap(); let table = transaction .table(Arc::new("t1".to_string())) diff --git a/tests/sqllogictest/Cargo.toml b/tests/sqllogictest/Cargo.toml index 053e4435..b54def18 100644 --- a/tests/sqllogictest/Cargo.toml +++ b/tests/sqllogictest/Cargo.toml @@ -4,7 +4,7 @@ version = "0.4.0" edition = "2021" [dependencies] -"kip-sql" = { path = "../.." } +"fnck_sql" = { path = "../.." } glob = "0.3" async-trait = "0.1" tokio = "1.29.1" diff --git a/tests/sqllogictest/src/lib.rs b/tests/sqllogictest/src/lib.rs index aca86e83..9f13a515 100644 --- a/tests/sqllogictest/src/lib.rs +++ b/tests/sqllogictest/src/lib.rs @@ -1,5 +1,5 @@ -use kip_sql::db::{Database, DatabaseError}; -use kip_sql::storage::kip::KipStorage; +use fnck_sql::db::{Database, DatabaseError}; +use fnck_sql::storage::kip::KipStorage; use sqllogictest::{AsyncDB, DBOutput, DefaultColumnType}; use std::time::Instant; diff --git a/tests/sqllogictest/src/main.rs b/tests/sqllogictest/src/main.rs index b65bbd0d..be927f92 100644 --- a/tests/sqllogictest/src/main.rs +++ b/tests/sqllogictest/src/main.rs @@ -1,4 +1,4 @@ -use kip_sql::db::Database; +use fnck_sql::db::Database; use sqllogictest::Runner; use sqllogictest_test::KipSQL; use std::path::Path; @@ -11,7 +11,7 @@ async fn main() { let path = Path::new(env!("CARGO_MANIFEST_DIR")).join("..").join(".."); std::env::set_current_dir(path).unwrap(); - println!("KipSQL Test Start!\n"); + println!("FnckSQL Test Start!\n"); for slt_file in glob::glob(SLT_PATTERN).expect("failed to find slt files") { let temp_dir = TempDir::new().expect("unable to create temporary working directory");