Project

General

Profile

« Previous | Next » 

Revision 9589

inputs/GBIF/_MySQL/run: added load_data(), which loads the dumpfile into MySQL

View differences:

inputs/GBIF/_MySQL/run
1 1
#!/bin/bash -e
2 2
. "$(dirname "${BASH_SOURCE[0]}")"/../../../lib/runscripts/import.run
3
. "$(dirname "${BASH_SOURCE[0]}")"/../../../lib/runscripts/subdir.run
4
. "$(dirname "${BASH_SOURCE[0]}")"/../../../lib/sh/resume_import.sh
3 5

  
4 6
if self_not_included; then
5 7

  
8
dumpfile_stem=GBIFPortalDB-2013-02-20
9
dumpfile_stem_path="$top_dir/$dumpfile_stem"
10

  
11
load_data() # usage: [database=GBIF_new] load_data
12
{
13
	echo_func
14
	
15
	use_local_remote
16
	database= mysql_root <<EOF
17
CREATE DATABASE IF NOT EXISTS $database DEFAULT CHARACTER SET utf8/*utf8_general_ci*/;
18
GRANT  ALL PRIVILEGES              ON $database.* TO   '$local_user'@'%' WITH GRANT OPTION;
19
REVOKE UPDATE, DELETE, ALTER, DROP ON $database.* FROM '$local_user'@'%';
20
EOF
21
	
22
	sql_preamble <"$top_dir"/../_src/"$dumpfile_stem".dump >"$dumpfile_stem_path".schema.0.preamble.sql
23
	cat "$dumpfile_stem_path".schema*.sql|mysql_root
24
	time cat "$dumpfile_stem_path".data*.sql|mysql_rm_privileged_statements\
25
|log_queries= mysql_local
26
}
27

  
6 28
import()
7 29
{
8 30
	echo_func

Also available in: Unified diff