MYDB使用指南
进入项目路径
1 | E:\Projects_Java\Project_xfg\MYDB-master |
编译
1 | mvn compile |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 E:\Projects_Java\Project_xfg\MYDB-master>mvn compile
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------------< top.guoziyang:MyDB >-------------------------
[INFO] Building MyDB 1.0-SNAPSHOT
[INFO] from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ MyDB ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory E:\Projects_Java\Project_xfg\MYDB-master\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ MyDB ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 65 source files to E:\Projects_Java\Project_xfg\MYDB-master\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.436 s
[INFO] Finished at: 2024-09-08T12:46:45+08:00
[INFO] ------------------------------------------------------------------------
创建数据库
1 | 自己创建一个文件夹,比如: |
1 | mvn exec:java -Dexec.mainClass="top.guoziyang.mydb.backend.Launcher" -Dexec.args="-create E:\Projects_Java\Project_xfg\tmp\mydb" |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 E:\Projects_Java\Project_xfg\MYDB-master>mvn exec:java -Dexec.mainClass="top.guoziyang.mydb.backend.Launcher" -Dexec.args="-create E:\Projects_Java\Project_xfg\tmp\mydb"
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------------< top.guoziyang:MyDB >-------------------------
[INFO] Building MyDB 1.0-SNAPSHOT
[INFO] from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- exec-maven-plugin:3.4.1:java (default-cli) @ MyDB ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.342 s
[INFO] Finished at: 2024-09-08T12:49:07+08:00
[INFO] ------------------------------------------------------------------------
以默认参数启动数据库服务
1 | mvn exec:java -Dexec.mainClass="top.guoziyang.mydb.backend.Launcher" -Dexec.args="-open E:\Projects_Java\Project_xfg\tmp\mydb" |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 E:\Projects_Java\Project_xfg\MYDB-master>mvn exec:java -Dexec.mainClass="top.guoziyang.mydb.backend.Launcher" -Dexec.args="-open E:\Projects_Java\Project_xfg\tmp\mydb"
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------------< top.guoziyang:MyDB >-------------------------
[INFO] Building MyDB 1.0-SNAPSHOT
[INFO] from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- exec-maven-plugin:3.4.1:java (default-cli) @ MyDB ---
Server listen to port: 9999
Establish connection: 127.0.0.1:52192
Execute: create table test_table id int32, value int32 (index id)
Execute: insert into test_table values 10 33
Execute: select * from test_table
Execute: begin
Execute: insert into test_table values 20 34
Execute: commit
Execute: select * from test_table
Execute: begin
Execute: delete from test_table where id = 10
Execute: abort
Execute: select * from test_table
Execute: delete from test_table where id = 10
Execute: select * from test_table
新起一个终端,启动客户端连接数据库
1 | mvn exec:java -Dexec.mainClass="top.guoziyang.mydb.client.Launcher" |
1
2
3
4
5
6
7
8
9
10 E:\Projects_Java\Project_xfg\MYDB-master>mvn exec:java -Dexec.mainClass="top.guoziyang.mydb.client.Launcher"
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------------< top.guoziyang:MyDB >-------------------------
[INFO] Building MyDB 1.0-SNAPSHOT
[INFO] from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- exec-maven-plugin:3.4.1:java (default-cli) @ MyDB ---
:>
测试
1 | ## 建表 |
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 花火の红玉宫!
评论