aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2018-12-10 21:40:32 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2018-12-10 21:40:32 +0000
commitcd6d6e622caf9957dada889def6f95e1a75f106d (patch)
treea5f5513b5922f5086a2b407df04782ffb6d44d37
parentd209a57058e44ab587cc3b1c7c3f77dd64ec49ec (diff)
downloadjackcess-cd6d6e622caf9957dada889def6f95e1a75f106d.tar.gz
jackcess-cd6d6e622caf9957dada889def6f95e1a75f106d.zip
minor tweaks to date handling; clear caches when config updated; ensure date formats have correct symbols
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@1234 f203690c-595d-4dc9-a70b-905162fa7fd2
-rw-r--r--src/main/java/com/healthmarketscience/jackcess/impl/ColumnImpl.java2
-rw-r--r--src/main/java/com/healthmarketscience/jackcess/impl/DBEvalContext.java14
2 files changed, 11 insertions, 5 deletions
diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/ColumnImpl.java b/src/main/java/com/healthmarketscience/jackcess/impl/ColumnImpl.java
index be2bf1c..6d237b4 100644
--- a/src/main/java/com/healthmarketscience/jackcess/impl/ColumnImpl.java
+++ b/src/main/java/com/healthmarketscience/jackcess/impl/ColumnImpl.java
@@ -1990,7 +1990,7 @@ public class ColumnImpl implements Column, Comparable<ColumnImpl> {
return ((value instanceof Double) ? value :
toNumber(value, db).doubleValue());
case SHORT_DATE_TIME:
- return ((value instanceof DateExt) ? value :
+ return ((value instanceof Date) ? value :
new Date(toDateLong(value)));
case TEXT:
case MEMO:
diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/DBEvalContext.java b/src/main/java/com/healthmarketscience/jackcess/impl/DBEvalContext.java
index 398d9fa..7f50f68 100644
--- a/src/main/java/com/healthmarketscience/jackcess/impl/DBEvalContext.java
+++ b/src/main/java/com/healthmarketscience/jackcess/impl/DBEvalContext.java
@@ -49,8 +49,7 @@ public class DBEvalContext implements Expressionator.ParseContext, EvalConfig
private final RandomContext _rndCtx = new RandomContext();
private Bindings _bindings = new SimpleBindings();
- public DBEvalContext(DatabaseImpl db)
- {
+ public DBEvalContext(DatabaseImpl db) {
_db = db;
}
@@ -63,7 +62,10 @@ public class DBEvalContext implements Expressionator.ParseContext, EvalConfig
}
public void setTemporalConfig(TemporalConfig temporal) {
- _temporal = temporal;
+ if(_temporal != temporal) {
+ _temporal = temporal;
+ _sdfs = null;
+ }
}
public Calendar getCalendar() {
@@ -75,7 +77,10 @@ public class DBEvalContext implements Expressionator.ParseContext, EvalConfig
}
public void setNumericConfig(NumericConfig numeric) {
- _numeric = numeric;
+ if(_numeric != numeric) {
+ _numeric = numeric;
+ _dfs = null;
+ }
}
public FunctionLookup getFunctionLookup() {
@@ -101,6 +106,7 @@ public class DBEvalContext implements Expressionator.ParseContext, EvalConfig
SimpleDateFormat sdf = _sdfs.get(formatStr);
if(sdf == null) {
sdf = _db.createDateFormat(formatStr);
+ sdf.setDateFormatSymbols(_temporal.getDateFormatSymbols());
_sdfs.put(formatStr, sdf);
}
return sdf;