本文整理汇总了Java中com.avaje.ebean.SqlUpdate.execute方法的典型用法代码示例。如果您正苦于以下问题:Java SqlUpdate.execute方法的具体用法?Java SqlUpdate.execute怎么用?Java SqlUpdate.execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.avaje.ebean.SqlUpdate
的用法示例。
在下文中一共展示了SqlUpdate.execute方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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();
}
示例6: 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;
}
示例7: 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;
}
示例8: 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;
}
示例9: 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);
}
示例10: addI18nKey
import com.avaje.ebean.SqlUpdate; //导入方法依赖的package包/类
/**
* Add a i18k key.
*
* @param key
* the key
* @param value
* the value
* @param languageCode
* the language
*/
private void addI18nKey(String key, String value, String languageCode) {
SqlUpdate insertKeyQuery = Ebean.createSqlUpdate("insert into i18n_messages (`key`, language, value) values (:key, :language, :value)");
insertKeyQuery.setParameter("value", value);
insertKeyQuery.setParameter("key", key);
insertKeyQuery.setParameter("language", languageCode);
insertKeyQuery.execute();
}
示例11: createLink
import com.avaje.ebean.SqlUpdate; //导入方法依赖的package包/类
/**
* Create a new identification link
*
* @param pluginConfigurationId
* a plugin configuration id
* @param internalId
* the id of the internal BizDock object
* @param externalId
* the id of the external object to which the BizDock object is
* linked
* @param linkType
* a type of link
* @return 1 of the creation was successfull
*/
public static int createLink(Long pluginConfigurationId, Long internalId, String externalId, String linkType) {
String sql = "insert into plugin_identification_link (plugin_configuration_id, internal_id, external_id, link_type, last_update)"
+ " values (:pluginConfigurationId,:internalId,:externalId,:linkType, NOW())";
SqlUpdate update = Ebean.createSqlUpdate(sql);
update.setParameter("pluginConfigurationId", pluginConfigurationId);
update.setParameter("internalId", internalId);
update.setParameter("externalId", externalId);
update.setParameter("linkType", linkType);
return update.execute();
}