aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/com/healthmarketscience/jackcess/expr/Value.java
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2017-02-07 05:09:10 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2017-02-07 05:09:10 +0000
commit631911dcf16b3bf860995e1984d9169842df4aae (patch)
tree4896c6e2f47c56a7ff1d3ba6743ec9965dfd6872 /src/main/java/com/healthmarketscience/jackcess/expr/Value.java
parentc70c26bed9f6a369addbbe0985afb3f53205b47f (diff)
downloadjackcess-631911dcf16b3bf860995e1984d9169842df4aae.tar.gz
jackcess-631911dcf16b3bf860995e1984d9169842df4aae.zip
add more type coercion, string and date to num
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/branches/exprs@1084 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'src/main/java/com/healthmarketscience/jackcess/expr/Value.java')
-rw-r--r--src/main/java/com/healthmarketscience/jackcess/expr/Value.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main/java/com/healthmarketscience/jackcess/expr/Value.java b/src/main/java/com/healthmarketscience/jackcess/expr/Value.java
index 04844ae..ad0e587 100644
--- a/src/main/java/com/healthmarketscience/jackcess/expr/Value.java
+++ b/src/main/java/com/healthmarketscience/jackcess/expr/Value.java
@@ -46,6 +46,16 @@ public interface Value
return((ordinal() <= DOUBLE.ordinal()) ? DOUBLE : BIG_DEC);
}
+ public Type getPreferredNumericType() {
+ if(isNumeric()) {
+ return this;
+ }
+ if(isTemporal()) {
+ return ((this == DATE) ? LONG : DOUBLE);
+ }
+ return null;
+ }
+
private boolean inRange(Type start, Type end) {
return ((start.ordinal() <= ordinal()) && (ordinal() <= end.ordinal()));
}