Skip to content

Commit 2b0e6f5

Browse files
committed
Import mysql/sqlite from advancedcore
1 parent 5b4bd7b commit 2b0e6f5

26 files changed

+1759
-0
lines changed

SimpleAPI/pom.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@
144144
<id>jeff-media-gbr</id>
145145
<url>https://repo.jeff-media.com/public</url>
146146
</repository>
147+
<repository>
148+
<id>bungeecord-repo</id>
149+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
150+
</repository>
147151
</repositories>
148152
<dependencies>
149153
<dependency>
@@ -152,6 +156,12 @@
152156
<version>1.21.5-R0.1-SNAPSHOT</version>
153157
<scope>provided</scope>
154158
</dependency>
159+
<dependency>
160+
<groupId>net.md-5</groupId>
161+
<artifactId>bungeecord-api</artifactId>
162+
<version>1.21-R0.1-SNAPSHOT</version>
163+
<scope>provided</scope>
164+
</dependency>
155165
<dependency>
156166
<groupId>com.tcoded</groupId>
157167
<artifactId>FoliaLib</artifactId>
@@ -188,6 +198,12 @@
188198
<version>5.17.0</version>
189199
<scope>test</scope>
190200
</dependency>
201+
<dependency>
202+
<groupId>com.zaxxer</groupId>
203+
<artifactId>HikariCP</artifactId>
204+
<version>3.4.1</version>
205+
<scope>compile</scope>
206+
</dependency>
191207
</dependencies>
192208
<profiles>
193209
<profile>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package com.bencodez.simpleapi.sql;
2+
3+
import com.bencodez.simpleapi.sql.data.DataValue;
4+
5+
import lombok.Getter;
6+
import lombok.Setter;
7+
8+
public class Column {
9+
10+
@Getter
11+
@Setter
12+
private DataType dataType;
13+
@Getter
14+
@Setter
15+
private int limit = 0;
16+
@Getter
17+
@Setter
18+
private String name;
19+
@Getter
20+
@Setter
21+
private DataValue value;
22+
23+
public Column(String name, DataType dataType) {
24+
this.name = name;
25+
this.dataType = dataType;
26+
limit = 0;
27+
}
28+
29+
public Column(String name, DataType dataType, int limit) {
30+
this.name = name;
31+
this.dataType = dataType;
32+
this.limit = limit;
33+
}
34+
35+
public Column(String name, DataValue value) {
36+
this.name = name;
37+
limit = 0;
38+
this.value = value;
39+
dataType = value.getType();
40+
}
41+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.bencodez.simpleapi.sql;
2+
3+
public enum DataType {
4+
5+
BOOLEAN, INTEGER, STRING;
6+
7+
public String getNoValue() {
8+
switch (this) {
9+
case INTEGER:
10+
return "0";
11+
default:
12+
return "NULL";
13+
14+
}
15+
}
16+
17+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.bencodez.simpleapi.sql.data;
2+
3+
import com.bencodez.simpleapi.sql.DataType;
4+
5+
public interface DataValue {
6+
public boolean getBoolean();
7+
8+
public int getInt();
9+
10+
public String getString();
11+
12+
public DataType getType();
13+
14+
public String getTypeName();
15+
16+
public boolean isBoolean();
17+
18+
public boolean isInt();
19+
20+
public boolean isString();
21+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
package com.bencodez.simpleapi.sql.data;
2+
3+
import com.bencodez.simpleapi.sql.DataType;
4+
5+
public class DataValueBoolean implements DataValue {
6+
private boolean value;
7+
8+
public DataValueBoolean(boolean value) {
9+
super();
10+
this.value = value;
11+
}
12+
13+
@Override
14+
public boolean getBoolean() {
15+
return value;
16+
}
17+
18+
@Override
19+
public int getInt() {
20+
return 0;
21+
}
22+
23+
@Override
24+
public String getString() {
25+
return "" + getBoolean();
26+
}
27+
28+
@Override
29+
public DataType getType() {
30+
return DataType.BOOLEAN;
31+
}
32+
33+
@Override
34+
public String getTypeName() {
35+
return "Boolean";
36+
}
37+
38+
@Override
39+
public boolean isBoolean() {
40+
return true;
41+
}
42+
43+
@Override
44+
public boolean isInt() {
45+
return false;
46+
}
47+
48+
@Override
49+
public boolean isString() {
50+
return false;
51+
}
52+
53+
@Override
54+
public String toString() {
55+
return "" + value;
56+
}
57+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
package com.bencodez.simpleapi.sql.data;
2+
3+
import com.bencodez.simpleapi.sql.DataType;
4+
5+
public class DataValueInt implements DataValue {
6+
private int value;
7+
8+
public DataValueInt(int value) {
9+
super();
10+
this.value = value;
11+
}
12+
13+
@Override
14+
public boolean getBoolean() {
15+
return false;
16+
}
17+
18+
@Override
19+
public int getInt() {
20+
return value;
21+
}
22+
23+
@Override
24+
public String getString() {
25+
return null;
26+
}
27+
28+
@Override
29+
public DataType getType() {
30+
return DataType.INTEGER;
31+
}
32+
33+
@Override
34+
public String getTypeName() {
35+
return "Int";
36+
}
37+
38+
@Override
39+
public boolean isBoolean() {
40+
return false;
41+
}
42+
43+
@Override
44+
public boolean isInt() {
45+
return true;
46+
}
47+
48+
@Override
49+
public boolean isString() {
50+
return false;
51+
}
52+
53+
@Override
54+
public String toString() {
55+
return "" + value;
56+
}
57+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
package com.bencodez.simpleapi.sql.data;
2+
3+
import com.bencodez.simpleapi.sql.DataType;
4+
5+
public class DataValueString implements DataValue {
6+
private String value;
7+
8+
public DataValueString(String value) {
9+
super();
10+
this.value = value;
11+
}
12+
13+
@Override
14+
public boolean getBoolean() {
15+
return false;
16+
}
17+
18+
@Override
19+
public int getInt() {
20+
return 0;
21+
}
22+
23+
@Override
24+
public String getString() {
25+
if (value == null) {
26+
return "";
27+
}
28+
return value;
29+
}
30+
31+
@Override
32+
public DataType getType() {
33+
return DataType.STRING;
34+
}
35+
36+
@Override
37+
public String getTypeName() {
38+
return "String";
39+
}
40+
41+
@Override
42+
public boolean isBoolean() {
43+
return false;
44+
}
45+
46+
@Override
47+
public boolean isInt() {
48+
return false;
49+
}
50+
51+
@Override
52+
public boolean isString() {
53+
return true;
54+
}
55+
56+
@Override
57+
public String toString() {
58+
if (value == null) {
59+
return "";
60+
}
61+
return value;
62+
}
63+
}

0 commit comments

Comments
 (0)