-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'ysobj-bugfix-return-object-as-maps-value'
- Loading branch information
Showing
4 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/main/java/com/miragesql/miragesql/type/ObjectValueType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.miragesql.miragesql.type; | ||
|
||
import java.sql.CallableStatement; | ||
import java.sql.PreparedStatement; | ||
import java.sql.ResultSet; | ||
import java.sql.SQLException; | ||
|
||
public class ObjectValueType extends AbstractValueType<Object> { | ||
|
||
public ObjectValueType() { | ||
super(Object.class); | ||
} | ||
|
||
public Object get(Class<? extends Object> type, ResultSet rs, int columnIndex) throws SQLException { | ||
return rs.getObject(columnIndex); | ||
} | ||
|
||
public Object get(Class<? extends Object> type, ResultSet rs, String columnName) throws SQLException { | ||
return rs.getObject(columnName); | ||
} | ||
|
||
public void set(Class<? extends Object> type, PreparedStatement stmt, Object value, int index) throws SQLException { | ||
if (value == null) { | ||
setNull(type, stmt, index); | ||
} else { | ||
stmt.setObject(index, value); | ||
} | ||
} | ||
|
||
public Object get(Class<? extends Object> type, CallableStatement cs, int index) throws SQLException { | ||
return cs.getObject(index); | ||
} | ||
|
||
public Object get(Class<? extends Object> type, CallableStatement cs, String parameterName) throws SQLException { | ||
return cs.getObject(parameterName); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters