Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dbstmt.fetch() Ignores Orientation SQL_FETCH_RELATIVE and Offset #47

Closed
abmusse opened this issue Nov 19, 2018 · 4 comments
Closed

dbstmt.fetch() Ignores Orientation SQL_FETCH_RELATIVE and Offset #47

abmusse opened this issue Nov 19, 2018 · 4 comments
Labels
bug Something isn't working major

Comments

@abmusse
Copy link
Member

abmusse commented Nov 19, 2018

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.

@abmusse
Copy link
Member Author

abmusse commented Nov 20, 2018

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

@abmusse
Copy link
Member Author

abmusse commented Nov 20, 2018

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

@abmusse
Copy link
Member Author

abmusse commented Nov 20, 2018

Original comment by Xu Meng (Bitbucket: mengxumx, GitHub: dmabupt).


Refined corresponding debug information with commit 6cd8d8e

@abmusse
Copy link
Member Author

abmusse commented Nov 26, 2018

Original comment by Xu Meng (Bitbucket: mengxumx, GitHub: dmabupt).


Refined the docs with commit 346e2cf and I will close this issue.

@abmusse abmusse closed this as completed Nov 26, 2018
@abmusse abmusse added major bug Something isn't working labels Jan 24, 2019
@abmusse abmusse mentioned this issue Jan 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working major
Projects
None yet
Development

No branches or pull requests

1 participant