Skip to content

Instantly share code, notes, and snippets.

@HelixOW
Created June 16, 2017 19:48
Show Gist options
  • Save HelixOW/3f3f9d90faf158a2cd96c84ef09d380d to your computer and use it in GitHub Desktop.
Save HelixOW/3f3f9d90faf158a2cd96c84ef09d380d to your computer and use it in GitHub Desktop.
public class ExamplePlugin extends JavaPlugin {
private static MySQLDatabase database;
public void onEnable() {
for (MySQLAPI api : MySQLAPI.getMysqlDBs()) {
api.initMySQLAPI();
database = new MySQLDatabase("Example", api.getDatabase());
}
database.create(database.createColumn("UUID", MySQLAPI.MySQLDataType.VARCHAR, 50),
database.createColumn("Some Column", MySQLAPI.MySQLDataType.TEXT, 5000000),
database.createColumn("etc"...));
database.insert(playerUUID, someValue, ...) //insert a new row into the database
database.update("UUID", playerUUID, "column", "new Value for column") //updates a column inside the row where playerUUID matches the given UUID
database.getResult("UUID", playerUUID.toString(), "Some Column") //returns object inside the column "Some Column"
}
public static MySQLDatabase getDatabase() {
return database;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment