Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mysql function CONTAINS and GEOMFROMTEXT does not working

Tags:

mysql

So i have this method that contains a geometry function from mysql :

select *, (SELECT SUM(t_o.value) FROM tree_operations t_o WHERE t_o.operation_id = operations.id) operationTreeValue, (SELECT COUNT(t_o.id)  FROM `tree_operations` t_o WHERE t_o.operation_id = operations.id) operationTreeNumber, (CASE\r                          WHEN operations.type = 'pieces' THEN (SELECT GROUP_CONCAT(p.name) FROM `pieces` p WHERE p.id IN (SELECT piece_id FROM `piece_row_operations` WHERE operation_id = operations.id))\r                          WHEN operations.type = 'rows' THEN (SELECT GROUP_CONCAT(r.number) FROM `rows` r WHERE r.id IN (SELECT row_id FROM `piece_row_operations` WHERE operation_id = operations.id))\r                          END) AS typeName from `operations` where operations.id IN (SELECT t_o.operation_id FROM `tree_operations` t_o WHERE t_o.tree_id IN (SELECT t.id FROM `trees` t WHERE t.coordinates IN (Contains(GeomFromText('POLYGON(49.816472 35.971209,49.7868 35.970981,49.788668 35.947219,49.15201 35.947905,49.816472 35.971209)'))))) order by `operations`.`id` desc

But surprisingly it doesn't work on server (while it's perfectly fine in local) After spending chunk load of time (running query on different environments and so on ) i couldn't get any solid answer . is there anything wrong with my query or is it the functions that are not working anymore?? p.s : my mysql version in the local is 5.7 and server is mariadb 10.2

like image 246
Alireza Amrollahi Avatar asked Feb 23 '19 08:02

Alireza Amrollahi


1 Answers

Some of mysql functions as GeomFromText() are deprecated as of MySQL 5.7.6;

Use MariaDB@latest && ST_GeomFromText() and ST_ (other functions) instead

like image 140
Amin Jafari Avatar answered Sep 27 '22 22:09

Amin Jafari