Search in sources :

Example 11 with Sql2o

use of org.sql2o.Sql2o in project mapping-benchmark by arnaudroger.

the class Sql2OBenchmark method init.

@Setup
public void init() throws Exception {
    ConnectionParam connParam = new ConnectionParam();
    connParam.db = db;
    connParam.init();
    sql2o = new Sql2o(connParam.dataSource);
}
Also used : ConnectionParam(org.simpleflatmapper.db.ConnectionParam) Sql2o(org.sql2o.Sql2o)

Example 12 with Sql2o

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

the class SpringBootWebApplicationTest method cacheSql2o.

@Bean("Runelite Cache SQL2O")
Sql2o cacheSql2o() throws NamingException {
    Map<Class, Converter> converters = new HashMap<>();
    converters.put(Instant.class, new InstantConverter());
    return new Sql2o("jdbc:mysql://192.168.1.2/cache", "runelite", "runelite", new NoQuirks(converters));
}
Also used : HashMap(java.util.HashMap) InstantConverter(net.runelite.http.service.util.InstantConverter) Converter(org.sql2o.converters.Converter) InstantConverter(net.runelite.http.service.util.InstantConverter) NoQuirks(org.sql2o.quirks.NoQuirks) Sql2o(org.sql2o.Sql2o) Bean(org.springframework.context.annotation.Bean)

Example 13 with Sql2o

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

the class SpringBootWebApplicationTest method xpSql2o.

@Bean("Runelite XP Tracker SQL2O")
Sql2o xpSql2o() throws NamingException {
    Map<Class, Converter> converters = new HashMap<>();
    converters.put(Instant.class, new InstantConverter());
    return new Sql2o("jdbc:mysql://192.168.1.2/xptracker", "runelite", "runelite", new NoQuirks(converters));
}
Also used : HashMap(java.util.HashMap) InstantConverter(net.runelite.http.service.util.InstantConverter) Converter(org.sql2o.converters.Converter) InstantConverter(net.runelite.http.service.util.InstantConverter) NoQuirks(org.sql2o.quirks.NoQuirks) Sql2o(org.sql2o.Sql2o) Bean(org.springframework.context.annotation.Bean)

Example 14 with Sql2o

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

the class SpringBootWebApplicationTest method sql2o.

@Bean("Runelite SQL2O")
Sql2o sql2o() {
    Map<Class, Converter> converters = new HashMap<>();
    converters.put(Instant.class, new InstantConverter());
    return new Sql2o("jdbc:mysql://192.168.1.2/runelite", "runelite", "runelite", new NoQuirks(converters));
}
Also used : HashMap(java.util.HashMap) InstantConverter(net.runelite.http.service.util.InstantConverter) Converter(org.sql2o.converters.Converter) InstantConverter(net.runelite.http.service.util.InstantConverter) NoQuirks(org.sql2o.quirks.NoQuirks) Sql2o(org.sql2o.Sql2o) Bean(org.springframework.context.annotation.Bean)

Example 15 with Sql2o

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

the class SpringBootWebApplication method sql2o.

@Bean("Runelite SQL2O")
Sql2o sql2o() throws NamingException {
    DataSource dataSource = (DataSource) getContext().lookup("jdbc/runelite");
    Map<Class, Converter> converters = new HashMap<>();
    converters.put(Instant.class, new InstantConverter());
    return new Sql2o(dataSource, new NoQuirks(converters));
}
Also used : HashMap(java.util.HashMap) InstantConverter(net.runelite.http.service.util.InstantConverter) Converter(org.sql2o.converters.Converter) InstantConverter(net.runelite.http.service.util.InstantConverter) NoQuirks(org.sql2o.quirks.NoQuirks) Sql2o(org.sql2o.Sql2o) DataSource(javax.sql.DataSource) Bean(org.springframework.context.annotation.Bean)

Aggregations

Sql2o (org.sql2o.Sql2o)16 HashMap (java.util.HashMap)9 NoQuirks (org.sql2o.quirks.NoQuirks)8 Bean (org.springframework.context.annotation.Bean)7 Converter (org.sql2o.converters.Converter)7 InstantConverter (net.runelite.http.service.util.InstantConverter)6 Test (org.junit.Test)5 DataSource (javax.sql.DataSource)4 ConnectionParam (org.simpleflatmapper.db.ConnectionParam)3 SfmResultSetHandlerFactoryBuilder (org.simpleflatmapper.sql2o.SfmResultSetHandlerFactoryBuilder)2 Connection (org.sql2o.Connection)2 Query (org.sql2o.Query)2 Connection (java.sql.Connection)1 UUID (java.util.UUID)1 JdbcDataSource (org.h2.jdbcx.JdbcDataSource)1 Before (org.junit.Before)1 MappedObject16 (org.simpleflatmapper.beans.MappedObject16)1 DbObject (org.simpleflatmapper.test.beans.DbObject)1 Qualifier (org.springframework.beans.factory.annotation.Qualifier)1 SingleConnectionDataSource (org.springframework.jdbc.datasource.SingleConnectionDataSource)1