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

Binding objects of inherited types causes data loss. #132

Closed
y-maltsev opened this issue Jan 10, 2018 · 4 comments
Closed

Binding objects of inherited types causes data loss. #132

y-maltsev opened this issue Jan 10, 2018 · 4 comments
Assignees

Comments

@y-maltsev
Copy link

y-maltsev commented Jan 10, 2018

Hi,
I'm trying to work with inherited object types.
In Oracle I've defined a simple ADT and a subtype for it:

create type ym_base as object(id number, name varchar2(200), trailer number ) not final; 
create type ym_derived under ym_base (sid number ); 

Then when binding the object with the subtype everything seems OK until i try to access the data from the subtype. In this case, the sid.

  Statement stO(con);
  Object objIO(TypeInfo(con, "ym_derived", TypeInfo::Type));

  stO.Prepare("begin :objIO:=ym_derived(1,'Maltsev',123,1666); end;");
  stO.Bind(":objIO",objIO,BindInfo::Out);
  stO.ExecutePrepared();
  std::cerr<<objIO<<std::endl; 

//YM_DERIVED(1, 'Maltsev', 123, )

This data loss happens regardless if the bind variable is input or output one.
I can't confirm if this happens only when the subtype has a number member while the last member of the supertype is also a number, as its the only case I've found so far.

@vrogier
Copy link
Owner

vrogier commented Jan 10, 2018 via email

@vrogier
Copy link
Owner

vrogier commented Jan 10, 2018

Hi,

This is bug, indeed related to super type / sub types.
Thanks for reporting that :)

In the case of sub types deriving from super types, OCILIB is computing wrong offsets for sub object types members properties within the opaque oracle buffer holding objects data.

I've been working on a fix and will commit it this evening.
I will include a sample in the demo based on your example.

Regards,

Vincent

@y-maltsev
Copy link
Author

Hello,

First, I want to thank you for the quick response.
Then - I'm using ocilib for the last week, so I'm using the latest version, v4.4.1.

Best Regards,
Yani

@vrogier
Copy link
Owner

vrogier commented Jan 10, 2018

Fix committed :)
Enjoy!

Thanks again for reporting issues :)

Vincent

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

2 participants