Skip to content

Commit 79d4e34

Browse files
committed
DBFMS Initial Commit. Basic DB Structure and Commands
0 parents  commit 79d4e34

16 files changed

+844
-0
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
todo
2+
derby.log
3+
.settings
4+
.project
5+
.classpath
6+
target/

pom.xml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>net.bmagnu.dbfms</groupId>
6+
<artifactId>dbfms</artifactId>
7+
<version>0.0.1</version>
8+
9+
<name>DatabaseFileManagementSystem</name>
10+
11+
<properties>
12+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
13+
<maven.compiler.release>11</maven.compiler.release>
14+
<javafx.version>13</javafx.version>
15+
<mainClass>net.bmagnu.dbfms.Client</mainClass>
16+
<moduleName>dbfms</moduleName>
17+
</properties>
18+
19+
<build>
20+
<sourceDirectory>src</sourceDirectory>
21+
<resources>
22+
<resource>
23+
<directory>res</directory>
24+
<excludes>
25+
<exclude>**/*.java</exclude>
26+
</excludes>
27+
</resource>
28+
</resources>
29+
<pluginManagement>
30+
<plugins>
31+
<plugin>
32+
<artifactId>maven-compiler-plugin</artifactId>
33+
<version>3.8.1</version>
34+
<configuration>
35+
<release>${maven.compiler.release}</release>
36+
</configuration>
37+
</plugin>
38+
<plugin>
39+
<groupId>org.openjfx</groupId>
40+
<artifactId>javafx-maven-plugin</artifactId>
41+
<version>0.0.4</version>
42+
<configuration>
43+
<stripDebug>true</stripDebug>
44+
<compress>2</compress>
45+
<noHeaderFiles>true</noHeaderFiles>
46+
<noManPages>true</noManPages>
47+
<jlinkImageName>dbfms</jlinkImageName>
48+
<mainClass>pixit/net.bmagnu.dbfms.Client</mainClass>
49+
</configuration>
50+
</plugin>
51+
</plugins>
52+
</pluginManagement>
53+
</build>
54+
<dependencies>
55+
<dependency>
56+
<groupId>org.apache.derby</groupId>
57+
<artifactId>derby</artifactId>
58+
<version>10.15.2.0</version>
59+
</dependency>
60+
61+
<dependency>
62+
<groupId>org.openjfx</groupId>
63+
<artifactId>javafx-fxml</artifactId>
64+
<version>${javafx.version}</version>
65+
</dependency>
66+
67+
<dependency>
68+
<groupId>org.openjfx</groupId>
69+
<artifactId>javafx-media</artifactId>
70+
<version>${javafx.version}</version>
71+
</dependency>
72+
</dependencies>
73+
</project>

src/module-info.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* @author Birk
3+
*
4+
*/
5+
module dbfms {
6+
7+
exports net.bmagnu.dbfms;
8+
9+
requires javafx.controls;
10+
11+
requires javafx.fxml;
12+
13+
requires javafx.media;
14+
15+
requires transitive javafx.graphics;
16+
17+
requires javafx.base;
18+
requires java.sql;
19+
20+
opens net.bmagnu.dbfms.gui to javafx.fxml, javafx.graphics;
21+
}

src/net/bmagnu/dbfms/Main.java

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
package net.bmagnu.dbfms;
2+
3+
import net.bmagnu.dbfms.database.Collection;
4+
import net.bmagnu.dbfms.database.LocalDatabase;
5+
import net.bmagnu.dbfms.database.SQLQueryHelper;
6+
import net.bmagnu.dbfms.gui.DBFMS;
7+
8+
import static javafx.application.Application.launch;
9+
10+
import java.util.ArrayList;
11+
import java.util.HashMap;
12+
import java.util.List;
13+
import java.util.Map;
14+
import java.util.Map.Entry;
15+
16+
import javafx.util.Pair;
17+
18+
public class Main {
19+
public static void main(String[] args) {
20+
//launch(DBFMS.class, args);
21+
22+
/*List<Map<String, Object>> tables = LocalDatabase.executeSQL("SELECT * FROM sys.systables", "TABLENAME");
23+
for(Map<String, Object> table : tables) {
24+
for(Entry<String, Object> value : table.entrySet())
25+
System.out.println(value.getKey() + ": " + (String)value.getValue());
26+
}*/
27+
28+
//LocalDatabase.executeSQL("CREATE TABLE test(Test1 INT, Test2 VARCHAR(255))", true);
29+
Collection collection = new Collection("test", "a", "b", "c");
30+
31+
/*tables = LocalDatabase.executeSQL("SELECT * FROM sys.systables", "TABLENAME");
32+
for(Map<String, Object> table : tables) {
33+
for(Entry<String, Object> value : table.entrySet())
34+
System.out.println(value.getKey() + ": " + (String)value.getValue());
35+
}*/
36+
37+
collection.emplaceTag("1", "");
38+
collection.emplaceTag("2", "");
39+
collection.emplaceTag("3", "");
40+
41+
collection.emplaceTypeValue("a", "1");
42+
collection.emplaceTypeValue("a", "2");
43+
collection.emplaceTypeValue("b", "1");
44+
collection.emplaceTypeValue("b", "2");
45+
collection.emplaceTypeValue("c", "1");
46+
collection.emplaceTypeValue("c", "2");
47+
48+
Map<String, String> types1 = new HashMap<>();
49+
types1.put("a", "1");
50+
types1.put("b", "1");
51+
types1.put("c", "1");
52+
53+
Map<String, String> types2 = new HashMap<>();
54+
types2.put("a", "1");
55+
types2.put("b", "2");
56+
types2.put("c", "2");
57+
58+
collection.emplaceFile("a", "", 0, types1);
59+
collection.emplaceFile("b", "", 0, types1);
60+
collection.emplaceFile("c", "", 0, types2);
61+
62+
collection.connectTag("a", "1");
63+
collection.connectTag("a", "2");
64+
65+
collection.connectTag("b", "2");
66+
collection.connectTag("b", "3");
67+
68+
collection.connectTag("c", "3");
69+
collection.connectTag("c", "1");
70+
71+
collection.emplaceField("a", "f", "te");
72+
collection.emplaceField("b", "f", "ttes");
73+
collection.emplaceField("c", "f", "banane");
74+
collection.emplaceField("c", "g", "obst");
75+
76+
List<Pair<String, String>> types = new ArrayList<>();
77+
types.add(new Pair<>("a","2"));
78+
79+
String query = SQLQueryHelper.queryTypes(collection, types) ;
80+
81+
List<Map<String, Object>>tables = LocalDatabase.executeSQL(query, "fileID");
82+
83+
84+
85+
for(Map<String, Object> table : tables) {
86+
for(Entry<String, Object> value : table.entrySet())
87+
System.out.println(value.getKey() + ": " + (Integer)value.getValue());
88+
}
89+
90+
System.out.println();
91+
92+
Map<Integer, String> test = collection.queryFiles("+f:nane +g:o");
93+
for(Integer value : test.keySet())
94+
System.out.println(value);
95+
96+
System.out.println();
97+
98+
/*test = collection.queryFiles("1 ~2");
99+
for(Integer value : test.keySet())
100+
System.out.println(value);*/
101+
}
102+
}

0 commit comments

Comments
 (0)