org.jdbi.v3.sqlobject.customizer.Bind Java Examples

The following examples show how to use org.jdbi.v3.sqlobject.customizer.Bind. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VerifierDao.java    From presto with Apache License 2.0 6 votes vote down vote up
@SqlQuery("" +
        "SELECT\n" +
        "  suite\n" +
        ", name\n" +
        ", test_catalog\n" +
        ", test_schema\n" +
        ", test_prequeries\n" +
        ", test_query\n" +
        ", test_postqueries\n" +
        ", test_username\n" +
        ", test_password\n" +
        ", control_catalog\n" +
        ", control_schema\n" +
        ", control_prequeries\n" +
        ", control_query\n" +
        ", control_postqueries\n" +
        ", control_username\n" +
        ", control_password\n" +
        ", session_properties_json\n" +
        "FROM verifier_queries\n" +
        "WHERE suite = :suite\n" +
        "ORDER BY id\n" +
        "LIMIT :limit")
@UseRowMapper(QueryPairMapper.class)
List<QueryPair> getQueriesBySuite(@Bind("suite") String suite, @Bind("limit") int limit);
 
Example #2
Source File: H2ResourceGroupsDao.java    From presto with Apache License 2.0 6 votes vote down vote up
@SqlUpdate("UPDATE selectors SET\n" +
        " resource_group_id = :resource_group_id\n" +
        ", user_regex = :user_regex\n" +
        ", source_regex = :source_regex\n" +
        ", client_tags = :client_tags\n" +
        "WHERE resource_group_id = :resource_group_id\n" +
        " AND ((user_regex IS NULL AND :old_user_regex IS NULL) OR user_regex = :old_user_regex)\n" +
        " AND ((source_regex IS NULL AND :old_source_regex IS NULL) OR source_regex = :old_source_regex)\n" +
        " AND ((client_tags IS NULL AND :old_client_tags IS NULL) OR client_tags = :old_client_tags)")
void updateSelector(
        @Bind("resource_group_id") long resourceGroupId,
        @Bind("user_regex") String newUserRegex,
        @Bind("source_regex") String newSourceRegex,
        @Bind("client_tags") String newClientTags,
        @Bind("old_user_regex") String oldUserRegex,
        @Bind("old_source_regex") String oldSourceRegex,
        @Bind("old_client_tags") String oldClientTags);
 
Example #3
Source File: ResourceGroupsDao.java    From presto with Apache License 2.0 5 votes vote down vote up
@SqlQuery("SELECT resource_group_id, name, soft_memory_limit, max_queued, soft_concurrency_limit, " +
        "  hard_concurrency_limit, scheduling_policy, scheduling_weight, jmx_export, soft_cpu_limit, " +
        "  hard_cpu_limit, parent\n" +
        "FROM resource_groups\n" +
        "WHERE environment = :environment\n")
@UseRowMapper(ResourceGroupSpecBuilder.Mapper.class)
List<ResourceGroupSpecBuilder> getResourceGroups(@Bind("environment") String environment);
 
Example #4
Source File: ResourceGroupsDao.java    From presto with Apache License 2.0 5 votes vote down vote up
@SqlQuery("SELECT S.resource_group_id, S.priority, S.user_regex, S.source_regex, S.query_type, S.client_tags, S.selector_resource_estimate\n" +
        "FROM selectors S\n" +
        "JOIN resource_groups R ON (S.resource_group_id = R.resource_group_id)\n" +
        "WHERE R.environment = :environment\n" +
        "ORDER by priority DESC")
@UseRowMapper(SelectorRecord.Mapper.class)
List<SelectorRecord> getSelectors(@Bind("environment") String environment);
 
Example #5
Source File: TeststepDAO.java    From irontest with Apache License 2.0 5 votes vote down vote up
@SqlUpdate("update teststep set name = :t.name, description = :t.description, action = :t.action, request = :request, " +
        "request_type = :requestType, request_filename = :t.requestFilename, api_request = :apiRequest, " +
        "endpoint_id = :endpointId, endpoint_property = :t.endpointProperty, other_properties = :t.otherProperties, " +
        "updated = CURRENT_TIMESTAMP where id = :t.id")
void _updateWithStringRequest(@BindBean("t") Teststep teststep, @Bind("request") Object request,
                              @Bind("requestType") String requestType,
                              @Bind("apiRequest") String apiRequest,
                              @Bind("endpointId") Long endpointId);
 
Example #6
Source File: H2ResourceGroupsDao.java    From presto with Apache License 2.0 5 votes vote down vote up
@SqlUpdate("INSERT INTO selectors\n" +
        "(resource_group_id, priority, user_regex, source_regex, query_type, client_tags, selector_resource_estimate)\n" +
        "VALUES (:resource_group_id, :priority, :user_regex, :source_regex, :query_type, :client_tags, :selector_resource_estimate)")
