当前位置: 首页>>代码示例>>Java>>正文


Java SqlUpdate.setParameter方法代码示例

本文整理汇总了Java中com.avaje.ebean.SqlUpdate.setParameter方法的典型用法代码示例。如果您正苦于以下问题:Java SqlUpdate.setParameter方法的具体用法?Java SqlUpdate.setParameter怎么用?Java SqlUpdate.setParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.avaje.ebean.SqlUpdate的用法示例。


在下文中一共展示了SqlUpdate.setParameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: saveAccess

import com.avaje.ebean.SqlUpdate; //导入方法依赖的package包/类
public Result saveAccess() {
    Map<String, String[]> form_data = request().body().asFormUrlEncoded();
    Organization org = OrgConfig.get().org;

    if (form_data.containsKey("allowed_ip")) {
        String sql = "DELETE from allowed_ips where organization_id=:org_id";
        SqlUpdate update = Ebean.createSqlUpdate(sql);
        update.setParameter("org_id", org.id);
        update.execute();

        sql = "INSERT into allowed_ips (ip, organization_id) VALUES(:ip, :org_id)";
        update = Ebean.createSqlUpdate(sql);
        update.setParameter("org_id", org.id);
        update.setParameter("ip", form_data.get("allowed_ip")[0]);
        update.execute();
    }

    return redirect(routes.Settings.viewAccess());
}
 
开发者ID:schmave,项目名称:demschooltools,代码行数:20,代码来源:Settings.java

示例2: savePluginLog

import com.avaje.ebean.SqlUpdate; //导入方法依赖的package包/类
/**
 * Creates a plugin log on a specific event associated with the plugin
 * 
 * @param transactionId
 *            the unique Id for the transaction
 * @param pluginConfigurationId
 *            the unique identifier for the plugin configuration
 * @param isError
 *            true if the log is an error
 * @param event
 *            the type of event
 * @param logMessage
 *            the error message
 * @param dataType
 *            an internal BizDock data type
 * @param internalId
 *            the Id of internal BizDock object to which the transaction is
 *            associated
 * @param externalId
 *            the Id of the external (third party system) plugin to which
 *            the transaction is associated
 */
private static void savePluginLog(String transactionId, Long pluginConfigurationId, boolean isError, String event, String logMessage, DataType dataType,
        Long internalId, String externalId) {
    try {
        String sql = "insert into plugin_log (transaction_id, plugin_configuration_id, "
                + "event, is_error, log_message, last_update, data_type, internal_id, external_id)"
                + " values(:transaction_id,:pluginConfigurationId,:event,:is_error,"
                + ":log_message, :last_update, :data_type, :internal_id, :external_id)";
        SqlUpdate update = Ebean.createSqlUpdate(sql);
        update.setParameter("transaction_id", transactionId);
        update.setParameter("pluginConfigurationId", pluginConfigurationId);
        update.setParameter("event", event);
        update.setParameter("is_error", isError);
        update.setParameter("log_message", logMessage != null ? logMessage.replace("\n", "<br/>") : null);
        update.setParameter("last_update", new Date());
        update.setParameter("data_type", dataType != null ? dataType.getDataTypeClassName() : null);
        update.setParameter("internal_id", internalId);
        update.setParameter("external_id", externalId);
        update.execute();
    } catch (Exception e) {
        log.warn("Unexpected exception", e);
    }
}
 
开发者ID:theAgileFactory,项目名称:app-framework,代码行数:45,代码来源:PluginLog.java

示例3: delete

import com.avaje.ebean.SqlUpdate; //导入方法依赖的package包/类
@Override
public void delete(String key, String languageCode) {
    if (!isLanguageValid(languageCode)) {
        throw new IllegalArgumentException("Invalid language code " + languageCode);
    }
    try {

        SqlUpdate updateKeyQuery = Ebean.createSqlUpdate("DELETE FROM `i18n_messages` WHERE `key`=:key and`language`=:language");
        updateKeyQuery.setParameter("key", key);
        updateKeyQuery.setParameter("language", languageCode);
        updateKeyQuery.execute();

        synchronized (i18nMessagesStore) {
            Hashtable<Object, Object> i18Messages = getI18nMessagesStore().get(languageCode);
            if (i18Messages == null) {
                i18Messages = new Hashtable<Object, Object>();
            }
            i18Messages.remove(key);
            i18nMessagesStore.put(languageCode, i18Messages);
        }

    } catch (Exception e) {
        throw new IllegalArgumentException("Error while deleting the i18n key : " + key, e);
    }

}
 
