Rev 863 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 863 | Rev 1244 | ||
---|---|---|---|
Line 16... | Line 16... | ||
16 | # limitations under the License. |
16 | # limitations under the License. |
17 | 17 | ||
18 | DIR=$( dirname "$0" ) |
18 | DIR=$( dirname "$0" ) |
19 | cd "$DIR" |
19 | cd "$DIR" |
20 | 20 | ||
21 | # Export tables "demo_*" into file setup/sql/example_oracle.sql |
21 | # Export tables "demo_*" into file plugins/viathinksoft/sqlSlang/oracle/sql/example.sql |
22 | # We don't print to console because of encoding issues |
22 | # We don't print to console because of encoding issues |
23 | #mysqldump --default-character-set=utf8 --no-create-info --extended-insert=FALSE oidplus demo_iri demo_asn1id demo_ra demo_objects -r ../setup/sql/example_oracle.sql |
23 | #mysqldump --default-character-set=utf8 --no-create-info --extended-insert=FALSE oidplus demo_iri demo_asn1id demo_ra demo_objects -r ../plugins/viathinksoft/sqlSlang/oracle/sql/example.sql |
24 | 24 | ||
25 | # Remove database prefix |
25 | # Remove database prefix |
26 | #sed -i 's/`demo_/`/g' ../setup/sql/example_oracle.sql |
26 | #sed -i 's/`demo_/`/g' ../plugins/viathinksoft/sqlSlang/oracle/sql/example.sql |
27 | 27 | ||
28 | # Since we have to do some manual work to the MySQL data, we do not create a new dump |
28 | # Since we have to do some manual work to the MySQL data, we do not create a new dump |
29 | # but instead use the MySQL example script (that has been carefully checked) |
29 | # but instead use the MySQL example script (that has been carefully checked) |
30 | cat ../setup/sql/example_mysql.sql > ../setup/sql/example_oracle.sql |
30 | cat ../plugins/viathinksoft/sqlSlang/oracle/sql/example_mysql.sql > ../plugins/viathinksoft/sqlSlang/pgsql/sql/example.sql |
31 | 31 | ||
32 | # Avoid that there is a conflict with well known IDs (e.g. 2.999) |
32 | # Avoid that there is a conflict with well known IDs (e.g. 2.999) |
33 | #sed -i 's/INSERT INTO `iri`/INSERT IGNORE INTO `iri`/g' ../setup/sql/example_pgsql.sql |
33 | #sed -i 's/INSERT INTO `iri`/INSERT IGNORE INTO `iri`/g' ../plugins/viathinksoft/sqlSlang/pgsql/sql/example.sql |
34 | #sed -i 's/INSERT INTO `asn1id`/INSERT IGNORE INTO `asn1id`/g' ../setup/sql/example_pgsql.sql |
34 | #sed -i 's/INSERT INTO `asn1id`/INSERT IGNORE INTO `asn1id`/g' ../plugins/viathinksoft/sqlSlang/pgsql/sql/example.sql |
35 | 35 | ||
36 | # Change backticks to double quotes |
36 | # Change backticks to double quotes |
37 | # and write everything inside upper case! (very important) |
37 | # and write everything inside upper case! (very important) |
38 | sed -i 's/`/"/g' ../setup/sql/example_oracle.sql |
38 | sed -i 's/`/"/g' ../plugins/viathinksoft/sqlSlang/oracle/sql/example.sql |
39 | sed -i 's/"asn1id"/"ASN1ID"/g' ../setup/sql/example_oracle.sql |
39 | sed -i 's/"asn1id"/"ASN1ID"/g' ../plugins/viathinksoft/sqlSlang/oracle/sql/example.sql |
40 | sed -i 's/"objects"/"OBJECTS"/g' ../setup/sql/example_oracle.sql |
40 | sed -i 's/"objects"/"OBJECTS"/g' ../plugins/viathinksoft/sqlSlang/oracle/sql/example.sql |
41 | sed -i 's/"iri"/"IRI"/g' ../setup/sql/example_oracle.sql |
41 | sed -i 's/"iri"/"IRI"/g' ../plugins/viathinksoft/sqlSlang/oracle/sql/example.sql |
42 | 42 | ||
43 | # Change \" to " |
43 | # Change \" to " |
44 | sed -i 's/\\"/"/g' ../setup/sql/example_oracle.sql |
44 | sed -i 's/\\"/"/g' ../plugins/viathinksoft/sqlSlang/oracle/sql/example.sql |
45 | 45 | ||
46 | # Add at the beginning |
46 | # Add at the beginning |
47 | # ALTER SESSION SET NLS_DATE_FORMAT = 'yyyy-mm-dd hh24:mi:ss'; |
47 | # ALTER SESSION SET NLS_DATE_FORMAT = 'yyyy-mm-dd hh24:mi:ss'; |
48 | mv ../setup/sql/example_oracle.sql ../setup/sql/example_oracle.tmp |
48 | mv ../plugins/viathinksoft/sqlSlang/oracle/sql/example.sql example_oracle.tmp |
49 | echo "ALTER SESSION SET NLS_DATE_FORMAT = 'yyyy-mm-dd hh24:mi:ss';" > ../setup/sql/example_oracle.sql |
49 | echo "ALTER SESSION SET NLS_DATE_FORMAT = 'yyyy-mm-dd hh24:mi:ss';" > ../plugins/viathinksoft/sqlSlang/oracle/sql/example.sql |
50 | # "set define off" is important, otherwise we cannot use "&" in a SQL statement |
50 | # "set define off" is important, otherwise we cannot use "&" in a SQL statement |
51 | echo "set define off" >> ../setup/sql/example_oracle.sql |
51 | echo "set define off" >> ../plugins/viathinksoft/sqlSlang/oracle/sql/example.sql |
52 | echo "" >> ../setup/sql/example_oracle.sql |
52 | echo "" >> ../plugins/viathinksoft/sqlSlang/oracle/sql/example.sql |
53 | cat ../setup/sql/example_oracle.tmp >> ../setup/sql/example_oracle.sql |
53 | cat example_oracle.tmp >> ../plugins/viathinksoft/sqlSlang/oracle/sql/example.sql |
54 | rm ../setup/sql/example_oracle.tmp |
54 | rm example_oracle.tmp |
55 | 55 | ||
56 | # Dates need "TIMESTAMP" prefix |
56 | # Dates need "TIMESTAMP" prefix |
57 | for year in {2010..2099} |
57 | for year in {2010..2099} |
58 | do |
58 | do |
59 | sed -i "s/'$year/TIMESTAMP '$year/g" ../setup/sql/example_oracle.sql |
59 | sed -i "s/'$year/TIMESTAMP '$year/g" ../plugins/viathinksoft/sqlSlang/oracle/sql/example.sql |
60 | done |
60 | done |
61 | 61 | ||
62 | # Change "\n" to "' || chr(10) || '" |
62 | # Change "\n" to "' || chr(10) || '" |
63 | sed -i "s/\\\n/' \|\| chr\(10\) \|\| '/g" ../setup/sql/example_oracle.sql |
63 | sed -i "s/\\\n/' \|\| chr\(10\) \|\| '/g" ../plugins/viathinksoft/sqlSlang/oracle/sql/example.sql |