@@ -17,6 +17,65 @@ public boolean isNull() {
1717 return false ;
1818 }
1919
20+ public abstract static class MySQLNoPQSConstant extends MySQLConstant {
21+
22+ @ Override
23+ public boolean asBooleanNotNull () {
24+ throw throwException ();
25+ }
26+
27+ private RuntimeException throwException () {
28+ throw new UnsupportedOperationException ("not applicable for PQS evaluation!" );
29+ }
30+
31+ @ Override
32+ public MySQLConstant isEquals (MySQLConstant rightVal ) {
33+ throw throwException ();
34+
35+ }
36+
37+ @ Override
38+ public MySQLConstant castAs (CastType type ) {
39+ throw throwException ();
40+ }
41+
42+ @ Override
43+ public String castAsString () {
44+ throw throwException ();
45+
46+ }
47+
48+ @ Override
49+ public MySQLDataType getType () {
50+ throw throwException ();
51+ }
52+
53+ @ Override
54+ protected MySQLConstant isLessThan (MySQLConstant rightVal ) {
55+ throw throwException ();
56+ }
57+
58+ }
59+
60+ public static class MySQLDoubleConstant extends MySQLNoPQSConstant {
61+
62+ private double val ;
63+
64+ public MySQLDoubleConstant (double val ) {
65+ this .val = val ;
66+ if (Double .isInfinite (val ) || Double .isNaN (val )) {
67+ // seems to not be supported by MySQL
68+ throw new IgnoreMeException ();
69+ }
70+ }
71+
72+ @ Override
73+ public String getTextRepresentation () {
74+ return String .valueOf (val );
75+ }
76+
77+ }
78+
2079 public static class MySQLTextConstant extends MySQLConstant {
2180
2281 private final String value ;
@@ -29,12 +88,11 @@ public MySQLTextConstant(String value) {
2988 }
3089
3190 private void checkIfSmallFloatingPointText () {
32- boolean isSmallFloatingPointText = isString ()
33- && asBooleanNotNull ()
91+ boolean isSmallFloatingPointText = isString () && asBooleanNotNull ()
3492 && castAs (CastType .SIGNED ).getInt () == 0 ;
35- if (isSmallFloatingPointText ) {
36- throw new IgnoreMeException ();
37- }
93+ if (isSmallFloatingPointText ) {
94+ throw new IgnoreMeException ();
95+ }
3896 }
3997
4098 @ Override
@@ -245,7 +303,7 @@ public MySQLDataType getType() {
245303 public boolean isSigned () {
246304 return isSigned ;
247305 }
248-
306+
249307 private final String getStringRepr () {
250308 if (isSigned ) {
251309 return String .valueOf (value );
0 commit comments