Beispiel #1
0
  /**
   * Returns the specified expression as normalized database path. Throws an exception if the path
   * is invalid.
   *
   * @param i index of argument
   * @param ctx query context
   * @return normalized path
   * @throws QueryException query exception
   */
  private String path(final int i, final QueryContext ctx) throws QueryException {

    final String path = string(checkStr(expr[i], ctx));
    final String norm = MetaData.normPath(path);
    if (norm == null) RESINV.thrw(input, path);
    return norm;
  }
Beispiel #2
0
  /**
   * Performs the store function.
   *
   * @param ctx query context
   * @return {@code null}
   * @throws QueryException query exception
   */
  private Item store(final QueryContext ctx) throws QueryException {
    checkWrite(ctx);

    final Data data = data(0, ctx);
    final String path = path(1, ctx);
    final IOFile file = data.meta.binary(path);
    if (file == null || file.isDir()) RESINV.thrw(input, path);

    final Item it = checkItem(expr[2], ctx);
    ctx.updates.add(new DBStore(data, token(path), it, input), ctx);
    return null;
  }