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

A new type handler for SQLXML data type. #1221

Merged
merged 3 commits into from
May 2, 2018

Conversation

harawata
Copy link
Member

@harawata harawata commented Mar 22, 2018

It seems to be working with...

  • Oracle 11g, 12c (XMLTYPE column)
  • PostgreSQL 10 (XML column)
  • MS SQL Server 2017 Express (XML column / mssql-jdbc driver)
  • DB2 Express-C 11.1 (XML column / db2jcc4 driver)

Copy link
Member

@kazuki43zoo kazuki43zoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @harawata,
I've added some comments.

}

protected String sqlxmlToString(SQLXML sqlxml) throws SQLException {
String result = sqlxml.getString();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it needs the null check.

import java.sql.SQLException;
import java.sql.SQLXML;

public class SqlxmlTypeHandler extends BaseTypeHandler<String> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add JavaDoc(description, since, author...).

SQLXML sqlxml = ps.getConnection().createSQLXML();
sqlxml.setString(parameter);
ps.setSQLXML(i, sqlxml);
sqlxml.free();
Copy link
Member

@kazuki43zoo kazuki43zoo Mar 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you need to call free(), it may be better to call it in try-finally.

@harawata
Copy link
Member Author

Thanks @kazuki43zoo !
I've fixed the test as well. Please let me know if you noticed anything.
Your thorough reviews are invaluable!

/**
* Convert <code>String</code> to/from <code>SQLXML</code>.
*
* @since 3.4.5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3.5.0 or 3.4.7 ?

@kazuki43zoo kazuki43zoo added the enhancement Improve a feature or add a new feature label Mar 23, 2018
@kazuki43zoo kazuki43zoo added this to the 3.5.0 milestone Mar 24, 2018
@harawata harawata self-assigned this May 2, 2018
@harawata harawata merged commit 9829703 into mybatis:master May 2, 2018
kazuki43zoo added a commit to kazuki43zoo/mybatis-3 that referenced this pull request May 3, 2018
kazuki43zoo added a commit to kazuki43zoo/mybatis-3 that referenced this pull request May 3, 2018
kazuki43zoo added a commit that referenced this pull request May 3, 2018
@kazuki43zoo
Copy link
Member

I've updated as follows:

@harawata
Copy link
Member Author

harawata commented May 3, 2018

Thank you for the update, @kazuki43zoo !

h3adache pushed a commit that referenced this pull request May 5, 2018
Requires drivers support JDBC 4.0+.
h3adache pushed a commit that referenced this pull request May 5, 2018
h3adache pushed a commit that referenced this pull request May 5, 2018
h3adache pushed a commit that referenced this pull request May 5, 2018
pulllock pushed a commit to pulllock/mybatis-3 that referenced this pull request Oct 19, 2023
Requires drivers support JDBC 4.0+.
pulllock pushed a commit to pulllock/mybatis-3 that referenced this pull request Oct 19, 2023
pulllock pushed a commit to pulllock/mybatis-3 that referenced this pull request Oct 19, 2023
pulllock pushed a commit to pulllock/mybatis-3 that referenced this pull request Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improve a feature or add a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants