From 33884979c7c4cfaf049e354ae528a9bf919bd11b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jind=C5=99ich=20Moravec?= Date: Sun, 28 Jan 2024 16:45:28 +0100 Subject: [PATCH 1/3] feat: add command complete for create table and index --- server/src/main.rs | 10 ++++++++-- server/src/proto_wrapper.rs | 4 ++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/server/src/main.rs b/server/src/main.rs index 8ce6785..ea69c48 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -210,8 +210,14 @@ async fn handle_query(writer: &mut W, state: &SharedDbState, query: String, t } false }, - Response::TableCreated => true, - Response::IndexCreated => true, + Response::TableCreated => { + writer.write_command_complete(CompleteStatus::CreateTable).await?; + true + }, + Response::IndexCreated => { + writer.write_command_complete(CompleteStatus::CreateIndex).await?; + true + }, } }; diff --git a/server/src/proto_wrapper.rs b/server/src/proto_wrapper.rs index 3415255..b7680d1 100644 --- a/server/src/proto_wrapper.rs +++ b/server/src/proto_wrapper.rs @@ -13,6 +13,8 @@ pub enum CompleteStatus { }, Delete(usize), Select(usize), + CreateTable, + CreateIndex, } impl CompleteStatus { @@ -21,6 +23,8 @@ impl CompleteStatus { CompleteStatus::Insert { oid, rows } => format!("INSERT {} {}", oid, rows), CompleteStatus::Delete(rows) => format!("DELETE {}", rows), CompleteStatus::Select(rows) => format!("SELECT {}", rows), + CompleteStatus::CreateTable => "CREATE TABLE".to_string(), + CompleteStatus::CreateIndex => "CREATE INDEX".to_string(), } } } From 9cef9caad233f706bec25890a226bc21aac63d71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jind=C5=99ich=20Moravec?= Date: Sun, 28 Jan 2024 18:30:06 +0100 Subject: [PATCH 2/3] ci: add pipeline for build and test --- .gitlab-ci.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..27f39e7 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,16 @@ +stages: + - primary + +build-and-test: + stage: primary + image: rust:1.74.0 + tags: + - shared-fi + rules: + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + - if: $CI_PIPELINE_SOURCE == "merge_request_event" + script: + # build and test in single job for faster execution + # because shared runner doesn't allow caching + - cargo build --verbose + - cargo test --verbose From 02defb3d5437660440c8749af9095c650741cb1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jind=C5=99ich=20Moravec?= Date: Sun, 28 Jan 2024 18:33:51 +0100 Subject: [PATCH 3/3] chore: min rust version for minisql crate --- minisql/Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/minisql/Cargo.toml b/minisql/Cargo.toml index d200f70..3bfcbfa 100644 --- a/minisql/Cargo.toml +++ b/minisql/Cargo.toml @@ -2,6 +2,7 @@ name = "minisql" version = "0.1.0" edition = "2021" +rust-version = "1.74" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html