awslabs / amazon-timestream-odbc-driver

Apache License 2.0
5 stars 4 forks source link

Cursor can advance pass the end #10

Closed Aryex closed 1 week ago

Aryex commented 4 weeks ago

Describe the bug

Timestream cursor can advance pass the end, causing an error. See link.

Expected Behavior

When advanced pass the end, driver does not break.

Current Behavior

It breaks.

Reproduction Steps

Instantiate a TimestreamCursor and advance it pass the end.

Possible Solution

Check if cursor is at the end.

Additional Information/Context

No response

Timestream ODBC Driver Log

No response

Timestream ODBC Driver version

2.0.0

Host Operating System and version

N/A

trevorbonas commented 3 weeks ago

I have noticed this problem and I am working on a fix.

trevorbonas commented 2 weeks ago

The fix has been implemented as

bool TimestreamCursor::Increment() {
  LOG_DEBUG_MSG("Increment is called");

  if (curPos_ > 0 && iterator_ < rowVec_.end()) {
    ++iterator_;
  }
  curPos_++;
  return curPos_ <= rowVec_.size();
}

An integration test has also been added to confirm the fix.