Search in sources :

Example 31 with Connection

use of org.sql2o.Connection in project runelite by runelite.

the class ConfigService method get.

@RequestMapping
public Configuration get(HttpServletRequest request, HttpServletResponse response) throws IOException {
    SessionEntry session = auth.handle(request, response);
    if (session == null) {
        return null;
    }
    List<ConfigEntry> config;
    try (Connection con = sql2o.open()) {
        config = con.createQuery("select `key`, value from config where user = :user").addParameter("user", session.getUser()).executeAndFetch(ConfigEntry.class);
    }
    return new Configuration(config);
}
Also used : ConfigEntry(net.runelite.http.api.config.ConfigEntry) Configuration(net.runelite.http.api.config.Configuration) Connection(org.sql2o.Connection) SessionEntry(net.runelite.http.service.account.beans.SessionEntry) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

Connection (org.sql2o.Connection)31 Test (org.junit.Test)16 Query (org.sql2o.Query)7 UUID (java.util.UUID)5 Table (org.sql2o.data.Table)5 Instant (java.time.Instant)4 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 Sql2oException (org.sql2o.Sql2oException)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 SessionEntry (net.runelite.http.service.account.beans.SessionEntry)2 PlayerEntity (net.runelite.http.service.xp.beans.PlayerEntity)2 Sql2o (org.sql2o.Sql2o)2 Row (org.sql2o.data.Row)2 ServiceBuilder (com.github.scribejava.core.builder.ServiceBuilder)1 OAuth2AccessToken (com.github.scribejava.core.model.OAuth2AccessToken)1 OAuthRequest (com.github.scribejava.core.model.OAuthRequest)1 Response (com.github.scribejava.core.model.Response)1 OAuth20Service (com.github.scribejava.core.oauth.OAuth20Service)1 SQLException (java.sql.SQLException)1