JP5488792B2 - Database operation device, database operation method, and program - Google Patents

Database operation device, database operation method, and program Download PDF

Info

Publication number
JP5488792B2
JP5488792B2 JP2009206742A JP2009206742A JP5488792B2 JP 5488792 B2 JP5488792 B2 JP 5488792B2 JP 2009206742 A JP2009206742 A JP 2009206742A JP 2009206742 A JP2009206742 A JP 2009206742A JP 5488792 B2 JP5488792 B2 JP 5488792B2
Authority
JP
Japan
Prior art keywords
entity object
database
result
sql
statement
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
JP2009206742A
Other languages
Japanese (ja)
Other versions
JP2011059845A (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.)
NEC Corp
Original Assignee
NEC Corp
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 NEC Corp filed Critical NEC Corp
Priority to JP2009206742A priority Critical patent/JP5488792B2/en
Publication of JP2011059845A publication Critical patent/JP2011059845A/en
Application granted granted Critical
Publication of JP5488792B2 publication Critical patent/JP5488792B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

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

Description

本発明は、データベースを操作するためのデータベース操作装置、データベース操作方法、及びプログラムに関する。   The present invention relates to a database operating device, a database operating method, and a program for operating a database.

近年、データベースの殆どは、リレーショナルデータベースであり、この操作には、一般に、SQL(Structured Query Language)と呼ばれるデータベース専用の言語が用いられている。SQLによれば、利用者側では、特にデータベースを構成している記憶装置を意識することなく、データの取り出し、書き込み、変更、削除、及び検索といった操作を実行することが可能となる。   In recent years, most databases are relational databases, and a database-dedicated language called SQL (Structured Query Language) is generally used for this operation. According to SQL, on the user side, operations such as data extraction, writing, modification, deletion, and search can be executed without being aware of the storage devices that constitute the database.

また、リレーショナルデータベースでは、データは、テーブルによって管理されており、リーレーションナルデータベース内には、複数のテーブルが構築されている。そして、互いに関連するテーブルは、互いに関連付けられた状態で管理されている。更に、関連付けられた各テーブルに対してアクセスが行われる場合は、SQLによって関連テーブルの結合が行われる。   In the relational database, data is managed by tables, and a plurality of tables are constructed in the relational database. The tables associated with each other are managed in a state associated with each other. Further, when accessing each associated table, the related tables are joined by SQL.

ところで、このようなSQLを用いた操作によれば、利用者は、データベースを構成する記憶装置を意識する必要がないが、SQLを利用するために、SQLを学習し、これを理解しておく必要がある。SQLを用いたデータベースの操作は、誰もが簡単に行えるわけではない。   By the way, according to such an operation using SQL, the user does not need to be aware of the storage device constituting the database, but in order to use SQL, the user learns and understands SQL. There is a need. Database operations using SQL are not easy for everyone.

このため、例えば、特許文献1は、利用者が入力した操作条件に基づいて、SQL文を自動的に生成するアプリケーションプログラム(以下、単に「アプリケーション」という。)を開示している。特許文献1に開示されたアプリケーションによれば、利用者は、SQLについての知識を有していなくても、データベースを操作することができる。   For this reason, for example, Patent Document 1 discloses an application program (hereinafter simply referred to as “application”) that automatically generates an SQL sentence based on an operation condition input by a user. According to the application disclosed in Patent Document 1, the user can operate the database even if the user does not have knowledge about SQL.

また、近年においては、JAVA(登録商標)アプリケーションからリレーショナルデータベースを操作する手法も提案されている。具体的には、SQL文を発行するJDBC(Java Data Base Connectivity)を用いた手法が知られている。また、JPA(Java Persistence API)、Hibernate等のO/Rマッピングを用いた手法も提案されている。これらの手法によっても、利用者は、SQLの知識を有することなく、データベースを操作することができる。   In recent years, a method of operating a relational database from a JAVA (registered trademark) application has also been proposed. Specifically, a technique using JDBC (Java Data Base Connectivity) that issues an SQL statement is known. In addition, methods using O / R mapping such as JPA (Java Persistence API) and Hibernate have been proposed. Even with these methods, the user can operate the database without having knowledge of SQL.

特開2004−126680号公報JP 2004-126680 A

しかしながら、特許文献1に開示されたアプリケーションには、単一のテーブルにアクセスする場合には対応できるが、関連する複数のテーブルにアクセスする際には対応できないという問題がある。また、特許文献1に開示されたアプリケーションでは、SQL文を自動生成する度に、テーブル名、検索カラム情報等が登録された管理情報テーブルを作成する必要がある。よって、処理が複雑となり、アクセス性能が低下するという問題も発生する。   However, the application disclosed in Patent Document 1 has a problem that it can cope with access to a single table but cannot cope with access to a plurality of related tables. In addition, in the application disclosed in Patent Document 1, it is necessary to create a management information table in which table names, search column information, and the like are registered each time an SQL sentence is automatically generated. As a result, the processing becomes complicated and the access performance is degraded.

一方、JAVA(登録商標)アプリケーションからリレーショナルデータベースにアクセスする手法は、複数のテーブルが関連しているリレーショナルデータベースにも適用できる。しかしながら、この手法をリレーショナルデータベースに適用した場合は、パフォーマンスや可読性が低下する。即ち、この場合も、アクセス性能が低下するという問題が発生する。   On the other hand, the method of accessing a relational database from a JAVA (registered trademark) application can also be applied to a relational database in which a plurality of tables are related. However, when this method is applied to a relational database, performance and readability deteriorate. That is, also in this case, there arises a problem that the access performance is deteriorated.

本発明の目的は、上記問題を解消し、関連する2以上のテーブルを操作対象とした場合において、利用者側にSQLの記述を求めることなく操作を実行し得、且つ、その際のアクセス性能の低下を抑制し得る、データベース操作装置、データベース操作方法、及びプログラムを提供することにある。   An object of the present invention is to solve the above-mentioned problem, and in the case where two or more related tables are set as the operation target, the operation can be executed without requiring the description of SQL on the user side, and the access performance at that time It is to provide a database operation device, a database operation method, and a program capable of suppressing a decrease in the above.

上記目的を達成するため、本発明におけるデータベース操作装置は、
データベースを構成しているテーブル毎に作成されたエンティティオブジェクトと、前記データベースを操作するためのSQL文を生成するSQL生成部とを備え、
前記エンティティオブジェクトは、対応するテーブルを特定する情報及び操作条件を含み、加えて、前記対応するテーブルに関連するテーブルが存在する場合は、前記関連するテーブルを特定する情報を更に含み、
前記SQL生成部は、前記エンティティオブジェクトが対応する前記テーブルを特定し、前記操作条件に応じて、特定した前記テーブルに対する操作を実行するためのSQL文を作成し、そして、
前記エンティオブジェクトが、前記関連するテーブルを特定する情報を含んでいるかどうかを判定し、含んでいる場合は、前記関連するテーブルに対する操作を実行するためのSQL文を更に生成する、ことを特徴とする。
In order to achieve the above object, a database operating device according to the present invention includes:
An entity object created for each table constituting the database, and an SQL generator for generating an SQL statement for operating the database,
The entity object includes information for specifying a corresponding table and operation conditions. In addition, if there is a table related to the corresponding table, the entity object further includes information for specifying the related table,
The SQL generation unit specifies the table corresponding to the entity object, creates an SQL statement for executing an operation on the specified table according to the operation condition, and
It is determined whether or not the entity object includes information specifying the related table, and if included, an SQL statement for executing an operation on the related table is further generated. To do.

