diff options
author | Alexey Botchkov <holyfoot@askmonty.org> | 2016-01-21 14:03:24 +0400 |
---|---|---|
committer | Alexey Botchkov <holyfoot@askmonty.org> | 2016-01-25 11:32:19 +0400 |
commit | da0991c6daaa650ec224fe4028975eaf6db02ba7 (patch) | |
tree | df1710f44045ce0acf8280a1f16203837e2d86dd /scripts | |
parent | ff8d4009a7743b99c1c13831172b08041a4b272e (diff) | |
download | mariadb-git-da0991c6daaa650ec224fe4028975eaf6db02ba7.tar.gz |
MDEV-7875 Duplicate maria_add_gis_sp script in the sources.
Now both are generated by the cmake from the
scripts/maria_add_gis_sp.sql.in
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/CMakeLists.txt | 30 | ||||
-rw-r--r-- | scripts/maria_add_gis_sp.sql | 48 | ||||
-rw-r--r-- | scripts/maria_add_gis_sp.sql.in (renamed from scripts/maria_add_gis_sp_bootstrap.sql) | 7 |
3 files changed, 33 insertions, 52 deletions
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 01fd1c4f78f..6af76816c60 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -79,8 +79,6 @@ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mysql_performance_tables.sql ${CMAKE_CURRENT_SOURCE_DIR}/fill_help_tables.sql ${CMAKE_CURRENT_SOURCE_DIR}/mysql_test_data_timezone.sql - ${CMAKE_CURRENT_SOURCE_DIR}/maria_add_gis_sp.sql - ${CMAKE_CURRENT_SOURCE_DIR}/maria_add_gis_sp_bootstrap.sql ${FIX_PRIVILEGES_SQL} DESTINATION ${INSTALL_MYSQLSHAREDIR} COMPONENT Server ) @@ -324,6 +322,34 @@ ELSE() ENDFOREACH() ENDIF() +# Configure two scripts from one 'in' file. +# The maria_add_gis_sp.sql - to be sent to 'mysql' tool +# and the maria_add_gis_sp_bootstrap.sql, that can be sent to +# the server as a bootstrap command. + +SET(ADD_GIS_SP_SET_DELIMITER "delimiter |") +SET(ADD_GIS_SP_RESET_DELIMITER "delimiter ;") +SET(ADD_GIS_SP_EOL "|") +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/maria_add_gis_sp.sql.in + ${CMAKE_CURRENT_BINARY_DIR}/maria_add_gis_sp.sql ESCAPE_QUOTES @ONLY) + +INSTALL_SCRIPT(${CMAKE_CURRENT_BINARY_DIR}/maria_add_gis_sp.sql + DESTINATION ${INSTALL_BINDIR} + COMPONENT Server + ) + +SET(ADD_GIS_SP_SET_DELIMITER "") +SET(ADD_GIS_SP_RESET_DELIMITER "") +SET(ADD_GIS_SP_EOL ";") +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/maria_add_gis_sp.sql.in + ${CMAKE_CURRENT_BINARY_DIR}/maria_add_gis_sp_bootstrap.sql ESCAPE_QUOTES @ONLY) + +INSTALL_SCRIPT(${CMAKE_CURRENT_BINARY_DIR}/maria_add_gis_sp.sql + ${CMAKE_CURRENT_BINARY_DIR}/maria_add_gis_sp_bootstrap.sql + DESTINATION ${INSTALL_MYSQLSHAREDIR} + COMPONENT Server + ) + # Install libgcc as mylibgcc.a IF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_FLAGS MATCHES "-static") EXECUTE_PROCESS ( diff --git a/scripts/maria_add_gis_sp.sql b/scripts/maria_add_gis_sp.sql deleted file mode 100644 index 8ddc7abd17f..00000000000 --- a/scripts/maria_add_gis_sp.sql +++ /dev/null @@ -1,48 +0,0 @@ --- 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. --- 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=''; - -DROP PROCEDURE IF EXISTS AddGeometryColumn; -DROP PROCEDURE IF EXISTS DropGeometryColumn; - -delimiter | - -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| - -delimiter ; - diff --git a/scripts/maria_add_gis_sp_bootstrap.sql b/scripts/maria_add_gis_sp.sql.in index 063b6650efd..1e2e513cd0a 100644 --- a/scripts/maria_add_gis_sp_bootstrap.sql +++ b/scripts/maria_add_gis_sp.sql.in @@ -18,17 +18,20 @@ SET sql_mode=''; +@ADD_GIS_SP_SET_DELIMITER@ + 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; + 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@ 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; + 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@ +@ADD_GIS_SP_RESET_DELIMITER@ |