开发者ID:theAgileFactory,项目名称:app-framework,代码行数:27,代码来源:I18nMessagesPluginImpl.java

示例4: deleteOldExpiredTokens

import com.avaje.ebean.SqlUpdate; //导入方法依赖的package包/类
public static void deleteOldExpiredTokens() {
  String sql = "DELETE " +
      " FROM pos_token WHERE " +
     "accessExpires < :date";

  SqlUpdate batchDelete = Ebean.createSqlUpdate(sql);

  Date date = new DateTime().minusMonths(1).toDate();

  batchDelete.setParameter("date", date);
  int rows = batchDelete.execute();

  if (rows > 0) {
    LOGGER.info("deleted '{}' rows in pos_token", rows);
  }
}
 
开发者ID:metno,项目名称:poseidon-rest,代码行数:17,代码来源:Token.java

示例5: run

import com.avaje.ebean.SqlUpdate; //导入方法依赖的package包/类
@Override
public void run() {
    SqlUpdate deletePoints = Ebean.createSqlUpdate(
        "DELETE FROM point " +
        "WHERE series_id IN (" +
            "SELECT id " +
            "FROM series " +
            "WHERE indicator_id = :indicator_id " +
        ")");
    deletePoints.setParameter("indicator_id", indicator.getId());
    deletePoints.execute();

    SqlUpdate deleteSeries = Ebean.createSqlUpdate(
        "DELETE FROM series " +
        "WHERE indicator_id = :indicator_id");
    deleteSeries.setParameter("indicator_id", indicator.getId());
    deleteSeries.execute();
}
 
开发者ID:snogaraleal,项目名称:wbi,代码行数:19,代码来源:IndicatorUnloadTask.java

示例6: processFiles

import com.avaje.ebean.SqlUpdate; //导入方法依赖的package包/类
public static Boolean processFiles(String uniq) {
    String sql = getUpdateSqlByDbType();
    SqlUpdate updateProcess = Ebean.createSqlUpdate(sql);
    updateProcess.setParameter("uniq", uniq);
    updateProcess.setParameter("status", UploadStatus.UPLOADED.getType());
    updateProcess.setParameter("qty", GlobalParams.LIMIT_PROCCESS_FILES);

    return Ebean.execute(updateProcess) == 1;
}
 
开发者ID:webinerds,项目名称:s3-proxy-chunk-upload,代码行数:10,代码来源:S3File.java

示例7: createStatusSQL

import com.avaje.ebean.SqlUpdate; //导入方法依赖的package包/类
private static Boolean createStatusSQL(String sql, String id, int status, String jobId, String response) {
    SqlUpdate updateStatus = Ebean.createSqlUpdate(sql);
    updateStatus.setParameter("id", id);
    updateStatus.setParameter("status", status);
    if(!jobId.isEmpty()) {
        updateStatus.setParameter("job", jobId);
    }

    if(!response.isEmpty()) {
        updateStatus.setParameter("response", response);
    }

    return Ebean.execute(updateStatus) == 1;
}
 
开发者ID:webinerds,项目名称:s3-proxy-chunk-upload,代码行数:15,代码来源:S3File.java

示例8: removePersonAtMeeting

import com.avaje.ebean.SqlUpdate; //导入方法依赖的package包/类
@Secured.Auth(UserRole.ROLE_EDIT_7_DAY_JC)
public Result removePersonAtMeeting(Integer meeting_id, Integer person_id,
    Integer role) {
    SqlUpdate update = Ebean.createSqlUpdate(
        "DELETE from person_at_meeting where meeting_id = :meeting_id"+
        " and person_id = :person_id and role = :role");
    update.setParameter("meeting_id", meeting_id);
    update.setParameter("person_id", person_id);
    update.setParameter("role", role);

    Ebean.execute(update);

    return ok();
}
 
开发者ID:schmave,项目名称:demschooltools,代码行数:15,代码来源:ApplicationEditing.java

示例9: removePersonAtCase

import com.avaje.ebean.SqlUpdate; //导入方法依赖的package包/类
@Secured.Auth(UserRole.ROLE_EDIT_7_DAY_JC)
public Result removePersonAtCase(Integer case_id, Integer person_id, Integer role)
{
    SqlUpdate update = Ebean.createSqlUpdate(
        "DELETE from person_at_case where case_id = :case_id "+
        "and person_id = :person_id "+
        "and role = :role");
    update.setParameter("case_id", case_id);
    update.setParameter("person_id", person_id);
    update.setParameter("role", role);

    Ebean.execute(update);
    return ok();
}
 
开发者ID:schmave,项目名称:demschooltools,代码行数:15,代码来源:ApplicationEditing.java

示例10: storeAccountChest

import com.avaje.ebean.SqlUpdate; //导入方法依赖的package包/类
@Override
public boolean storeAccountChest(AccountChest chest) {
    SqlUpdate storeChest = db.createSqlUpdate(
            "insert into gringotts_accountchest (world,x,y,z,account) values (:world, :x, :y, :z, (select id from gringotts_account where owner=:owner and type=:type))");
    Sign mark = chest.sign;
    storeChest.setParameter("world", mark.getWorld().getName());
    storeChest.setParameter("x", mark.getX());
    storeChest.setParameter("y", mark.getY());
    storeChest.setParameter("z", mark.getZ());
    storeChest.setParameter("owner", chest.account.owner.getId());
    storeChest.setParameter("type", chest.account.owner.getType());

    return storeChest.execute() > 0;
}
 
开发者ID:sakunc,项目名称:Gringotts-,代码行数:15,代码来源:EBeanDAO.java

示例11: deleteAccountChest

import com.avaje.ebean.SqlUpdate; //导入方法依赖的package包/类
private boolean deleteAccountChest(String world, int x, int y, int z) {
    SqlUpdate deleteChest = db.createSqlUpdate(
            "delete from gringotts_accountchest where world = :world and x = :x and y = :y and z = :z");
    deleteChest.setParameter("world", world);
    deleteChest.setParameter("x", x);
    deleteChest.setParameter("y", y);
    deleteChest.setParameter("z", z);

    return deleteChest.execute() > 0;
}
 
开发者ID:sakunc,项目名称:Gringotts-,代码行数:11,代码来源:EBeanDAO.java

示例12: storeCents

import com.avaje.ebean.SqlUpdate; //导入方法依赖的package包/类
@Override
public boolean storeCents(GringottsAccount account, long amount) {
    SqlUpdate up = db.createSqlUpdate("UPDATE gringotts_account SET cents = :cents WHERE owner = :owner and type = :type");
    up.setParameter("cents", amount);
    up.setParameter("owner", account.owner.getId());
    up.setParameter("type", account.owner.getType());
    
    return up.execute() == 1;
}
 
开发者ID:sakunc,项目名称:Gringotts-,代码行数:10,代码来源:EBeanDAO.java

示例13: flushPluginLog

import com.avaje.ebean.SqlUpdate; //导入方法依赖的package包/类
/**
 * Flush all log messages for the specified pluginConfiguration
 * 
 * @return the number of logs deleted
 */
public static int flushPluginLog(Long pluginConfigurationId) {
    String sql = "delete from plugin_log where plugin_configuration_id=:plugin_configuration_id";
    SqlUpdate update = Ebean.createSqlUpdate(sql);
    update.setParameter("plugin_configuration_id", pluginConfigurationId);
    return Ebean.execute(update);
}
 
开发者ID:theAgileFactory,项目名称:app-framework,代码行数:12,代码来源:PluginLog.java

示例14: flushLinksForPlugin

import com.avaje.ebean.SqlUpdate; //导入方法依赖的package包/类
/**
 * Flush all associations for the specified pluginConfiguration
 * 
 * @return the number of links deleted
 */
public static int flushLinksForPlugin(Long pluginConfigurationId) {
    String sql = "delete plugin_identification_link where plugin_configuration_id=:plugin_configuration_id";
    SqlUpdate update = Ebean.createSqlUpdate(sql);
    update.setParameter("plugin_configuration_id", pluginConfigurationId);
    return Ebean.execute(update);
}
 
开发者ID:theAgileFactory,项目名称:app-framework,代码行数:12,代码来源:PluginIdentificationLink.java

示例15: updateIndicatorStatus

import com.avaje.ebean.SqlUpdate; //导入方法依赖的package包/类
/**
 * Update the {@link Indicator.Status} of the specified {@link Indicator}.
 *
 * @param indicator Indicator to update.
 * @param status New indicator status.
 */
private static void updateIndicatorStatus(
        Indicator indicator, Indicator.Status status) {

    SqlUpdate updateIndicator = Ebean.createSqlUpdate(
        "UPDATE indicator " +
        "SET status = :status " +
        "WHERE id = :id");

    updateIndicator.setParameter("status", status);
    updateIndicator.setParameter("id", indicator.getId());
    updateIndicator.execute();

    indicator.setStatus(status);
}
 
开发者ID:snogaraleal,项目名称:wbi,代码行数:21,代码来源:WBIManagementService.java


注:本文中的com.avaje.ebean.SqlUpdate.setParameter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。