-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
58 changed files
with
548 additions
and
1,862 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
src/main/java/com/exortions/pluginutils/database/DatabaseManipulator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package com.exortions.pluginutils.database; | ||
|
||
import lombok.Data; | ||
|
||
import java.sql.Connection; | ||
import java.sql.DriverManager; | ||
import java.sql.ResultSet; | ||
import java.sql.SQLException; | ||
|
||
@Data | ||
public abstract class DatabaseManipulator { | ||
|
||
private String database; | ||
private String host; | ||
private String port; | ||
private boolean useSSL; | ||
|
||
private String username; | ||
private String password; | ||
|
||
private String url; | ||
|
||
private Connection connection; | ||
|
||
public DatabaseManipulator(String database, String host, String port, String username, String password, boolean useSSL) { | ||
this.database = database; | ||
this.host = host; | ||
this.port = port; | ||
this.username = username; | ||
this.password = password; | ||
this.useSSL = useSSL; | ||
|
||
this.url = "jdbc:mysql://" + host + ":" + port + "/" + database + "?useSSL=" + useSSL; | ||
} | ||
|
||
public DatabaseManipulator createConnection() throws SQLException { | ||
connection = DriverManager.getConnection(url, username, password); | ||
return this; | ||
} | ||
|
||
public ResultSet query(String sql) { | ||
try { | ||
return connection.createStatement().executeQuery(sql); | ||
} catch (SQLException e) { | ||
e.printStackTrace(); | ||
return null; | ||
} | ||
} | ||
|
||
public boolean execute(String sql) { | ||
try { | ||
return connection.createStatement().execute(sql); | ||
} catch (SQLException e) { | ||
e.printStackTrace(); | ||
return false; | ||
} | ||
} | ||
|
||
} |
13 changes: 0 additions & 13 deletions
13
src/main/java/com/exortions/pluginutils/database/v1/AlreadyConnectedException.java
This file was deleted.
Oops, something went wrong.
58 changes: 0 additions & 58 deletions
58
src/main/java/com/exortions/pluginutils/database/v1/MySQL.java
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
src/main/java/com/exortions/pluginutils/database/v1/NotConnectedException.java
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
src/main/java/com/exortions/pluginutils/database/v1/SQLDatabase.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.