また、上記目的を達成するため、本発明におけるデータベース操作方法は、
(a)データベースを構成しているテーブル毎に作成され、且つ、対応するテーブルを特定する情報及び操作条件を含む、エンティティオブジェクトから、前記エンティティオブジェクトが対応する前記テーブルを特定する、ステップと、
(b)前記操作条件に応じて、前記(a)のステップで特定された前記テーブルに対する操作を実行するためのSQL文を生成する、ステップと、
(c)前記エンティティオブジェクトが、前記(a)のステップで特定されたテーブルに関連するテーブルを特定する情報を更に含んでいるかどうかを判定するステップと、
(d)前記(c)のステップで、含んでいると判定された場合に、前記関連するテーブルに対する操作を実行するためのSQL文を更に生成する、ステップと、
を有することを特徴とする。
In order to achieve the above object, the database operation method according to the present invention includes:
(A) identifying the table to which the entity object corresponds from an entity object created for each table constituting the database and including information and operation conditions for identifying the corresponding table;
(B) generating an SQL statement for executing an operation on the table specified in the step (a) according to the operation condition;
(C) determining whether the entity object further includes information identifying a table related to the table identified in the step (a);
(D) when it is determined in step (c) that it contains, an SQL statement for executing an operation on the related table is further generated;
It is characterized by having.

更に、上記目的を達成するため、本発明におけるプログラムは、コンピュータによってデータベースの操作を実行させるためのプログラムであって、
前記コンピュータに、
(a)前記データベースを構成しているテーブル毎に作成され、且つ、対応するテーブルを特定する情報及び操作条件を含む、エンティティオブジェクトから、前記エンティティオブジェクトが対応する前記テーブルを特定する、ステップと、
(b)前記操作条件に応じて、前記(a)のステップで特定された前記テーブルに対する操作を実行するためのSQL文を生成する、ステップと、
(c)前記エンティティオブジェクトが、前記(a)のステップで特定されたテーブルに関連するテーブルを特定する情報を更に含んでいるかどうかを判定するステップと、
(d)前記(c)のステップで、含んでいると判定された場合に、前記関連するテーブルに対する操作を実行するためのSQL文を更に生成する、ステップと、
を実行させることを特徴とする。
Furthermore, in order to achieve the above object, a program according to the present invention is a program for causing a computer to execute a database operation,
In the computer,
(A) identifying the table to which the entity object corresponds from an entity object created for each table constituting the database and including information and operation conditions for identifying the corresponding table;
(B) generating an SQL statement for executing an operation on the table specified in the step (a) according to the operation condition;
(C) determining whether the entity object further includes information identifying a table related to the table identified in the step (a);
(D) when it is determined in step (c) that it contains, an SQL statement for executing an operation on the related table is further generated;
Is executed.

以上のように、本発明におけるデータベース操作装置、データベース操作方法、及びプログラムによれば、関連する2以上のテーブルを操作対象とした場合において、利用者側にSQLの記述を求めることなく操作を実行できる。更に、関連する2以上のテーブルを操作した際のアクセス性能の低下も抑制される。   As described above, according to the database operation device, the database operation method, and the program according to the present invention, when two or more related tables are set as the operation target, the operation is executed without requiring the user to describe the SQL. it can. Furthermore, a decrease in access performance when operating two or more related tables is also suppressed.

図1は、本発明の実施の形態1におけるデータベース操作装置の構成を示すブロック図である。FIG. 1 is a block diagram showing the configuration of the database operating device according to Embodiment 1 of the present invention. 図2は、本発明の実施の形態1で操作対象となるテーブルの一例を示す図である。FIG. 2 is a diagram showing an example of a table to be operated in the first embodiment of the present invention. 図3は、図2に示したテーブルに対応するエンティティオブジェクトの一例を示す図である。FIG. 3 is a diagram illustrating an example of an entity object corresponding to the table illustrated in FIG. 図4は、本発明の実施の形態1におけるデータベース操作装置の動作を示すフロー図である。FIG. 4 is a flowchart showing the operation of the database operation device according to Embodiment 1 of the present invention. 図5は、本発明の実施の形態1において作成されたSQL文の一例を示す図である。FIG. 5 is a diagram showing an example of the SQL sentence created in the first embodiment of the present invention. 図6は、本発明の実施の形態1におけるエンティティオブジェクト及びデータアクセスオブジェクトの定義と実装例とを示す図である。FIG. 6 is a diagram showing definitions and implementation examples of entity objects and data access objects in Embodiment 1 of the present invention. 図7は、本発明の実施の形態2におけるデータベース操作装置の構成を示すブロック図である。FIG. 7 is a block diagram showing a configuration of the database operating device according to Embodiment 2 of the present invention. 図8は、本発明の実施の形態2におけるデータベース操作装置の動作を示すフロー図である。FIG. 8 is a flowchart showing the operation of the database operating device in the second embodiment of the present invention.

(実施の形態1)
以下、本発明の実施の形態1におけるデータベース操作装置、データベース操作方法、及びプログラムについて、図1〜図6を参照しながら説明する。最初に、本実施の形態1におけるデータベース操作装置の構成を図1に基づいて説明する。図1は、本発明の実施の形態1におけるデータベース操作装置の構成を示すブロック図である。
(Embodiment 1)
Hereinafter, a database operation device, a database operation method, and a program according to Embodiment 1 of the present invention will be described with reference to FIGS. First, the configuration of the database operating device according to the first embodiment will be described with reference to FIG. FIG. 1 is a block diagram showing the configuration of the database operating device according to Embodiment 1 of the present invention.

図1に示す本実施の形態1におけるデータベース操作装置1は、データベース3に対して、データの取り出し、書き込み、更新、削除、検索等の操作を実行する装置である。データベース3は、リレーショナルデータベースであり、操作が記述されたSQL文を受け取ると、それに応じて処理を実行する。また、図1に示すように、データベース3は、n個のテーブル17−1〜17−nを備えている。nは任意の自然数である。以下において、特定のテーブルを指定していない場合は、単に「テーブル17」とする。   The database operating device 1 according to the first embodiment shown in FIG. 1 is a device that performs operations such as data fetch, write, update, delete, and search on the database 3. When the database 3 is a relational database and receives an SQL statement in which an operation is described, the database 3 executes processing accordingly. As shown in FIG. 1, the database 3 includes n tables 17-1 to 17-n. n is an arbitrary natural number. In the following, when a specific table is not designated, it is simply referred to as “table 17”.

図1に示すように、データベース操作装置1は、テーブル17毎に作成されたエンティティオブジェクト12−1〜12−nと、データベース3を操作するためのSQL文を生成するSQL生成部14とを備えている。また、以下において、特定のエンティティオブジェクトを指定していない場合は、単に「エンティティオブジェクト12」とする。   As shown in FIG. 1, the database operation device 1 includes entity objects 12-1 to 12-n created for each table 17 and an SQL generation unit 14 that generates an SQL sentence for operating the database 3. ing. In the following, when a specific entity object is not designated, it is simply referred to as “entity object 12”.

また、図1には例示していないが、各エンティティオブジェクト12は、対応するテーブル17を特定する情報、及び操作条件を含んでいる。操作条件は、データベース3に対して実行される操作の条件であり、利用者によって予め指定されている。更に、各エンティティオブジェクト12は、対応するテーブルに関連するテーブルが存在する場合は、関連するテーブルを特定する情報も含んでいる。   Although not illustrated in FIG. 1, each entity object 12 includes information for specifying the corresponding table 17 and operation conditions. The operation condition is a condition for an operation performed on the database 3 and is designated in advance by the user. Further, each entity object 12 includes information for specifying a related table when a table related to the corresponding table exists.

SQL生成部14は、先ず、エンティティオブジェクト12が対応しているテーブル17を特定し、更に、操作条件に応じて、特定したテーブル17に対する操作を実行するためのSQL文を生成する。また、SQL生成部14は、エンティオブジェクト12が、関連するテーブルを特定する情報を含んでいるかどうかを判定し、判定の結果、含んでいる場合は、関連するテーブルに対する操作を実行するためのSQL文も生成する。   The SQL generation unit 14 first specifies the table 17 to which the entity object 12 corresponds, and further generates an SQL statement for executing an operation on the specified table 17 according to the operation condition. In addition, the SQL generation unit 14 determines whether the entity object 12 includes information for specifying a related table. If the entity object 12 includes the information as a result of the determination, an SQL for executing an operation on the related table is included. A sentence is also generated.

このように、データベース操作装置1では、関連するテーブルの関係が予めエンティティオブジェクト12によって特定されており、更に、このエンティティオブジェクト12に基づいてSQL文が作成される。よって、データベース操作装置1によれば、操作対象が関連する2以上のテーブルであっても、利用者側(利用者が直接操作を行うアプリケーション側)でのSQLの記述を求めることなくデータベースの操作の実行が可能となる。また、データベース操作装置1での処理は、複雑でないため、関連する2以上のテーブルを操作した際のアクセス性能の低下も抑制される。   As described above, in the database operation device 1, the relationship between related tables is specified in advance by the entity object 12, and an SQL sentence is created based on the entity object 12. Therefore, according to the database operation device 1, even if there are two or more tables related to the operation target, the database operation can be performed without requiring the SQL description on the user side (the application side on which the user directly operates). Can be executed. In addition, since the processing in the database operation device 1 is not complicated, a decrease in access performance when two or more related tables are operated is suppressed.

ここで、本実施の形態1におけるデータベース操作装置の構成を図2及び図3を用いて更に具体的に説明する。図2は、本発明の実施の形態1で操作対象となるテーブルの一例を示す図である。図3は、図2に示したテーブルに対応するエンティティオブジェクトの一例を示す図である。   Here, the configuration of the database operation device according to the first embodiment will be described more specifically with reference to FIGS. FIG. 2 is a diagram showing an example of a table to be operated in the first embodiment of the present invention. FIG. 3 is a diagram illustrating an example of an entity object corresponding to the table illustrated in FIG.

図1に示すように、本実施の形態1では、データベース操作装置1は、後述する本実施の形態1におけるプログラムをコンピュータ2上で実行することによって構築されている。また、データベース操作装置1は、更に、SQL処理部16を備えている。SQL処理部16は、SQL生成部14が生成したSQL文に記述された操作を、データベース3に対して実行し、操作の結果をデータベース3の各テーブル17から取得する。   As shown in FIG. 1, in the first embodiment, the database operating device 1 is constructed by executing a program in the first embodiment to be described later on a computer 2. The database operating device 1 further includes an SQL processing unit 16. The SQL processing unit 16 executes the operation described in the SQL statement generated by the SQL generation unit 14 on the database 3 and acquires the operation result from each table 17 of the database 3.

また、本実施の形態1では、上記プログラムは、JAVA(登録商標)アプリケーションである。このため、図1に示すように、データベース操作装置1は、データアクセスオブジェクト(DAO:Data Access Object)13を備えている。データアクセスオブジェクト13は、エンティティオブジェクト17とデータベース3との間でのデータのやり取りを実行するプログラムによって構築されている。   In the first embodiment, the program is a JAVA (registered trademark) application. For this reason, as shown in FIG. 1, the database operating device 1 includes a data access object (DAO) 13. The data access object 13 is constructed by a program for exchanging data between the entity object 17 and the database 3.

本実施の形態1においては、SQL生成部14及びSQL処理部16は、データアクセスオブジェクト13によって構築されている。データアクセスオブジェクト13は、エンティティオブジェクト17の内容からSQL文を自動生成し、データベース3に対して、生成したSQLの処理を行い、データを取得する。   In the first embodiment, the SQL generation unit 14 and the SQL processing unit 16 are constructed by the data access object 13. The data access object 13 automatically generates an SQL sentence from the contents of the entity object 17, performs the generated SQL process on the database 3, and acquires data.

また、エンティティオブジェクト12は、複数のフィールドを備えており、対応するテーブルを特定する情報、対応するテーブルに関連するテーブルを特定する情報(関連の定義)、及び操作条件を、各フィールドに格納する。   The entity object 12 includes a plurality of fields, and stores information for identifying the corresponding table, information for identifying the table related to the corresponding table (related definition), and operation conditions in each field. .

ここで、具体例を挙げて説明する。図2に示すように、データベース3において、テーブル17−lとテーブル17−mとが関連しているとする。そして、図3に示すように、テーブル17−lに対応してエンティオブジェクト12−lが作成されており、テーブル17−mに対応してエンティティオブジェクト12−mが作成されているとする。なお、l及びmは共にn以下の自然数である。   Here, a specific example will be described. As shown in FIG. 2, in the database 3, it is assumed that the table 17-l and the table 17-m are related. Then, as shown in FIG. 3, it is assumed that an entity object 12-l is created corresponding to the table 17-l, and an entity object 12-m is created corresponding to the table 17-m. Note that both l and m are natural numbers of n or less.

図2及び図3に示すように、テーブル17とエンティティオブジェクト12との対応付けは、例えば、テーブル17のカラム(column)と、エンティティオブジェクト12のフィールドとを対応づけることによって行うことができる。この場合、図3に示すように、エンティティオブジェクト12の一のフィールドには、対応するテーブル17を特定する
情報として、対応するテーブルのカラムに登録された情報が格納される。
As shown in FIGS. 2 and 3, the association between the table 17 and the entity object 12 can be performed by, for example, associating the column of the table 17 with the field of the entity object 12. In this case, as shown in FIG. 3, in one field of the entity object 12, information registered in the column of the corresponding table is stored as information for specifying the corresponding table 17.

また、本実施の形態では、上述したように、テーブル17−lがテーブル17−mに関連付けられている。そして、関連するテーブルを特定するため、例えば、テーブル17−lの外部キーに対応しているエンティティオブジェクト12−lのフィールドの型が、関連先のテーブル17−mに対応しているエンティティオブジェクト12−mのクラスに設定される。   In the present embodiment, as described above, the table 17-l is associated with the table 17-m. In order to specify a related table, for example, the type of the field of the entity object 12-l corresponding to the foreign key of the table 17-l is the entity object 12 corresponding to the related table 17-m. Set to -m class.

つまり、図3に示すように、エンティティオブジェクト12−lにおいて、テーブル17−lのカラムの情報が格納されたフィールドの型Xは、エンティティオブジェクト12−mのクラスYに設定されている。図3の例では、フィールドの型Xが、関連するテーブルを特定する情報として機能している。   That is, as shown in FIG. 3, in the entity object 12-l, the type X of the field storing the column information of the table 17-l is set to the class Y of the entity object 12-m. In the example of FIG. 3, the field type X functions as information for specifying the related table.

更に、図3の例では、エンティティオブジェクト12−lのフィールドに、操作条件が格納されている場合は、エンティティオブジェクト12−mのフィールドにも、同様の操作条件が格納される。例えば、操作条件が、テーブル17−lを検索対象とする検索条件であるとする。テーブル17−lはテーブル17−mと関連しているため、検索は、テーブル17−lとテーブル17−mとにまたがって行う必要がある。よって、エンティティオブジェクト12−lのフィールドと、エンティティオブジェクト12−mのフィールドとに、操作条件として、同一の検索条件が格納される。   Further, in the example of FIG. 3, when the operation condition is stored in the field of the entity object 12-l, the same operation condition is also stored in the field of the entity object 12-m. For example, it is assumed that the operation condition is a search condition for searching the table 17-l. Since the table 17-l is related to the table 17-m, the search needs to be performed across the table 17-l and the table 17-m. Therefore, the same search condition is stored as the operation condition in the field of the entity object 12-l and the field of the entity object 12-m.

