インデックス作成スクリプト
0001: #! /bin/bash 0002: #-----------------------------------------------------------# 0003: # CreateIndex.sh 0004: # ============== 0005: # 0006: # INDEX 作成 0007: # 0008: # CreateIndexOnALL.sh [ options ] 0009: # options : 0010: # [ -r | -d ] なし INDEX を新規作成する 0011: # -d INDEX を削除する 0012: # -r INDEX を再作成する 0013: # [ encode={EUCJ_0208|UTF8} ] 標準 CHARACTER SET 0014: # 省略値は EUCJ_0208 0015: # [ dbpath=<dbpath> ] Database PATH 0016: # [<hostname>]:<path> 0017: # 省略値は localhost:/DB/biords/birds.fdb 0018: # [ nounique ] UNIQUE であるべき列にもあえて UNIQUE 制約を書かない 0019: # [ uniqueindex ] UNIQUE な列にも別途 INDEX を付ける 0020: # ( DBMS の親切なお世話をあてにしない ) 0021: # 0022: # 0023: # $Id: CreateIndex.sh,v 1.4 ########## $ 0024: # 0025: #-----------------------------------------------------------# 0026: # 0027: encode="EUCJ_0208" 0028: dbpath="localhost:/DB/birds/birds.fdb" 0029: unique="UNIQUE" 0030: uniqueindex=0 0031: while [ "${1}" != "" ]; do 0032: if [ "${1:0:1}" == "-" ]; then 0033: param=${1} 0034: else 0035: if [ "${1:0:7}" == "encode=" ]; then 0036: encode=${1:7} 0037: fi 0038: if [ "${1:0:7}" == "dbpath=" ]; then 0039: dbpath=${1:7} 0040: fi 0041: if [ "${1}" == "nounique" ]; then 0042: unique="" 0043: fi 0044: if [ "${1}" == "uniqueindex" ]; then 0045: uniqueindex=1 0046: fi 0047: fi 0048: shift 0049: done 0050: 0051: if [ "${param}" == "-d" ] || [ "${param}" == "-r" ]; then 0052: if [ ${uniqueindex} -eq 0 ]; then 0053: echo '**** DROP INDEX ****' 0054: isql << EOF 0055: SET NAMES ${encode}; 0056: CONNECT "${dbpath}" USER "SYSDBA" PASSWORD "********"; 0057: DROP INDEX SPGN; 0058: DROP INDEX SPSJ; 0059: DROP INDEX SPSC; 0060: DROP INDEX GEFN; 0061: DROP INDEX FAON; 0062: DROP INDEX FAFJ; 0063: DROP INDEX OROJ; 0064: DROP INDEX ACDT; 0065: DROP INDEX ACIP; 0066: COMMIT; 0067: QUIT; 0068: EOF 0069: else 0070: echo '**** DROP UNIQUE INDEX ****' 0071: isql <<EOF 0072: SET NAMES ${encode}; 0073: CONNECT "${dbpath}" USER "SYSDBA" PASSWORD "********"; 0074: DROP INDEX SPSN; 0075: DROP INDEX SPSQ; 0076: DROP INDEX GEGN; 0077: DROP INDEX GESQ; 0078: DROP INDEX FAFN; 0079: DROP INDEX FASQ; 0080: DROP INDEX ORON; 0081: DROP INDEX ORSQ; 0082: DROP INDEX ACSQ; 0083: COMMIT; 0084: QUIT; 0085: EOF 0086: fi 0087: [ "${param}" == "-d" ] && exit 0088: fi 0089: 0090: if [ ${uniqueindex} -eq 0 ]; then 0091: echo '**** CREATE INDEX ****' 0092: isql <<EOF 0093: SET NAMES ${encode}; 0094: CONNECT "${dbpath}" USER "SYSDBA" PASSWORD "********"; 0095: CREATE INDEX SPGN ON SPECIES(GENUSNAME); 0096: CREATE INDEX SPSJ ON SPECIES(SPECIESJPN); 0097: CREATE INDEX SPSC ON SPECIES(SPECIESENGCAP); 0098: CREATE INDEX GEFN ON GENUS(FAMILYNAME); 0099: CREATE INDEX FAON ON FAMILY(ORDERNAME); 0100: CREATE INDEX FAFJ ON FAMILY(FAMILYJPN); 0101: CREATE INDEX OROJ ON ORDERTAB(ORDERJPN); 0102: CREATE INDEX ACDT ON ACCLOG(DATETIME); 0103: CREATE INDEX ACIP ON ACCLOG(IPADDR); 0104: COMMIT; 0105: QUIT; 0106: EOF 0107: else 0108: echo '**** CREATE UNIQUE INDEX ****' 0109: isql <<EOF 0110: SET NAMES ${encode}; 0111: CONNECT "${dbpath}" USER "SYSDBA" PASSWORD "********"; 0112: CREATE ${unique} INDEX SPSN ON SPECIES(SPECIESNAME); 0113: CREATE ${unique} INDEX SPSQ ON SPECIES(SEQNO); 0114: CREATE ${unique} INDEX GEGN ON GENUS(GENUSNAME); 0115: CREATE ${unique} INDEX GESQ ON GENUS(SEQNO); 0116: CREATE ${unique} INDEX FAFN ON FAMILY(FAMILYNAME); 0117: CREATE ${unique} INDEX FASQ ON FAMILY(SEQNO); 0118: CREATE ${unique} INDEX ORON ON ORDERTAB(ORDERNAME); 0119: CREATE ${unique} INDEX ORSQ ON ORDERTAB(SEQNO); 0120: CREATE ${unique} INDEX ACSQ ON ACCLOG(SEQNO); 0121: COMMIT; 0122: QUIT; 0123: EOF 0124: fi 0125: 0126: exit
この HTML を検査する。( XHTML 1.0 Strict で書かれています )
Another HTML Lint Gateway ( Mirrored by htmllint.oosato.org )