[ofbiz-framework] branch trunk updated: Make latitude and longitude numeric fields for correct comparisons (#220)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] branch trunk updated: Make latitude and longitude numeric fields for correct comparisons (#220)

jleroux@apache.org
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new d288e12  Make latitude and longitude numeric fields for correct comparisons (#220)
d288e12 is described below

commit d288e12030fc75ffe0419c17b2f3f96e96fbf397
Author: fehnomenal <[hidden email]>
AuthorDate: Sat May 29 12:07:19 2021 +0200

    Make latitude and longitude numeric fields for correct comparisons (#220)
---
 framework/common/entitydef/entitymodel.xml                            | 4 ++--
 .../src/main/java/org/apache/ofbiz/entity/jdbc/SqlJdbcUtil.java       | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/framework/common/entitydef/entitymodel.xml b/framework/common/entitydef/entitymodel.xml
index 490a941..37b8133 100644
--- a/framework/common/entitydef/entitymodel.xml
+++ b/framework/common/entitydef/entitymodel.xml
@@ -286,8 +286,8 @@ under the License.
         <field name="geoPointTypeEnumId" type="id"/>
         <field name="description" type="description"></field>
         <field name="dataSourceId" type="id"></field>
-        <field name="latitude" type="short-varchar" not-null="true"></field>
-        <field name="longitude" type="short-varchar" not-null="true"></field>
+        <field name="latitude" type="fixed-point" not-null="true"></field>
+        <field name="longitude" type="fixed-point" not-null="true"></field>
         <field name="elevation" type="fixed-point"></field>
         <field name="elevationUomId" type="id"><description>UOM for elevation (feet, meters, etc.)</description></field>
         <field name="information" type="comment"><description>To enter any related information</description></field>
diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SqlJdbcUtil.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SqlJdbcUtil.java
index 5b5604b..654c44a 100644
--- a/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SqlJdbcUtil.java
+++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SqlJdbcUtil.java
@@ -954,6 +954,8 @@ public final class SqlJdbcUtil {
     public static void addValueSingle(StringBuilder buffer, ModelField field, Object value, List<EntityConditionParam> params) {
         if (field != null) {
             buffer.append('?');
+        } else if (value instanceof Number) {
+            buffer.append(value);
         } else {
             buffer.append('\'');
             if (value instanceof String) {