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

Issues Parsing Multiple Result Sets #385

Open
david-engelmann opened this issue Mar 20, 2023 · 2 comments
Open

Issues Parsing Multiple Result Sets #385

david-engelmann opened this issue Mar 20, 2023 · 2 comments

Comments

@david-engelmann
Copy link
Contributor

the cursor object description is not updated when cursor.nextset is called. I'll need to dive deeper to see where the issue occurs. The problem is that when parsing multiple result sets you can't tell which set you are looking at

@david-engelmann
Copy link
Contributor Author

david-engelmann commented Mar 20, 2023

Branch for tracking progress.

@for_one_database
def test_next_set_with_many_column_names(dsn, configuration):                                                                                                                                                                                                            
    cursor = connect(dsn, **get_credentials(configuration)).cursor()                                                                                                                                                                                                     
    cursor.execute("SELECT 1 as Column1;Select 2 as Column2;Select 3 as Column3;Select 4 as Column4")                                                                                                                                                                
    result_one = cursor.fetchallnumpy()                                                                                                                                                                                                                                  
    print(result_one)                                                                                                                                                                                                                                                   
    cursor.nextset()                                                                                                                                                                                                                                                   
    result_two = cursor.fetchallnumpy()                                                                                                                                                                                                                                
    print(result_two)                                                                                                                                                                                                                                                    
    cursor.nextset()                                                                                                                                                                                                                                                  
    result_three = cursor.fetchallnumpy()                                                                                                                                                                                                                             
    print(result_three)                                                                                                                                                                                                                                                  
    cursor.nextset()                                                                                                                                                                                                                                                   
    result_four = cursor.fetchallnumpy()                                                                                                                                                                                                                               
    print(result_four)

----------------------------- Captured stdout call -----------------------------

OrderedDict([('column1', masked_array(data=[1], mask=False,  fill_value=999999))])
OrderedDict([('column1', masked_array(data=[2], mask=False,  fill_value=999999))])
OrderedDict([('column1', masked_array(data=[3], mask=False,  fill_value=999999))])
OrderedDict([('column1', masked_array(data=[4], mask=False,  fill_value=999999))])

@david-engelmann
Copy link
Contributor Author

Relevant Documentation of SQLMoreResults

I believe the most relevant section is as follows:

When SQLMoreResults returns SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value can be obtained by calling SQLGetDiagRec with a HandleType of SQL_HANDLE_STMT and a Handle of StatementHandle.

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

No branches or pull requests

1 participant