public static Parameter parameter(String name) { return new Parameter(":" + name); }
@Override public String getAssignment() { return toString(); } }
/** * {@inheritDoc} */ @Override public boolean delete(K key) throws GoraException { Delete delete = new Delete(); delete.from(orientDBMapping.getDocumentClass()) .where(projection("_id").eq(Parameter.parameter("key"))); Map<String, Object> params = new HashMap<String, Object>(); params.put("key", key); OCommandSQL query = new OCommandSQL(delete.toString().replace("DELETE", "DELETE FROM")); try (ODatabaseDocumentTx deleteTx = connectionPool.acquire()) { deleteTx.activateOnCurrentThread(); int deleteCount = deleteTx.command(query).execute(params); if (deleteCount == 1) { return true; } else { return false; } } catch (Exception e) { throw new GoraException(e); } }
.where(projection("_id").eq(Parameter.parameter("key"))); Map<String, Object> params = new HashMap<String, Object>(); params.put("key", key);
if ((this.getStartKey() != null) && (this.getEndKey() != null) && this.getStartKey().equals(this.getEndKey())) { selectQuery.where(projection("_id").eq(Parameter.parameter("key"))); params.put("key", this.getStartKey()); } else if (this.getStartKey() != null || this.getEndKey() != null) { if (this.getStartKey() != null) { selectQuery.where(projection("_id").ge(Parameter.parameter("key_lower"))); params.put("key_lower", this.getStartKey()); selectQuery.where(projection("_id").le(Parameter.parameter("key_upper"))); params.put("key_upper", this.getEndKey());
@Override public String getAssignment() { return toString(); } }
public static Parameter parameter(String name) { return new Parameter(j.join(":", name)); }
if (query.getFields() == null || (query.getFields().length == getFields().length)) { if (query.getStartKey() != null) { delete.where(projection("_id").ge(Parameter.parameter("start"))); params.put("start", query.getStartKey()); delete.where(projection("_id").le(Parameter.parameter("end"))); params.put("end", query.getEndKey());