To use spatial DB functions, you need the ability to save values
1. Use default values defined by functions: for example, "default" : "POINT(1,1)". This is currently impossible - values are necessarily escaped (except for boolean, integer and real) https://github.com/espocrm/espocrm/b...oser.php#L2266
(external example of using the specified functions https://github.com/jsor/doctrine-pos...ostGISType.php )
2. Use the corresponding functions in selects by default (I believe this can be bypassed by defining the list of functions and specifying the select in entityDefs) - I have not tested this for stored fields
I believe it would be logical to pass this through the corresponding functions as is done in doctrine/dbal, but it is not currently used at the BaseQueryComposer level.
Now it is possible to redefine the function quote but the field parameter is not passed to it and the only option is to determine this empirically by the presence of something in the passed value, which is clearly wrong from a security point of view
Addition: To use a spatial index, you don't need to add anything - just specify the flag in the index definition
1. Use default values defined by functions: for example, "default" : "POINT(1,1)". This is currently impossible - values are necessarily escaped (except for boolean, integer and real) https://github.com/espocrm/espocrm/b...oser.php#L2266
(external example of using the specified functions https://github.com/jsor/doctrine-pos...ostGISType.php )
2. Use the corresponding functions in selects by default (I believe this can be bypassed by defining the list of functions and specifying the select in entityDefs) - I have not tested this for stored fields
I believe it would be logical to pass this through the corresponding functions as is done in doctrine/dbal, but it is not currently used at the BaseQueryComposer level.
Now it is possible to redefine the function quote but the field parameter is not passed to it and the only option is to determine this empirically by the presence of something in the passed value, which is clearly wrong from a security point of view
Addition: To use a spatial index, you don't need to add anything - just specify the flag in the index definition
Code:
"indexes": { "geometry": { "columns": ["geometry"], "flags": ["spatial"] } }
Comment