Amélioration de l'ORM

This commit is contained in:
Marc Baloup 2014-12-26 00:24:32 +01:00
parent 526e724db5
commit 9ec2dfb95b
2 changed files with 29 additions and 4 deletions

View File

@ -1,4 +1,10 @@
package net.mc_pandacraft.java.plugin.pandacraftutils.data_model;
import java.sql.Date;
import java.util.UUID;
import org.bukkit.entity.Player;
/**
* Représente les données persistante correspondant à un joueur donné sur le serveur
*
@ -13,22 +19,39 @@ public class PandacraftUtils_Player extends Table {
// TODO Créer la table dans la base de donnée
// TODO Ajouter les champs
public UUID uuid; // NOT NULL
public String name; // NOT NULL
public boolean vanish = false; // NOT NULL
public Date mute = null;
public PandacraftUtils_Player(Player p) {
name = p.getName();
uuid = p.getUniqueId();
}
@Override
public String[] getValues() {
// TODO Auto-generated method stub
return null;
return new String[]{
uuid.toString(),
name,
(vanish)?"true":"false",
String.valueOf(mute)};
}
@Override
public String[] getFieldsName() {
// TODO Auto-generated method stub
return null;
return new String[]{
"uuid",
"name",
"vanish",
"mute"};
}
}

View File

@ -36,8 +36,10 @@ public class DBConnection {
}
}
public Connection getConnection()
public Connection getConnection() throws SQLException
{
if (!conn.isValid(1))
reconnectIfNecessary();
return conn;
}