MampfMysql Api
This plugin is a library to use mysql-databases for bukkit plugins.
Features
- connect to a mysql server/database
- perform querys with and without return values
- if the connection is closed it will reconnect automatically
- mysql_real_escape_string function for better security
Javadoc:
Example
try { mysql = new MySQL(Bukkit.getLogger(), // logger "[ExamplePlugin] ", // prefix "localhost", // host 3306, // port "minecraft", // db "root", // user "" // pw); mysql.open(); if (mysql.isOpen()) // Check if the Connection was successful mysql.query("CREATE TABLE IF NOT EXISTS `regionen` ( `id` varchar(20) NOT NULL) ENGINE=MyISAM DEFAULT CHARSET=utf8;"); else Bukkit.getLogger().severe("[ExamplePlugin] Can't create connection"); } [...] public static String getOwner(String region) { try { ResultSet result = mysql.query("SELECT owner FROM region WHERE id = " + mysql.quote(region) + " LIMIT 1;"); if (result != null) { while (result.next()) { return result.getString("besitzer"); } } } catch (SQLException e) { Bukkit.getLogger().severe(e.getMessage()); } return null; }
Please report problems with this plugin!
-
View User Profile
-
Send Message
Posted Jun 17, 2013@FR34KYN01535
There isn't someone that forces you to use this plugin. With this plugin you can use mysql_real_escape_string like php ;)
-
View User Profile
-
Send Message
Posted Jun 17, 2013This is already part of Java / JDBC (http://dev.mysql.com/usingmysql/java/) I don't see any advantages in using ur plugin & the disadvantage of a needless dependency... This (https://github.com/KeepJ96/IP-Check/tree/master/src/main/java/net/risenphoenix/jnk/ipcheck/database) should give any developer an idea of how easy this is... (This class is also able to do queries against sqllite, without problems!)