Help setting mysql

Discussion in 'Plugin Development' started by GongasTheBoss, Jan 6, 2019.

  1. Offline

    GongasTheBoss

    Code:
    public class PermissionStorage
    {
      private static String TABLE = "permissions_table";
      public static void downloadGroups()
      {
        try
        {
          PreparedStatement sql = Main.getConnection().prepareStatement("SELECT * FROM " + TABLE);
          ResultSet result = sql.executeQuery();
          while (result.next())
          {
            List<String> permissions = result.getString("permissions") == null ? null : getListFromJson(result.getString("permissions"));
            List<String> inheritance = result.getString("inheritance") == null ? null : getListFromJson(result.getString("inheritance"));
            new PermissionGroup(result.getInt("id"), result.getString("name"), result.getString("prefix"), result.getString("suffix"), permissions, inheritance);
          }
          for (PermissionGroup g : PermissionGroup.getGroups()) {
            g.convert();
          }
          result.close();
          sql.close();
        }
        catch (SQLException e)
        {
          e.printStackTrace();
        }
      }
      private static List<String> getListFromJson(String json)
      {
        if ((json == null) || (json.length() < 1)) {
          return null;
        }
        Gson g = Main.getGson();
        return (List)g.fromJson(json, new TypeToken<List<String>>() {}.getType());
      }
    }
    


    Can someone help me fix this error? I think this has something to do with the mysql table not being created properly but I don't know how to fix this
     

    Attached Files:

    Last edited: Jan 6, 2019
  2. Offline

    timtower Ninja on the waves Moderator

    @GongasTheBoss Yeah, don't post on two forums at the same time please, certainly not when the image is hosted on the other one.
    Can't see it.
     
  3. Offline

    GongasTheBoss

    @timtower I think it's fixed now, thanks for the warning.
     
  4. Offline

    timtower Ninja on the waves Moderator

Share This Page