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

Handling of update counts before result sets in select #193

Closed
GoogleCodeExporter opened this issue Mar 17, 2015 · 8 comments
Closed

Handling of update counts before result sets in select #193

GoogleCodeExporter opened this issue Mar 17, 2015 · 8 comments

Comments

@GoogleCodeExporter
Copy link

What version of the MyBatis are you using?
3.0.3 in combination with Sybase ASE 12.1 and jtds jdbc drivers

Please describe the problem.  Unit tests are best!
Mybatis gives zero results when a ResultSet is preceded by an update count. 
This causes mybatis to return zero results when calling a stored procedure that 
for example first performs an update and then a select.

While this might be expected behavior, I'm currently working with a legacy 
sybase ase database that contains a lot of these stored procedures. 

What is the expected output? What do you see instead?
Mybatis should just return the results of the first result set. It now returns 
nothing since the first result is an update count.

I think it would be better if mybatis skips any update counts in a select 
statement. The attached patch implements this behavior.

Example stored proc:

create proc test_multiresult
as
begin
create table #testtable( test int ) 

insert into #testtable values (8)

select * from #testtable

insert into #testtable values (10)

select * from #testtable

return

end

Original issue reported on code.google.com by b...@desert-spring.nl on 1 Dec 2010 at 2:05

Attachments:

@GoogleCodeExporter
Copy link
Author

Does this error still occur with the latest version of MyBatis?  I did some 
work in this area and think that this problem might be solved.

Original comment by jeffgbut...@gmail.com on 7 Sep 2011 at 7:06

@GoogleCodeExporter
Copy link
Author

[deleted comment]

3 similar comments
@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

Issue 329 has been merged into this issue.

Original comment by eduardo.macarron on 12 Feb 2012 at 7:02

@GoogleCodeExporter
Copy link
Author

Was fixed in r3717 for 3.0.5. Please try again.

Original comment by eduardo.macarron on 12 Feb 2012 at 7:10

  • Changed state: Fixed
  • Added labels: Target-Release3.0.5

@GoogleCodeExporter
Copy link
Author

I can confirm that it is working as expected in version 3.0.5. 

I setup a test case with a mapper that calls the test_multiresult stored 
procedure given in the initial report. Mybatis version 3.0.3 and 3.0.4 return 
null, version 3.0.5 returns 8.

Original comment by b...@desert-spring.nl on 12 Feb 2012 at 10:13

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

No branches or pull requests

1 participant