Closed abmusse closed 5 years ago
Original comment by Xu Meng (Bitbucket: mengxumx, GitHub: dmabupt).
@DavidRosson Seems we can not set the scrollable attribute directly. We have to set the cursor type to SQL_CURSOR_DYNAMIC then the cursor become scrollable automatically.
#!javascript
dbstmt.setStmtAttr(db2i.SQL_ATTR_CURSOR_TYPE, db2i.SQL_CURSOR_DYNAMIC);
// dbstmt.setStmtAttr(db2i.SQL_ATTR_CURSOR_SCROLLABLE, db2i.SQL_TRUE);
console.log("Scrollable is " + dbstmt.getStmtAttr(db2i.SQL_ATTR_CURSOR_SCROLLABLE));
#!shell
SetStmtAttr() attr = 10050, value = 2, sqlReturnCode = 0
GetStmtAttr() attr = 10015, value = 1, sqlReturnCode = 0
Scrollable is 1
Original comment by Xu Meng (Bitbucket: mengxumx, GitHub: dmabupt).
Hello @DavidRusso , Seems the scrollable attribute is not set succesfully -->
#!javascript
dbstmt.setStmtAttr(db2i.SQL_ATTR_CURSOR_SCROLLABLE, db2i.SQL_TRUE);
console.log("Scrollable is " + dbstmt.getStmtAttr(db2i.SQL_ATTR_CURSOR_SCROLLABLE));
Debug:
#!shell
SetStmtAttr() attr = 10015, value = 1, sqlReturnCode = 0
GetStmtAttr() attr = 10015, value = 0, sqlReturnCode = 0
Scrollable is 0
Original report by David Russo (Bitbucket: DavidRusso, GitHub: DavidRusso).
The fetch() call seems to ignore orientation == SQL_FETCH_RELATIVE and offset. See attached example script. The first fetch() call should move the cursor 10 rows from the start of the result set.
Run the script and compare the results vs. running the same query interactively. The results are identical, meaning the fetch() call with SQL_FETCH_RELATIVE did not move the cursor 10 rows.