また、操作条件が、上述したテーブル17−l及び17−mを検索対象とする検索条件である場合は、SQL生成部14は、先ず、SELECT文及びFROMを生成する。そして、SQL生成部14は、エンティティオブジェクト12−lのフィールドを走査して、エンティオブジェクト12−lが関連するテーブル17−mを特定する情報を含んでいるかどうかを判定する。   When the operation condition is a search condition for searching the above-described tables 17-l and 17-m, the SQL generation unit 14 first generates a SELECT statement and FROM. Then, the SQL generation unit 14 scans the field of the entity object 12-l and determines whether the entity object 12-l includes information specifying the related table 17-m.

具体的には、SQL生成部14は、エンティオブジェクト12−lのいずれかのフィールドの型が、別のエンティティオブジェクト12−mのクラスに設定されているかどうかを判定する。そして、図3の例では、エンティオブジェクト12−lのフィールドの型Xがエンティティオブジェクト12−mのクラスYに設定されているので、SQL生成部14は、JOIN文を生成する。その後、SQL生成部14は、エンティティオブジェクト12−mに基づいて、更に、SQL文を生成する。   Specifically, the SQL generation unit 14 determines whether the type of any field of the entity object 12-l is set to the class of another entity object 12-m. In the example of FIG. 3, since the field type X of the entity object 12-l is set to the class Y of the entity object 12-m, the SQL generation unit 14 generates a JOIN statement. Thereafter, the SQL generation unit 14 further generates an SQL sentence based on the entity object 12-m.

次に、本発明の実施の形態1におけるデータベース操作装置1の動作について図4を用いて説明する。図4は、本発明の実施の形態1におけるデータベース操作装置の動作を示すフロー図である。また、本実施の形態1では、データベース操作装置1を動作させることによって、データベース操作方法が実施される。よって、本実施の形態1におけるデータベース操作方法の説明は、以下のデータベース操作装置1の動作の説明に代える。なお、適宜図1〜図3を参酌する。   Next, operation | movement of the database operating device 1 in Embodiment 1 of this invention is demonstrated using FIG. FIG. 4 is a flowchart showing the operation of the database operation device according to Embodiment 1 of the present invention. In the first embodiment, the database operating method is implemented by operating the database operating device 1. Therefore, the description of the database operation method in the first embodiment will be replaced with the following description of the operation of the database operation device 1. Note that FIGS. 1 to 3 are referred to as appropriate.

また、図4の例は、コンピュータ2(図1参照)が、情報の検索を行う業務システムを構成している場合を示しており、エンティティオブジェクト12のフィールドに格納される操作条件は、検索条件である。更に、各エンティティオブジェクト12は、テーブル17に合わせて予め作成されている。また、利用者は、コンピュータ2を介して、予め、検索条件を指定し、指定した検索条件を、指定したエンティオブジェクト12のフィールドに格納させている。   The example of FIG. 4 shows a case where the computer 2 (see FIG. 1) constitutes a business system that searches for information. The operation condition stored in the field of the entity object 12 is the search condition. It is. Further, each entity object 12 is created in advance according to the table 17. Further, the user designates a search condition in advance via the computer 2 and stores the designated search condition in the field of the designated entity object 12.

図4に示すように、先ず、SQL生成部14は、SELECT文を作成し、予め指定されたエンティオブジェクト12の検索条件を読み出し、そして、対応するテーブル17に
登録されているデータのうち取得すべきデータを特定する(ステップA1)。
As shown in FIG. 4, first, the SQL generation unit 14 creates a SELECT statement, reads a search condition for the entity object 12 designated in advance, and acquires the data registered in the corresponding table 17. The data to be specified is specified (step A1).

次に、SQL生成部14は、予め指定されたエンティティオブジェクトから、それが対応しているテーブルを特定する(ステップA2)。そして、SQL生成部14は、ステップA2で特定されたテーブルに基づき、FROM文を生成する(ステップA3)。その後、SQL生成部14は、予め指定されたエンティティオブジェクト内のフィールドの走査を実行する(ステップA4)。   Next, the SQL generation unit 14 specifies a table corresponding to the entity object designated in advance (step A2). Then, the SQL generation unit 14 generates a FROM sentence based on the table specified in step A2 (step A3). Thereafter, the SQL generation unit 14 performs scanning of the field in the entity object designated in advance (step A4).

次に、SQL生成部14は、走査中のフィールドの内容が空であるかどうか、即ち、当該フィールドにデータが格納されているかどうかを判定する(ステップA5)。判定の結果、空である場合は、再度、ステップS4を実行する。これにより、次の別のフィールドの走査が実行される。一方、判定の結果、空でない場合は、SQL生成部14は、ステップA6を実行する。   Next, the SQL generation unit 14 determines whether the content of the field being scanned is empty, that is, whether data is stored in the field (step A5). As a result of the determination, if it is empty, step S4 is executed again. As a result, the next scanning of another field is executed. On the other hand, if the result of the determination is that it is not empty, the SQL generating unit 14 executes Step A6.

ステップA6では、SQL生成部14は、走査中のフィールドの型が、他のエンティティオブジェク12のクラスに設定されているかどうかを判定する。ステップA6の判定の結果、走査中のフィールドの型が、他のエンティティオブジェク12のクラスに設定されている場合は、SQL生成部14は、他のエンティティオブジェクト12に対して、ステップA2〜A6を再帰的に実行する。但し、この場合のステップA3では、SQL生成部14は、FROM文を生成する代わりに、JOIN文を生成し、これを既に生成しているSQL文に追加する。   In step A <b> 6, the SQL generation unit 14 determines whether the type of the field being scanned is set to the class of another entity object 12. As a result of the determination in step A6, when the type of the field being scanned is set to the class of another entity object 12, the SQL generation unit 14 performs steps A2 to A6 on the other entity object 12. Run recursively. However, in step A3 in this case, instead of generating the FROM statement, the SQL generation unit 14 generates a JOIN statement and adds it to the already generated SQL statement.

一方、ステップA6の判定の結果、走査中のフィールドの型が、他のエンティティオブジェク12のクラスに設定されていない場合は、SQL生成部14は、走査中のフィールドに格納されているデータに基づいて、WHERE文を生成する(ステップA7)。また、ステップA7では、SQL生成部4は、ステップA2〜A6が再帰的に実行され、JOIN文によってSQL文が結合されている場合は、ON文を生成する。   On the other hand, if the result of determination in step A6 is that the type of the field being scanned is not set to the class of another entity object 12, the SQL generating unit 14 is based on the data stored in the field being scanned. Then, a WHERE statement is generated (step A7). In step A7, the SQL generation unit 4 recursively executes steps A2 to A6, and generates an ON statement when the SQL statements are joined by a JOIN statement.

次に、SQL生成部14は、指定されたエンティティオブジェクト12(又はステップA6で判定された他のエンティティオブジェクト12)の全てのフィールドを走査したかどうか判定する(ステップA8)。   Next, the SQL generation unit 14 determines whether or not all fields of the specified entity object 12 (or other entity object 12 determined in step A6) have been scanned (step A8).

ステップA8での判定の結果、エンティティオブジェクト12の全てのフィールドを走査していない場合は、SQL生成部14は、当該エンティティオブジェクト12の次のフィールドを走査するため、再度、ステップS4を実行する。一方、ステップA8の判定の結果、エンティティオブジェクト12の全てのフィールドを走査している場合は、SQL生成部14における処理は終了する。   As a result of the determination in step A8, if not all the fields of the entity object 12 have been scanned, the SQL generation unit 14 executes step S4 again to scan the next field of the entity object 12. On the other hand, if it is determined in step A8 that all fields of the entity object 12 have been scanned, the processing in the SQL generation unit 14 ends.

その後、SQL処理部16は、生成されたSQL文をデータベース3に渡し(ステップA9)、そして、データベース3から操作の結果を受け取る(ステップA10)。ステップA10が実行されると、データベース操作装置1での処理は終了する。   Thereafter, the SQL processing unit 16 passes the generated SQL sentence to the database 3 (step A9), and receives the operation result from the database 3 (step A10). When step A10 is executed, the processing in the database operation device 1 is finished.

また、指定されたエンティティオブジェクト12が図3に示す例であり、対応しているテーブルが図2に示す例であった場合、SQL文の具体例は図5に示す通りとなる。図5は、本発明の実施の形態1において作成されたSQL文の一例を示す図である。図5に示すように、SQL文には、SELECT文、FROM文、JOIN文、ON文が含まれている。   Further, when the specified entity object 12 is the example shown in FIG. 3 and the corresponding table is the example shown in FIG. 2, a specific example of the SQL sentence is as shown in FIG. FIG. 5 is a diagram showing an example of the SQL sentence created in the first embodiment of the present invention. As shown in FIG. 5, the SQL statement includes a SELECT statement, a FROM statement, a JOIN statement, and an ON statement.

更に、上記の場合において、エンティティオブジェクト12及びデータアクセスオブジェクト13における、定義と検索時の実装例とは、図6に示す通りとなる。図6は、本発
明の実施の形態1におけるエンティティオブジェクト及びデータアクセスオブジェクトの定義と実装例とを示す図である。なお、図6において、定義と検索時の実装例とは、Javaのソースコードをベースにして作成されている。
Further, in the above case, the definition and implementation example at the time of retrieval in the entity object 12 and the data access object 13 are as shown in FIG. FIG. 6 is a diagram showing definitions and implementation examples of entity objects and data access objects in Embodiment 1 of the present invention. In FIG. 6, the definition and the implementation example at the time of retrieval are created based on the Java source code.

以上のように、本実施の形態1によれば、上述したように、操作対象が関連する2以上のテーブル17であったとしても、利用者側(利用者が直接操作を行うアプリケーション側)でのSQLの記述が求められることはない。この結果、利用者は、直接SQL文を作成しなくても、例えば、複数のテーブルにまたがる検索を実行できる。また、データベース操作装置1では、複数のテーブルにまたがる検索の実行時において、複雑な処理は要求されないため、関連する2以上のテーブルを操作した際のアクセス性能の低下は抑制される。   As described above, according to the first embodiment, as described above, even if there are two or more tables 17 related to the operation target, on the user side (the application side on which the user directly operates). The description of the SQL is not required. As a result, the user can execute a search across a plurality of tables, for example, without directly creating an SQL sentence. Further, in the database operation device 1, since complicated processing is not required at the time of executing a search across a plurality of tables, a decrease in access performance when operating two or more related tables is suppressed.

本実施の形態1におけるプログラムは、コンピュータ2(図1参照)に、図4に示すステップA1〜A10を実行させるプログラムであれば良い。このプログラムをコンピュータ2にインストールし、実行することによって、本実施の形態1におけるデータベース操作装置1とデータベース操作方法とを実現することができる。この場合、コンピュータ2のCPU(Central Processing Unit)は、データアクセスオブジェクト13として機能し、処理を行なう。また、コンピュータ2のCPUは、メモリやハードディスク等の記憶装置の記憶領域に、エンティティオブジェクト12を構築する。   The program in the first embodiment may be a program that causes the computer 2 (see FIG. 1) to execute steps A1 to A10 shown in FIG. By installing and executing this program on the computer 2, the database operating device 1 and the database operating method according to the first embodiment can be realized. In this case, a CPU (Central Processing Unit) of the computer 2 functions as the data access object 13 and performs processing. Further, the CPU of the computer 2 constructs the entity object 12 in a storage area of a storage device such as a memory or a hard disk.

(実施の形態2)
次に、本発明の実施の形態2におけるデータベース操作装置、データベース操作方法、及びプログラムについて、図7及び図8を参照しながら説明する。最初に、本実施の形態2におけるデータベース操作装置の構成を図7に基づいて説明する。図7は、本発明の実施の形態2におけるデータベース操作装置の構成を示すブロック図である。
(Embodiment 2)
Next, a database operation device, a database operation method, and a program according to Embodiment 2 of the present invention will be described with reference to FIGS. Initially, the structure of the database operating device in this Embodiment 2 is demonstrated based on FIG. FIG. 7 is a block diagram showing a configuration of the database operating device according to Embodiment 2 of the present invention.

図7に示すように、本実施の形態2におけるデータベース操作装置4は、図1に示した実施の形態1におけるデータベース操作装置1の構成に加えて、更に、入力受付部10、結果出力部11、及び結果変換部15を備えている。なお、これらを備えている以外は、データベース操作装置4は、実施の形態1におけるデータベース操作装置1と同様に構成されている。以下、相違点について説明する。   As shown in FIG. 7, in addition to the configuration of the database operation device 1 in the first embodiment shown in FIG. 1, the database operation device 4 in the second embodiment further includes an input receiving unit 10 and a result output unit 11. And a result conversion unit 15. Except for these, the database operation device 4 is configured in the same manner as the database operation device 1 in the first embodiment. Hereinafter, differences will be described.

入力受付部10は、外部から利用者によって入力された操作条件を受け付ける。更に、入力受付部10は、受け付けた操作条件に対応するエンティティオブジェクト12を特定し、特定したエンティティオブジェクト12に、受け付けた操作条件を格納させる。   The input receiving unit 10 receives an operation condition input from the outside by a user. Further, the input receiving unit 10 specifies the entity object 12 corresponding to the received operation condition, and stores the received operation condition in the specified entity object 12.

また、本実施の形態2では、入力受付部10は、コンピュータ2に接続された表示装置6に、操作条件の入力画面を表示させることができる。例えば、操作条件が検索条件である場合は、入力画面には、AND又はORでつながれる複数のフィールドが表示される。利用者は、入力画面上で、キーボードやマウスといった入力装置を用いて、各フィールドにキーワードを入力することによって、検索条件を設定することができる。   In the second embodiment, the input receiving unit 10 can display an operation condition input screen on the display device 6 connected to the computer 2. For example, when the operation condition is a search condition, a plurality of fields connected by AND or OR are displayed on the input screen. A user can set a search condition by inputting a keyword in each field using an input device such as a keyboard or a mouse on the input screen.

結果変換部15は、SQL処理部16によってデータベース3から取得された操作の結果を、エンティティオブジェクト12で登録可能なデータ形式に変換する。更に、結果変換部15は、変換した結果を、取得元のテーブル17に対応しているエンティティオブジェクト12に登録する。   The result conversion unit 15 converts the result of the operation acquired from the database 3 by the SQL processing unit 16 into a data format that can be registered by the entity object 12. Further, the result conversion unit 15 registers the converted result in the entity object 12 corresponding to the acquisition source table 17.

結果出力部11は、結果変換部15によって変換された結果が登録されたエンティティオブジェクト12から、登録された結果を取り出し、取り出した結果を外部に出力する。本実施の形態2では、結果出力部11は、表示装置6に、結果を示す結果画面を表示させ
ることができる。この場合、利用者は、結果を容易に把握することができる。
The result output unit 11 extracts the registered result from the entity object 12 in which the result converted by the result conversion unit 15 is registered, and outputs the extracted result to the outside. In the second embodiment, the result output unit 11 can cause the display device 6 to display a result screen indicating the result. In this case, the user can easily grasp the result.

次に、本発明の実施の形態2におけるデータベース操作装置4の動作について図8を用いて説明する。図8は、本発明の実施の形態2におけるデータベース操作装置の動作を示すフロー図である。また、本実施の形態2においても、データベース操作装置4を動作させることによって、データベース操作方法が実施される。よって、本実施の形態におけるデータベース操作方法の説明は、以下のデータベース操作装置4の動作の説明に代える。なお、適宜図7を参酌する。   Next, operation | movement of the database operating device 4 in Embodiment 2 of this invention is demonstrated using FIG. FIG. 8 is a flowchart showing the operation of the database operating device in the second embodiment of the present invention. In the second embodiment, the database operation method is also implemented by operating the database operation device 4. Therefore, the description of the database operation method in the present embodiment is replaced with the following description of the operation of the database operation device 4. Note that FIG. 7 is taken into consideration as appropriate.

また、図8の例も、実施の形態1において図4に示した例と同様に、コンピュータ2(図1参照)が、情報の検索を行う業務システムを構成している場合を示している。図8の例において、エンティティオブジェクト12のフィールドに格納される操作条件は、検索条件である。なお、各エンティティオブジェクト12は、テーブル17に合わせて予め作成されているが、操作条件は設定されていない状態にある。   Also, the example of FIG. 8 shows a case where the computer 2 (see FIG. 1) constitutes a business system that searches for information, similarly to the example shown in FIG. 4 in the first embodiment. In the example of FIG. 8, the operation condition stored in the field of the entity object 12 is a search condition. Each entity object 12 is created in advance according to the table 17, but no operation condition is set.

図8に示すように、先ず、入力受付部10は、入力画面上で入力された検索条件を取得し、これを受け付ける(ステップB1)。次に、入力受付部10は、受け付けた検索条件に対応するエンティティオブジェクト12を特定し、特定したエンティティオブジェクト12のフィールドに検索条件を格納させる(ステップB2)。   As shown in FIG. 8, first, the input receiving unit 10 acquires the search condition input on the input screen and receives this (step B1). Next, the input receiving unit 10 specifies the entity object 12 corresponding to the received search condition, and stores the search condition in the field of the specified entity object 12 (step B2).

次に、SQL生成部14は、エンティティオブジェクト12に基づいてSQL文を生成する(ステップB3)。本実施の形態2において、ステップB3は、実施の形態1において図4に示したステップA1〜A8を全て含んでいる。ステップB3で生成されたSQL文は、SQL処理部16に入力される。   Next, the SQL generation unit 14 generates an SQL sentence based on the entity object 12 (step B3). In the second embodiment, step B3 includes all steps A1 to A8 shown in FIG. 4 in the first embodiment. The SQL sentence generated in step B3 is input to the SQL processing unit 16.

次に、SQL処理部16は、生成されたSQL文をデータベース3に渡し(ステップB4)、そして、データベース3から検索の結果を受け取る(ステップB5)。続いて、結果変換部15は、ステップB5で取得された検索の結果を、エンティティオブジェクト12で登録可能なデータ形式に変換し、変換した結果を、取得元のテーブル17に対応しているエンティティオブジェクト12に登録する(ステップB6)。   Next, the SQL processing unit 16 passes the generated SQL sentence to the database 3 (step B4), and receives a search result from the database 3 (step B5). Subsequently, the result conversion unit 15 converts the search result acquired in step B5 into a data format that can be registered in the entity object 12, and converts the converted result into the entity object corresponding to the acquisition source table 17. 12 (step B6).

その後、結果出力部11は、ステップB6で検索の結果が登録されたエンティティオブジェクト12から、登録された検索の結果を取り出し、取り出した検索の結果を表示装置6に出力する(ステップB7)。これにより、検索の結果が、表示装置6の表示画面に表示され、利用者は、検索の結果を容易に把握することができる。ステップB7が実行されると、データベース操作装置4での処理は終了する。   After that, the result output unit 11 extracts the registered search result from the entity object 12 in which the search result is registered in Step B6, and outputs the retrieved search result to the display device 6 (Step B7). Thereby, the result of the search is displayed on the display screen of the display device 6, and the user can easily grasp the result of the search. When step B7 is executed, the processing in the database operation device 4 ends.

以上のように、本実施の形態2によれば、利用者は、入力画面上で、直接、検索条件を入力することができる。また、入力された検索条件がエンティティオブジェクト12に設定されるので、本実施の形態2を用いた場合も、実施の形態1を用いた場合と同様に、利用者側でSQLを記述することなく、複数のテーブルにまたがる検索の実行が可能となる。更に、データベース操作装置4においても、複数のテーブルにまたがる検索の実行時において、複雑な処理は要求されず、アクセス性能の低下は抑制される。   As described above, according to the second embodiment, the user can input the search condition directly on the input screen. In addition, since the input search condition is set in the entity object 12, even when the second embodiment is used, the SQL is not described on the user side as in the first embodiment. It is possible to execute a search across a plurality of tables. Further, the database operation device 4 also does not require complicated processing when executing a search across a plurality of tables and suppresses a decrease in access performance.

また、本実施の形態2におけるプログラムは、コンピュータ2(図1参照)に、図8に示すステップB1〜A7を実行させるプログラムであれば良い。このプログラムをコンピュータ2にインストールし、実行することによって、本実施の形態2におけるデータベース操作装置4とデータベース操作方法とを実現することができる。この場合、コンピュータ2のCPU(Central Processing Unit)は、データアクセスオブジェクト13として機能し、処理を行なう。また、コンピュータ2のCPUは、メモリやハードディスク等の
記憶装置の記憶領域に、エンティティオブジェクト12を構築する。
Moreover, the program in this Embodiment 2 should just be a program which makes the computer 2 (refer FIG. 1) perform step B1-A7 shown in FIG. By installing and executing this program on the computer 2, the database operation device 4 and the database operation method in the second embodiment can be realized. In this case, a CPU (Central Processing Unit) of the computer 2 functions as the data access object 13 and performs processing. Further, the CPU of the computer 2 constructs the entity object 12 in a storage area of a storage device such as a memory or a hard disk.

以上説明した実施の形態1及び2では、SQL生成部14が最初にSELECT文を生成する例が、挙げられている(図4参照)。但し、本発明は、この例に限定されるものではない。本発明では、SQL生成部は、エンティティオブジェクトに設定されている操作条件に基づいて、UPDATE文や、DELETE文を生成することもできる。この場合、データベースに対しては、更新処理や、削除処理が行われる。   In Embodiment 1 and 2 demonstrated above, the example in which the SQL production | generation part 14 produces | generates a SELECT sentence first is mentioned (refer FIG. 4). However, the present invention is not limited to this example. In the present invention, the SQL generation unit can also generate an UPDATE statement and a DELETE statement based on the operation condition set in the entity object. In this case, update processing and deletion processing are performed on the database.

本発明によれば、互いに関連するテーブルが存在している場合であっても、利用者側でSQL文を記述することなく、データベースを操作できる。本発明は、リレーショナルデータベースを利用した業務システム、特には、アプリケーションプログラムによってSQLが作成され、このSQLによってデータベースが操作されるシステムに有用である。   According to the present invention, even if there are tables related to each other, the database can be operated without describing the SQL statement on the user side. The present invention is useful for a business system using a relational database, particularly a system in which SQL is created by an application program and the database is operated by this SQL.

1 データベース操作装置(実施の形態1)
2 コンピュータ
3 データベース
4 データベース操作装置(実施の形態2)
5 入力装置
6 表示装置
10 入力受付部
11 結果出力部
12−1〜12−n エンティティオブジェクト
13 データアクセスオブジェクト
14 SQL生成部
15 結果変換部
16 SQL処理部
17−1〜17−n テーブル
1 Database operation device (Embodiment 1)
2 Computer 3 Database 4 Database operation device (Embodiment 2)
DESCRIPTION OF SYMBOLS 5 Input device 6 Display apparatus 10 Input reception part 11 Result output part 12-1 to 12-n Entity object 13 Data access object 14 SQL generation part 15 Result conversion part 16 SQL process part 17-1 to 17-n Table

