@UseStringTemplate3StatementLocator() @RegisterContainerMapper(QueryKeys.QueryKeysContainerFactory.class) public interface QueryKeys
public static boolean isArrayByteBase64( byte[] arrayOctect ) { int length = arrayOctect.length; if ( length == 0 ) { return false; } for ( int i=0; i < length; i++ ) { if ( Base64.isBase64( arrayOctect[i] ) == false) { return false; } } return true; }
@Override public SqlStatementCustomizer createForMethod(final Annotation annotation, final Class sqlObjectType, final Method method) { return make((UseST4StatementLocator) annotation, sqlObjectType); }
/** * Create a statement locator intended for setting on a DBI or Handle instance which will * lookup a template group to use based on the name of the sql object type for a particular query, using * the same logic as {@link UseST4StatementLocator}. * <p> * Supports a fallback template group for statements created not using a sql object. */ public static StatementLocator perType(final UseSTGroupCache useCache, final URL baseTemplate) { return perType(useCache, urlToSTGroup(baseTemplate)); }
@UseST4StatementLocator public interface OuterDao { @SqlUpdate void createSomething2(); @SqlUpdate void insert2(@Define("table") String table, @Bind("id") int id, @Bind("name") String name); @SqlQuery @MapResultAsBean Something findById2(@Bind("id") int id); }
@UseStringTemplate3StatementLocator public abstract class PostgresHistoryJDBI extends AbstractHistoryJDBI {
public static boolean isArrayByteBase64( byte[] arrayOctect ) { int length = arrayOctect.length; if ( length == 0 ) { return false; } for ( int i=0; i < length; i++ ) { if ( Base64.isBase64( arrayOctect[i] ) == false) { return false; } } return true; }
@UseStringTemplate3StatementLocator public abstract class MySQLHistoryJDBI extends AbstractHistoryJDBI {
@UseStringTemplate3StatementLocator() public interface RolledUpUsageSqlDao { @SqlUpdate public void create(@BindBean RolledUpUsageModelDao rolledUpUsage, @InternalTenantContextBinder final InternalCallContext context); @SqlQuery public RolledUpUsageModelDao getUsageForSubscription(@Bind("subscriptionId") final UUID subscriptionId, @InternalTenantContextBinder final InternalTenantContext context); }
@UseStringTemplate3StatementLocator private interface SomethingByIterableHandleThrow { @SqlQuery("select id, name from something where id in (<ids>)") List<Something> get(@BindIn(value = "ids", onEmpty = THROW) Iterable<Integer> ids); }
@UseStringTemplate3StatementLocator(errorListener=MyTestCustomErrorHandler.class) public interface MyDAO { @SqlQuery("select * from foo where bar < 12 and id in (<ids>)") Object broken(); @SqlQuery("select * from foo where bar \\< 12 and id in (<ids>)") Object works(@BindIn("ids") List<Long> ids); @SqlQuery("select * from foo where id in (<ids>)") Object ids(@BindIn("ids") List<Integer> ids); }
@UseStringTemplate3StatementLocator private interface SomethingByVarargsHandleDefault { @SqlQuery("select id, name from something where id in (<ids>)") List<Something> get(@BindIn("ids") int... ids); }
@UseStringTemplate3StatementLocator private interface SomethingByArrayHandleVoid { @SqlQuery("select id, name from something where id in (<ids>)") List<Something> get(@BindIn(value = "ids", onEmpty = VOID) int[] ids); }
@UseStringTemplate3StatementLocator private interface SomethingByArrayHandleThrow { @SqlQuery("select id, name from something where id in (<ids>)") List<Something> get(@BindIn(value = "ids", onEmpty = THROW) int[] ids); }
@UseStringTemplate3StatementLocator private interface SomethingByIteratorHandleDefault { @SqlQuery("select id, name from something where id in (<ids>)") List<Something> get(@BindIn("ids") Iterator<Integer> ids); } }
@UseStringTemplate3StatementLocator private interface SomethingByIterableHandleNull { @SqlQuery("select id, name from something where name in (<names>)") List<Something> get(@BindIn(value = "names", onEmpty = NULL) Iterable<Object> ids); }
@UseStringTemplate3StatementLocator private interface SomethingByIterableHandleVoid { @SqlQuery("select id, name from something where id in (<ids>);") List<Something> get(@BindIn(value = "ids", onEmpty = VOID) Iterable<Object> ids); }
@UseStringTemplate3StatementLocator private interface SomethingByIterableHandleNull { @SqlQuery("select id, name from something where name in (<names>)") List<Something> get(@BindIn(value = "names", onEmpty = NULL) Iterable<Object> ids); } }
@UseStringTemplate3StatementLocator(value = "/org/skife/jdbi/v2/sqlobject/stringtemplate/Kombucha.sql.stg", cacheable = true) public interface Kombucha { @SqlQuery String getIngredients(); }
@UseStringTemplate3StatementLocator private interface SomethingByIterableHandleDefault { @SqlQuery("select id, name from something where id in (<ids>)") List<Something> get(@BindIn(value = "ids", onEmpty = VOID) Iterable<Integer> ids); }