@SuppressWarnings("boxing") public short getShort(String columnLabel) throws SQLException { try { final Short r = result.getProperty(columnLabel); lastReadWasNull = r == null; return r != null ? r : 0; } catch (Exception e) { throw new SQLException("An error occurred during the retrieval of the short value at column '" + columnLabel + "'", e); } }
private void copy(OResult from, OResultInternal to) { for (String prop : from.getPropertyNames()) { to.setProperty(prop, from.getProperty(prop)); } }
@Override public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException { try { BigDecimal r = ((BigDecimal) result.getProperty(columnLabel)).setScale(scale); lastReadWasNull = r == null; return r; } catch (Exception e) { throw new SQLException("An error occurred during the retrieval of the double value at column '" + columnLabel + "'", e); } }
public void deserialize(OResult fromResult) { if (fromResult.getProperty("clusters") != null) { clusters = new ArrayList<>(); List<OResult> ser = fromResult.getProperty("clusters"); for (OResult item : ser) { OIdentifier id = OIdentifier.deserialize(item); clusters.add(id); } } } }
public void deserialize(OResult fromResult) { if (fromResult.getProperty("functionCall") != null) { functionCall = new OFunctionCall(-1); functionCall.deserialize(fromResult.getProperty("functionCall")); } self = fromResult.getProperty("self"); if (fromResult.getProperty("collection") != null) { collection = new OCollection(-1); collection.deserialize(fromResult.getProperty("collection")); } }
public void deserialize(OResult fromResult) { if (fromResult.getProperty("num") != null) { num = new OInteger(-1); num.deserialize(fromResult.getProperty("num")); } if (fromResult.getProperty("inputParam") != null) { inputParam = OInputParameter.deserializeFromOResult(fromResult.getProperty("inputParam")); } } }
public Time getTime(String columnLabel) throws SQLException { try { java.util.Date date = result.getProperty(columnLabel); lastReadWasNull = date == null; return getTime(date); } catch (Exception e) { throw new SQLException("An error occurred during the retrieval of the time value at column '" + columnLabel + "'", e); } }
@Override public void deserialize(OResult fromResult) { try { OExecutionStepInternal.basicDeserialize(fromResult, this); this.className = fromResult.getProperty("className"); this.orderByRidAsc = fromResult.getProperty("orderByRidAsc"); this.orderByRidDesc = fromResult.getProperty("orderByRidDesc"); } catch (Exception e) { throw OException.wrapException(new OCommandExecutionException(""), e); } }
private void tryAddEntryPoint(OResult res, OCommandContext ctx) { if (whileClause == null || whileClause.matchesFilters(res, ctx)) { this.entryPoints.add(0, res); } if (res.isElement()) { traversed.add(res.getElement().get().getIdentity()); } else if (res.getProperty("@rid") != null && res.getProperty("@rid") instanceof OIdentifiable) { traversed.add(((OIdentifiable) res.getProperty("@rid")).getIdentity()); } }
public void deserialize(OResult fromResult) { left = new OExpression(-1); left.deserialize(fromResult.getProperty("left")); try { operator = (OBinaryCompareOperator) Class.forName(String.valueOf(fromResult.getProperty("operator"))).newInstance(); } catch (Exception e) { throw OException.wrapException(new OCommandExecutionException(""), e); } right = new OExpression(-1); right.deserialize(fromResult.getProperty("right")); }
public static OInputParameter deserializeFromOResult(OResult doc) { try { OInputParameter result = (OInputParameter) Class.forName(doc.getProperty("__class")).getConstructor(Integer.class) .newInstance(-1); result.deserialize(doc); } catch (Exception e) { throw OException.wrapException(new OCommandExecutionException(""), e); } return null; }
public static OStatement deserializeFromOResult(OResult doc) { try { OStatement result = (OStatement) Class.forName(doc.getProperty("__class")).getConstructor(Integer.class).newInstance(-1); result.deserialize(doc); } catch (Exception e) { throw OException.wrapException(new OCommandExecutionException(""), e); } return null; }
public static OMathExpression deserializeFromResult(OResult fromResult) { String className = fromResult.getProperty("__class"); try { OMathExpression result = (OMathExpression) Class.forName(className).getConstructor(Integer.class).newInstance(-1); result.deserialize(fromResult); return result; } catch (Exception e) { throw OException.wrapException(new OCommandExecutionException(""), e); } }
public boolean remove(final Object key) { try(OResultSet result = getDatabase().command(String.format(QUERY_REMOVE, name), key)) { if (!result.hasNext()) { return false; } return ((long) result.next().getProperty("count")) > 0; } }
public int remove(final OIdentifiable iRecord) { try (OResultSet rs = getDatabase().command(String.format(QUERY_REMOVE3, name, iRecord.getIdentity()), iRecord)) { return (Integer) rs.next().getProperty("value"); } }
@Override public void deserialize(OResult fromResult) { try { super.deserialize(fromResult); this.asc = fromResult.getProperty("asc"); } catch (Exception e) { throw OException.wrapException(new OCommandExecutionException(""), e); } }
@Override public void deserialize(OResult fromResult) { try { OExecutionStepInternal.basicDeserialize(fromResult, this); className = fromResult.getProperty("className"); } catch (Exception e) { throw OException.wrapException(new OCommandExecutionException(""), e); } }
@Override public void deserialize(OResult fromResult) { try { OExecutionStepInternal.basicDeserialize(fromResult, this); functionCondition = new OBinaryCondition(-1); functionCondition.deserialize(fromResult.getProperty("functionCondition ")); queryTarget = new OFromClause(-1); queryTarget.deserialize(fromResult.getProperty("functionCondition ")); } catch (Exception e) { throw OException.wrapException(new OCommandExecutionException(""), e); } } }
public long count(final Object iKey) { try (final OResultSet result = getDatabase().indexQuery(getName(), String.format(QUERY_COUNT, name), iKey)) { if (!result.hasNext()) { return 0; } return (Long) result.next().getProperty("size"); } }
public long getKeySize() { try (OResultSet result = getDatabase().indexQuery(getName(), String.format(QUERY_KEY_SIZE, name))) { if (result.hasNext()) return (Long) result.next().getProperty("size"); } return 0; }