ArcadeData / arcadedb

ArcadeDB Multi-Model Database, one DBMS that supports SQL, Cypher, Gremlin, HTTP/JSON, MongoDB and Redis. ArcadeDB is a conceptual fork of OrientDB, the first Multi-Model DBMS. ArcadeDB supports Vector Embeddings.
https://arcadedb.com
Apache License 2.0
505 stars 63 forks source link

DatabaseAsyncExecutor query method returns void #296

Closed Jurgen-Aquilina closed 2 years ago

Jurgen-Aquilina commented 2 years ago

ArcadeDB Version: 22.1.2

JDK Version: Coretto 11

OS: Windows 10

Expected behavior

Running a query through the DatabaseAsyncExecutor method should return a result set, same as the query method on the Database interface.

Actual behavior

Running a query through the DatabaseAsyncExecutor returns void.

Steps to reproduce

database.async().query("sql", "SELECT COUNT(*) FROM V", null)
lvca commented 2 years ago

The intent of the async API is to be executed asynchronously. So the result can be managed in the callback.

The callback covers the whole lifecycle, from when the query is executed, to each result to the closing. Also in case of error, you have a method for that.

Try this:

 database.async().query("sql", "select from User", new AsyncResultsetCallback() {
  @Override
  public boolean onNext(Result result) {
    System.out.println( "Email = " + result.getProperty("email"));
    return true;
  }
});
lvca commented 2 years ago

Check the docs about this (recently updated): https://docs.arcadedb.com/#asyncQueryPos