Update 29.10.2022
This commit is contained in:
1
Java/GameEngine/.idea/encodings.xml
generated
1
Java/GameEngine/.idea/encodings.xml
generated
@@ -2,5 +2,6 @@
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
||||
6
Java/GameEngine/.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
6
Java/GameEngine/.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="VulnerableLibrariesLocal" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
</profile>
|
||||
</component>
|
||||
10
Java/GameEngine/.idea/runConfigurations.xml
generated
10
Java/GameEngine/.idea/runConfigurations.xml
generated
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
2
Java/GameEngine/.idea/vcs.xml
generated
2
Java/GameEngine/.idea/vcs.xml
generated
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -57,7 +57,13 @@
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.25</version>
|
||||
<version>8.0.30</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.xerial</groupId>
|
||||
<artifactId>sqlite-jdbc</artifactId>
|
||||
<version>3.39.3.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -69,12 +75,12 @@
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.3</version>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
<version>1.9</version>
|
||||
<version>1.30</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -7,19 +7,17 @@ import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
|
||||
public class MySQL implements Serializable {
|
||||
|
||||
protected String server;
|
||||
protected int port;
|
||||
protected String database;
|
||||
public class MySQL extends SqLite {
|
||||
protected String username;
|
||||
protected String password;
|
||||
protected Connection con;
|
||||
|
||||
public MySQL(String connection) {
|
||||
super(connection);
|
||||
}
|
||||
|
||||
public MySQL(String server, int port, String database, String username, String password) {
|
||||
this.server = server;
|
||||
this.port = port;
|
||||
this.database = database;
|
||||
super(server + ":" + port + "/" + database);
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
}
|
||||
@@ -30,7 +28,7 @@ public class MySQL implements Serializable {
|
||||
if (isConnected()) return;
|
||||
try {
|
||||
Class.forName("com.mysql.cj.jdbc.Driver");
|
||||
con = DriverManager.getConnection("jdbc:mysql://" + server + ":" + port + "/" + database, username, password);
|
||||
con = DriverManager.getConnection("jdbc:mysql://" + file);
|
||||
}catch (Exception e) {
|
||||
GameEngine.throwError(e);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package de.craftix.engine.var;
|
||||
|
||||
import de.craftix.engine.GameEngine;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
|
||||
public class SqLite {
|
||||
|
||||
protected String file;
|
||||
protected Connection con;
|
||||
|
||||
public SqLite(String file) {
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
public void connect() {
|
||||
if (isConnected()) return;
|
||||
try {
|
||||
Class.forName("org.sqlite.JDBC");
|
||||
con = DriverManager.getConnection("jdbc:sqlite:" + file);
|
||||
}catch (Exception e) {
|
||||
GameEngine.throwError(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void disconnect() {
|
||||
if (!isConnected()) return;
|
||||
try {
|
||||
con.close();
|
||||
con = null;
|
||||
}catch (Exception e) { GameEngine.throwError(e); }
|
||||
}
|
||||
|
||||
public boolean isConnected() { return con != null; }
|
||||
|
||||
public void insert(String qry) {
|
||||
if (!isConnected()) throw new NullPointerException("SqLite not connected");
|
||||
try {
|
||||
con.prepareStatement(qry).executeUpdate();
|
||||
}catch (Exception e) { GameEngine.throwError(e); }
|
||||
}
|
||||
|
||||
public ResultSet getData(String qry) {
|
||||
if (!isConnected()) throw new NullPointerException("SqLite not connected");
|
||||
try {
|
||||
return con.prepareStatement(qry).executeQuery();
|
||||
}catch (Exception e) { GameEngine.throwError(e); }
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -8,6 +8,7 @@ de\craftix\engine\var\Scene.class
|
||||
de\craftix\engine\var\Sound.class
|
||||
de\craftix\engine\render\Resizer$6.class
|
||||
de\craftix\engine\var\Image.class
|
||||
de\craftix\engine\var\SqLite.class
|
||||
de\craftix\engine\var\Quaternion.class
|
||||
de\craftix\engine\render\Sprite.class
|
||||
de\craftix\engine\render\Resizer.class
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user