Commit 015994f2 authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-7515 GIS: No AddGeometryColumn or DropGeometryColumn in the tree.

Installation scripts added to setup the required SP-s with the mysql_install_db.
parent ccc7297f
......@@ -13,9 +13,11 @@
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# This part created stored procedures required by the OpenGIS standards.
# Proc privilege is needed to run it.
-- This part creates stored procedures required by the OpenGIS standards.
-- Proc privilege is needed to run it.
-- To use this file, load its contents into the mysql database like that:
-- mysql -u root -p mysql < scripts/maria_add_gis_sp.sql
SET sql_mode='';
......
-- Copyright (C) 2014 MariaDB Ab.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; version 2 of the License.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# This part creates stored procedures required by the OpenGIS standards.
# script is prepared to be run with the --bootstrap server option
SET sql_mode='';
DROP PROCEDURE IF EXISTS AddGeometryColumn;
DROP PROCEDURE IF EXISTS DropGeometryColumn;
CREATE PROCEDURE AddGeometryColumn(catalog varchar(64), t_schema varchar(64),
t_name varchar(64), geometry_column varchar(64), t_srid int)
begin
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;
CREATE PROCEDURE DropGeometryColumn(catalog varchar(64), t_schema varchar(64),
t_name varchar(64), geometry_column varchar(64))
begin
set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' DROP ', geometry_column); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end;
......@@ -348,8 +348,9 @@ if ( $opt->{srcdir} )
my $fill_help_tables = "$pkgdatadir/fill_help_tables.sql";
my $create_system_tables = "$pkgdatadir/mysql_system_tables.sql";
my $fill_system_tables = "$pkgdatadir/mysql_system_tables_data.sql";
my $maria_add_gis_sp = "$pkgdatadir/maria_add_gis_sp_bootstrap.sql";
foreach my $f ( $fill_help_tables,$create_system_tables,$fill_system_tables )
foreach my $f ( $fill_help_tables,$create_system_tables,$fill_system_tables,$maria_add_gis_sp )
{
-f $f or cannot_find_file($f);
}
......@@ -496,6 +497,32 @@ if ( open(PIPE, "| $mysqld_install_cmd_line") )
"The \"HELP\" command might not work properly");
}
# ----------------------------------------------------------------------
# Pipe maria_add_gis_sp.sql to "mysqld --bootstrap"
# ----------------------------------------------------------------------
report_verbose_wait($opt,"Creating OpenGIS required SP-s...");
open(SQL, $maria_add_gis_sp)
or error($opt,"can't open $maria_add_gis_sp for reading: $!");
# FIXME > /dev/null ?
if ( open(PIPE, "| $mysqld_install_cmd_line") )
{
print PIPE "use test;\n";
while ( <SQL> )
{
print PIPE $_;
}
close PIPE;
close SQL;
report_verbose($opt,"OK");
}
else
{
warning($opt,"OPENGIS REQUIRED SP-S WERE NOT COMPLETELY INSTALLED!",
"GIS extentions might not work properly");
}
report_verbose($opt,"To start mysqld at boot time you have to copy",
"support-files/mysql.server to the right place " .
"for your system");
......
......@@ -307,8 +307,9 @@ fill_help_tables="$pkgdatadir/fill_help_tables.sql"
create_system_tables="$pkgdatadir/mysql_system_tables.sql"
create_system_tables2="$pkgdatadir/mysql_performance_tables.sql"
fill_system_tables="$pkgdatadir/mysql_system_tables_data.sql"
maria_add_gis_sp="$pkgdatadir/maria_add_gis_sp_bootstrap.sql"
for f in "$fill_help_tables" "$create_system_tables" "$create_system_tables2" "$fill_system_tables"
for f in "$fill_help_tables" "$create_system_tables" "$create_system_tables2" "$fill_system_tables" "$maria_add_gis_sp"
do
if test ! -f "$f"
then
......@@ -469,6 +470,17 @@ else
echo "The \"HELP\" command might not work properly."
fi
s_echo "Creating OpenGIS required SP-s..."
if { echo "use test;"; cat "$maria_add_gis_sp"; } | mysqld_install_cmd_line > /dev/null
then
s_echo "OK"
else
echo
echo "WARNING: OPENGIS REQUIRED SP-S WERE NOT COMPLETELY INSTALLED!"
echo "GIS extentions might not work properly."
fi
# Don't output verbose information if running inside bootstrap or using
# --srcdir for testing. In such cases, there's no end user looking at
# the screen.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment