Skip to content

Commit

Permalink
0000021: SQLite
Browse files Browse the repository at this point in the history
  • Loading branch information
mhanes committed Dec 3, 2012
1 parent fe4fceb commit b987ce2
Showing 1 changed file with 6 additions and 13 deletions.
Expand Up @@ -16,6 +16,7 @@
import org.jumpmind.db.sql.JdbcSqlTemplate;
import org.jumpmind.db.sql.SqlTemplateSettings;
import org.jumpmind.db.sql.SymmetricLobHandler;
import org.jumpmind.util.FormatUtils;
import org.springframework.jdbc.core.SqlTypeValue;
import org.springframework.jdbc.core.StatementCreatorUtils;
import org.springframework.jdbc.support.lob.LobHandler;
Expand Down Expand Up @@ -49,18 +50,9 @@ public <T> T getObjectFromResultSet(ResultSet rs, Class<T> clazz) throws SQLExce

String s = rs.getString(1);
Date d = null;
try {
d = dateTimeFormat.parse(s);
} catch (ParseException e) {
try {
d = timeFormat.parse(s);
} catch (ParseException f) {
try {
d = dateFormat.parse(s);
} catch (ParseException g) {
}
}
}

d = FormatUtils.parseDate(s,FormatUtils.TIMESTAMP_PATTERNS);

if (Timestamp.class.isAssignableFrom(clazz)) {
return (T) new Timestamp(d.getTime());
} else {
Expand All @@ -87,7 +79,8 @@ public void setValues(PreparedStatement ps, Object[] args, int[] argTypes,
} else if (argType == Types.CLOB && lobHandler != null) {
lobHandler.getLobCreator().setClobAsString(ps, i, (String) arg);
} else if (arg!=null && (arg instanceof Date || arg instanceof Timestamp)) {
arg = args[i-1] = dateTimeFormat.format(arg);
arg = dateTimeFormat.format(arg);
args[i-1] = arg;
StatementCreatorUtils.setParameterValue(ps, i, verifyArgType(arg, argType), arg);
} else {
StatementCreatorUtils.setParameterValue(ps, i, verifyArgType(arg, argType), arg);
Expand Down

0 comments on commit b987ce2

Please sign in to comment.