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

Projects
None yet
2 participants
@harawata
Copy link
Member

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)
@kazuki43zoo
Copy link
Member

kazuki43zoo left a comment

Hi @harawata,
I've added some comments.

}

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

This comment has been minimized.

@kazuki43zoo

kazuki43zoo Mar 22, 2018

Member

I think it needs the null check.

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

public class SqlxmlTypeHandler extends BaseTypeHandler<String> {

This comment has been minimized.

@kazuki43zoo

kazuki43zoo Mar 22, 2018

Member

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

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

This comment has been minimized.

@kazuki43zoo

kazuki43zoo Mar 22, 2018

Member

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

@harawata

This comment has been minimized.

Copy link
Member Author

harawata commented Mar 22, 2018

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

This comment has been minimized.

@kazuki43zoo

kazuki43zoo Mar 23, 2018

Member

3.5.0 or 3.4.7 ?

@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

1 check passed

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

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

This comment has been minimized.

Copy link
Member

kazuki43zoo commented May 3, 2018

I've updated as follows:

@harawata

This comment has been minimized.

Copy link
Member Author

harawata commented May 3, 2018

Thank you for the update, @kazuki43zoo !

h3adache added a commit that referenced this pull request May 5, 2018

A new type handler for SQLXML data type. (#1221)
Requires drivers support JDBC 4.0+.

h3adache added a commit that referenced this pull request May 5, 2018

h3adache added a commit that referenced this pull request May 5, 2018

h3adache added a commit that referenced this pull request May 5, 2018

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