Claims (15)

データベースを構成しているテーブル毎に作成されたエンティティオブジェクトと、前記データベースを操作するためのSQL文を生成するSQL生成部とを備え、
前記エンティティオブジェクトは、複数のフィールドを備え、前記複数のフィールドのうち一のフィールドに、対応するテーブルを特定する情報として、前記対応するテーブルのいずれかのカラムに登録された情報を格納し、他のフィールドに操作条件を格納し、加えて、前記対応するテーブルに関連するテーブルが存在する場合は、前記一のフィールドにおいて、その型が、前記関連するテーブルに対応している別のエンティティオブジェクトのクラスに設定されており、
前記SQL生成部は、
前記エンティティオブジェクトが対応する前記テーブルを特定し、
前記操作条件に応じて、特定した前記テーブルに対する操作を実行するためのSQL文を作成し、そして、
前記エンティオブジェクトにおいて、前記一のフィールドにおいて、その型が、前記関連するテーブルに対応している別のエンティティオブジェクトのクラスに設定されているかどうかを判定し、設定されている場合は、前記関連するテーブルに対する操作を実行するためのSQL文を更に生成する、
ことを特徴とする、データベース操作装置。
An entity object created for each table constituting the database, and an SQL generator for generating an SQL statement for operating the database,
The entity object includes a plurality of fields, and stores information registered in one of the columns of the corresponding table as information for specifying the corresponding table in one of the plurality of fields. field stores the operating conditions of, in addition, if the table associated with the corresponding table exists, the in one of the field, its type, another which corresponds to the associated table of entity objects Set to class,
The SQL generation unit
Identify the table to which the entity object corresponds;
Create an SQL statement for executing an operation on the identified table according to the operation condition, and
In the entity object, in the one field, its type, the associated determined whether it is set to the class of another entity object corresponding to the table, if it is set, the associated Further generating an SQL statement for performing an operation on the table;
A database operating device.
前記エンティティオブジェクトが含む操作条件が、前記対応するテーブルを検索対象とする検索条件である場合に、
前記SQL生成部が、先ず、SELECT文及びFROMを生成し、そして、
前記複数のフィールドを走査して、前記エンティオブジェクトが前記関連するテーブルを特定する情報を含んでいるかどうかを判定し、含んでいる場合は、JOIN文を生成する、請求項に記載のデータベース操作装置。
When the operation condition included in the entity object is a search condition for searching the corresponding table,
The SQL generator first generates a SELECT statement and FROM, and
The database operation according to claim 1 , wherein the plurality of fields are scanned to determine whether the entity object includes information specifying the related table, and if so, a JOIN statement is generated. apparatus.
外部から入力された操作条件を受け付け、受け付けた操作条件を前記エンティティオブジェクトに格納させる入力受付部を更に備えている、請求項1または2に記載のデータベース操作装置。 Accepts input operation condition from the outside, and an input receiving unit for storing the received operation condition to the entity object further database operation device according to claim 1 or 2. 前記SQL文に記述された操作を前記データベースに対して実行し、前記操作の結果を前記データベースの前記テーブルから取得する、SQL処理部を、更に備えている、請求項1〜のいずれかに記載のデータベース操作装置。 The operation described in the SQL statement to run against the database to retrieve the result of the operation from the table of the database, the SQL processing unit, and further comprising, in any one of claims 1 to 3 The database operating device described. 前記データベースから取得された前記操作の結果を、前記エンティティオブジェクトで登録可能なデータ形式に変換し、変換した前記結果を、取得元の前記テーブルに対応している前記エンティティオブジェクトに登録する、結果変換部と、
前記結果が登録されたエンティティオブジェクトから、登録された前記結果を取り出し、取り出した前記結果を外部に出力する、結果出力部とを、更に備えている、請求項に記載のデータベース操作装置。
Result conversion for converting the result of the operation acquired from the database into a data format that can be registered in the entity object, and registering the converted result in the entity object corresponding to the table of the acquisition source And
The database operation device according to claim 4 , further comprising: a result output unit that extracts the registered result from the registered entity object and outputs the extracted result to the outside.
(a)データベースを構成しているテーブル毎に作成され、且つ、一のフィールドに、対応するテーブルを特定する情報として、前記対応するテーブルのいずれかのカラムに登録された情報を格納し、他のフィールドに操作条件を格納する、エンティティオブジェクトから、前記エンティティオブジェクトが対応する前記テーブルを特定する、ステップと、
(b)前記操作条件に応じて、前記(a)のステップで特定された前記テーブルに対する操作を実行するためのSQL文を生成する、ステップと、
(c)前記エンティティオブジェクトにおいて、前記一のフィールドにおいて、その型が、前記関連するテーブルに対応している別のエンティティオブジェクトのクラスに設定されているかどうかを判定するステップと、
(d)前記(c)のステップで、設定されていると判定された場合に、前記関連するテーブルに対する操作を実行するためのSQL文を更に生成する、ステップと、
を有することを特徴とする、データベース操作方法。
(A) Information created in any column of the corresponding table is stored in one field as information for identifying the corresponding table, created for each table constituting the database, and others The operation condition is stored in the field, and the table corresponding to the entity object is specified from the entity object; and
(B) generating an SQL statement for executing an operation on the table specified in the step (a) according to the operation condition;
(C) determining whether the type of the entity object is set to a class of another entity object corresponding to the related table in the one field ;
(D) If it is determined in the step (c) that it is set, a SQL statement for further executing an operation on the related table is generated; and
A database operating method characterized by comprising:
前記エンティティオブジェクトが含む操作条件が、前記対応するテーブルを検索対象とする検索条件である場合に、
前記(b)のステップにおいて、SELECT文及びFROMを生成し、
前記(c)のステップにおいて、前記複数のフィールドを走査して、前記エンティオブジェクトが前記関連するテーブルを特定する情報を含んでいるかどうかを判定し、
前記(d)のステップにおいて、JOIN文を生成する、請求項に記載のデータベース操作方法。
When the operation condition included in the entity object is a search condition for searching the corresponding table,
In the step (b), a SELECT statement and FROM are generated,
In step (c), scanning the plurality of fields to determine whether the entity object contains information identifying the associated table;
The database operation method according to claim 6 , wherein a JOIN statement is generated in the step (d).
(e)外部から入力された操作条件を受け付け、受け付けた操作条件を前記エンティティオブジェクトに格納させる、ステップを更に有する、請求項6または7に記載のデータベース操作方法。 (E) The database operation method according to claim 6 or 7 , further comprising a step of receiving an operation condition input from the outside and storing the received operation condition in the entity object. (f)前記SQL文に記述された操作を前記データベースに対して実行し、前記操作の結果を前記データベースの前記テーブルから取得する、ステップを、更に有する、請求項のいずれかに記載のデータベース操作方法。 (F) perform the operations described in the SQL statement to the database and get the results of the operation from the table of the database, the step further comprises, according to any one of claims 6-8 Database operation method. (g)前記(f)のステップで取得された前記操作の結果を、前記エンティティオブジェクトで登録可能なデータ形式に変換し、変換した前記結果を、取得元の前記テーブルに対応している前記エンティティオブジェクトに登録する、ステップと、
(h)前記結果が登録されたエンティティオブジェクトから、登録された前記結果を取り出し、取り出した前記結果を外部に出力する、ステップとを、更に有する、請求項に記載のデータベース操作方法。
(G) The operation result acquired in the step (f) is converted into a data format that can be registered in the entity object, and the converted result is converted into the entity corresponding to the acquisition source table. Registering with objects, steps,
The database operation method according to claim 9 , further comprising: (h) extracting the registered result from an entity object in which the result is registered, and outputting the extracted result to the outside.
コンピュータによってデータベースの操作を実行させるためのプログラムであって、
前記コンピュータに、
(a)前記データベースを構成しているテーブル毎に作成され、且つ、一のフィールドに、対応するテーブルを特定する情報として、前記対応するテーブルのいずれかのカラムに登録された情報を格納し、他のフィールドに操作条件を格納する、エンティティオブジェクトから、前記エンティティオブジェクトが対応する前記テーブルを特定する、ステップと、
(b)前記操作条件に応じて、前記(a)のステップで特定された前記テーブルに対する操作を実行するためのSQL文を生成する、ステップと、
(c)前記エンティティオブジェクトにおいて、前記一のフィールドにおいて、その型が、前記関連するテーブルに対応している別のエンティティオブジェクトのクラスに設定されているかどうかを判定するステップと、
(d)前記(c)のステップで、設定されていると判定された場合に、前記関連するテーブルに対する操作を実行するためのSQL文を更に生成する、ステップと、
を実行させることを特徴とする、プログラム。
A program for causing a computer to execute database operations,
In the computer,
(A) Information created in any column of the corresponding table is stored in one field as information specifying the corresponding table, created for each table constituting the database , Identifying the table to which the entity object corresponds from the entity object, storing operation conditions in other fields ;
(B) generating an SQL statement for executing an operation on the table specified in the step (a) according to the operation condition;
(C) determining whether the type of the entity object is set to a class of another entity object corresponding to the related table in the one field ;
(D) If it is determined in the step (c) that it is set, a SQL statement for further executing an operation on the related table is generated; and
A program characterized by having executed.
前記エンティティオブジェクトが含む操作条件が、前記対応するテーブルを検索対象とする検索条件である場合に、
前記(b)のステップにおいて、SELECT文及びFROMを生成し、
前記(c)のステップにおいて、前記複数のフィールドを走査して、前記エンティオブジェクトが前記関連するテーブルを特定する情報を含んでいるかどうかを判定し、
前記(d)のステップにおいて、JOIN文を生成する、請求項11に記載のプログラム。
When the operation condition included in the entity object is a search condition for searching the corresponding table,
In the step (b), a SELECT statement and FROM are generated,
In step (c), scanning the plurality of fields to determine whether the entity object contains information identifying the associated table;
The program according to claim 11 , wherein in the step (d), a JOIN statement is generated.
(e)外部から入力された操作条件を受け付け、受け付けた操作条件を前記エンティティオブジェクトに格納させる、ステップを、更に前記コンピュータに実行させる、請求項11またはに記載のプログラム。 (E) receiving the inputted operation condition from the outside, and stores the received operation condition to the entity object, a step to execute further the computer program according to claim 1 1 or 1 2. (f)前記SQL文に記述された操作を前記データベースに対して実行し、前記操作の結果を前記データベースの前記テーブルから取得する、ステップを、更に前記コンピュータに実行させる、請求項1〜1のいずれかに記載のプログラム。 (F) perform the operations described in the SQL statement to the database and get the results of the operation from said table of said database, a step to execute further to the computer, according to claim 1 1 to 1 4. The program according to any one of 3 . (g)前記(f)のステップで取得された前記操作の結果を、前記エンティティオブジェクトで登録可能なデータ形式に変換し、変換した前記結果を、取得元の前記テーブルに対応している前記エンティティオブジェクトに登録する、ステップと、
(h)前記結果が登録されたエンティティオブジェクトから、登録された前記結果を取り出し、取り出した前記結果を外部に出力する、ステップとを、更に前記コンピュータに実行させる、請求項1に記載のプログラム。
(G) The operation result acquired in the step (f) is converted into a data format that can be registered in the entity object, and the converted result is converted into the entity corresponding to the acquisition source table. Registering with objects, steps,
(H) from the entity object that the result is registered, is taken out the result of the registered outputs the result of extraction to the outside, and a step to execute further the computer program as claimed in claim 1 4 .
JP2009206742A 2009-09-08 2009-09-08 Database operation device, database operation method, and program Expired - Fee Related JP5488792B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2009206742A JP5488792B2 (en) 2009-09-08 2009-09-08 Database operation device, database operation method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2009206742A JP5488792B2 (en) 2009-09-08 2009-09-08 Database operation device, database operation method, and program

