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

The following examples show how to use org.jdbi.v3.sqlobject.customizer.Bind. These examples are extracted from open source projects. 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 Project: presto   Source File: VerifierDao.java    License: 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 Project: presto   Source File: H2ResourceGroupsDao.java    License: 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 Project: presto   Source File: ResourceGroupsDao.java    License: 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 Project: presto   Source File: ResourceGroupsDao.java    License: 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 Project: presto   Source File: H2ResourceGroupsDao.java    License: 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 6
Source Project: irontest   Source File: EndpointDAO.java    License: 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 7
Source Project: irontest   Source File: TeststepDAO.java    License: 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 8
Source Project: irontest   Source File: TestcaseDAO.java    License: 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 Project: irontest   Source File: PropertyExtractorDAO.java    License: Apache License 2.0 4 votes vote down vote up
@SqlUpdate("insert into property_extractor (teststep_id, property_name, type, other_properties) " +
        "select :newTeststepId, property_name, type, other_properties " +
        "from property_extractor where teststep_id = :oldTeststepId")
void duplicateByTeststep(@Bind("oldTeststepId") long oldTeststepId, @Bind("newTeststepId") long newTeststepId);
 
Example 10
Source Project: presto   Source File: SessionPropertiesDao.java    License: Apache License 2.0 4 votes vote down vote up
@VisibleForTesting
@SqlUpdate("INSERT INTO " + CLIENT_TAGS_TABLE + " (tag_spec_id, client_tag) VALUES (:spec_id, :client_tag)")
void insertClientTag(@Bind("spec_id") long specId, @Bind("client_tag") String clientTag);
 
Example 11
Source Project: irontest   Source File: TeststepDAO.java    License: Apache License 2.0 4 votes vote down vote up
@SqlUpdate("update teststep set request = :request, updated = CURRENT_TIMESTAMP where id = :teststepId")
void updateRequest(@Bind("teststepId") long teststepId, @Bind("request") byte[] request);
 
Example 12
Source Project: irontest   Source File: HTTPStubMappingDAO.java    License: Apache License 2.0 4 votes vote down vote up
@SqlUpdate("update httpstubmapping set number = :newNumber, updated = CURRENT_TIMESTAMP where id = :id")
void updateNumberById(@Bind("id") long id, @Bind("newNumber") short newNumber);
 
Example 13
Source Project: irontest   Source File: UserDefinedPropertyDAO.java    License: Apache License 2.0 4 votes vote down vote up
@SqlUpdate("update udp set name = :name where id = :id")
void updateNameForInsert(@Bind("id") long id, @Bind("name") String name);
 
Example 14
Source Project: presto   Source File: H2ResourceGroupsDao.java    License: Apache License 2.0 4 votes vote down vote up
@SqlUpdate("UPDATE resource_groups_global_properties SET name = :name")
void updateResourceGroupsGlobalProperties(@Bind("name") String name);
 
Example 15
Source Project: irontest   Source File: TestcaseDAO.java    License: Apache License 2.0 4 votes vote down vote up
@SqlQuery("select count(*) = 1 from testcase where name = :name and parent_folder_id = :parentFolderId")
boolean _nameExistsInFolder(@Bind("name") String name,
                            @Bind("parentFolderId") long parentFolderId);
 
Example 16
Source Project: presto   Source File: H2ResourceGroupsDao.java    License: Apache License 2.0 4 votes vote down vote up
@SqlUpdate("DELETE FROM resource_groups WHERE resource_group_id = :resource_group_id")
void deleteResourceGroup(@Bind("resource_group_id") long resourceGroupId);
 
Example 17
Source Project: irontest   Source File: TestcaseRunDAO.java    License: Apache License 2.0 4 votes vote down vote up
@SqlQuery("select * from testcase_run where id = :id")
TestcaseRun _findById(@Bind("id") long id);
 
Example 18
Source Project: irontest   Source File: AssertionDAO.java    License: Apache License 2.0 4 votes vote down vote up
@SqlQuery("select * from assertion where teststep_id = :teststepId")
List<Assertion> findByTeststepId(@Bind("teststepId") long teststepId);
 
