Help setting mysql

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

Thread Status:
Not open for further replies.
  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. Online

    timtower Administrator Administrator 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. Online

    timtower Administrator Administrator Moderator

Thread Status:
Not open for further replies.

Share This Page