JP4112282B2 - Relational database construction apparatus and method - Google Patents

Relational database construction apparatus and method Download PDF

Info

Publication number
JP4112282B2
JP4112282B2 JP2002153236A JP2002153236A JP4112282B2 JP 4112282 B2 JP4112282 B2 JP 4112282B2 JP 2002153236 A JP2002153236 A JP 2002153236A JP 2002153236 A JP2002153236 A JP 2002153236A JP 4112282 B2 JP4112282 B2 JP 4112282B2
Authority
JP
Japan
Prior art keywords
data
database
item
script file
script
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP2002153236A
Other languages
Japanese (ja)
Other versions
JP2003345594A (en
Inventor
正和 吉田
隆志 福田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Japan Research Institute Ltd
Original Assignee
Japan Research Institute Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Japan Research Institute Ltd filed Critical Japan Research Institute Ltd
Priority to JP2002153236A priority Critical patent/JP4112282B2/en
Publication of JP2003345594A publication Critical patent/JP2003345594A/en
Application granted granted Critical
Publication of JP4112282B2 publication Critical patent/JP4112282B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Stored Programmes (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Description

【0001】
【技術分野】
この発明は,データベース構築のためのスクリプト・ファイル生成装置,より具体的には,データベース管理システムに用いられるデータベースを構築するスクリプト・ファイルを生成するための装置および方法,ならびに生成されたスクリプト・ファイルを実行することによってデータベースを構築する装置および方法に関する。
【0002】
【発明の背景】
データベース管理システム(データベース・マネジメント・システム:DBMS)に用いられるデータベースは,データベースのデータ容量,データベースに格納されるテーブルの種類,各テーブルに格納される項目,各項目ごとのレコード長等を定義したデータベース設計データに基づいて,スクリプト・ファイルを作成し,作成されたスクリプト・ファイルに基づいて構築される。
【0003】
データベース設計データとスクリプト・ファイルとは別ファイルで管理される。このため,データベース設計データが変更された場合には,スクリプト・ファイルも変更する必要がある。データベース設計データが頻繁に変更された場合には,スクリプト・ファイルに対する変更作業が遅れたり,誤った内容でスクリプト・ファイルが変更されることがある。
【0004】
【発明の開示】
この発明は,データベースの構築に用いられるスクリプト・ファイルを,データベース設計データから自動的に生成することを目的とする。
【0005】
またこの発明は,自動的に生成されたスクリプト・ファイルを実行することによってデータベースを構築するデータベース構築装置および方法を提供することを目的とする。
【0006】
この発明はさらに,作成されるデータベースが相互に参照制約を持つデータを含むものであっても,データベース作成時においては参照制約を不問にすることを目的とする。
【0007】
この発明によるスクリプト・ファイル生成装置は,少なくとも作成すべきデータベースのデータベース・サイズ,上記データベースを構成するテーブルのそれぞれについてのテーブル名およびテーブル・サイズ,ならびに上記テーブルに含まれる項目のそれぞれについての項目名および項目サイズを含むデータベース設計データ,所定のデータが埋込まれることによって上記データベースの構築のためのスクリプト・ファイルが構成されるテンプレート・データを含むスクリプト作成マクロ,ならびに上記データベース設計データに含まれるデータを上記スクリプト作成マクロの上記テンプレート・データの所定の位置に記述し,データが記述されたスクリプト作成マクロを実行することによってデータベースの構築のためのスクリプト・ファイルを生成するスクリプト・ファイル生成手段を備えている。
【0008】
この発明によるスクリプト・ファイル生成方法は,少なくとも作成すべきデータベースのデータベース・サイズ,上記データベースを構成するテーブルのそれぞれについてのテーブル名およびテーブル・サイズ,ならびに上記テーブルに含まれる項目のそれぞれについての項目名および項目サイズを含むデータベース設計データを入力し,所定のデータが埋込まれることによって上記データベースの構築のためのスクリプト・ファイルが構成されるテンプレート・データを含むスクリプト作成マクロの所定の位置に,上記データベース設計データに含まれるデータを記述し,データが記述されたスクリプト作成マクロを実行することによってデータベースの構築のためのスクリプト・ファイルを生成するものである。
【0009】
この発明によると,テンプレート・データが用意され,このテンプレート・データの所定の位置にデータベース設計データ中のデータが記述(挿入)されることによってスクリプト・ファイルが生成される。生成されるスクリプト・ファイルは,データベース設計データの内容を反映するものとなる。生成されたスクリプト・ファイルを実行することによって,上記データベース設計データに記述された通りの上記データベースが構築される。
【0010】
この発明によると,データベース設計データに変更が生じた場合であっても,その変更を反映したスクリプト・ファイルが生成されるので,スクリプト・ファイルが実行されることによって作成されるデータベースがデータベース設計データに沿うものになる。データベース設計データの変更が漏れなくデータベースに反映される。データベース設計データの変更の内容を確実にデータベースに反映させることができる。
【0011】
一実施態様では,データベース設計データは制約条件データを含み,上記制約条件データに基づいて,構築されたデータベースについての論理的エラーの有無をチェックするチェック手段がさらに備えられる。
【0012】
一般的に,データベース管理システムに利用されるデータベースにおいて,あるデータAが別のデータBを参照するような場合に,データBが存在することを保証する制約が設けられる。あるデータAが別のデータBを参照する場合,データBを登録した後にデータAを登録する必要がある。この発明によると,データベースを構築した後に,構築されたデータベースについての論理的エラー(上述の場合,データAがあるにも関わらずデータBが未だ存在しない)の有無がチェックされる。データベースの構築のときにデータBを先に登録する必要があるといったことを考慮する必要がない。
【0013】
【実施例の説明】
CPU,メモリ,ハードディスク,入力装置,出力装置等を備えたコンピュータ・システムにおいて,そのハードディスクにデータベースおよびデータベース管理プログラムを記憶させることによって,コンピュータ・システムをデータベース管理システム(データベース・マネジメント・システム)として機能させることができる。データベース管理システムでは,複数の利用者が同時にデータベースを更新,検索等したとしても効率よく管理すること,データベースに記憶されている重要なデータに対するアクセスをユーザごとに許可または制限すること,ハードウエアに何らかの障害が発生した場合に障害の直前の状態にデータベースの内容を復元すること等を実現するシステムである。
【0014】
この実施例において説明する装置(データベース構築装置)は,上述のデータベース管理システムにおいて用いられるデータベースを構築する装置である。
【0015】
図1は,データベース管理システムに用いられるデータベースを構築する装置(データベース構築装置)のハードウエア構成を示すブロック図である。
【0016】
データベース構築装置1は,CPU2,入力装置3,表示装置4,通信装置5,メモリ6,FDドライブ7およびハードディスク8を備えたコンピュータ・システムによって構成される。ハードディスク8には,データベース設計データ用マクロ(プログラム),初期登録データ用マクロ(プログラム),本番移行データ用マクロ(プログラム),スクリプト一括実行プログラムおよびデータ整合性チェック・プログラムが記憶されている。
【0017】
後述するように,入力装置3,通信装置5等を通じて,データベース構築装置1に,データベース設計データ,初期登録データおよび本番移行データが入力される。これらのデータから,スクリプト・ファイル(スクリプトが記述されたファイル)が作成される。作成されたスクリプト・ファイルが実行,すなわち,スクリプト・ファイルに記述されたスクリプトがCPU2によって実行されることによって,データベース管理システムに用いられるデータベースが構築される。
【0018】
図2は,データベース構築装置1に入力される3種類のデータと,これらのデータを入力データとし,それらのデータにマクロ処理(上述のデータベース設計データ用マクロ,初期登録データ用マクロ,および本番移行データ用マクロによる処理)が行われることによって出力されるスクリプト・ファイルの種類とを示している。
【0019】
データベース設計データからは,テーブル作成スクリプト・ファイル,権限設計スクリプト・ファイル,主キー設定スクリプト・ファイル,トリガ作成スクリプト・ファイル,および制約条件設定スクリプト・ファイルが作成される。
【0020】
初期登録データからは,初期データ(初期登録)スクリプト・ファイルが作成される。
【0021】
本番移行データからは,初期データ(本番移行)スクリプト・ファイルが作成される。
【0022】
これらのスクリプト・ファイルは,必ずしも一つのファイルを意味するものではない。スクリプト・ファイルの種類によっては,データベース構築装置1によって作成されるデータベースに含まれるテーブルまたは入力されるデータごとに作成されるものもある。これらのデータおよびスクリプト・ファイルの詳細については,後述する。
【0023】
制約条件設定スクリプト・ファイルを除く上述のスクリプト・ファイルが,スクリプト・ファイル一括実行プログラムによって一括して(すべて)実行される。スクリプト・ファイルが実行されることによって,ハードディスク8にデータベースが構築される。制約条件設定スクリプト・ファイルは,データ整合性チェック・プログラムによって実行される。
【0024】
はじめに,データベース構築装置1に入力される3種類のデータ(データベース設計データ,初期登録データおよび本番移行データ)について説明する。
【0025】
(1)データベース設計データ
図3〜図6は,データベース設計データの一例を示している。データベース設計データには,データベース管理システムにおいて用いられるべき(作成されるべき)データベース自体の基本的な構造(データベース構造)(バイト数,アクセス権限等)を規定するもの(図3および図4),およびデータベースを構成する各種テーブル(このテーブルにデータ(実データ)が格納される)についての構造(テーブル構造)を規定するもの(図5および図6)とが含まれる。データベースに複数のテーブルが作成される場合には,テーブル構造を規定するデータベース設計データは複数作成される。
【0026】
図3は,作成されるデータベースのバイト数(ハードディスクを占有する領域の大きさ)(データベースの大きさ)を規定する設計データ(データベース・サイズ設計データ)である。「平均」および「最大」の項目を持つ。
【0027】
「平均」欄には,作成するべきデータベースを利用するデータベース管理システムが稼動している間に平均的に必要となると思われるサイズが示されている。「最大」欄には,同様にデータベース管理システムの稼働中に最大必要となると思われるサイズが示されている。
【0028】
図4は,作成されるデータベースの利用権限を規定する設計データ(権限設定データ)である。
【0029】
権限設定データは,「ユーザ名」欄と「権限」欄とを含む。「ユーザ名」欄に権限内容を設定すべきユーザ(データベース管理システムのユーザ)のユーザ名が記述される。「権限」欄に権限内容が記述される。図4の例は,「public」ユーザに,すべての権限を許可するという指定である。
【0030】
図5は,データベースに格納される各種テーブルの属性を規定する設計データ(テーブル設計データ)の一例である。図5は銀行の情報を管理するテーブル(銀行テーブル)のテーブル設計データを示している。
【0031】
テーブル設計データには,テーブル名,レコード数(平均および最大),テーブルのバイト数(平均および最大),および1レコードのバイト数が規定される。
【0032】
「テーブル名」欄には,テーブル名が記述される。「レコード数」欄の平均には,データベースを利用するデータベース管理システムが稼動している間に平均的に予想されるレコード数が記載される。「レコード数」欄の最大には,予想されるレコード数の最大値を記載する。
【0033】
「バイト数」欄の平均には,このテーブルに必要と予想される平均的なバイト数が,「バイト数」欄の最大にはこのテーブルに必要となる最大のバイト数がそれぞれ記述される。「バイト数」欄の1レコードには,このテーブルの1レコードに必要となるバイト数が記載される。
【0034】
すべてのテーブルについてのバイト数(平均)を合計したものが,図3に示すデータベース・サイズ設計データの平均欄のバイト数と一致する。すべてのテーブルについてのバイト数(最大)を合計したものが,図3に示すデータベース・サイズ設計データの最大欄のバイト数と一致する。
【0035】
図6は,データベースに格納される各種テーブルに含まれる項目の設計データ(項目設計データ)の一例である。図6は,図5に示す銀行テーブルに含まれる各項目のそれぞれについての項目設計データを示している。
【0036】
項目設計データは,項目名,データタイプ,整数バイト数,小数バイト数,属性,主キー,インデックス,ゼロ・データの可否,項目説明および制約条件に関するデータを含む。
【0037】
「項目名」は,個々の項目の名称である。
【0038】
「データタイプ」は各項目のデータの種別である。たとえば,charなら固定長文字列というデータ種別を意味する。
【0039】
「整数バイト数」は,上述のデータ・タイプが真数データ型(varchar) の場合の,整数部の桁数である。データ・タイプが真数データ型以外で文字列型以外の場合には,必要なバイト数を記載する。文字列型の場合には,このバイト数は記録できる文字数を意味する。
【0040】
「小数バイト数」は,データ・タイプが真数データ型の場合の,小数部の桁数である。真数データ型以外の場合は0が記述される。
【0041】
「属性」欄には,データの種類(半角,全角等)が記述される。
【0042】
「主キー」欄には,主キーとして採用するべき項目が示される。○印または◎印が示される。○印は,非クラスタ化主キーを意味する。◎印は,クラスタ化主キーを意味する。
【0043】
「インデックス」欄には,インデックスとして採用する項目が示される。○印または◎印が示される。○印は非クラスタ化インデックスを,◎印はクラスタ化インデックスを意味する。
【0044】
クラスタ化された主キーやインデックスは,一つのテーブルに一つまでしか存在しない。二つ以上ある場合には,いずれか一方を非クラスタ化する(◎印を○印に代える)必要がある。クラスタ化主キーおよびクラスタ化インデックスがないテーブルが存在してもよい。
【0045】
「ゼロ可否」欄には,0(ゼロ)値を許すかどうかが設定される。ここでは,0を許さない場合には「否」と記述され,0を許す場合には「可」と記述されている。
【0046】
「項目説明」欄には,項目の説明が記載される。
【0047】
「制約条件」欄には,項目に対する制約条件が記載される。制約条件については後述する。
【0048】
(2)初期登録データ
図7は,初期登録データの一例を示している。
【0049】
初期登録データは作成されるべきデータベースに含まれるテーブルごとに作成される。初期登録データはテーブル名欄を含み,このテーブル名欄に上述のデータベース設計データにおいて定義されたテーブル名が記載される。これにより,いずれのテーブルについての初期登録データであるかが明示される。
【0050】
初期登録データは,上述のテーブルごとに作成される項目設計データ(図6)において設計された項目ごとの具体的なデータである。上述したように,銀行テーブルに銀行コード,銀行漢字,銀行名カナ,備考欄,更新日時および更新プログラムの項目を設けることが設計されている場合には,この銀行テーブルの初期登録データには,これらの項目のそれぞれについての具体的なデータが格納される。
【0051】
(3)本番移行データ
初期登録データと基本的に同じである。初期登録データと本番移行データの違いは次の通りである。
【0052】
初期登録データは,作成されるデータベースを利用するデータベース管理システムが稼動する為に必要最小限の事項を記述したデータである。このため初期登録データには,データベース管理システムの稼動に必須のコード等が記述されている。これに対して,本番移行データは,旧来のデータベース管理システムから引継ぐデータ類である。旧来のデータベース管理システムが存在しないような,全くの新しいデータベース管理システムについては,本番移行データは必ずしも必要とするものではない。
【0053】
上述したように,データベース設計データ,初期登録データおよび本番移行データが,これらのデータのそれぞれのためのマクロによって処理されることによって,各種のスクリプト・ファイルが作成される。
【0054】
図8は,各種スクリプト・ファイルの作成のためのプログラムの処理の流れを示すフローチャートである。このプログラムは,上述のマクロ,すなわち,データベース設計データ用マクロ,初期登録データ用マクロおよび本番移行データ用マクロを順次実行するプログラム(マクロ順次実行プログラム)である。
【0055】
ユーザは,データベース設計データ,初期登録データおよび本番移行データを準備する。これらのデータは,データベース構築装置1のハードディスク8に記憶させておく。もちろん,データベース構築装置1にネットワーク(LAN,WAN等)によって接続された他のコンピュータのハードディスクに記憶させたものを用いてもよい。
【0056】
データベース構築装置1のユーザがスクリプト・ファイル作成プログラムを起動する。初めに,データベース設計データ用マクロ(プログラム)が実行される(ステップ21)。
【0057】
データベース設計データが読込まれる。たとえば,作成すべきデータベースについてのデータベース設計データが記憶されているアドレスがデータベース構築装置1のユーザによって指定される。アドレスが指定されると,その指定されたアドレスに記憶されているデータベース設計データがデータベース構築装置1のメモリ6に読み込まれる。メモリ6に読み込まれたデータベース設計データを処理対象にして,データベース設計データ用マクロによる処理が開始される(ステップ22)。
【0058】
上述したように,データベース設計データ用マクロは,データベース設計データに基づいて,テーブル作成スクリプト・ファイル,権限設定スクリプト・ファイル,主キー設定スクリプト・ファイル,トリガ設定スクリプト・ファイルおよび制約条件設定スクリプト・ファイルを作成する。
【0059】
データベース設計データ用マクロは,メモリ6に読込まれたデータベース設計データ中の一部のデータを,上述のスクリプト・ファイルのそれぞれについてのテンプレートの所定の位置に記述するように,プログラミングされている。
【0060】
図9〜図13はスクリプト・ファイルの内容の一例を示している。左端の数字は行番号でありスクリプトそのものには含まれない。また,1行目〜8行目は,いずれもコメントでありスクリプトではない。
【0061】
図9は,図5に示す銀行テーブルに関するテーブル設計データおよび図6に示す銀行テーブルの各項目に関する項目設計データに基づいて作成されるテーブル作成スクリプト・ファイルの一例を示している。
【0062】
9行目から17行目が,作成すべき「銀行テーブル」の構築のためのスクリプトである。他のテーブルについての設計データ(テーブル設計データおよび項目設計データ)が用意されていれば,そのテーブルについてのスクリプトが,第18行目以降に順次記述されることになる。
【0063】
たとえば,第9行目には,「CREATE TABLE 銀行(」 と記述されている。この記述は,データベース設計データ用マクロが,データベース設計データ中のテーブル設計データからテーブル名を読出し,読出したテーブル名を 「CREATE TABLE 」と「(」との間に記述した結果作成されるスクリプト記述である。このように,データベース設計データ用マクロは,データベース設計データから読み出したデータの一部を,テンプレートの所定の箇所に記述する(埋め込む)処理を行う。これにより,各種スクリプト・ファイルが順次作成される。
【0064】
図10は,権限設定データ(図4参照)に基づいて作成される権限設定スクリプト・ファイルの一例である。
【0065】
図11は,項目設計データ(図6参照)に基づいて作成される主キー設定スクリプト・ファイルの一例である。
【0066】
図12は,トリガ作成スクリプト・ファイルの一例である。トリガ作成スクリプト・ファイルは,テーブル中のデータが追加または更新されたときに,追加または更新したときの日時を記録するための処理を,データベース管理システムに行わせるためのファイルである。
【0067】
図13は,項目設計データ(図6参照)に記述される制約条件に基づいて作成される制約条件設定スクリプト・ファイルの一例である。
【0068】
図8に戻って,データベース設計データ用マクロによる処理が終了すると,次に初期登録データ用マクロが起動する(ステップ23)。初期登録データがメモリ6に読み込まれる。
【0069】
図14は,初期データ(初期登録)バッチ・ファイルの記述例である。初期データ(初期登録)バッチ・ファイルは,初期登録データに含まれている。図15は,初期登録データ用マクロによって生成される初期データ(初期登録)スクリプト・ファイルの一例である。
【0070】
初期登録データ用マクロによって生成される初期データ(初期登録)スクリプト・ファイルは,初期登録データが多数の場合には複数出力される。その場合に,漏らすことなく初期登録データをマクロ処理するプログラムが,図14に示す初期データ(初期登録)バッチ・ファイルである。初期データ(初期登録)バッチ・ファイルが実行されることによって,初期登録データ(図7参照)に対して初期登録データ用マクロによるマクロ処理が行われる。図15に示すような初期データ(初期登録)スクリプト・ファイルが生成される(ステップ24)。初期登録データが複数ある場合には,初期データ(初期登録)スクリプト・ファイルは複数生成される(初期データ(初期登録)スクリプト・ファイル群)。
【0071】
図8に戻って,初期登録データ用マクロの処理が終了すると,本番移行データ用マクロが起動する(ステップ25)。本番移行データがメモリに読み込まれる。本番移行データに基づいて,図15に示すものと同様の初期データ(本番移行)スクリプト・ファイルが生成される(ステップ26)。
【0072】
マクロ順次実行プログラム(マクロ)によって作成された各種スクリプト・ファイルは,データベース構築装置1のハードディスク8に記憶される。次にスクリプト・ファイル一括実行プログラムの処理に進む。
【0073】
図16は,スクリプト・ファイル一括実行プログラムの処理の流れを示すフローチャートである。
【0074】
データベース構築装置1のユーザがスクリプト・ファイル一括実行プログラムの起動命令を入力すると,スクリプト・ファイル一括実行プログラムがハードディスク8から読み出されてCPU2に読み込まれる(ステップ31)。
【0075】
「テーブル作成スクリプト」,「権限設定スクリプト」,「主キー設定スクリプト」および「トリガ作成スクリプト」が実行される。データベース管理システムにおいて利用されるデータベースに,テーブルが作成され(ステップ32),各テーブルのアクセス権限が設定され(ステップ33),主キーが設定され(ステップ34),トリガが作成される(ステップ35)。
【0076】
初期データ(初期登録)スクリプト・ファイル(群)が,ハードディスク8に記憶されているかどうかが判断される(ステップ36)。上述した初期登録データ用マクロによる処理が成功していれば(行われていれば),ハードディスク8には初期データ(初期登録)スクリプト・ファイル(群)が記憶されている。ハードディスク8に初期データ(初期登録)スクリプト・ファイル(群)が記憶されている場合には(ステップ36で「存在する」),初期データ(初期登録)スクリプト・ファイル(群)が実行される。初期データ(初期登録)スクリプト・ファイル(群)に格納されているデータ(銀行名等)が,上述のテーブル作成スクリプト・ファイルによって作成されたテーブルに格納される(ステップ37)。
【0077】
初期データ(本番移行)スクリプト・ファイル(群)が,ハードディスク8に記憶されているかどうかが判断される(ステップ38)。ハードディスク8に初期データ(本番移行)スクリプト・ファイル(群)が記憶されている場合には(ステップ38で「存在する」),初期データ(本番移行)スクリプト・ファイル(群)が実行される。初期データ(本番移行)スクリプト・ファイル(群)に格納されているデータ(銀行名等)が,上述のテーブル作成スクリプトによって作成されたテーブルに格納される(ステップ39)。
【0078】
初期データ(初期登録)スクリプト・ファイルまたは初期データ(本番移行)スクリプト・ファイルがハードディスク8に記憶されていない場合には,スクリプト・ファイル一括実行プログラムの処理が終了する(ステップ36で「存在しない」,ステップ38で「存在しない」)。
【0079】
以上の処理によりデータベース管理システムに利用されるデータベースが構築される。その後にデータ整合性チェック・プログラムが起動する。図17はデータ整合性チェック・プログラムの処理を表すフローチャートである。
【0080】
データ整合性チェック・プログラムは,データベース管理システムが持つデータ整合性チェック機構を活用する。データベース設計データに記述されたデータに,制約条件に合わないデータがあれば検出する処理である。
【0081】
図18は,スクリプト・ファイル一括実行プログラムおよびデータ整合性チェック・プログラムの具体的なプログラム記述を表している。
【0082】
1行目は,必要のない表示を行わない為の指示である。
【0083】
2行目〜9行目はコメントである。
【0084】
10行目〜13行目は,変数の設定であり「サーバ名」,「データベース名」,「ユーザー名」,「パスワード」が記述されている。
【0085】
15行目もコメントである。
【0086】
17行目はフラグとして変数FLGを使うために初期化している。
【0087】
18行目および19行目は,既存のデータベース構成を一度削除する為の処理である。「07_drop_constraint.sql」および「10_Drop.sql」という2つのスクリプトが使用されている。2つのスクリプトの役割は,それぞれ「制約条件削除」および「テーブル削除」である。テーブルを削除する前に制約条件を削除するのは,制約条件がある場合にテーブルを削除できない場合があるためである。
【0088】
21行目〜23行目で,「テーブル作成スクリプト」が実行され,テーブルが作成される。21行目で画面に「Create」と表示することが記述されている。テーブル作成処理に入ったことを示す。22行目は「00_Create.log」というログファイルに,「Create」と書き出すことでテーブル作成処理に入ったという記録を残すことを意味する。
【0089】
23行目で実際に「01_Create.sql」というファイル名の「テーブル作成スクリプト」が実行される。以下,同様の構成で,24行目〜26行目で権限設定,27行目〜29行目で主キー設定,30行目〜32行目でトリガ作成の各処理が行われる。
【0090】
34行目では,初期データ(初期登録)スクリプト・ファイル(群)が存在するかどうかをチェックし,存在しなければ処理を50行目にジャンプする。
【0091】
35行目および36行目で画面とログファイルに記録を残し,37行目は,「05_default_0000.bat」という図14に示したようなプログラムの実行を意味する。
【0092】
38行目では,「初期データ(初期登録)」を登録した状態を表すようにFLG変数を変更する。
【0093】
40行目から44行目は「初期データ(本番移行)」を登録する為に同様の処理を行う。
【0094】
46行目では,初期データを登録したかどうかを判定している。初期データを登録しなかった場合には,50行目へジャンプする。初期データを登録していた場合には,データ整合性チェック処理を行うことになる。
【0095】
データ整合性チェックの処理は,47行目〜49行目に記述されている。
【0096】
制約条件が追加される(図17:ステップ41)。
【0097】
制約条件の追加時にエラーがあった場合(図17:ステップ42で「失敗」)には,ログファイル「00_Create.log」に記録が残ることになる(ステップ43)。制約条件の追加時に成功すると,データ整合性チェック処理が終了する(ステップ42で「成功」)。
【0098】
以上の処理を経て,図19に示すようにデータベース管理システムに用いられるデータベースが構築される。
【図面の簡単な説明】
【図1】データベース構築装置のハードウエア構成を示すブロック図である。
【図2】データベース設計データ,初期登録データおよび本番移行データと,これらのデータがマクロ処理されることによって作成される各種スクリプト・ファイルとの関係を示す。
【図3】データベース・サイズ設計データの一例を示す。
【図4】権限設定データの一例を示す。
【図5】テーブル設計データの一例を示す。
【図6】項目設計データの一例を示す。
【図7】初期登録データの一例を示す。
【図8】スクリプト・ファイル作成プログラムの処理の流れを示すフローチャートである。
【図9】テーブル作成スクリプト・ファイルの内容の一例を示す。
【図10】権限設定スクリプト・ファイルの内容の一例を示す。
【図11】主キー設定スクリプト・ファイルの内容の一例を示す。
【図12】トリガ作成スクリプト・ファイルの内容の一例を示す。
【図13】制約条件設定スクリプト・ファイルの内容の一例を示す。
【図14】初期データ(初期登録)バッチ・ファイルの内容の一例を示す。
【図15】初期データ(初期登録)スクリプト・ファイルの内容の一例を示す。
【図16】スクリプト・ファイル一括実行プログラムの処理の流れを示すフローチャートである。
【図17】データ整合性チェック・プログラムの処理の流れを示すフローチャートである。
【図18】スクリプト・ファイル一括実行プログラムおよびデータ整合性チェック・プログラムの具体例を示す。
【図19】構築されたデータベースを概念的に示す。
【符号の説明】
1 データベース構築装置
2 CPU
3 入力装置
8 ハードディスク
[0001]
【Technical field】
The present invention relates to a script file generating apparatus for database construction, more specifically, an apparatus and method for generating a script file for constructing a database used in a database management system, and a generated script file. The present invention relates to an apparatus and method for constructing a database by executing
[0002]
BACKGROUND OF THE INVENTION
The database used in the database management system (database management system: DBMS) defines the data capacity of the database, the types of tables stored in the database, the items stored in each table, the record length for each item, etc. A script file is created based on the database design data, and is built based on the created script file.
[0003]
Database design data and script files are managed as separate files. For this reason, if the database design data is changed, the script file must also be changed. If the database design data is changed frequently, the modification work on the script file may be delayed or the script file may be changed with incorrect contents.
[0004]
DISCLOSURE OF THE INVENTION
An object of the present invention is to automatically generate a script file used for database construction from database design data.
[0005]
It is another object of the present invention to provide a database construction apparatus and method for constructing a database by executing automatically generated script files.
[0006]
Another object of the present invention is to make reference constraints unquestioned when creating a database, even if the database to be created includes data having referential constraints.
[0007]
The script file generation device according to the present invention includes at least a database size of a database to be created, a table name and a table size for each table constituting the database, and an item name for each item included in the table. Database design data including data size and item size, script creation macro including template data in which script data for constructing the database is configured by embedding predetermined data, and data included in the database design data Is written at a predetermined position of the template data in the script creation macro, and the script creation macro for database construction is executed by executing the script creation macro in which the data is described. And a script file generation means for generating yl.
[0008]
The script file generation method according to the present invention includes at least a database size of a database to be created, a table name and a table size for each table constituting the database, and an item name for each item included in the table. The database design data including the item size is input, and the predetermined data is embedded in the script creation macro including the template data in which the script file for constructing the database is embedded. Data included in the database design data is described, and a script file for database construction is generated by executing a script creation macro in which the data is described.
[0009]
According to the present invention, template data is prepared, and a script file is generated by describing (inserting) data in the database design data at a predetermined position of the template data. The generated script file reflects the contents of the database design data. By executing the generated script file, the database as described in the database design data is constructed.
[0010]
According to the present invention, even if a change occurs in the database design data, a script file reflecting the change is generated. Therefore, the database created by executing the script file is the database design data. It will be along. Database design data changes are reflected in the database without omission. The database design data changes can be reliably reflected in the database.
[0011]
In one embodiment, the database design data includes constraint data, and further includes check means for checking whether there is a logical error in the constructed database based on the constraint data.
[0012]
In general, in a database used in a database management system, when a certain data A refers to another data B, there is a constraint that ensures that the data B exists. When a certain data A refers to another data B, it is necessary to register the data A after registering the data B. According to the present invention, after the database is constructed, it is checked whether there is a logical error (in the above case, data B does not exist even though there is data A) for the constructed database. There is no need to consider that data B needs to be registered first when the database is constructed.
[0013]
[Explanation of Examples]
In a computer system equipped with a CPU, memory, hard disk, input device, output device, etc., the computer system functions as a database management system (database management system) by storing the database and database management program on the hard disk Can be made. In a database management system, even if multiple users update or search the database at the same time, they can manage it efficiently, permit or restrict access to important data stored in the database for each user, This is a system that realizes, for example, restoring the contents of a database to the state immediately before the failure when some kind of failure occurs.
[0014]
An apparatus (database construction apparatus) described in this embodiment is an apparatus that constructs a database used in the above-described database management system.
[0015]
FIG. 1 is a block diagram showing a hardware configuration of an apparatus (database construction apparatus) that constructs a database used in a database management system.
[0016]
The database construction device 1 is constituted by a computer system including a CPU 2, an input device 3, a display device 4, a communication device 5, a memory 6, an FD drive 7 and a hard disk 8. The hard disk 8 stores a database design data macro (program), an initial registration data macro (program), a production transfer data macro (program), a script batch execution program, and a data consistency check program.
[0017]
As will be described later, database design data, initial registration data, and production transfer data are input to the database construction device 1 through the input device 3, the communication device 5, and the like. From these data, a script file (file in which a script is described) is created. The created script file is executed, that is, the script described in the script file is executed by the CPU 2, whereby a database used in the database management system is constructed.
[0018]
FIG. 2 shows three types of data input to the database construction device 1 and these data as input data, and the macro processing (the above-mentioned database design data macro, initial registration data macro, and actual transfer) The type of script file that is output when the processing by the data macro) is performed.
[0019]
From the database design data, a table creation script file, a privilege design script file, a primary key setting script file, a trigger creation script file, and a constraint condition setting script file are created.
[0020]
From the initial registration data, an initial data (initial registration) script file is created.
[0021]
Initial data (production migration) script file is created from production migration data.
[0022]
These script files do not necessarily mean a single file. Some types of script files are created for each table or input data included in the database created by the database construction device 1. Details of these data and script files will be described later.
[0023]
The above script files except for the constraint condition setting script file are collectively (all) executed by the script file batch execution program. A database is constructed on the hard disk 8 by executing the script file. The constraint condition setting script file is executed by the data integrity check program.
[0024]
First, three types of data (database design data, initial registration data, and production transfer data) input to the database construction device 1 will be described.
[0025]
(1) Database design data
3 to 6 show an example of database design data. The database design data defines the basic structure (database structure) (number of bytes, access authority, etc.) of the database itself to be used (created) in the database management system (FIGS. 3 and 4), And a table (FIGS. 5 and 6) for defining a structure (table structure) for various tables constituting the database (data (actual data) is stored in this table). When a plurality of tables are created in the database, a plurality of database design data defining the table structure is created.
[0026]
FIG. 3 shows design data (database size design data) that defines the number of bytes of the database to be created (the size of the area that occupies the hard disk) (the size of the database). Has "Average" and "Maximum" items.
[0027]
The “average” column indicates the size that is expected to be required on average while the database management system that uses the database to be created is in operation. Similarly, the “Maximum” column indicates the size that is expected to be the maximum required during operation of the database management system.
[0028]
FIG. 4 shows design data (authority setting data) that defines the authority to use the created database.
[0029]
The authority setting data includes a “user name” field and an “authority” field. In the “user name” column, the user name of the user (database management system user) to whom the authority content is to be set is described. The authority content is described in the “authority” column. The example of FIG. 4 is a designation that all privileges are granted to the “public” user.
[0030]
FIG. 5 is an example of design data (table design data) that defines attributes of various tables stored in the database. FIG. 5 shows table design data of a table (bank table) for managing bank information.
[0031]
The table design data defines the table name, the number of records (average and maximum), the number of bytes in the table (average and maximum), and the number of bytes in one record.
[0032]
A table name is described in the “table name” column. The average of the “number of records” column describes the average number of records expected while the database management system using the database is operating. The maximum value of the expected number of records is described in the maximum of the “number of records” column.
[0033]
The average number of bytes expected in this table is described in the average of the “number of bytes” column, and the maximum number of bytes required in this table is described in the maximum of the “number of bytes” column. One record in the “number of bytes” column describes the number of bytes required for one record of this table.
[0034]
The total number of bytes (average) for all tables matches the number of bytes in the average column of the database size design data shown in FIG. The total number of bytes (maximum) for all tables matches the number of bytes in the maximum column of the database size design data shown in FIG.
[0035]
FIG. 6 is an example of design data (item design data) of items included in various tables stored in the database. FIG. 6 shows item design data for each item included in the bank table shown in FIG.
[0036]
Item design data includes data on item name, data type, integer byte count, decimal byte count, attribute, primary key, index, availability of zero data, item description, and constraint conditions.
[0037]
“Item name” is the name of each item.
[0038]
“Data type” is the type of data of each item. For example, char means the data type of fixed-length character string.
[0039]
“Integer byte count” is the number of digits in the integer part when the above data type is an exact data type (varchar). If the data type is not an exact data type or a character string type, enter the required number of bytes. For string types, this number of bytes means the number of characters that can be recorded.
[0040]
"Number of decimal bytes" is the number of digits in the decimal part when the data type is an exact data type. If the data type is not a true data type, 0 is described.
[0041]
In the “attribute” column, the type of data (half-width, full-width, etc.) is described.
[0042]
In the “primary key” column, items to be adopted as the primary key are shown. ○ mark or ◎ mark is shown. A circle indicates a non-clustered primary key. ◎ means clustered primary key.
[0043]
In the “index” column, items to be adopted as indexes are shown. ○ mark or ◎ mark is shown. A circle indicates a non-clustered index, and a circle indicates a clustered index.
[0044]
There can be only one clustered primary key or index per table. If there are two or more, one of them must be non-clustered (replace ◎ mark with ○ mark). There may be a table without a clustered primary key and a clustered index.
[0045]
Whether or not to allow a 0 (zero) value is set in the “zero enable / disable” column. Here, “No” is described when 0 is not allowed, and “Yes” is described when 0 is allowed.
[0046]
In the “item description” column, an item description is described.
[0047]
In the “constraint condition” column, the constraint condition for the item is described. The constraint conditions will be described later.
[0048]
(2) Initial registration data
FIG. 7 shows an example of the initial registration data.
[0049]
Initial registration data is created for each table included in the database to be created. The initial registration data includes a table name column, and the table name defined in the above-described database design data is described in this table name column. This clearly indicates which table is the initial registration data.
[0050]
The initial registration data is specific data for each item designed in the item design data (FIG. 6) created for each table. As mentioned above, when it is designed to provide the bank code, bank kanji, bank name kana, remarks column, update date and update program items in the bank table, the initial registration data of this bank table includes Specific data for each of these items is stored.
[0051]
(3) Production transfer data
It is basically the same as the initial registration data. The difference between the initial registration data and the production transfer data is as follows.
[0052]
Initial registration data is data that describes the minimum items necessary for the operation of a database management system that uses a database to be created. For this reason, in the initial registration data, codes and the like essential for the operation of the database management system are described. On the other hand, the actual migration data is data inherited from the old database management system. For a completely new database management system where there is no old database management system, production migration data is not always necessary.
[0053]
As described above, the database design data, the initial registration data, and the production transfer data are processed by the macros for each of these data, thereby creating various script files.
[0054]
FIG. 8 is a flowchart showing the flow of processing of a program for creating various script files. This program is a program (macro sequential execution program) for sequentially executing the above-described macros, that is, the database design data macro, the initial registration data macro, and the production transfer data macro.
[0055]
The user prepares database design data, initial registration data, and production transfer data. These data are stored in the hard disk 8 of the database construction device 1. Of course, you may use what was memorize | stored in the hard disk of the other computer connected to the database construction apparatus 1 by networks (LAN, WAN, etc.).
[0056]
A user of the database construction device 1 starts a script file creation program. First, a database design data macro (program) is executed (step 21).
[0057]
Database design data is read. For example, the address where the database design data for the database to be created is stored is designated by the user of the database construction device 1. When an address is designated, the database design data stored at the designated address is read into the memory 6 of the database construction device 1. The database design data read into the memory 6 is targeted for processing, and processing using the database design data macro is started (step 22).
[0058]
As described above, the macro for database design data is based on the database design data, the table creation script file, permission setting script file, primary key setting script file, trigger setting script file, and constraint condition setting script file. Create
[0059]
The macro for database design data is programmed so as to describe a part of the data in the database design data read into the memory 6 at a predetermined position of the template for each of the above script files.
[0060]
9 to 13 show an example of the contents of the script file. The leftmost number is the line number and is not included in the script itself. The first to eighth lines are all comments and not scripts.
[0061]
FIG. 9 shows an example of a table creation script file created based on the table design data relating to the bank table shown in FIG. 5 and the item design data relating to each item of the bank table shown in FIG.
[0062]
The 9th to 17th lines are scripts for building the “bank table” to be created. If design data (table design data and item design data) for other tables is prepared, scripts for the tables are sequentially described in the 18th and subsequent lines.
[0063]
For example, in the 9th line, “CREATE TABLE bank (” is described. This description is the table name that the macro for database design data reads the table name from the table design data in the database design data and reads the table name. Is a script description that is created as a result of the description between "CREATE TABLE" and "(". In this way, the database design data macro uses part of the data read from the database design data as a template The script file is sequentially created (embedded), thereby creating various script files.
[0064]
FIG. 10 is an example of an authority setting script file created based on the authority setting data (see FIG. 4).
[0065]
FIG. 11 is an example of a primary key setting script file created based on the item design data (see FIG. 6).
[0066]
FIG. 12 shows an example of a trigger creation script file. The trigger creation script file is a file for causing the database management system to perform processing for recording the date and time when data is added or updated when data in the table is added or updated.
[0067]
FIG. 13 is an example of a constraint condition setting script file created based on the constraint conditions described in the item design data (see FIG. 6).
[0068]
Returning to FIG. 8, when the database design data macro processing is completed, the initial registration data macro is activated next (step 23). Initial registration data is read into the memory 6.
[0069]
FIG. 14 shows a description example of an initial data (initial registration) batch file. The initial data (initial registration) batch file is included in the initial registration data. FIG. 15 shows an example of an initial data (initial registration) script file generated by the macro for initial registration data.
[0070]
A plurality of initial data (initial registration) script files generated by the macro for initial registration data are output when there are many initial registration data. In this case, a program for performing macro processing on the initial registration data without leakage is the initial data (initial registration) batch file shown in FIG. By executing the initial data (initial registration) batch file, macro processing by the initial registration data macro is performed on the initial registration data (see FIG. 7). An initial data (initial registration) script file as shown in FIG. 15 is generated (step 24). When there are a plurality of initial registration data, a plurality of initial data (initial registration) script files are generated (initial data (initial registration) script file group).
[0071]
Returning to FIG. 8, when the processing of the initial registration data macro is completed, the production transfer data macro is activated (step 25). Production transfer data is read into memory. Based on the production transfer data, initial data (production migration) script file similar to that shown in FIG. 15 is generated (step 26).
[0072]
Various script files created by the macro sequential execution program (macro) are stored in the hard disk 8 of the database construction device 1. Next, the process proceeds to the script file batch execution program.
[0073]
FIG. 16 is a flowchart showing the flow of processing of the script file batch execution program.
[0074]
When the user of the database construction device 1 inputs an instruction to start a script file batch execution program, the script file batch execution program is read from the hard disk 8 and read into the CPU 2 (step 31).
[0075]
"Table creation script", "Permission setting script", "Primary key setting script", and "Trigger creation script" are executed. A table is created in a database used in the database management system (step 32), access authority for each table is set (step 33), a primary key is set (step 34), and a trigger is created (step 35). ).
[0076]
It is determined whether the initial data (initial registration) script file (group) is stored in the hard disk 8 (step 36). If the processing by the initial registration data macro described above is successful (if it has been performed), the hard disk 8 stores initial data (initial registration) script file (s). If the initial data (initial registration) script file (group) is stored in the hard disk 8 ("exists" in step 36), the initial data (initial registration) script file (group) is executed. Data (bank name, etc.) stored in the initial data (initial registration) script file (group) is stored in the table created by the table creation script file (step 37).
[0077]
It is determined whether the initial data (production transfer) script file (group) is stored in the hard disk 8 (step 38). If the initial data (production transfer) script file (group) is stored in the hard disk 8 ("exists" in step 38), the initial data (production transfer) script file (group) is executed. Data (bank name, etc.) stored in the initial data (production transfer) script file (group) is stored in the table created by the table creation script (step 39).
[0078]
If the initial data (initial registration) script file or the initial data (production migration) script file is not stored in the hard disk 8, the processing of the script file batch execution program ends ("not present" in step 36). , "Not present" in step 38).
[0079]
The database used for the database management system is constructed by the above processing. Thereafter, the data integrity check program is started. FIG. 17 is a flowchart showing the processing of the data consistency check program.
[0080]
The data integrity check program uses the data integrity check mechanism of the database management system. This is a process for detecting if there is data that does not meet the constraints in the data described in the database design data.
[0081]
FIG. 18 shows specific program descriptions of the script file batch execution program and the data consistency check program.
[0082]
The first line is an instruction not to perform unnecessary display.
[0083]
The second to ninth lines are comments.
[0084]
The 10th to 13th lines are the variable settings that describe "server name", "database name", "user name", and "password".
[0085]
The 15th line is also a comment.
[0086]
The 17th line is initialized to use the variable FLG as a flag.
[0087]
Lines 18 and 19 are processes for deleting the existing database configuration once. Two scripts “07_drop_constraint.sql” and “10_Drop.sql” are used. The roles of the two scripts are “restriction condition deletion” and “table deletion”, respectively. The reason why the constraint condition is deleted before deleting the table is that the table may not be deleted if there is a constraint condition.
[0088]
On the 21st to 23rd lines, the “table creation script” is executed to create a table. The 21st line describes that “Create” is displayed on the screen. Indicates that the table creation process has been started. The 22nd line means that a record that the table creation processing has been started is left by writing “Create” in the log file “00_Create.log”.
[0089]
On the 23rd line, the “table creation script” with the file name “01_Create.sql” is actually executed. Hereinafter, with the same configuration, authority setting is performed in the 24th to 26th lines, primary key setting is performed in the 27th to 29th lines, and trigger generation is performed in the 30th to 32nd lines.
[0090]
Line 34 checks whether the initial data (initial registration) script file (group) exists, and if not, the process jumps to line 50.
[0091]
Lines 35 and 36 are recorded in the screen and log file, and line 37 indicates the execution of the program "05_default_0000.bat" as shown in FIG.
[0092]
In line 38, the FLG variable is changed to represent the state in which “initial data (initial registration)” is registered.
[0093]
Lines 40 to 44 perform the same process to register “initial data (production transfer)”.
[0094]
Line 46 determines whether the initial data has been registered. If initial data is not registered, jump to the 50th line. If initial data has been registered, data consistency check processing is performed.
[0095]
Data consistency check processing is described in the 47th to 49th lines.
[0096]
A constraint condition is added (FIG. 17: step 41).
[0097]
If there is an error when adding the constraint condition (FIG. 17: “failure” in step 42), a record remains in the log file “00_Create.log” (step 43). If it succeeds when the constraint condition is added, the data consistency check process ends (“success” in step 42).
[0098]
Through the above processing, a database used in the database management system is constructed as shown in FIG.
[Brief description of the drawings]
FIG. 1 is a block diagram showing a hardware configuration of a database construction device.
FIG. 2 shows the relationship between database design data, initial registration data, production transfer data, and various script files created by macro-processing these data.
FIG. 3 shows an example of database size design data.
FIG. 4 shows an example of authority setting data.
FIG. 5 shows an example of table design data.
FIG. 6 shows an example of item design data.
FIG. 7 shows an example of initial registration data.
FIG. 8 is a flowchart showing the flow of processing of a script file creation program.
FIG. 9 shows an example of the contents of a table creation script file.
FIG. 10 shows an example of the contents of an authority setting script file.
FIG. 11 shows an example of the contents of a primary key setting script file.
FIG. 12 shows an example of the contents of a trigger creation script file.
FIG. 13 shows an example of the contents of a constraint condition setting script file.
FIG. 14 shows an example of the contents of an initial data (initial registration) batch file.
FIG. 15 shows an example of the contents of an initial data (initial registration) script file.
FIG. 16 is a flowchart showing the flow of processing of a script / file batch execution program.
FIG. 17 is a flowchart showing the flow of processing of a data consistency check program.
FIG. 18 shows specific examples of a script file batch execution program and a data consistency check program.
FIG. 19 conceptually shows a constructed database.
[Explanation of symbols]
1 Database construction device
2 CPU
3 Input devices
8 Hard disk

Claims (2)

少なくとも作成すべき関係データベースのデータベース・サイズを含むデータベース・サイズ設計データ,上記関係データベースを構成するテーブルのそれぞれについてのテーブル名およびテーブル・サイズを含むテーブル設計データ,上記テーブルに含まれる項目のそれぞれについての項目名および項目サイズ,ならびに一の項目のデータが他の項目のデータを参照する場合に上記他の項目のデータが存在することを保証するための制約条件データを含む項目設計データを備えたデータベース設計データと,作成される関係データベースに登録されるべき登録データの入力を受付ける入力装置,
上記データベース設計データに含まれるデータのうち記述されるべきデータとその記述位置とを特定する記述をもつテンプレート・データを含むデータベース設計データ用スクリプト作成マクロ,および作成される関係データベースを構成するテーブルに含まれる項目中に,上記登録データを格納する登録データ用スクリプト・ファイルを作成するための登録データ用スクリプト作成マクロを記憶した記憶装置,および
上記記憶装置に記憶されているデータベース設計データ用スクリプト作成マクロおよび登録データ用スクリプト作成マクロを実行し,かつこれらのスクリプト作成マクロの実行によって生成されるスクリプト・ファイルを実行する処理装置を備え,
上記処理装置は,
上記データベース設計用スクリプト作成マクロを実行することによって,上記テンプレート・データ中の記述にしたがって,上記データベース設計データに含まれるデータをテンプレート・データの記述特定位置に記述して関係データベースを構築するためのテーブル作成スクリプト・ファイル,および参照データの存在の有無をチェックするための制約条件設定スクリプト・ファイルを生成し,
上記登録データ用スクリプト作成マクロを実行することによって,作成される関係データベースを構成するテーブルに含まれる項目中に登録データを格納するための登録データ用スクリプト・ファイルを生成し,
生成された上記テーブル作成スクリプト・ファイルを実行することによって,上記データベース・サイズ設計データに含まれるデータベース・サイズを有する関係データベースであって,上記テーブル設計データに含まれるテーブル名およびテーブル・サイズを持つテーブルを有し,上記テーブルが上記項目設計データに含まれる項目名および項目サイズを有している関係データベースを構築し,
生成された登録データ用スクリプト・ファイルを実行することによって,構築された関係データベースを構成するテーブルに含まれる項目に,上記登録データ格納し,
生成された制約条件設定スクリプト・ファイルを実行することによって,上記データベース設計データの項目設計データ中に含まれている上記制約条件データに基づいて,登録データが格納された関係データベースに対して一の項目のデータが他の項目のデータを参照する場合の上記他の項目のデータの存在の有無をチェックするものである
関係データベース構築装置。
At least database size design data including the database size of the relational database to be created, table design data including the table name and table size for each table constituting the relational database, and items included in the table Item design data including item name and item size, and constraint data to ensure that the data of the other item exists when the data of one item refers to the data of the other item An input device that accepts input of database design data and registration data to be registered in the created relational database ,
The database design data script creation macro including the template data having the description specifying the data to be described and the description position among the data included in the database design data , and the table constituting the relational database to be created A storage device storing a registration data script creation macro for creating a registration data script file for storing the registration data, among the included items ; and
A processing unit for executing a script creation macro for database design data and a script creation macro for registration data stored in the storage device, and executing a script file generated by executing the script creation macro;
The above processing equipment
By executing the database design script creation macro, in accordance with the description in the template data, the data included in the database design data is described at a specific location of the template data description , and a relational database is constructed. Generate a table creation script file and a constraint condition setting script file for checking the existence of reference data ,
By executing the above registered data script creation macro, a registration data script file for storing the registered data in the items included in the table constituting the created relational database is generated.
A relational database having a database size included in the database size design data by executing the generated table creation script file, and having a table name and a table size included in the table design data Build a relational database that has a table and the table has the item name and item size included in the item design data ,
By executing the generated registration data for the script file, the items included in the tables that comprise the constructed relational database to store the registration data,
By executing the generated constraint condition setting script file, the relational database storing the registration data is updated based on the constraint condition data included in the item design data of the database design data. in which items of data to check for the presence of data of the other items in the case of referring to the data of other items,
Relational database construction device.
入力装置が,少なくとも作成すべき関係データベースのデータベース・サイズを含むデータベース・サイズ設計データ,上記関係データベースを構成するテーブルのそれぞれについてのテーブル名およびテーブル・サイズを含むテーブル設計データ,上記テーブルに含まれる項目のそれぞれについての項目名および項目サイズ,ならびに一の項目のデータが他の項目のデータを参照する場合に上記他の項目のデータが存在することを保証するための制約条件データを含む項目設計データを備えたデータベース設計データと,作成される関係データベースに登録されるべき登録データの入力を受付け,
記憶装置に,上記データベース設計データに含まれるデータのうち記述されるべきデータとその記述位置とを特定する記述をもつテンプレート・データを含むデータベース設計データ用スクリプト作成マクロ,および作成される関係データベースを構成するテーブルに含まれる項目中に,上記登録データを格納する登録データ用スクリプト・ファイルを作成するための登録データ用スクリプト作成マクロを記憶させておき,
処理装置が,
上記データベース設計用スクリプト作成マクロを実行することによって,上記テンプレート・データ中の記述にしたがって,上記データベース設計データに含まれるデータをテンプレート・データの記述特定位置に記述して,関係データベースを作成するためのテーブル作成スクリプト・ファイル,および参照データの存在の有無をチェックするための制約条件設定スクリプト・ファイルを作成し,
上記登録データ用スクリプト作成マクロを実行することによって,作成される関係データベースを構成するテーブルに含まれる項目中に登録データを格納するための登録データ用スクリプト・ファイルを生成し,
生成された上記テーブル作成スクリプト・ファイルを実行することによって,上記データベース・サイズ設計データに含まれるデータベース・サイズを有する関係データベースであって,上記テーブル設計データに含まれるテーブル名およびテーブル・サイズを持つテーブルを有し,上記テーブルが上記項目設計データに含まれる項目名および項目サイズを有している関係データベースを構築し,
生成された登録データ用スクリプト・ファイルを実行することによって,構築された上記関係データベースを構成するテーブルに含まれる項目に上記登録データ格納し,
生成された上記制約条件設定スクリプト・ファイルを実行することによって,登録データが格納された関係データベースに対して上記データベース設計データの項目設計データ中に含まれている上記制約条件データに基づいて,一の項目のデータが他の項目のデータを参照する場合の上記他の項目のデータの存在の有無をチェックする,
関係データベース構築方法。
The input device includes at least the database size design data including the database size of the relational database to be created, the table design data including the table name and table size for each of the tables constituting the relational database, and included in the above table. Item design including item name and item size for each item, and constraint data to ensure that the other item's data exists when one item's data references other item's data and database design data having the data, the input of registration data to be registered in a relational database that is created reception,
A script for creating database design data including template data having a description for specifying the data to be described and the description position among the data included in the database design data and a relational database to be created are stored in the storage device. The registration data script creation macro for creating the registration data script file for storing the registration data is stored in the items included in the table to be configured .
The processing unit
To create a relational database by executing the database design script creation macro and describing the data included in the database design data at the specified location of the template data according to the description in the template data. Create a table creation script file and a constraint condition setting script file to check whether the reference data exists,
By executing the above registered data script creation macro, a registration data script file for storing the registered data in the items included in the table constituting the created relational database is generated.
A relational database having a database size included in the database size design data by executing the generated table creation script file, and having a table name and a table size included in the table design data Build a relational database that has a table and the table has the item name and item size included in the item design data,
By executing the generated registration data script file, the registration data is stored in the items included in the table constituting the constructed relational database ,
By executing the generated constraint condition setting script file, the relational database storing the registered data is changed based on the constraint condition data included in the item design data of the database design data. Check whether the data of the other item exists when the data of the other item refers to the data of the other item,
Relational database construction method.
JP2002153236A 2002-05-28 2002-05-28 Relational database construction apparatus and method Expired - Fee Related JP4112282B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2002153236A JP4112282B2 (en) 2002-05-28 2002-05-28 Relational database construction apparatus and method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2002153236A JP4112282B2 (en) 2002-05-28 2002-05-28 Relational database construction apparatus and method

Publications (2)

Publication Number Publication Date
JP2003345594A JP2003345594A (en) 2003-12-05
JP4112282B2 true JP4112282B2 (en) 2008-07-02

Family

ID=29770318

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2002153236A Expired - Fee Related JP4112282B2 (en) 2002-05-28 2002-05-28 Relational database construction apparatus and method

Country Status (1)

Country Link
JP (1) JP4112282B2 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7627854B2 (en) * 2006-01-12 2009-12-01 International Business Machines Corporation Graphical aid for generating object setup scripts
JP5028894B2 (en) * 2006-07-18 2012-09-19 富士通株式会社 Computer-executable program for causing a computer to perform join processing for joining a plurality of tables constituting a database
JP2008129844A (en) * 2006-11-21 2008-06-05 Nec Informatec Systems Ltd Stored procedure generation device, method, program, and system
JP7060797B2 (en) 2018-05-28 2022-04-27 富士通株式会社 Table generation method, table generator and table generation program
CN109271199B (en) * 2018-09-11 2023-01-10 航天信息软件技术有限公司 Method and system for database continuous integration and script file management

Also Published As

Publication number Publication date
JP2003345594A (en) 2003-12-05

Similar Documents

Publication Publication Date Title
KR102452425B1 (en) Methods and apparatus for efficiently implementing a fast-copyable database
JP6419633B2 (en) Search system
US6185569B1 (en) Linked data structure integrity verification system which verifies actual node information with expected node information stored in a table
JP4799936B2 (en) Conditional snapshot acquisition method and system
US7966353B2 (en) Method and system for flexibly providing shared access to non-data pool file systems
WO2020211236A1 (en) Read-write conflict resolution method and apparatus employing b+ tree and storage medium
US20050015674A1 (en) Method, apparatus, and program for converting, administering, and maintaining access control lists between differing filesystem types
US8234317B1 (en) Auto-committing files to immutable status based on a change log of file system activity
JP2006134214A (en) File version management method and computing system
JP2005302038A (en) Method and system for renaming consecutive key in b-tree
WO2005055093A2 (en) System and method for generating extensible file system metadata and file system content processing
KR20070034916A (en) Systems and Methods for Versioning-Based Triggers
JP4778500B2 (en) DATABASE SYSTEM AND DATABASE SYSTEM CONTROL METHOD
WO2020119143A1 (en) Database deleted record recovery method and system
JP3868171B2 (en) Document digital signature management method and document management apparatus
JP4112282B2 (en) Relational database construction apparatus and method
JP3752945B2 (en) DIRECTORY SEARCH SYSTEM AND METHOD, COMPUTER-READABLE RECORDING MEDIUM CONTAINING DIRECTORY SEARCH PROGRAM
KR101135629B1 (en) Method and apparatus for preventing autorun of portable USB storage
US8775746B2 (en) Information processing system and method
JP3636773B2 (en) Information processing device for database check
US20100205197A1 (en) Two-valued logic database management system with support for missing information
JP5783010B2 (en) Index management program, index management device, and search system
JP4825504B2 (en) Data registration / retrieval system and data registration / retrieval method
Yarabarla Learning Apache Cassandra
Schneller et al. MySQL admin cookbook

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20050530

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20070905

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20070918

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20071119

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20071211

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20080208

A911 Transfer to examiner for re-examination before appeal (zenchi)

Free format text: JAPANESE INTERMEDIATE CODE: A911

Effective date: 20080214

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20080408

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20080409

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110418

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20140418

Year of fee payment: 6

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees