/** * Create a sql update for executing native dml statements. * <p> * Use this to execute a Insert Update or Delete statement. The statement will * be native to the database and contain database table and column names. * </p> * <p> * See {@link SqlUpdate} for example usage. * </p> */ public static SqlUpdate createSqlUpdate(String sql) { return serverMgr.getDefaultServer().createSqlUpdate(sql); }
/** * Create a sql update for executing native dml statements. * <p> * Use this to execute a Insert Update or Delete statement. The statement will * be native to the database and contain database table and column names. * </p> * <p> * See {@link SqlUpdate} for example usage. * </p> * <p> * Where possible it would be expected practice to put the statement in a orm * xml file (named update) and use {@link #createNamedSqlUpdate(String)} . * </p> */ public static SqlUpdate createSqlUpdate(String sql) { return serverMgr.getPrimaryServer().createSqlUpdate(sql); }
/** * Create a sql update for executing native dml statements. * <p> * Use this to execute a Insert Update or Delete statement. The statement * will be native to the database and contain database table and column * names. * </p> * <p> * See {@link SqlUpdate} for example usage. * </p> * <p> * Where possible it would be expected practice to put the statement in a * orm xml file (named update) and use {@link #createNamedSqlUpdate(String)} * . * </p> */ public static SqlUpdate createSqlUpdate(String sql) { return serverMgr.getPrimaryServer().createSqlUpdate(sql); }
@Override public SqlUpdate createSqlUpdate(String sql) { methodCalls.add(MethodCall.of("createSqlUpdate").with("sql", sql)); return delegate.createSqlUpdate(sql); }
@Override public void drop() { String sql = "DELETE from " + tableName; SqlUpdate sqlUpdate = ebean_(false).createSqlUpdate(sql); ebean_(false).execute(sqlUpdate); }
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; }
@Override public synchronized 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; }
@Override public synchronized 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; }