Example 19
Source Project: irontest   Source File: ArticleDAO.java    License: Apache License 2.0 4 votes vote down vote up
@SqlQuery("select * from article where id = :id")
Article findById(@Bind("id") long id);
 
Example 20
Source Project: Guilds   Source File: GuildSQLiteProvider.java    License: MIT License 4 votes vote down vote up
@Override
@SqlQuery("SELECT EXISTS(SELECT 1 FROM <prefix>guild WHERE id = :id)")
boolean guildExists(@Define("prefix") @NotNull String prefix, @Bind("id") @NotNull String id) throws IOException;
 
Example 21
Source Project: Guilds   Source File: GuildSQLiteProvider.java    License: MIT License 4 votes vote down vote up
@Override
@SqlQuery("SELECT * FROM <prefix>guild WHERE id = :id")
@RegisterRowMapper(GuildRowMapper.class)
Guild getGuild(@Define("prefix") @NotNull String prefix, @Bind("id") @NotNull String id) throws IOException;
 
Example 22
Source Project: irontest   Source File: HTTPStubMappingDAO.java    License: Apache License 2.0 4 votes vote down vote up
@SqlQuery("select * from httpstubmapping where testcase_id = :testcaseId and number = :number")
HTTPStubMapping findByNumber(@Bind("testcaseId") long testcaseId, @Bind("number") short number);
 
Example 23
Source Project: irontest   Source File: HTTPStubMappingDAO.java    License: Apache License 2.0 4 votes vote down vote up
@SqlQuery("select * from httpstubmapping where id = :httpStubId")
HTTPStubMapping findById(@Bind("httpStubId") long httpStubId);
 
Example 24
Source Project: Guilds   Source File: GuildSQLiteProvider.java    License: MIT License 4 votes vote down vote up
@Override
@SqlUpdate("DELETE FROM <prefix>guild WHERE id = :id")
void deleteGuild(@Define("prefix") @NotNull String prefix, @Bind("id") @NotNull String id) throws IOException;
 
Example 25
Source Project: Guilds   Source File: GuildMySQLProvider.java    License: MIT License 4 votes vote down vote up
@Override
@SqlQuery("SELECT EXISTS(SELECT 1 FROM <prefix>guild WHERE id = :id)")
boolean guildExists(@Define("prefix") @NotNull String prefix, @Bind("id") @NotNull String id) throws IOException;
 
Example 26
Source Project: Guilds   Source File: GuildMySQLProvider.java    License: MIT License 4 votes vote down vote up
@Override
@SqlUpdate("INSERT INTO <prefix>guild(id, data) VALUES (:id, :data)")
void createGuild(@Define("prefix") @NotNull String prefix, @Bind("id") String id, @Bind("data") String data);
 
Example 27
Source Project: irontest   Source File: FolderDAO.java    License: Apache License 2.0 4 votes vote down vote up
@SqlUpdate("update folder set name = :name where id = :id")
void updateNameForInsert(@Bind("id") long id, @Bind("name") String name);
 
Example 28
Source Project: Guilds   Source File: GuildMySQLProvider.java    License: MIT License 4 votes vote down vote up
@Override
@SqlUpdate("DELETE FROM <prefix>guild WHERE id = :id")
void deleteGuild(@Define("prefix") @NotNull String prefix, @Bind("id") @NotNull String id) throws IOException;
 
Example 29
Source Project: Guilds   Source File: GuildMariaDBProvider.java    License: MIT License 4 votes vote down vote up
@Override
@SqlQuery("SELECT EXISTS(SELECT 1 FROM <prefix>guild WHERE id = :id)")
boolean guildExists(@Define("prefix") @NotNull String prefix, @Bind("id") @NotNull String id) throws IOException;
 
Example 30
Source Project: irontest   Source File: UserDefinedPropertyDAO.java    License: Apache License 2.0 4 votes vote down vote up
@SqlUpdate("delete from udp where id = :id")
void deleteById(@Bind("id") long id);