JP2004126680A - Sql masking type database access method and computer program - Google Patents
Sql masking type database access method and computer program Download PDFInfo
- Publication number
- JP2004126680A JP2004126680A JP2002286077A JP2002286077A JP2004126680A JP 2004126680 A JP2004126680 A JP 2004126680A JP 2002286077 A JP2002286077 A JP 2002286077A JP 2002286077 A JP2002286077 A JP 2002286077A JP 2004126680 A JP2004126680 A JP 2004126680A
- Authority
- JP
- Japan
- Prior art keywords
- data
- sql
- input
- management information
- database
- 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.)
- Pending
Links
Images
Abstract
Description
【0001】
【発明の属する技術分野】
本発明は、リレーショナルデータベースのアクセス方法、つまりリレーショナルデータベースマネージメントシステム(RDBMS)におけるデータの参照、更新、追加及び削除を行う方法に関する。
【0002】
【従来の技術】
リレーショナルデータベースに対してデータの参照、更新、追加及び削除といったアクセスを行う場合に、通常はSQLと呼ばれるリレーショナルデータベースの問い合わせ及び操作のための言語が使用される。SQL(Structured Query Language)は、米国IBM社が開発した構造化照会言語である。
【0003】
しかし、SQLを使いこなすには、SQLを学習して理解する必要があり、誰もが自由にSQL文を記述できるわけではない。そこで、SQL文を自動的に作成するツールや簡易言語も開発されている(例えば、特開平5−2611号公報参照)。しかし、これらを使用するにもSQLに関する知識や理解がある程度必要である。また、そのようなツールや簡易言語は特定のデータベース用に開発されることが多く、汎用的なものではない。
【0004】
図17は、従来のデータベースのテーブルアクセス方法を示す概念図である。データベースのテーブルアクセス処理をSQL文で記述して高級言語中に組み込む場合に、従来は図17に示すようにテーブルごとにAPI(プリケーションプログラムインタフェース)を作成し、オブジェクト化(インスタンスの作成)を行う必要がある。
【0005】
【発明が解決しようとする課題】
本発明は上記のような課題に鑑みてなされたものであり、SQLをまったく知らない人でもリレーショナルデータベースに容易にアクセスすることができ、しかもデータベースを構成するテーブル毎にアクセスプログラムを作成する必要が無いSQL隠蔽型のデータベースアクセス方法及びコンピュータプログラムを提供することを目的とする。
【0006】
【課題を解決するための手段】
本発明によるSQL隠蔽型データベースアクセス方法は、リレーショナルデータベースのテーブルのデータ参照、データ更新、データ挿入、及びデータ削除を簡易に行うためのデータベースアクセス方法であって、入力画面からアクセス条件を入力するステップと、入力されたアクセス条件にしたがって管理情報テーブルを生成するステップと、入力画面から要求アクションを入力するステップと、入力された要求アクションと前記管理情報テーブルから読み出したデータに基づいてSQL文を自動生成するステップと、前記SQL文をリレーショナルデータベースに対して発行すると共に検索結果を取得するステップと、取得した検索結果をメモリに展開するステップと、前記メモリから読み出した検索結果を表示画面に一覧表示するステップとを有することを特徴とする。
【0007】
このような方法によれば、SQLをまったく知らない人でもリレーショナルデータベースに容易にアクセスすることができ、しかもデータベースを構成するテーブル毎にアクセスプログラムを作成する必要が無い。所定の情報を管理情報テーブルに登録しておけば、複数種類のSQL文に使用することができる。また、複数のSQL文をRDBMS(リレーショナルデータベースマネージメントシステム)に発行する際に、RDBMSはバッチ処理によって検索結果を一括して返せばよいので、オーバヘッドを低減することができる。
【0008】
前記管理情報テーブルには、好ましくは、テーブル名、検索カラム情報、設定データ情報、絞込キー情報及びソートカラム情報が登録される。SQL文の種類に応じて、これらの情報の一部又は全部が使用される。
【0009】
また、本発明によるコンピュータプログラムは、リレーショナルデータベースのテーブルのデータ参照、データ更新、データ挿入、及びデータ削除を簡易に行うためのSQL隠蔽型データベースアクセス方法を実現するためにコンピュータに実行させるコンピュータプログラムであって、入力画面からアクセス条件を入力するステップと、入力されたアクセス条件にしたがって管理情報テーブルを生成するステップと、入力画面から要求アクションを入力するステップと、入力された要求アクションと前記管理情報テーブルから読み出したデータに基づいてSQL文を自動生成するステップと、前記SQL文をリレーショナルデータベースに対して発行すると共に検索結果を取得するステップと、取得した検索結果をメモリに展開するステップと、前記メモリから読み出した検索結果を表示画面に一覧表示するステップとを含む処理をコンピュータに実行させることを特徴とする。
【0010】
このようなコンピュータプログラムをパーソナルコンピュータ等のコンピュータシステムにインストールして実行させることにより、上記のようなSQL隠蔽型データベースアクセス方法による効果を奏することができる。
【0011】
このようなコンピュータプログラムは、例えばCD−ROMのようなコンピュータ読み取り可能な記録媒体に記録された状態で供給され、記録媒体からコンピュータにインストールされ実行される。あるいはネットワークに接続されたサーバ等の他のコンピュータからダウンロードしてインストールし、又は逐次実行することも可能である。
【0012】
【発明の実施の形態】
以下、本発明の実施形態を図面に基づいて説明する。
【0013】
図1は、本発明の実施形態に係るデータベースアクセス方法を実現するためのコンピュータシステムの構成例を示すブロック図である。コンピュータシステム1は、ネットワーク4への接続機能を有し、ネットワーク4を介してRDBMS(リレーショナルデータベースマネージメントシステム)2にアクセスすることができる。コンピュータシステム1には、OS(オペレーティングシステム)や各種アプリケーションソフトウェアと共に、RDBMS(以下、単にデータベースということもある)2にアクセスしてデータの参照、更新、追加及び削除を行うためのコンピュータプログラムがインストールされる。このコンピュータプログラムは、例えばCD−ROM(光ディスク)のような記録媒体6に記録された状態で供給され、読取装置7を介してコンピュータ本体10の補助記憶装置(HDD)13にインストールされる。
【0014】
補助記憶装置13にインストールされたコンピュータプログラムは主メモリ12にロードされ、処理装置14によって実行される。コンピュータ本体10は、主メモリ12、補助記憶装置13及び処理装置14の他に、入力処理部15a、表示処理部16a及び通信部17を備えている。入力処理部15aにはキーボード、マウス等の入力装置15が接続され、表示処理部16aにはCRT(陰極線管)、LCD(液晶表示装置)等の表示装置16が接続されている。通信部17は、ネットワーク4に接続され、コンピュータシステム1はネットワーク4を介してデータベース2等に接続されている。
【0015】
図2は、本発明の実施形態に係るデータベースアクセス方法を示す概念図であり、図17に示した従来の概念図に対応するものである。この実施形態の構成では、テーブルアクセス処理が汎用化されており、データベースのテーブル21ごとにAPI(プリケーションプログラムインタフェース)を作成する必要がない。
【0016】
図2において、SQL文自動生成部23とSQL文発行及び検索結果取得部24はプログラムによって構成される。表示装置16に表示された入力画面26から入力された検索テーブル名、検索項目、検索条件等のアクセス条件は補助記憶装置13に記憶される汎用テーブル(管理情報テーブルということもある)22に登録される。また、入力された参照、更新、追加及び削除の要求アクションはSQL文自動生成部23に直接与えられる。
【0017】
SQL文自動生成部23は、汎用テーブル22から読み込んだデータと、入力された要求アクションとにしたがってSQL文を自動生成し、SQL文発行及び検索結果取得部24に与える。SQL文発行及び検索結果取得部24は、リレーショナルデータベースの各テーブル21に対してSQL文を発行し、検索結果を取得する。その結果データはメモリ25(主メモリ12)に一旦保存された後、まとめて表示出力され、表示装置16の表示画面27に表示される。
【0018】
図3は、汎用テーブル(管理情報テーブル)22の構成例を示す図である。本実施形態のSQL隠蔽型データベースアクセス方法では、ユーザからの各種手続によって得られた情報を図3に示すような汎用テーブル22で管理する。図3において、テーブル名は1情報のみであるが、他の情報(検索カラム情報、設定データ情報等)は複数の情報となる。各管理情報の内容は以下の通りである。
【0019】
テーブル名はデータベースアクセスの対象となるテーブル名である。検索カラム情報に記されるカラム名は検索対象のカラム名である。設定データ情報にはカラム名、カラム型及びカラム設定データが記される。カラム名は更新したいデータや追加したいデータのカラム名である。カラム型は更新したいデータや追加したいデータのカラム型である。カラム設定データは更新したいデータや追加したいデータのデータ値そのものである。
【0020】
絞込キー情報にはカラム名、カラム型、カラム設定データ、判定条件及び論理条件が記される。カラム名は検索、更新又は削除時に絞込対象となるカラム名である。カラム型は検索、更新又は削除時に絞込対象となるカラム型である。カラム設定データは検索、更新又は削除時に絞込対象となるデータの値そのものである。判定条件はデータを絞込むための同等(=)、大小(>、<、>=、<=)等の条件である。論理条件は、複数の判定条件の論理積(AND)又は論理和(OR)の条件である。
【0021】
ソートカラム情報にはカラム名及びソート種別が記される。カラム名はソート対象となるカラム名である。ソート種別は昇順または降順の区別である。
【0022】
これらの情報は、SQL文(SELECT、INSERT、UPDATE及びDELETEのDML文)の自動生成を行う際に複数のDML(データベース操作言語)文の間で共通に使用できるものと各DML文に固有のものとに分けることができる。どの情報がどのDML文を自動生成させる際に必要なのかを次に一覧で示す。
【0023】
図4は、各DML文の自動生成に必要な情報の一覧を示す図表である。図4において、マーク「○」が必要な情報を示し、マーク「−」が不要な情報を示している。また、図5は、アクションの選択用画面を例示する図である。入力画面26のうちのアクション選択用画面において、図5に示すように、参照、更新、追加及び削除の要求アクションを示す4つのボタンが表示される。ユーザはこれらのボタンのいずれかを押下することによって要求アクションを選択する。参照ボタンを押下すればSELECT文が生成され、更新ボタンを押下すればUPDATE文が生成され、追加ボタンを押下すればINSERT文が生成され、削除ボタンを押下すればDELETE文が生成される。
【0024】
図6は、本実施形態のデータベースアクセス方法におけるデータの流れを示す図である。また、これに対応する処理のフローチャートを図7に示す。ステップ#101において、入力画面(標準入力も含む)より、問い合わせる情報を入力すると、次のステップ#102において、入力された情報が汎用テーブル22に設定される。
【0025】
ステップ#103では、要求アクションに相当するDML文が選択される。つまり、上述のようにしてユーザに選択された要求アクションに相当するDML文が選択される。図5に示したようなアクション選択用画面からユーザが要求アクションを選択するタイミングは、ステップ#101及びステップ#103の処理によって汎用テーブル22に情報が設定された後に行う。
【0026】
次のステップ#104において、汎用テーブル22より情報が読み込まれ、DML文が編集され、SQL文が生成される。続くステップ#105においてSQL文がデータベース2に対して発行され、データベース2から検索結果が一括で返される。ステップ#106で一括して取得された検索結果は、ステップ#107でメモリ25に一旦展開(記憶)される。そして、ステップ#108で、メモリ25から読み出された検索結果がまとめて表示出力され、表示装置16の表示画面27に表示される。
【0027】
以下、具体的な例を挙げて本実施形態のデータベースアクセス方法について説明を加える。図8は、データベースの一例として商品テーブルを示す図表である。図8に例示するデータベース(商品テーブル)の参照(SELECT)、追加(INSERT)、更新(UPDATE)及び削除(DELETE)を例にとって順番に説明する。
【0028】
まず、データベースの参照のために、SELECT文を自動生成するには、「テーブル名」、「検索カラム情報」、「絞込キー情報」及び「ソートカラム情報」の管理情報を用いる。例えば、商品テーブルの中から、原価が7円以上の鉛筆の商品コード、商品名及び価格を商品コードの昇順に参照したい場合に作成すべきSQL文は、「SELECT 商品コード,商品名,価格 FROM 商品 WHERE 原価>7 AND 商品名=’鉛筆’ ORDER BY 商品コード ASC」となる。
【0029】
図9は、データベースの商品テーブルを参照するための入力情報の例を示す図である。また、図10は、入力情報にしたがって登録された管理情報テーブル(汎用テーブル)22と自動生成されるSELECT文31との関係を示す図である。この例では、図9の情報を入力画面26から入力することにより、図10に示すような管理情報テーブル22が登録され、SELECT文31が自動生成される。
【0030】
次に、データベースへのデータ追加のために、INSERT文を自動生成するには、「テーブル名」及び「設定データ情報」の管理情報を用いる。例えば、データベースの商品テーブルに、商品コード:21、商品名:鉛筆2B、価格:10円、原価:8円の商品情報を追加する場合に作成すべきSQL文は、「INSERT INTO 商品 (商品コード,商品名,価格,原価) VALUES(21, ’鉛筆2B’,10,8)」となる。
【0031】
図11は、データベースの商品テーブルにデータを追加するための入力情報の例を示す図である。また、図12は、入力情報にしたがって登録された管理情報テーブル(汎用テーブル)22と自動生成されるINSERT文32との関係を示す図である。この例では、図11の情報を入力画面26から入力することにより、図12に示すような管理情報テーブル22が登録され、INSERT文32が自動生成される。
【0032】
次に、データベースのデータ更新のために、UPDATE文を自動生成するには、「テーブル名」、「設定データ情報」及び「絞込キー情報」の管理情報を用いる。例えば、鉛筆HBの価格が9円になり、原価が5円になったときに、データベースのデータ更新のために作成すべきSQL文は、「UPDATE 商品 SET 価格=9,原価=5 WHERE 商品名=’鉛筆HB’」となる。
【0033】
図13は、データベースの商品テーブルを更新するための入力情報の例を示す図である。また、図14は、入力情報にしたがって登録された管理情報テーブル(汎用テーブル)22と自動生成されるUPDATE文33との関係を示す図である。この例では、図13の情報を入力画面26から入力することにより、図14に示すような管理情報テーブル22が登録され、UPDATE文33が自動生成される。
【0034】
次に、データベースのデータ削除のために、DELETE文を自動生成するには、「テーブル名」及び「絞込キー情報」の管理情報を用いる。例えば、原価が8円以上の鉛筆のデータを削除する場合に作成すべきSQL文は、「DELETE FROM 商品 WHERE 原価>=8 AND 商品名=’鉛筆’」となる。
【0035】
図15は、データベースの商品テーブルからデータを削除するための入力情報の例を示す図である。また、図16は、入力情報にしたがって登録された管理情報テーブル(汎用テーブル)22と自動生成されるDELETE文34との関係を示す図である。この例では、図15の情報を入力画面26から入力することにより、図16に示すような管理情報テーブル22が登録され、DELETE文34が自動生成される。
【0036】
なお、上記の例において、管理情報テーブル(汎用テーブル)に登録したデータは、変更が無い限りSQL文が変わっても共通に使用することができる。また、一部のデータを変更する場合は、その変更する個所のデータのみを入力すればよい。このように、管理情報テーブル(汎用テーブル)に情報を一度登録しておけば、複数種類のSQL文に使用することができる。
【0037】
また、上記の実施形態で示した具体的な処理内容や処理手順は一例に過ぎない。本発明は上記実施形態に限定されず種々の形態で実施することが可能である。
【0038】
(付記1)リレーショナルデータベースのテーブルのデータ参照、データ更新、データ挿入、及びデータ削除を簡易に行うためのSQL隠蔽型データベースアクセス方法であって、
入力画面からアクセス条件を入力するステップと、
入力されたアクセス条件にしたがって管理情報テーブルを生成するステップと、
入力画面から要求アクションを入力するステップと、
入力された要求アクションと前記管理情報テーブルから読み出したデータに基づいてSQL文を自動生成するステップと、
前記SQL文をリレーショナルデータベースに対して発行すると共に検索結果を取得するステップと、
取得した検索結果をメモリに展開するステップと、
前記メモリから読み出した検索結果を表示画面に一覧表示するステップと
を有することを特徴とするSQL隠蔽型データベースアクセス方法。
【0039】
(付記2)前記管理情報テーブルには、テーブル名、検索カラム情報、設定データ情報、絞込キー情報及びソートカラム情報が登録されることを特徴とする付記1記載のSQL隠蔽型データベースアクセス方法。
【0040】
(付記3)リレーショナルデータベースのテーブルのデータ参照、データ更新、データ挿入、及びデータ削除を簡易に行うためのSQL隠蔽型データベースアクセス方法を実現するためにコンピュータに実行させるコンピュータプログラムであって、
入力画面からアクセス条件を入力するステップと、
入力されたアクセス条件にしたがって管理情報テーブルを生成するステップと、
入力画面から要求アクションを入力するステップと、
入力された要求アクションと前記管理情報テーブルから読み出したデータに基づいてSQL文を自動生成するステップと、
前記SQL文をリレーショナルデータベースに対して発行すると共に検索結果を取得するステップと、
取得した検索結果をメモリに展開するステップと、
前記メモリから読み出した検索結果を表示画面に一覧表示するステップと
を含む処理をコンピュータに実行させることを特徴とするコンピュータプログラム。
【0041】
(付記4)前記管理情報テーブルには、テーブル名、検索カラム情報、設定データ情報、絞込キー情報及びソートカラム情報が登録されることを特徴とする付記2記載のコンピュータプログラム。
【0042】
(付記5)リレーショナルデータベースのテーブルのデータ参照、データ更新、データ挿入、及びデータ削除を簡易に行うためのSQL隠蔽型データベースアクセス方法を実現するためにコンピュータに実行させるコンピュータプログラムを記録したコンピュータ読取可能な記録媒体であって、前記コンピュータプログラムが
入力画面からアクセス条件を入力するステップと、
入力されたアクセス条件にしたがって管理情報テーブルを生成するステップと、
入力画面から要求アクションを入力するステップと、
入力された要求アクションと前記管理情報テーブルから読み出したデータに基づいてSQL文を自動生成するステップと、
前記SQL文をリレーショナルデータベースに対して発行すると共に検索結果を取得するステップと、
取得した検索結果をメモリに展開するステップと、
前記メモリから読み出した検索結果を表示画面に一覧表示するステップと
を含むことを特徴とする記録媒体。
【0043】
(付記6)リレーショナルデータベースのテーブルのデータ参照、データ更新、データ挿入、及びデータ削除を簡易に行うためのSQL隠蔽型データベースアクセス方法を実現するためにコンピュータに実行させるコンピュータプログラムを記録したコンピュータ読取可能な記録媒体であって、前記コンピュータプログラムが
入力画面からアクセス条件を入力するステップと、
入力されたアクセス条件にしたがって管理情報テーブルを生成するステップと、
入力画面から要求アクションを入力するステップと、
入力された要求アクションと前記管理情報テーブルから読み出したデータに基づいてSQL文を自動生成するステップと、
前記SQL文をリレーショナルデータベースに対して発行すると共に検索結果を取得するステップと、
取得した検索結果をメモリに展開するステップと、
前記メモリから読み出した検索結果を記憶装置に出力するステップと、
メモリ間のやり取りを行うステップと、
表示画面に一覧表示するステップと
を含むことを特徴とする記録媒体。
【0044】
【発明の効果】
以上に説明したように、本発明のSQL隠蔽型のデータベースアクセス方法及びコンピュータプログラムによれば、SQLをまったく知らない人でもリレーショナルデータベースに容易にアクセスすることができ、しかもデータベースを構成するテーブル毎にアクセスプログラムを作成する必要が無い。所定の情報を管理情報テーブルに登録しておけば、複数種類のSQL文に使用することができる。また、複数のSQL文をRDBMSに発行する際に、RDBMSはバッチ処理によって検索結果を一括して返せばよいので、オーバヘッドを低減することができる。
【図面の簡単な説明】
【図1】本発明の実施形態に係るデータベースアクセス方法を実現するためのコンピュータシステムの構成例を示すブロック図である。
【図2】本発明の実施形態に係るデータベースアクセス方法を示す概念図である。
【図3】汎用テーブル(管理情報テーブル)の構成例を示す図である。
【図4】各DML文の自動生成に必要な情報の一覧を示す図表である。
【図5】アクションの選択用画面を例示する図である。
【図6】本実施形態のデータベースアクセス方法におけるデータの流れを示す図である。
【図7】図6のデータの流れに対応する処理のフローチャートである。
【図8】データベースの一例として商品テーブルを示す図表である。
【図9】データベースの商品テーブルを参照するための入力情報の例を示す図である。
【図10】入力情報にしたがって登録された管理情報テーブル(汎用テーブル)と自動生成されるSELECT文との関係を示す図である。
【図11】データベースの商品テーブルにデータを追加するための入力情報の例を示す図である。
【図12】入力情報にしたがって登録された管理情報テーブル(汎用テーブル)と自動生成されるINSERT文との関係を示す図である。
【図13】データベースの商品テーブルを更新するための入力情報の例を示す図である。
【図14】入力情報にしたがって登録された管理情報テーブル(汎用テーブル)と自動生成されるUPDATE文との関係を示す図である。
【図15】データベースの商品テーブルからデータを削除するための入力情報の例を示す図である。
【図16】入力情報にしたがって登録された管理情報テーブル(汎用テーブル)と自動生成されるDELETE文との関係を示す図である。
【図17】従来のデータベースのテーブルアクセス方法を示す概念図である。
【符号の説明】
1 コンピュータシステム
2 RDBMS(データベース)
6 記録媒体
7 読取装置
22 汎用テーブル(管理情報テーブル)
23 SQL文自動生成部
24 SQL文発行及び検索結果取得部
25 メモリ[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a relational database access method, that is, a method of referring, updating, adding and deleting data in a relational database management system (RDBMS).
[0002]
[Prior art]
When accessing a relational database such as referring to, updating, adding, and deleting data, a language for querying and operating the relational database, usually called SQL, is used. SQL (Structured Query Language) is a structured query language developed by IBM Corporation in the United States.
[0003]
However, in order to make full use of SQL, it is necessary to learn and understand SQL, and not everyone can freely write an SQL sentence. Therefore, a tool and a simple language for automatically creating an SQL sentence have been developed (for example, see Japanese Patent Application Laid-Open No. 5-2611). However, their use also requires some knowledge and understanding of SQL. Also, such tools and simple languages are often developed for specific databases and are not universal.
[0004]
FIG. 17 is a conceptual view showing a conventional database table access method. Conventionally, when a database table access process is described in an SQL statement and incorporated in a high-level language, an API (application program interface) is created for each table as shown in FIG. There is a need to do.
[0005]
[Problems to be solved by the invention]
SUMMARY OF THE INVENTION The present invention has been made in view of the above-described problems, and even a person who has no knowledge of SQL can easily access a relational database, and it is necessary to create an access program for each table constituting the database. It is an object of the present invention to provide a SQL concealment type database access method and a computer program without any.
[0006]
[Means for Solving the Problems]
An SQL concealed database access method according to the present invention is a database access method for easily performing data reference, data update, data insertion, and data deletion of a table of a relational database, and a step of inputting an access condition from an input screen. Generating a management information table according to the input access condition; inputting a request action from an input screen; automatically generating an SQL statement based on the input request action and data read from the management information table. Generating, issuing the SQL statement to a relational database and obtaining a search result, expanding the obtained search result in a memory, and displaying a list of the search results read from the memory on a display screen To do And having a flop.
[0007]
According to such a method, even a person who has no knowledge of SQL can easily access the relational database, and it is not necessary to create an access program for each table constituting the database. If predetermined information is registered in the management information table, it can be used for a plurality of types of SQL statements. Also, when issuing a plurality of SQL statements to an RDBMS (relational database management system), the RDBMS only needs to return search results collectively by batch processing, so that overhead can be reduced.
[0008]
Preferably, a table name, search column information, setting data information, narrowing key information, and sort column information are registered in the management information table. Some or all of this information is used depending on the type of the SQL sentence.
[0009]
Further, a computer program according to the present invention is a computer program executed by a computer to realize an SQL concealed database access method for easily performing data reference, data update, data insertion, and data deletion of a table of a relational database. Inputting an access condition from an input screen, generating a management information table in accordance with the input access condition, inputting a requested action from the input screen, inputting the requested action and the management information Automatically generating an SQL statement based on the data read from the table, issuing the SQL statement to a relational database and obtaining a search result, and expanding the obtained search result in a memory. When, characterized in that to execute a process including the step of displaying a list of search results read from the memory on the display screen to the computer.
[0010]
By installing such a computer program in a computer system such as a personal computer and executing the same, the effects of the above SQL concealed database access method can be achieved.
[0011]
Such a computer program is supplied in a state of being recorded on a computer-readable recording medium such as a CD-ROM, and is installed on a computer from the recording medium and executed. Alternatively, it can be downloaded from another computer such as a server connected to a network, installed, and executed sequentially.
[0012]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, embodiments of the present invention will be described with reference to the drawings.
[0013]
FIG. 1 is a block diagram showing a configuration example of a computer system for realizing a database access method according to an embodiment of the present invention. The
[0014]
The computer program installed in the
[0015]
FIG. 2 is a conceptual diagram showing a database access method according to the embodiment of the present invention, and corresponds to the conventional conceptual diagram shown in FIG. In the configuration of this embodiment, the table access processing is generalized, and it is not necessary to create an API (application program interface) for each table 21 of the database.
[0016]
In FIG. 2, the SQL statement
[0017]
The SQL sentence
[0018]
FIG. 3 is a diagram showing a configuration example of the general-purpose table (management information table) 22. In the SQL concealment type database access method of the present embodiment, information obtained by various procedures from the user is managed by a general-purpose table 22 as shown in FIG. In FIG. 3, the table name is only one information, but other information (search column information, setting data information, etc.) is a plurality of information. The contents of each management information are as follows.
[0019]
The table name is the name of the table to be accessed by the database. The column name described in the search column information is the column name of the search target. In the setting data information, a column name, a column type, and column setting data are described. The column name is the column name of the data to be updated or added. The column type is the column type of the data you want to update or add. The column setting data is the data value of the data to be updated or the data to be added.
[0020]
The narrowing key information includes a column name, a column type, column setting data, a judgment condition, and a logical condition. The column name is a column name to be narrowed down at the time of search, update or deletion. The column type is a column type to be narrowed down when searching, updating, or deleting. The column setting data is the value of the data to be narrowed down at the time of search, update or deletion. The determination condition is a condition such as equality (=), large and small (>, <,> =, <=) for narrowing down data. The logical condition is a condition of a logical product (AND) or a logical sum (OR) of a plurality of determination conditions.
[0021]
A column name and a sort type are described in the sort column information. The column name is the column name to be sorted. The sort type is an ascending order or a descending order.
[0022]
These pieces of information can be used in common among a plurality of DML (database operation language) statements when performing automatic generation of SQL statements (SELECT, INSERT, UPDATE, and DELETE DML statements) and unique to each DML statement. Can be divided into things. The following list shows which information is necessary for automatically generating which DML sentence.
[0023]
FIG. 4 is a chart showing a list of information necessary for automatically generating each DML sentence. In FIG. 4, a mark “「 ”indicates necessary information, and a mark“ − ”indicates unnecessary information. FIG. 5 is a diagram exemplifying an action selection screen. On the action selection screen of the
[0024]
FIG. 6 is a diagram showing a data flow in the database access method of the present embodiment. FIG. 7 shows a flowchart of the corresponding process. In
[0025]
In
[0026]
In the
[0027]
Hereinafter, the database access method of the present embodiment will be described with a specific example. FIG. 8 is a chart showing a product table as an example of a database. Reference (SELECT), addition (INSERT), update (UPDATE), and deletion (DELETE) of the database (product table) illustrated in FIG. 8 will be sequentially described as an example.
[0028]
First, in order to automatically generate a SELECT statement for referring to a database, management information of “table name”, “search column information”, “narrowing key information”, and “sort column information” is used. For example, an SQL statement to be created when referring to the product code, product name, and price of a pencil with a cost of 7 yen or more from the product table in ascending order of the product code is “SELECT product code, product name, price FROM Product WHERE Cost> 7 AND Product name = “Pencil” ORDER BY Product code ASC ”.
[0029]
FIG. 9 is a diagram illustrating an example of input information for referring to a product table in a database. FIG. 10 is a diagram showing the relationship between the management information table (general-purpose table) 22 registered in accordance with the input information and the automatically generated
[0030]
Next, to automatically generate an INSERT statement for adding data to the database, management information of “table name” and “setting data information” is used. For example, when adding product information of product code: 21, product name: pencil 2B, price: 10 yen, cost: 8 yen to the product table of the database, the SQL statement to be created is “INSERT INTO product (product code , Product name, price, cost) VALUES (21, 'pencil 2B', 10, 8) ".
[0031]
FIG. 11 is a diagram illustrating an example of input information for adding data to the product table of the database. FIG. 12 is a diagram showing the relationship between the management information table (general-purpose table) 22 registered in accordance with the input information and the automatically generated
[0032]
Next, in order to automatically generate an UPDATE statement for updating data in the database, management information of “table name”, “setting data information”, and “narrowing key information” is used. For example, when the price of the pencil HB becomes 9 yen and the cost becomes 5 yen, the SQL statement to be created for updating the data in the database is “UPDATE product SET price = 9, cost = 5 WHERE product name = 'Pencil HB'.
[0033]
FIG. 13 is a diagram illustrating an example of input information for updating the product table of the database. FIG. 14 is a diagram showing the relationship between the management information table (general-purpose table) 22 registered in accordance with the input information and the
[0034]
Next, in order to automatically generate a DELETE statement for deleting data in the database, management information of “table name” and “narrowing key information” is used. For example, an SQL statement to be created when data of a pencil with a cost of 8 yen or more is to be deleted is “DELETE FROM product WHERE cost> = 8 AND product name =“ pencil ””.
[0035]
FIG. 15 is a diagram illustrating an example of input information for deleting data from the product table of the database. FIG. 16 is a diagram showing the relationship between the management information table (general-purpose table) 22 registered according to the input information and the
[0036]
In the above example, the data registered in the management information table (general-purpose table) can be used in common even if the SQL statement changes as long as there is no change. When a part of data is to be changed, only the data of the part to be changed need be input. Thus, once information is registered in the management information table (general-purpose table), it can be used for a plurality of types of SQL statements.
[0037]
In addition, the specific processing contents and processing procedures described in the above embodiment are merely examples. The present invention is not limited to the above embodiments, but can be implemented in various forms.
[0038]
(Supplementary Note 1) An SQL concealed database access method for easily performing data reference, data update, data insertion, and data deletion of a table of a relational database,
Inputting access conditions from an input screen;
Generating a management information table according to the input access condition;
Inputting a request action from an input screen;
Automatically generating an SQL statement based on the input requested action and data read from the management information table;
Issuing the SQL statement to a relational database and obtaining a search result;
Expanding the obtained search results in a memory;
Displaying a list of search results read from the memory on a display screen.
[0039]
(Supplementary note 2) The SQL concealment type database access method according to
[0040]
(Supplementary Note 3) A computer program executed by a computer to implement an SQL concealed database access method for easily performing data reference, data update, data insertion, and data deletion of a table of a relational database,
Inputting access conditions from an input screen;
Generating a management information table according to the input access condition;
Inputting a request action from an input screen;
Automatically generating an SQL statement based on the input requested action and data read from the management information table;
Issuing the SQL statement to a relational database and obtaining a search result;
Expanding the obtained search results in a memory;
Causing a computer to execute a process including a step of displaying a list of search results read from the memory on a display screen.
[0041]
(Supplementary note 4) The computer program according to supplementary note 2, wherein a table name, search column information, setting data information, narrowing key information, and sort column information are registered in the management information table.
[0042]
(Supplementary Note 5) Computer readable recording a computer program to be executed by a computer to realize an SQL concealed database access method for easily referencing data, updating data, inserting data, and deleting data in a table of a relational database Recording medium, wherein the computer program inputs an access condition from an input screen,
Generating a management information table according to the input access condition;
Inputting a request action from an input screen;
Automatically generating an SQL statement based on the input requested action and data read from the management information table;
Issuing the SQL statement to a relational database and obtaining a search result;
Expanding the obtained search results in a memory;
Displaying a list of search results read from the memory on a display screen.
[0043]
(Supplementary Note 6) Computer-readable recording a computer program to be executed by a computer to realize an SQL concealed database access method for easily performing data reference, data update, data insertion, and data deletion of a table of a relational database Recording medium, wherein the computer program inputs an access condition from an input screen,
Generating a management information table according to the input access condition;
Inputting a request action from an input screen;
Automatically generating an SQL statement based on the input requested action and data read from the management information table;
Issuing the SQL statement to a relational database and obtaining a search result;
Expanding the obtained search results in a memory;
Outputting a search result read from the memory to a storage device;
Communicating between the memories;
Displaying a list on a display screen.
[0044]
【The invention's effect】
As described above, according to the SQL concealment type database access method and the computer program of the present invention, even a person who has no knowledge of SQL can easily access the relational database, and furthermore, each table constituting the database has There is no need to create an access program. If predetermined information is registered in the management information table, it can be used for a plurality of types of SQL statements. Further, when issuing a plurality of SQL statements to the RDBMS, the RDBMS only needs to return the search results collectively by batch processing, so that the overhead can be reduced.
[Brief description of the drawings]
FIG. 1 is a block diagram showing a configuration example of a computer system for realizing a database access method according to an embodiment of the present invention.
FIG. 2 is a conceptual diagram illustrating a database access method according to an embodiment of the present invention.
FIG. 3 is a diagram illustrating a configuration example of a general-purpose table (management information table).
FIG. 4 is a table showing a list of information necessary for automatically generating each DML sentence.
FIG. 5 is a diagram illustrating an action selection screen.
FIG. 6 is a diagram showing a data flow in the database access method of the embodiment.
FIG. 7 is a flowchart of a process corresponding to the data flow of FIG. 6;
FIG. 8 is a chart showing a product table as an example of a database.
FIG. 9 is a diagram showing an example of input information for referring to a product table in a database.
FIG. 10 is a diagram showing a relationship between a management information table (general-purpose table) registered in accordance with input information and an automatically generated SELECT statement.
FIG. 11 is a diagram showing an example of input information for adding data to a product table of a database.
FIG. 12 is a diagram showing a relationship between a management information table (general-purpose table) registered in accordance with input information and an automatically generated INSERT statement.
FIG. 13 is a diagram showing an example of input information for updating a product table in a database.
FIG. 14 is a diagram illustrating a relationship between a management information table (general-purpose table) registered in accordance with input information and an automatically generated UPDATE statement.
FIG. 15 is a diagram showing an example of input information for deleting data from a product table of a database.
FIG. 16 is a diagram showing a relationship between a management information table (general-purpose table) registered according to input information and a DELETE statement automatically generated.
FIG. 17 is a conceptual view showing a conventional database table access method.
[Explanation of symbols]
1 computer system 2 RDBMS (database)
6 Recording medium 7
23 SQL sentence
Claims (5)
入力画面からアクセス条件を入力するステップと、
入力されたアクセス条件にしたがって管理情報テーブルを生成するステップと、
入力画面から要求アクションを入力するステップと、
入力された要求アクションと前記管理情報テーブルから読み出したデータに基づいてSQL文を自動生成するステップと、
前記SQL文をリレーショナルデータベースに対して発行すると共に検索結果を取得するステップと、
取得した検索結果をメモリに展開するステップと、
前記メモリから読み出した検索結果を表示画面に一覧表示するステップと
を有することを特徴とするSQL隠蔽型データベースアクセス方法。An SQL concealed database access method for easily performing data reference, data update, data insertion, and data deletion of a table of a relational database,
Inputting access conditions from an input screen;
Generating a management information table according to the input access condition;
Inputting a request action from an input screen;
Automatically generating an SQL statement based on the input requested action and data read from the management information table;
Issuing the SQL statement to a relational database and obtaining a search result;
Expanding the obtained search results in a memory;
Displaying a list of search results read from the memory on a display screen.
請求項1記載のSQL隠蔽型データベースアクセス方法。2. The SQL concealed database access method according to claim 1, wherein a table name, search column information, setting data information, narrowing key information, and sort column information are registered in the management information table.
入力画面からアクセス条件を入力するステップと、
入力されたアクセス条件にしたがって管理情報テーブルを生成するステップと、
入力画面から要求アクションを入力するステップと、
入力された要求アクションと前記管理情報テーブルから読み出したデータに基づいてSQL文を自動生成するステップと、
前記SQL文をリレーショナルデータベースに対して発行すると共に検索結果を取得するステップと、
取得した検索結果をメモリに展開するステップと、
前記メモリから読み出した検索結果を表示画面に一覧表示するステップと
を含む処理をコンピュータに実行させることを特徴とするコンピュータプログラム。A computer program executed by a computer to realize an SQL concealed database access method for easily performing data reference, data update, data insertion, and data deletion of a table of a relational database,
Inputting access conditions from an input screen;
Generating a management information table according to the input access condition;
Inputting a request action from an input screen;
Automatically generating an SQL statement based on the input requested action and data read from the management information table;
Issuing the SQL statement to a relational database and obtaining a search result;
Expanding the obtained search results in a memory;
Causing a computer to execute a process including a step of displaying a list of search results read from the memory on a display screen.
請求項2記載のコンピュータプログラム。3. The computer program according to claim 2, wherein a table name, search column information, setting data information, narrowing key information, and sort column information are registered in the management information table.
入力画面からアクセス条件を入力するステップと、
入力されたアクセス条件にしたがって管理情報テーブルを生成するステップと、
入力画面から要求アクションを入力するステップと、
入力された要求アクションと前記管理情報テーブルから読み出したデータに基づいてSQL文を自動生成するステップと、
前記SQL文をリレーショナルデータベースに対して発行すると共に検索結果を取得するステップと、
取得した検索結果をメモリに展開するステップと、
前記メモリから読み出した検索結果を表示画面に一覧表示するステップと
を含むことを特徴とする記録媒体。A computer-readable recording medium that records a computer program to be executed by a computer to realize an SQL concealed database access method for easily performing data reference, data update, data insertion, and data deletion of a table of a relational database. Wherein the computer program inputs an access condition from an input screen;
Generating a management information table according to the input access condition;
Inputting a request action from an input screen;
Automatically generating an SQL statement based on the input requested action and data read from the management information table;
Issuing the SQL statement to a relational database and obtaining a search result;
Expanding the obtained search results in a memory;
Displaying a list of search results read from the memory on a display screen.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2002286077A JP2004126680A (en) | 2002-09-30 | 2002-09-30 | Sql masking type database access method and computer program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2002286077A JP2004126680A (en) | 2002-09-30 | 2002-09-30 | Sql masking type database access method and computer program |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2004126680A true JP2004126680A (en) | 2004-04-22 |
Family
ID=32279218
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2002286077A Pending JP2004126680A (en) | 2002-09-30 | 2002-09-30 | Sql masking type database access method and computer program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2004126680A (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN100464329C (en) * | 2005-06-14 | 2009-02-25 | 联想(北京)有限公司 | Construction method for dynamic structured query language statement |
JP2009245282A (en) * | 2008-03-31 | 2009-10-22 | Japan Research Institute Ltd | Data retrieval system, data retrieval method, and program |
JP2009245283A (en) * | 2008-03-31 | 2009-10-22 | Japan Research Institute Ltd | Data retrieval system, data retrieval method, and program |
CN102682038A (en) * | 2011-03-18 | 2012-09-19 | 阿里巴巴集团控股有限公司 | Database change method and device |
CN104572896A (en) * | 2014-12-25 | 2015-04-29 | 福建亿榕信息技术有限公司 | Method and system for automatically governing data of relational database |
-
2002
- 2002-09-30 JP JP2002286077A patent/JP2004126680A/en active Pending
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN100464329C (en) * | 2005-06-14 | 2009-02-25 | 联想(北京)有限公司 | Construction method for dynamic structured query language statement |
JP2009245282A (en) * | 2008-03-31 | 2009-10-22 | Japan Research Institute Ltd | Data retrieval system, data retrieval method, and program |
JP2009245283A (en) * | 2008-03-31 | 2009-10-22 | Japan Research Institute Ltd | Data retrieval system, data retrieval method, and program |
CN102682038A (en) * | 2011-03-18 | 2012-09-19 | 阿里巴巴集团控股有限公司 | Database change method and device |
CN104572896A (en) * | 2014-12-25 | 2015-04-29 | 福建亿榕信息技术有限公司 | Method and system for automatically governing data of relational database |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP3053153B2 (en) | How to start application of document management system | |
KR101213798B1 (en) | Complex data access | |
US7593929B2 (en) | Context sensitive term expansion with dynamic term expansion | |
US8086623B2 (en) | Context-sensitive term expansion with multiple levels of expansion | |
US7734657B2 (en) | Containment hierarchy in a database system | |
US5745896A (en) | Referential integrity in a relational database management system | |
US6108651A (en) | Heuristic co-identification of objects across heterogeneous information sources | |
US8122009B2 (en) | Dealing with composite data through data model entities | |
US20060116999A1 (en) | Sequential stepwise query condition building | |
CN100465953C (en) | Iterative data analysis process via query result augmentation and result data feedback | |
US7409387B2 (en) | Materialized query table matching with query expansion | |
US6598055B1 (en) | Generic code for manipulating data of a structured object | |
US7613715B2 (en) | Map and data location provider | |
JP2000090098A (en) | Data base querying method, its implementing device, and medium recording processing program thereof | |
JPH10509264A (en) | Computer system to create semantic object model from existing relational database schema | |
US6591275B1 (en) | Object-relational mapping for tables without primary keys | |
US20020147725A1 (en) | Method and apparatus for database table definition | |
US20050044065A1 (en) | Method and apparatus for enabling national language support of a database engine | |
US20080120270A1 (en) | Database system | |
US6895554B2 (en) | Method of document assembly | |
US20090193420A1 (en) | Method and system for batch processing form data | |
US6934701B1 (en) | Using a stored procedure to access index configuration data in a remote database management system | |
US20050278306A1 (en) | Linked logical fields | |
JP2004126680A (en) | Sql masking type database access method and computer program | |
JP2007265250A (en) | Identifier issuing system, program and identifier issuing method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20050303 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20080814 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20080826 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20081022 |
|
A02 | Decision of refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A02 Effective date: 20081118 |