/** * Create a <a href="SqlQuery.html">SqlQuery</a> for executing native sql * query statements. * <p> * Note that you can use raw SQL with entity beans, refer to the SqlSelect * annotation for examples. * </p> */ public static SqlQuery createSqlQuery(String sql) { return serverMgr.getPrimaryServer().createSqlQuery(sql); }
/** * Create a SqlQuery for executing native sql * query statements. * <p> * Note that you can use raw SQL with entity beans, refer to the SqlSelect * annotation for examples. * </p> */ public static SqlQuery createSqlQuery(String sql) { return serverMgr.getDefaultServer().createSqlQuery(sql); }
/** * Create a <a href="SqlQuery.html">SqlQuery</a> for executing native sql * query statements. * <p> * Note that you can use raw SQL with entity beans, refer to the SqlSelect * annotation for examples. * </p> */ public static SqlQuery createSqlQuery(String sql) { return serverMgr.getPrimaryServer().createSqlQuery(sql); }
public SqlQuery createSqlQuery(String sql) { return delegate.createSqlQuery(sql); }
"ORDER BY company_name"; return ebean.createSqlQuery(query) .setParameter("totalCostBoundary", totalCostBoundary) .findList()
@Override public synchronized List<AccountChest> getChests(GringottsAccount account) { // TODO ensure world interaction is done in sync task SqlQuery getChests = db.createSqlQuery("SELECT ac.world, ac.x, ac.y, ac.z " + "FROM gringotts_accountchest ac JOIN gringotts_account a ON ac.account = a.id " + "WHERE a.owner = :owner and a.type = :type"); getChests.setParameter("owner", account.owner.getId()); getChests.setParameter("type", account.owner.getType()); List<AccountChest> chests = new LinkedList<>(); for (SqlRow result : getChests.findSet()) { String worldName = result.getString("world"); int x = result.getInteger("x"); int y = result.getInteger("y"); int z = result.getInteger("z"); World world = Bukkit.getWorld(worldName); if (world == null) { continue; // skip chest if it is in non-existent world } Location loc = new Location(world, x, y, z); Block signBlock = loc.getBlock(); if (Util.isSignBlock(signBlock)) { Sign sign = (Sign) loc.getBlock().getState(); chests.add(new AccountChest(sign, account)); } else { // remove accountchest from storage if it is not a valid chest deleteAccountChest(worldName, x, y, z); } } return chests; }
@Override public synchronized List<AccountChest> getChests() { List<SqlRow> result = db.createSqlQuery("SELECT ac.world, ac.x, ac.y, ac.z, a.type, a.owner " + "FROM gringotts_accountchest ac JOIN gringotts_account a ON ac.account = a.id ") .findList();
@Override public RegisterEmployeeOutput callRegisterEmployee(String name, String surname, String email, BigDecimal salary, String departmentName, String companyName) { String query = "SELECT employee_id, department_id, company_id FROM register_employee(:name, :surname, :email, :salary, :departmentName, :companyName)"; SqlRow row = ebean.createSqlQuery(query) .setParameter("name", name) .setParameter("surname", surname) .setParameter("email", email) .setParameter("salary", salary) .setParameter("departmentName", departmentName) .setParameter("companyName", companyName) .findUnique(); RegisterEmployeeOutput result = new RegisterEmployeeOutput(); result.setEmployeePid(row.getInteger("employee_id")); result.setDepartmentPid(row.getInteger("department_id")); result.setCompanyPid(row.getInteger("company_id")); // this is required so the EBean caches are invalidated Ebean.externalModification("department", true, false, false); Ebean.externalModification("company", true, false, false); Ebean.externalModification("employee", true, false, false); return result; }