mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-22 17:17:37 +00:00
i have no idea what im doing
This commit is contained in:
parent
2105f51b44
commit
f62e0a42d1
44
src/main/java/dev/plex/cache/notes/PlayerNotes.java
vendored
Normal file
44
src/main/java/dev/plex/cache/notes/PlayerNotes.java
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
package dev.plex.cache.notes;
|
||||
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.google.gson.Gson;
|
||||
import dev.plex.Plex;
|
||||
import dev.plex.cache.player.PlayerCache;
|
||||
import dev.plex.player.PlexPlayer;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class PlayerNotes
|
||||
{
|
||||
private final String SELECT = "SELECT * FROM `notes` WHERE uuid=?";
|
||||
//private final String UPDATE = "UPDATE `notes` SET name=?, written_by=?, note=? WHERE uuid=?";
|
||||
private final String INSERT = "INSERT INTO `notes` (`uuid`, `name`, `written_by`, `note`) VALUES (?, ?, ?, ?);";
|
||||
|
||||
public PlexPlayer getByUUID(UUID uuid)
|
||||
{
|
||||
try (Connection con = Plex.get().getSqlConnection().getCon())
|
||||
{
|
||||
PreparedStatement statement = con.prepareStatement(SELECT);
|
||||
statement.setString(1, uuid.toString());
|
||||
ResultSet set = statement.executeQuery();
|
||||
PlexPlayer plexPlayer = new PlexPlayer(uuid);
|
||||
while (set.next())
|
||||
{
|
||||
String name = set.getString("name");
|
||||
String writtenBy = set.getString("written_by");
|
||||
String note = set.getString("note");
|
||||
|
||||
}
|
||||
return plexPlayer;
|
||||
}
|
||||
catch (SQLException throwables)
|
||||
{
|
||||
throwables.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -76,6 +76,12 @@ public class SQLConnection extends PlexBase
|
||||
"`active` BOOLEAN, " +
|
||||
"`endDate` BIGINT" +
|
||||
");").execute();
|
||||
con.prepareStatement("CREATE TABLE IF NOT EXISTS `notes` (" +
|
||||
"`uuid` VARCHAR(46) NOT NULL, " +
|
||||
"`name` VARCHAR(18), " +
|
||||
"`written_by` VARCHAR(16), " +
|
||||
"`note` VARCHAR(2000), " +
|
||||
");").execute();
|
||||
}
|
||||
catch (SQLException throwables)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user