Subversion Repositories oidplus

Rev

Rev 865 | Blame | Compare with Previous | Last modification | View Log | RSS feed

#!/bin/bash

# OIDplus 2.0
# Copyright 2019 - 2021 Daniel Marschall, ViaThinkSoft
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

DIR=$( dirname "$0" )
cd "$DIR"

# Export tables "demo_*" into file plugins/viathinksoft/sqlSlang/sqlite/sql/example.sql
# We don't print to console because of encoding issues
#mysqldump --default-character-set=utf8 --no-create-info --extended-insert=FALSE oidplus demo_iri demo_asn1id demo_ra demo_objects -r ../plugins/viathinksoft/sqlSlang/mysql/sql/example.sql

# Remove database prefix
#sed -i 's/`demo_/`/g' ../plugins/viathinksoft/sqlSlang/mysql/sql/example.sql

# Since we have to do some manual work to the MySQL data, we do not create a new dump
# but instead use the MySQL example script (that has been carefully checked)
cat ../plugins/viathinksoft/sqlSlang/sqlite/sql/example_mysql.sql > ../plugins/viathinksoft/sqlSlang/sqlite/sql/example.sql

# Avoid that there is a conflict with well known IDs (e.g. 2.999)
#INSERT IGNORE INTO does not work??? It is not important, since the SQL-Dump contains DROP statements anyway.
#sed -i 's/INSERT INTO `iri`/INSERT IGNORE INTO `iri`/g' ../plugins/viathinksoft/sqlSlang/sqlite/sql/example.sql
#sed -i 's/INSERT INTO `asn1id`/INSERT IGNORE INTO `asn1id`/g' ../plugins/viathinksoft/sqlSlang/sqlite/sql/example.sql

# Change \" to "
sed -i 's/\\"/"/g' ../plugins/viathinksoft/sqlSlang/sqlite/sql/example.sql

# Change "\n" to "' || char(10) || '"
sed -i "s/\\\n/' \|\| char\(10\) \|\| '/g" ../plugins/viathinksoft/sqlSlang/sqlite/sql/example.sql