This repository has been archived by the owner on Aug 25, 2018. It is now read-only.
Refine assert in result_impl::position with SQL_ROW_NUMBER_UNKNOWN #70
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Apparently, not all drivers support
SQLGetStmtAttr
query forSQL_ATTR_ROW_NUMBER
or there may be differences in behaviour.For example, SQLiteODBC driver reports
SQL_ROW_NUMBER_UNKNOWN(-2)
which needs to be taken into account in the assertion.NOTE: Behaviour of the position() function has not changed.
But, it may be sensible to check if
SQL_ROW_NUMBER_UNKNOWN
is returned, then use it asposition()
return value.Currently, in such case, the function returns arguable value:
SQL_ROW_NUMBER_UNKNOWN - 1 + rowset_position_
.See my SO question where I asked about implementation differences (I have checked their code) between various drivers: SQLite3, PostgreSQL, MySQL:
SQLGetStmtAttr output value for SQL_ATTR_ROW_NUMBER
Also, check in
basic_test::simple_test
might need refinements:All of the above has been reproduced and tested on Windows 10 using Visual Studio 2015 + SQLite ODBC driver 32-bit and 64-bit, building the library for both platforms, 32-bit and 64-bit.