データベース初期化の一連の処理
0001: #! /bin/bash
0002: # ---------------------------------------------------- #
0003: # ResetDB.sh
0004: # ==========
0005: #
0006: # データベース初期化の一連の処理
0007: #
0008: # ResetDB.sh [ <option> ]
0009: # options :
0010: # [ encode={EUCJ_0208|UTF8} ] 標準 CHARACTER SET
0011: # 省略値は EUCJ_0208
0012: # [ dbpath=<dbpath> ] Database PATH
0013: # [<hostname>]:<path>
0014: # 省略値は localhost:/DB/biords/birds.fdb
0015: # [ nounique ] UNIQUE であるべき列にもあえて UNIQUE 制約を書かない
0016: # [ uniqueindex ] UNIQUE な列にも別途 INDEX を付ける
0017: # ( DBMS の親切なお世話をあてにしない )
0018: # [ noindex ] CREATE INDEX を行わない
0019: # [ nodata ] デー投入を行わない
0020: #
0021: # $Id: ResetDB.sh,v 1.7 ########## $
0022: # ------------------------------------------------------------ #
0023: encode="encode=EUCJ_0208"
0024: dbpath="dbpath=/DB/birds/birds.fdb"
0025: pagesize=""
0026: nounique=""
0027: uniqueindex=""
0028: noindex=""
0029: nodata=""
0030: while [ "${1}" != "" ]; do
0031: [ "${1:0:7}" == "encode=" ] && encode=${1}
0032: [ "${1:0:7}" == "dbpath=" ] && dbpath=${1}
0033: [ "${1:0:9}" == "pagesize=" ] && pagesize=${1}
0034: [ "${1}" == "nounique" ] && nounique=${1}
0035: [ "${1}" == "uniqueindex" ] && uniqueindex=${1}
0036: [ "${1}" == "noindex" ] && noindex=${1}
0037: [ "${1}" == "nodata" ] && nodata=${1}
0038: [ "${1}" == "shadow" ] && shadow=${1}
0039: shift
0040: done
0041:
0042: # LOG SAVE
0043: /DB/birds/isql/logsave.pl ${encode} ${dbpath} > /DB/birds/isql/logsave.txt
0044:
0045: # DB 作成
0046: yes | /DB/birds/isql/CreateDB.sh -r ${encode} ${dbpath} ${pagesize} ${shadow}
0047:
0048: # TABLE 作成
0049: /DB/birds/isql/CreateTableSPECIES.sh ${encode} ${dbpath} ${nounique}
0050:
0051: # TRIGGER 作成
0052: /DB/birds/isql/CreateTrigger.sh ${encode} ${dbpath}
0053:
0054: # INDEX 作成
0055: [ ! ${noindex} ] && /DB/birds/isql/CreateIndex.sh ${encode} ${dbpath} ${nounique}
0056:
0057: [ ! ${noindex} ] && [ ${uniqueindex} ] && \
0058: /DB/birds/isql/CreateIndex.sh ${encode} ${dbpath} ${nounique} ${uniqueindex}
0059:
0060: # PROCEDURE 作成
0061: /DB/birds/isql/CreateProcedureALL.sh ${encode} ${dbpath}
0062:
0063: # VIEW 作成
0064: /DB/birds/isql/CreateViewVJOIN_SGFO.sh ${encode} ${dbpath}
0065:
0066:
0067: [ ${nodata} ] && exit
0068:
0069: tail -10000 /DB/birds/isql/logsave.txt |
0070: /DB/birds/isql/logload.pl ${encode} ${dbpath}
0071:
0072: # データを流し込み
0073: if [ "${encode}" == "encode=UTF8" ]; then
0074: iconv -f eucjp -t utf8 /DB/birds/isql/BIRDLIST.TXT |\
0075: /DB/birds/isql/loadBirdList.pl ${encode} ${dbpath}
0076: else
0077: /DB/birds/isql/loadBirdList.pl ${encode} ${dbpath}\
0078: < /DB/birds/isql/BIRDLIST.TXT
0079: fi
0080:
この HTML を検査する。( XHTML 1.0 Strict で書かれています )
Another HTML Lint Gateway ( Mirrored by htmllint.oosato.org )