public boolean addCouponToDatabase(Coupon coupon) throws SQLException {
		if (couponExists(coupon)) return false;
		Connection con = sql.getConnection();
		PreparedStatement p = null;
		
		if (coupon instanceof ItemCoupon) {
			ItemCoupon c = (ItemCoupon) coupon;
			p = con.prepareStatement("INSERT INTO couponcodes (name, ctype, usetimes, usedplayers, ids, timeuse) "+
					"VALUES (?, ?, ?, ?, ?, ?)");
			p.setString(1, c.getName());
			p.setString(2, c.getType());
			p.setInt(3, c.getUseTimes());
			p.setString(4, plugin.convertHashToString2(c.getUsedPlayers()));
			p.setString(5, plugin.convertHashToString(c.getIDs()));
			p.setInt(6, c.getTime());
		}
		
		else if (coupon instanceof EconomyCoupon) {
			EconomyCoupon c = (EconomyCoupon) coupon;
			p = con.prepareStatement("INSERT INTO couponcodes (name, ctype, usetimes, usedplayers, money, timeuse) "+
					"VALUES (?, ?, ?, ?, ?, ?)");
			p.setString(1, c.getName());
			p.setString(2, c.getType());
			p.setInt(3, c.getUseTimes());
			p.setString(4, plugin.convertHashToString2(c.getUsedPlayers()));
			p.setInt(5, c.getMoney());
			p.setInt(6, c.getTime());
		}
		
		else if (coupon instanceof RankCoupon) {
			RankCoupon c = (RankCoupon) coupon;
			p = con.prepareStatement("INSERT INTO couponcodes (name, ctype, usetimes, usedplayers, groupname, timeuse) "+
					"VALUES (?, ?, ?, ?, ?, ?)");
			p.setString(1, c.getName());
			p.setString(2, c.getType());
			p.setInt(3, c.getUseTimes());
			p.setString(4, plugin.convertHashToString2(c.getUsedPlayers()));
			p.setString(5, c.getGroup());
			p.setInt(6, c.getTime());
		}
		
		else if (coupon instanceof XpCoupon) {
			XpCoupon c = (XpCoupon) coupon;
			p = con.prepareStatement("INSERT INTO couponcodes (name, ctype, usetimes, usedplayers, timeuse, xp) "+
					"VALUES (?, ?, ?, ?, ?, ?)");
			p.setString(1, c.getName());
			p.setString(2, c.getType());
			p.setInt(3, c.getUseTimes());
			p.setString(4, plugin.convertHashToString2(c.getUsedPlayers()));
			p.setInt(5, c.getTime());
			p.setInt(6, c.getXp());
		}
		
		p.addBatch();
		con.setAutoCommit(false);
		p.executeBatch();
		con.setAutoCommit(true);
		EventHandle.callCouponAddToDatabaseEvent(coupon);
		return true;
	}