Publications (2)

Publication Number Publication Date
JP2011059845A JP2011059845A (en) 2011-03-24
JP5488792B2 true JP5488792B2 (en) 2014-05-14

Family

ID=43947419

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2009206742A Expired - Fee Related JP5488792B2 (en) 2009-09-08 2009-09-08 Database operation device, database operation method, and program

Country Status (1)

Country Link
JP (1) JP5488792B2 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5542857B2 (en) * 2012-03-22 2014-07-09 株式会社東芝 Query issuing device, query issuing program, query issuing method
JP6415877B2 (en) * 2014-07-08 2018-10-31 株式会社東芝 Data processing apparatus and data processing method
KR101806449B1 (en) 2016-05-30 2017-12-07 주식회사 인브레인 Ansi query statement generation system using graphical user interface and method thereof

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6625613B2 (en) * 2001-02-26 2003-09-23 Motorola, Inc. Automatic generation of SQL for frame completion
JP2003337726A (en) * 2002-05-20 2003-11-28 Hitachi Software Eng Co Ltd Database access program forming method
JP2004164363A (en) * 2002-11-14 2004-06-10 Nobuhiko Nagamori Method for displaying relational database structure in tree diagram
JP2006251979A (en) * 2005-03-09 2006-09-21 Matsushita Electric Ind Co Ltd Variable item retrieval system
KR100558952B1 (en) * 2005-05-12 2006-03-10 김길웅 Method for automation of software manufacturing process based on graphic user interface design, and computer readable medium having thereon computer executable instruction for performing the same

Also Published As

Publication number Publication date
JP2011059845A (en) 2011-03-24

Similar Documents

Publication Publication Date Title
JP4947245B2 (en) Information retrieval apparatus, information retrieval method, computer program, and data structure
US8732127B1 (en) Method and system for managing versioned structured documents in a database
US9164738B2 (en) Database mapping of models for reporting tools in model driven development
US20080147707A1 (en) Method and apparatus for using set based structured query language (sql) to implement extract, transform, and load (etl) splitter operation
JP2007066017A (en) System and method for controlling access to database
JP4207438B2 (en) XML document storage / retrieval apparatus, XML document storage / retrieval method used therefor, and program thereof
JP5844824B2 (en) SPARQL query optimization method
JP5488792B2 (en) Database operation device, database operation method, and program
US20110270862A1 (en) Information processing apparatus and information processing method
JP3163141B2 (en) Relational database processing device and processing method
US8639709B2 (en) Comparing very large XML data
JP2010272006A (en) Relation extraction apparatus, relation extraction method and program
US20100153438A1 (en) Method and apparatus for searching for hierarchical structure document
US9542502B2 (en) System and method for XML subdocument selection
JP6287506B2 (en) Database access control program, database access control method, and information processing apparatus
JP2018060379A (en) Searching means selecting program, searching means selecting method and searching means selecting device
US8898122B1 (en) Method and system for managing versioned structured documents in a database
JP6589317B2 (en) Rewriting device, processing method and program thereof, and information processing device
JP2000181697A (en) Method and device for conversion to open type system of mainframe cobol property and recording medium
US20240028328A1 (en) Storage medium, information processing method, and information processing device
JP5596517B2 (en) Internationalized screen generation system and program
JP5190899B2 (en) Information processing apparatus, setting file generation method, and setting file generation program
JP4693807B2 (en) Program development support system, method and program
JP5483166B2 (en) Document search apparatus, document search method, and program
JP4983397B2 (en) Document search apparatus, document search method, and computer program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20120801

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20130904

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20130911

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20131107

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: 20140129

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20140211

R150 Certificate of patent or registration of utility model

Ref document number: 5488792

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees