Skip to content

Add DECLARE ... CURSOR FOR support for SQL Server #1821

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

Merged
merged 1 commit into from
Apr 24, 2025

Conversation

aharpervc
Copy link
Contributor

This PR adds support for declaring cursors on queries for SQL Server (docs)

Eg, this now parses correctly, which is the "A" example from documentation:

DECLARE vend_cursor CURSOR
    FOR SELECT * FROM Purchasing.Vendor
OPEN vend_cursor
FETCH NEXT FROM vend_cursor;

There was already basic support for SQL Server cursors. What was missing was detecting & parsing the for_query struct field, and not requiring the @ prefix for cursor names.

A new verified statement test was also added accordingly.

@aharpervc aharpervc marked this pull request as ready for review April 23, 2025 20:55
Copy link
Contributor

@iffyio iffyio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @aharpervc!
cc @alamb

@iffyio iffyio merged commit 7703fd0 into apache:main Apr 24, 2025
9 checks passed
aharpervc added a commit to aharpervc/datafusion-sqlparser-rs that referenced this pull request Apr 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants