Skip to content

Commit

Permalink
refactor quirks and allow bidirectional converters
Browse files Browse the repository at this point in the history
  • Loading branch information
aldenquimby committed Apr 6, 2014
1 parent 2ff6f8e commit e0253ad
Show file tree
Hide file tree
Showing 39 changed files with 674 additions and 253 deletions.
2 changes: 0 additions & 2 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@
<artifactId>spring-jdbc</artifactId>
<version>4.0.2.RELEASE</version>
</dependency>


</dependencies>

<build>
Expand Down
4 changes: 1 addition & 3 deletions core/src/main/java/org/sql2o/Connection.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ public Sql2o getSql2o() {
}

public Query createQuery(String queryText, String name){
// If postgresql, the default behaviour should be not to retur generated keys, as this will throw an exception on
// every query that does not create any new keys.
boolean returnGeneratedKeys = !(this.sql2o.quirksMode == QuirksMode.PostgreSQL);
boolean returnGeneratedKeys = this.sql2o.getQuirks().returnGeneratedKeysByDefault();
return createQuery(queryText, name, returnGeneratedKeys);
}

Expand Down
5 changes: 3 additions & 2 deletions core/src/main/java/org/sql2o/PojoResultSetIterator.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.sql2o.converters.Convert;
import org.sql2o.converters.Converter;
import org.sql2o.converters.ConverterException;
import org.sql2o.quirks.Quirks;
import org.sql2o.reflection.Pojo;
import org.sql2o.reflection.PojoMetadata;
import org.sql2o.tools.ResultSetUtils;
Expand All @@ -21,8 +22,8 @@ public class PojoResultSetIterator<T> extends ResultSetIteratorBase<T> {
private Converter converter;
private boolean useExecuteScalar;

public PojoResultSetIterator(ResultSet rs, boolean isCaseSensitive, QuirksMode quirksMode, PojoMetadata metadata) {
super(rs, isCaseSensitive, quirksMode);
public PojoResultSetIterator(ResultSet rs, boolean isCaseSensitive, Quirks quirks, PojoMetadata metadata) {
super(rs, isCaseSensitive, quirks);

this.metadata = metadata;
this.converter = Convert.getConverterIfExists(metadata.getType());
Expand Down
Loading

1 comment on commit e0253ad

@dimzon
Copy link
Contributor

@dimzon dimzon commented on e0253ad Apr 6, 2014

Choose a reason for hiding this comment

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

well, you are on proper Java-way...

Please sign in to comment.