void insertSelector(
        @Bind("resource_group_id") long resourceGroupId,
        @Bind("priority") long priority,
        @Bind("user_regex") String userRegex,
        @Bind("source_regex") String sourceRegex,
        @Bind("query_type") String queryType,
        @Bind("client_tags") String clientTags,
        @Bind("selector_resource_estimate") String selectorResourceEstimate);
 
Example #7
Source File: EndpointDAO.java    From irontest with Apache License 2.0 5 votes vote down vote up
@SqlUpdate("update endpoint set environment_id = :evId, name = :ep.name, type = :ep.type, " +
        "description = :ep.description, url = :ep.url, username = :ep.username, password = CASE " +
            "WHEN COALESCE(password, '') <> COALESCE(:ep.password, '') " + // encrypt only when password is changed
                "THEN ENCRYPT('AES', '" + ENDPOINT_PASSWORD_ENCRYPTION_KEY + "', STRINGTOUTF8(:ep.password)) " +
            "ELSE password END, " +
        "other_properties = :ep.otherProperties, updated = CURRENT_TIMESTAMP where id = :ep.id")
void _update(@BindBean("ep") Endpoint endpoint, @Bind("evId") Long environmentId);
 
Example #8
Source File: TestcaseDAO.java    From irontest with Apache License 2.0 5 votes vote down vote up
/**
 * @param testcaseId
 * @return folder path of the testcase
 */
@SqlQuery("WITH RECURSIVE T(parent_folder_id, path) AS (" +
              "SELECT parent_folder_id, name AS path " +
              "FROM folder WHERE id = (SELECT parent_folder_id FROM testcase WHERE id = :testcaseId) " +
              "UNION ALL " +
              "SELECT T2.parent_folder_id, (T2.name || '/' || T.path) AS path " +
              "FROM T INNER JOIN folder AS T2 ON T.parent_folder_id = T2.id " +
          ") SELECT path FROM T WHERE parent_folder_id IS NULL")
String getFolderPath(@Bind("testcaseId") long testcaseId);
 
Example #9
Source File: FolderDAO.java    From irontest with Apache License 2.0 4 votes vote down vote up
@SqlQuery("select * from folder where id = :id")
Folder _findById(@Bind("id") long id);
 
Example #10
Source File: ArenaSQLiteProvider.java    From Guilds with MIT License 4 votes vote down vote up
@Override
@SqlUpdate("UPDATE <prefix>arena SET data = :data WHERE id = :id")
void updateArena(@Define("prefix") @NotNull String prefix, @Bind("id") @NotNull String id, @Bind("data") @NotNull String data) throws IOException;
 
Example #11
Source File: EnvironmentDAO.java    From irontest with Apache License 2.0 4 votes vote down vote up
@SqlQuery("select * from environment where id = :id")
Environment _findById(@Bind("id") long id);
 
Example #12
Source File: ArticleDAO.java    From irontest with Apache License 2.0 4 votes vote down vote up
@SqlQuery("select * from article where created >= :startTime and created <= :endTime")
List<Article> findByCreationTimeRange(@Bind("startTime") Date startTime, @Bind("endTime") Date endTime);
 
Example #13
Source File: DataTableColumnDAO.java    From irontest with Apache License 2.0 4 votes vote down vote up
@SqlQuery("select * from datatable_column where testcase_id = :testcaseId order by sequence")
List<DataTableColumn> findByTestcaseId(@Bind("testcaseId") long testcaseId);
 
Example #14
Source File: DataTableCellDAO.java    From irontest with Apache License 2.0 4 votes vote down vote up
@SqlQuery("select * from datatable_cell where column_id = :columnId order by row_sequence")
List<DataTableCell> findByColumnId(@Bind("columnId") long columnId);
 
Example #15
Source File: DataTableCellDAO.java    From irontest with Apache License 2.0 4 votes vote down vote up
@SqlUpdate("insert into datatable_cell (column_id, row_sequence) " +
        "select :columnId, row_sequence from datatable_cell " +
        "where column_id = (select id from datatable_column where testcase_id = :testcaseId and sequence = 1)")
void insertCellsForNewColumn(@Bind("testcaseId") long testcaseId, @Bind("columnId") long columnId);
 
Example #16
Source File: DataTableColumnDAO.java    From irontest with Apache License 2.0 4 votes vote down vote up
@SqlUpdate("insert into datatable_column (name, type, sequence, testcase_id) values (:name, :type, " +
        "select coalesce(max(sequence), 0) + 1 from datatable_column where testcase_id = :testcaseId, :testcaseId)")
@GetGeneratedKeys
long insert(@Bind("testcaseId") long testcaseId, @Bind("name") String name, @Bind("type") String type);
 
Example #17
Source File: DataTableCellDAO.java    From irontest with Apache License 2.0 4 votes vote down vote up
@SqlUpdate("delete from datatable_cell where row_sequence = :rowSequence and column_id in (" +
        "select id from datatable_column where testcase_id = :testcaseId)")
void deleteRow(@Bind("testcaseId") long testcaseId, @Bind("rowSequence") short rowSequence);
 
Example #18
Source File: DataTableCellDAO.java    From irontest with Apache License 2.0 4 votes vote down vote up
@SqlUpdate("insert into datatable_cell (column_id, row_sequence, value, endpoint_id) values (:columnId, " +
        ":cell.rowSequence, :cell.value, :endpointId)")
void _insert(@Bind("columnId") long columnId, @BindBean("cell") DataTableCell cell, @Bind("endpointId") Long endpointId);
 
Example #19
Source File: ArenaSQLiteProvider.java    From Guilds with MIT License 4 votes vote down vote up
@Override
@SqlUpdate("INSERT INTO <prefix>arena(id, data) VALUES (:id, :data)")
void createArena(@Define("prefix") @NotNull String prefix, @Bind("id") String id, @Bind("data") String data);
 
Example #20
Source File: DataTableColumnDAO.java    From irontest with Apache License 2.0 4 votes vote down vote up
@SqlUpdate("update datatable_column set name = :name where id = :id")
void updateNameForInsert(@Bind("id") long id, @Bind("name") String name);
 
Example #21
Source File: CooldownMariaDBProvider.java    From Guilds with MIT License 4 votes vote down vote up
@Override
@SqlQuery("SELECT EXISTS(SELECT 1 FROM <prefix>cooldowns WHERE type = :type AND owner = :owner)")
boolean cooldownExists(@Define("prefix") @NotNull String tablePrefix, @NotNull @Bind("type") String cooldownType, @NotNull @Bind("owner") String cooldownOwner) throws IOException;
 
Example #22
Source File: TeststepDAO.java    From irontest with Apache License 2.0 4 votes vote down vote up
@SqlQuery("select id from teststep where testcase_id = :testcaseId and sequence = :sequence")
long findIdBySequence(@Bind("testcaseId") long testcaseId, @Bind("sequence") short sequence);
 
Example #23
Source File: ArenaMariaDBProvider.java    From Guilds with MIT License 4 votes vote down vote up
@Override
@SqlUpdate("UPDATE <prefix>arena SET data = :data WHERE id = :id")
void updateArena(@Define("prefix") @NotNull String prefix, @Bind("id") @NotNull String id, @Bind("data") @NotNull String data) throws IOException;
 
Example #24
Source File: ArenaMariaDBProvider.java    From Guilds with MIT License 4 votes vote down vote up
@Override
@SqlUpdate("INSERT INTO <prefix>arena(id, data) VALUES (:id, :data)")
void createArena(@Define("prefix") @NotNull String prefix, @Bind("id") String id, @Bind("data") String data);
 
Example #25
Source File: ArenaMariaDBProvider.java    From Guilds with MIT License 4 votes vote down vote up
@Override
@SqlQuery("SELECT * FROM <prefix>arena WHERE id = :id")
@RegisterRowMapper(ArenaRowMapper.class)
Arena getArena(@Define("prefix") @NotNull String prefix, @Bind("id") @NotNull String id) throws IOException;
 
Example #26
Source File: TestcaseDAO.java    From irontest with Apache License 2.0 4 votes vote down vote up
@SqlQuery("select * from testcase where id = :id")
Testcase _findById(@Bind("id") long id);
 
Example #27
Source File: EndpointDAO.java    From irontest with Apache License 2.0 4 votes vote down vote up
@SqlQuery("select id, environment_id, name, type, description from endpoint where environment_id = :environmentId")
List<Endpoint> findByEnvironmentId_EnvironmentEditView(@Bind("environmentId") long environmentId);
 
Example #28
Source File: EndpointDAO.java    From irontest with Apache License 2.0 4 votes vote down vote up
@SqlQuery(
        "select ep.*, ev.name as environment_name " +
        "from endpoint ep left outer join environment ev on ep.environment_id = ev.id " +
        "where ep.id = :id")
Endpoint findById(@Bind("id") long id);
 
Example #29
Source File: EnvironmentDAO.java    From irontest with Apache License 2.0 4 votes vote down vote up
@SqlUpdate("delete from environment where id = :id")
void deleteById(@Bind("id") long id);
 
Example #30
Source File: TeststepDAO.java    From irontest with Apache License 2.0 4 votes vote down vote up
@SqlUpdate("update teststep set name = :t.name, description = :t.description, request_type = :requestType, " +
        "request_filename = :t.requestFilename, action = :t.action, endpoint_id = :endpointId, " +
        "endpoint_property = :t.endpointProperty, other_properties = :t.otherProperties, updated = CURRENT_TIMESTAMP " +
        "where id = :t.id")
void _updateWithoutRequest(@BindBean("t") Teststep teststep, @Bind("requestType") String requestType,
                           @Bind("endpointId") Long endpointId);