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

Not all result sets are processed when UPDATE or INSERT is performed in between. #1036

Merged
merged 3 commits into from Jun 21, 2017

Conversation

Projects
None yet
3 participants
@happysearch
Contributor

happysearch commented Jun 19, 2017

fix multipleResultsetSets bug,when ((stmt.getMoreResults() or stmt.getUpdateCount()!=-1) and stmt.getResultSet()==null),will stop check the succedent resultsets and the succedent resultsets will be lost.

#1035

fix multipleResultsetSets bug
fix   multipleResultsetSets  bug,when ((stmt.getMoreResults() or stmt.getUpdateCount()!=-1)  and  stmt.getResultSet()==null),will stop check the succedent resultsets and the succedent  resultsets will be lost.
@harawata

This comment has been minimized.

Show comment
Hide comment
@harawata

harawata Jun 19, 2017

Member

Thank you for the PR, @happysearch !

That condition has been used for a very long time.
How did you encounter the 'lost resultset' issue?
Please post the details so that we can reproduce it.
An executable demo app is the best.

Member

harawata commented Jun 19, 2017

Thank you for the PR, @happysearch !

That condition has been used for a very long time.
How did you encounter the 'lost resultset' issue?
Please post the details so that we can reproduce it.
An executable demo app is the best.

@happysearch

This comment has been minimized.

Show comment
Hide comment
@happysearch

happysearch Jun 20, 2017

Contributor

It is difficult to provide Demo. The defect is presently found in the process of Sybase-to-Oracle project. The original Sybase project contained a lot of Stored procedures. Our project team developed one tools based on Mybaits to test the consistency of the newly-transferred Stored procedures.From the testing report we found the defect and then we made a manual examination for the cases at the client of Sybase and Oracle. Meanwhile we use original jdbc driver code to debug the similar cases of stored Procedures and finally fix the cause of the defect. The project team has applied the modified Mybatis for sure.
The commit code has not changed the condition but changed the way to the more simple understanding written. It was also a automatic decompiled of my Intelij Idea when I debuged the defect at the very begining. The commit code only add one line without breaking the original logic. Attached info printed by the our origin JDBC Driver Code which one defective case has gone through the whole resulset.

Begin Fetch First Results...
0,UpdateCount:1
1,UpdateCount:1
2,UpdateCount:1
3,UpdateCount:0
4,UpdateCount:12
5,UpdateCount:1
6,UpdateCount:1
First Resultset Count:1

Begin Fetch Next Results...
7,UpdateCount:-1
Resultset Count:0
8,UpdateCount:1
[NULL RESUTSET]
9,UpdateCount:-1
Resultset Count:11

The case should finally get back 3 resulset, yet the last resulset with 11 records has been lost by Mybatis.

Contributor

happysearch commented Jun 20, 2017

It is difficult to provide Demo. The defect is presently found in the process of Sybase-to-Oracle project. The original Sybase project contained a lot of Stored procedures. Our project team developed one tools based on Mybaits to test the consistency of the newly-transferred Stored procedures.From the testing report we found the defect and then we made a manual examination for the cases at the client of Sybase and Oracle. Meanwhile we use original jdbc driver code to debug the similar cases of stored Procedures and finally fix the cause of the defect. The project team has applied the modified Mybatis for sure.
The commit code has not changed the condition but changed the way to the more simple understanding written. It was also a automatic decompiled of my Intelij Idea when I debuged the defect at the very begining. The commit code only add one line without breaking the original logic. Attached info printed by the our origin JDBC Driver Code which one defective case has gone through the whole resulset.

Begin Fetch First Results...
0,UpdateCount:1
1,UpdateCount:1
2,UpdateCount:1
3,UpdateCount:0
4,UpdateCount:12
5,UpdateCount:1
6,UpdateCount:1
First Resultset Count:1

Begin Fetch Next Results...
7,UpdateCount:-1
Resultset Count:0
8,UpdateCount:1
[NULL RESUTSET]
9,UpdateCount:-1
Resultset Count:11

The case should finally get back 3 resulset, yet the last resulset with 11 records has been lost by Mybatis.

happysearch and others added some commits Jun 21, 2017

@harawata harawata merged commit 50e7697 into mybatis:master Jun 21, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@harawata

This comment has been minimized.

Show comment
Hide comment
@harawata

harawata Jun 21, 2017

Member

Thank you @happysearch !

I plan to add a test case later.

Member

harawata commented Jun 21, 2017

Thank you @happysearch !

I plan to add a test case later.

@kazuki43zoo kazuki43zoo added the bug label Jul 30, 2017

@kazuki43zoo kazuki43zoo added this to the 3.4.5 milestone Jul 30, 2017

@kazuki43zoo

This comment has been minimized.

Show comment
Hide comment
@kazuki43zoo

kazuki43zoo Jul 30, 2017

Member

Hi @happysearch and @harawata , Could you add test case for this change ?

Member

kazuki43zoo commented Jul 30, 2017

Hi @happysearch and @harawata , Could you add test case for this change ?

@harawata

This comment has been minimized.

Show comment
Hide comment
@harawata

harawata Jul 30, 2017

Member

I did : 3fcfe24

Member

harawata commented Jul 30, 2017

I did : 3fcfe24

@kazuki43zoo

This comment has been minimized.

Show comment
Hide comment
@kazuki43zoo
Member

kazuki43zoo commented Jul 30, 2017

👍

@harawata harawata changed the title from fix #1035 multipleResultsetSets bug to Not all result sets are processed when UPDATE or INSERT is performed in between. Aug 19, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment