Cleanup sql literal serialization code #714

Closed
timowest opened this Issue Apr 13, 2014 · 1 comment

Comments

Projects
None yet
1 participant
@timowest
Member

timowest commented Apr 13, 2014

Literal serialization code is now in the SQLTemplates code https://github.com/mysema/querydsl/blob/master/querydsl-sql/src/main/java/com/mysema/query/sql/SQLTemplates.java#L368

The code uses joda times directly and doesn't use the pluggable type handling of the Configuration class.

One solution could be provide a method like this in SQLTemplates

public String serialize(String literal, int jdbcType)

In addition to this the registered Type handlers will need to provide literal serialization as well

interface Type {
    // existing methods
    int[] getSQLTypes();
    Class<T> getReturnedClass();
    T getValue(ResultSet rs, int startIndex) throws SQLException;
    void setValue(PreparedStatement st, int startIndex, T value) throws SQLException;

    // new methods
    String getLiteral(T value) (default returns value.toString())
}

This is just a proposal, feel free to comment.

@timowest timowest added this to the 3.3.3 milestone Apr 17, 2014

@timowest timowest closed this in #718 Apr 30, 2014

@timowest timowest reopened this Apr 30, 2014

@timowest timowest added the fixed label Apr 30, 2014

@timowest timowest modified the milestone: 3.3.3 Apr 30, 2014

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest May 2, 2014

Member

Released in 3.3.3

Member

timowest commented May 2, 2014

Released in 3.3.3

@timowest timowest closed this May 2, 2014

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