MariaDB [appdev4db]> drop database if exists appdev4db;
|
Query OK, 1 row affected (0.022 sec)
|
|
MariaDB [(none)]> create database appdev4db;
|
Query OK, 1 row affected (0.002 sec)
|
|
MariaDB [(none)]> use appdev4db;
|
Database changed
|
MariaDB [appdev4db]> create table T1 (C1 INT, C2 CHAR(4), C3 GEOMETRY);
|
Query OK, 0 rows affected (0.033 sec)
|
|
MariaDB [appdev4db]> insert into T1 values (1,'AAAA',ST_GeomFromGeoJSON('{"type": "Point", "coordinates": [74.6466372, 16.8241727]}'));
|
Query OK, 1 row affected (0.005 sec)
|
|
MariaDB [appdev4db]> select * from T1;
|
+------+------+---------------------------+
|
| C1 | C2 | C3 |
|
+------+------+---------------------------+
|
| 1 | AAAA | !ÿ■Çb⌐R@è┴h√ⁿ╥0@ |
|
+------+------+---------------------------+
|
1 row in set (0.001 sec)
|
|
MariaDB [appdev4db]> select JSON_ARRAY(C1,C2,C3) from T1;
|
+---------------------------------------------------------------------------------------+
|
| JSON_ARRAY(C1,C2,C3) |
|
+---------------------------------------------------------------------------------------+
|
| [1, "AAAA", "\u0000\u0000\u0000\u0000\u0001\u0001\u0000\u0000\u0000!ÿ■Çb⌐R@è┴h√ⁿ╥0@"] |
|
+---------------------------------------------------------------------------------------+
|
1 row in set (0.001 sec)
|
|
MariaDB [appdev4db]> select JSON_ARRAY(ST_ASGEOJSON(C3)) from T1;
|
+----------------------------------------------------------------------+
|
| JSON_ARRAY(ST_ASGEOJSON(C3)) |
|
+----------------------------------------------------------------------+
|
| ["{\"type\": \"Point\", \"coordinates\": [74.6466372, 16.8241727]}"] |
|
+----------------------------------------------------------------------+
|
1 row in set (0.001 sec)
|
|
MariaDB [appdev4db]> select JSON_ARRAY(JSON_QUERY(ST_ASGEOJSON(C3),'$')) from T1;
|
+--------------------------------------------------------------+
|
| JSON_ARRAY(JSON_QUERY(ST_ASGEOJSON(C3),'$')) |
|
+--------------------------------------------------------------+
|
| [{"type": "Point", "coordinates": [74.6466372, 16.8241727]}] |
|
+--------------------------------------------------------------+
|
1 row in set (0.001 sec)
|
|
MariaDB [appdev4db]> select JSON_ARRAY(C1,JSON_QUERY(ST_ASGEOJSON(C3),'$')) from T1;
|
+-----------------------------------------------------------------+
|
| JSON_ARRAY(C1,JSON_QUERY(ST_ASGEOJSON(C3),'$')) |
|
+-----------------------------------------------------------------+
|
| [1, {"type": "Point", "coordinates": [74.6466372, 16.8241727]}] |
|
+-----------------------------------------------------------------+
|
1 row in set (0.001 sec)
|
|
MariaDB [appdev4db]> select JSON_ARRAY(C1,C2,JSON_QUERY(ST_ASGEOJSON(C3),'$')) from T1;
|
+---------------------------------------------------------------------------------+
|
| JSON_ARRAY(C1,C2,JSON_QUERY(ST_ASGEOJSON(C3),'$')) |
|
+---------------------------------------------------------------------------------+
|
| [1, "AAAA", "{\"type\": \"Point\", \"coordinates\": [74.6466372, 16.8241727]}"] |
|
+---------------------------------------------------------------------------------+
|
1 row in set (0.001 sec)
|