1-- Copyright (C) 2014 MariaDB Ab.
2--
3-- This program is free software; you can redistribute it and/or modify
4-- it under the terms of the GNU General Public License as published by
5-- the Free Software Foundation; version 2 of the License.
6--
7-- This program is distributed in the hope that it will be useful,
8-- but WITHOUT ANY WARRANTY; without even the implied warranty of
9-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10-- GNU General Public License for more details.
11--
12-- You should have received a copy of the GNU General Public License
13-- along with this program; if not, write to the Free Software
14-- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335  USA
15
16# This part creates stored procedures required by the OpenGIS standards.
17# script is prepared to be run with the --bootstrap server option
18
19SET sql_mode='';
20
21@ADD_GIS_SP_SET_DELIMITER@
22
23DROP PROCEDURE IF EXISTS AddGeometryColumn;
24DROP PROCEDURE IF EXISTS DropGeometryColumn;
25
26CREATE DEFINER=`mariadb.sys`@`localhost` PROCEDURE AddGeometryColumn(catalog varchar(64), t_schema varchar(64),
27   t_name varchar(64), geometry_column varchar(64), t_srid int) SQL SECURITY INVOKER
28begin
29  set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' ADD ', geometry_column,' GEOMETRY REF_SYSTEM_ID=', t_srid); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end @ADD_GIS_SP_EOL@
30
31CREATE DEFINER=`mariadb.sys`@`localhost` PROCEDURE DropGeometryColumn(catalog varchar(64), t_schema varchar(64),
32   t_name varchar(64), geometry_column varchar(64)) SQL SECURITY INVOKER
33begin
34  set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' DROP ', geometry_column); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end @ADD_GIS_SP_EOL@
35
36@ADD_GIS_SP_RESET_DELIMITER@
37
38