-
Notifications
You must be signed in to change notification settings - Fork 119
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
Strange behaviour with XMLTYPE #331
Comments
Hi, thanks for reporting the issue. I will commit a fix for this (resulting both iteration will throw the exception) by the end of the weekend. Then I will check for XMLTYPE but few years ago, when I checked for it, it required to implement the whole client OCI side XML API. Regards, Vincent |
thanks for the explanation, From my tool which i'm currently building -pov: regards, |
Hi' Yes, that's what I had in mind when you posted the issue. Vincent |
Added support for XMLTYPE (fetch only) exposed as OCI_Long / ocilib::Clong
Hi, Thus, some progress here. I have added in v4.7.7 partial support for XMLTYPE :) Only fetching XMLTYPE is supported. Let me know if there are any issues with this commit :) Regards, Vincent |
see https://github.com/vrogier/ocilib/blob/develop-v4.7.7/tests/TestREportedIssuesCppApi.cpp TEST(ReportedIssuesCppApi, Issue331)
{
auto expectedString = ToUpper(ostring(OTEXT("<element name=\"name\" type=\"str\"></element>")));
Environment::Initialize();
Environment::EnableWarnings(true);
Connection con(DBS, USR, PWD);
Statement st(con);
st.Execute(OTEXT("SELECT XMLELEMENT(\"element\",xmlattributes(('name') as name, ('str') as \"type\")) as xml from dual"));
auto rs = st.GetResultset();
rs.Next();
auto col = rs.GetColumn(1);
ASSERT_EQ(ostring(OTEXT("XMLTYPE")), col.GetSQLType());
ASSERT_EQ(ostring(OTEXT("XMLTYPE")), col.GetFullSQLType());
ASSERT_EQ(DataTypeValues::TypeLong, col.GetType());
ASSERT_EQ(LongTypeValues::LongCharacter, col.GetSubType());
ASSERT_EQ(expectedString, ToUpper(rs.Get<Clong>(1).GetContent()));
ASSERT_EQ(expectedString, ToUpper(rs.Get<ostring>(1)));
Environment::Cleanup();
} |
I will have to do further testing but its seems good so far. |
Just tried the new branch and it works, thanks! |
I completely forgot the constraint about LONG with scrollable cursors. I went with LONG + dynamic fetching as:
I will also check selecting 2 XMLTYPE as LONG with scrollable cursors (as documentation does not clearly mention server side columns types of host defined placeholder buffers types for columns). I will also check if using dynamic fetching with an intern host string buffer instead a long object works with scrollable cursor as OCI documentation is not clear about this combination. I will let you know asap. Regards, Vincent |
I made a test selecting 2 XMLTYPES with scrollable cursors and it works :). I will add these information to OCILIB documentation Regards, Vincent |
ah i see :) |
Quick observation: |
Hi, After thinking about it, I will design xlmtype support differently from what I committed (to quickly). Instead of relying on OCI_Long, I will create a new type OCI_Xml / OCI_CDT_XML and add the following method to the C API: For the C++ API, I will add a new class ocilib::xml that will wraps OCI_Xml. The reasoning is to be able to extend later XML support with DOM manipulation and integrate internally oracle XML library. That also means that v4.7.7 will be become v4.8.0 as there are API additions . I will commit this during the week. Regards, Vincent |
Sounds like a plan :) |
Hi, I committed the changes (internal changes were bigger than expected, but public API changes reduced). Vincent |
Any news on this subject ? |
Just tested it a bit - seems to work, thanks :) |
sorry, forgot (with branch version 4.7.7):
gives: If i disable scrolling resultsets i get 10. regards, |
Hi, I reproduced the issue. This is due to the combination scrollable cursors + dynamic piecewise fetching used for retrieving of xml content. Vincent |
Hi, I created a v4.8.0 branch with updates for XMLTYPE that will fix your scrollable statement issues. Regards, Vincent |
Tested a bit, this:
gives:
on my system with SetFetchSize(10) (happens at rs++) |
By the way, I pushed another commit today. About your issue, adding test on NULL was next on my todo. |
Fix committed for handling NULL in dynamic fetching. Test suite also updated. Regards, Vincent |
thanks, that works now :) |
Hi,
using 4.7.6 - not quite sure if XMLTYPE is supported, but:
gives:
why does this fail for the first but work for the second try ?
regards
gerald
The text was updated successfully, but these errors were encountered: