diff options
author | ementalo <ementalo@e251c2fe-e539-e718-e476-b85c1f46cddb> | 2011-03-30 14:31:54 +0000 |
---|---|---|
committer | ementalo <ementalo@e251c2fe-e539-e718-e476-b85c1f46cddb> | 2011-03-30 14:31:54 +0000 |
commit | 2b66459bce5f7cc0424ca0018c364ba165157643 (patch) | |
tree | 4e3f391e65c8f9dbbfa17e2b891641c85aba3e2f /EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockMySQL.java | |
parent | 243ff48778cdee3fc0ee3b096ab9c441a50abc84 (diff) | |
download | Essentials-2b66459bce5f7cc0424ca0018c364ba165157643.tar Essentials-2b66459bce5f7cc0424ca0018c364ba165157643.tar.gz Essentials-2b66459bce5f7cc0424ca0018c364ba165157643.tar.lz Essentials-2b66459bce5f7cc0424ca0018c364ba165157643.tar.xz Essentials-2b66459bce5f7cc0424ca0018c364ba165157643.zip |
remove
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1037 e251c2fe-e539-e718-e476-b85c1f46cddb
Diffstat (limited to 'EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockMySQL.java')
-rw-r--r-- | EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockMySQL.java | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockMySQL.java b/EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockMySQL.java deleted file mode 100644 index 8824f4040..000000000 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockMySQL.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.earth2me.essentials.protect.data; - -import java.beans.PropertyVetoException; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; - -public class ProtectedBlockMySQL extends ProtectedBlockJDBC { - - public ProtectedBlockMySQL(String url, String username, String password) throws PropertyVetoException { - super("com.mysql.jdbc.Driver", url, username, password); - } - - private static final String QueryCreateTable = - "CREATE TABLE IF NOT EXISTS `EssentialsProtectedBlocks` (" - + "`worldName` varchar(150) NOT NULL," - + "`x` int(11) NOT NULL, `y` int(11) NOT NULL, `z` int(11) NOT NULL," - + "`playerName` varchar(150) NOT NULL," - + ") ENGINE=MyISAM DEFAULT CHARSET=utf8"; - - @Override - protected PreparedStatement getStatementCreateTable(Connection conn) throws SQLException { - return conn.prepareStatement(QueryCreateTable); - } - private static final String QueryDeleteAll = "DELETE FROM EssentialsProtectedBlocks;"; - - @Override - protected PreparedStatement getStatementDeleteAll(Connection conn) throws SQLException { - return conn.prepareStatement(QueryDeleteAll); - } - private static final String QueryInsert = - "INSERT INTO EssentialsProtectedBlocks (worldName, x, y, z, playerName) VALUES (?, ?, ?, ?, ?);"; - - @Override - protected PreparedStatement getStatementInsert(Connection conn, String world, int x, int y, int z, String playerName) throws SQLException { - PreparedStatement ps = conn.prepareStatement(QueryInsert); - ps.setString(1, world); - ps.setInt(2, x); - ps.setInt(3, y); - ps.setInt(4, z); - ps.setString(5, playerName); - return ps; - } - private static final String QueryCountByPlayer = - "SELECT COUNT(playerName), SUM(playerName = ?) FROM EssentialsProtectedBlocks " - + "WHERE worldName = ? AND x = ? AND y = ? AND z = ? GROUP BY x;"; - - @Override - protected PreparedStatement getStatementPlayerCountByLocation(Connection conn, String world, int x, int y, int z, String playerName) throws SQLException { - PreparedStatement ps = conn.prepareStatement(QueryCountByPlayer); - ps.setString(1, playerName); - ps.setString(2, world); - ps.setInt(3, x); - ps.setInt(4, y); - ps.setInt(5, z); - return ps; - } - private static final String QueryPlayersByLocation = - "SELECT playerName FROM EssentialsProtectedBlocks WHERE worldname = ? AND x = ? AND y = ? AND z = ?;"; - - @Override - protected PreparedStatement getStatementPlayersByLocation(Connection conn, String world, int x, int y, int z) throws SQLException { - PreparedStatement ps = conn.prepareStatement(QueryPlayersByLocation); - ps.setString(1, world); - ps.setInt(2, x); - ps.setInt(3, y); - ps.setInt(4, z); - return ps; - } - private static final String QueryDeleteByLocation = - "DELETE FROM EssentialsProtectedBlocks WHERE worldName = ? AND x = ? AND y = ? AND z = ?;"; - - @Override - protected PreparedStatement getStatementDeleteByLocation(Connection conn, String world, int x, int y, int z) throws SQLException { - PreparedStatement ps = conn.prepareStatement(QueryDeleteByLocation); - ps.setString(1, world); - ps.setInt(2, x); - ps.setInt(3, y); - ps.setInt(4, z); - return ps; - } - private static final String QueryAllBlocks = - "SELECT worldName, x, y, z, playerName FROM EssentialsProtectedBlocks;"; - - @Override - protected PreparedStatement getStatementAllBlocks(Connection conn) throws SQLException { - return conn.prepareStatement(QueryAllBlocks); - } -} |