mirror of
https://github.com/plexusorg/Plex.git
synced 2024-06-17 18:31:46 +00:00
41 lines
1.3 KiB
Java
41 lines
1.3 KiB
Java
|
package dev.plex.cache.notes;
|
||
|
|
||
|
import dev.plex.Plex;
|
||
|
import dev.plex.player.PlexPlayer;
|
||
|
import java.sql.Connection;
|
||
|
import java.sql.PreparedStatement;
|
||
|
import java.sql.ResultSet;
|
||
|
import java.sql.SQLException;
|
||
|
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;
|
||
|
}
|
||
|
}
|