ngageoint / geopackage-java

GeoPackage Java Library
http://ngageoint.github.io/geopackage-java
MIT License
81 stars 26 forks source link

FeatureResultSet.moveToFirst() does nothing. #50

Closed AKShaw closed 4 years ago

AKShaw commented 4 years ago

Please fill out as much known and relevant information as possible.

Version Information:

Expected Results:

Expected cursor to move to the first row of the table

Observed Results:

Output:

Steps to Reproduce:

  1. Create a non empty FeatureResultSet by querying a DAO
  2. Print resultSet.getPosition()
  3. Call resultSet.moveToNext()
  4. Repeat 2, 3 as many times as you want
  5. Call resultSet.moveToFirst()
  6. Print resultSet.getPosition()

    Relevant Code:

FeatureResultSet frs = dao.queryForAll();
System.out.println("Current pos: " + frs.getPostition());
frs.moveToNext();
System.out.println("Current pos: " + frs.getPostition());
frs.moveToNext();
System.out.println("Current pos: " + frs.getPostition());
frs.moveToFirst();
System.out.println("Current pos: " + frs.getPostition());

Test Files:

Additional Information:

bosborn commented 4 years ago

The utilized SQLite JDBC library is TYPE_FORWARD_ONLY (statements can not be created with scroll types). For your example, close the result set and perform the query again. Made a few changes for the next version that will throw an exception in that case.

bosborn commented 4 years ago

The geopackage-core-java interface is shared by both this and the geopackage-android library, which is why some of the implementations differ.