JP2006004145A - Program code generator - Google Patents

Program code generator Download PDF

Info

Publication number
JP2006004145A
JP2006004145A JP2004179418A JP2004179418A JP2006004145A JP 2006004145 A JP2006004145 A JP 2006004145A JP 2004179418 A JP2004179418 A JP 2004179418A JP 2004179418 A JP2004179418 A JP 2004179418A JP 2006004145 A JP2006004145 A JP 2006004145A
Authority
JP
Japan
Prior art keywords
program code
data type
column
database
program
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
Application number
JP2004179418A
Other languages
Japanese (ja)
Inventor
Akira Umada
晃 馬田
Daisuke Baba
大輔 馬場
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.)
UL SYSTEMS Inc
Original Assignee
UL SYSTEMS Inc
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 UL SYSTEMS Inc filed Critical UL SYSTEMS Inc
Priority to JP2004179418A priority Critical patent/JP2006004145A/en
Publication of JP2006004145A publication Critical patent/JP2006004145A/en
Pending legal-status Critical Current

Links

Images

Landscapes

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

Abstract

<P>PROBLEM TO BE SOLVED: To provide a program code generator for efficiently developing an application program by using information describing the schema of a database. <P>SOLUTION: The program code generator involves: acquiring the schema information and retaining the pattern of a database operation code; and completing a program code based on the acquired schema information and the specimen of the retained database operation code. In addition, the program code is completed by using the corresponding relation between a data type used in the database and a data type used in a program language, or by associating the naming rule of the column name of the database with the data type used in the program language. <P>COPYRIGHT: (C)2006,JPO&NCIPI

Description

本発明は、プログラムコードを生成するプログラム生成装置に関し、特に、データベースへアクセスを行なうプログラムコードを生成するプログラム生成装置に関する。   The present invention relates to a program generation apparatus that generates a program code, and more particularly to a program generation apparatus that generates a program code for accessing a database.

データベースを操作するためには、SQL(一般には「Structured Qeury Language」の略と言われている)などのデータベース操作言語に習熟している必要があるが、一般の人々が習得するには困難が伴なう。そこで、データベースの構造(すなわち、データベースのスキーマ)を示す情報からグラフィカルユーザインターフェース(GUI)を生成して、そのGUIを通してデータベースを操作する技術が知られている(例えば、特許文献1参照。)。   In order to operate a database, it is necessary to be familiar with a database operation language such as SQL (generally called “Structured Query Language”), but it is difficult for general people to learn. Accompany. Therefore, a technique is known in which a graphical user interface (GUI) is generated from information indicating a database structure (that is, a database schema), and the database is operated through the GUI (see, for example, Patent Document 1).

一方、データベースの構造を対話形式により作成するツールがいくつか知られており(例えば、非特許文献1参照。)、これらのツールは、スキーマ情報をCSV(Comma Separated Values)形式やXML(eXteneded Markup Language)形式で出力している。   On the other hand, some tools for creating a database structure interactively are known (for example, see Non-Patent Document 1). These tools convert schema information into CSV (Comma Separated Values) format or XML (eXtended Markup). (Language) format.

また、データベースへアクセスするアプリケーションプログラムの開発においては、人間が個別にプログラムを書いている。   In the development of application programs that access a database, humans individually write programs.

図1は、データベースへアクセスするアプリケーションプログラムの動作を例示する。データベースへアクセスするアプリケーションプログラム101は、プロセス間通信などの手法を用いて、リレーショナルデータベース管理サーバ102と通信を行なう。具体的には、アプリケーションプログラム101がSQL文をリレーショナルデータベース管理サーバ102へ送信すると、そのSQL文に従って、リレーショナルデータベース管理サーバ102はデータベース103の参照あるいは変更などの操作を行ない、その結果をアプリケーションプログラムへ返すことを行なう。SQL文の種類としては、検索を行なうSELECT文、データを追加するINSERT文、更新を行なうUPDATE文、削除を行なうDELETE文、があり、また、データベースの構造を変更するスキーマ操作のための文や、スキーマの構造を参照するための文がある。これらの文は、アプリケーションプログラムに文字列として埋め込まれており、適宜実行されるようになっている。
特開2004−126680号公報 "製品情報>AllFusion ERwin Data Modeler",[online],2004,[検索日:2004.06.07],インターネット<http://www.jsys-products.com/product/al_erwin/>
FIG. 1 illustrates the operation of an application program that accesses a database. The application program 101 that accesses the database communicates with the relational database management server 102 using a technique such as interprocess communication. Specifically, when the application program 101 transmits an SQL statement to the relational database management server 102, the relational database management server 102 performs operations such as referring to or changing the database 103 according to the SQL statement, and sends the result to the application program. To return. The types of SQL statements include a SELECT statement for searching, an INSERT statement for adding data, an UPDATE statement for updating, and a DELETE statement for deleting, and a statement for schema operation that changes the structure of the database. There is a statement to refer to the structure of the schema. These sentences are embedded as character strings in the application program and are appropriately executed.
JP 2004-126680 A "Product Information> AllFusion ERwin Data Modeler", [online], 2004, [Search Date: 2004.6.007], Internet <http://www.jsys-products.com/product/al_erwin/>

このようにデータベースへアクセスするアプリケーションプログラムの開発においては、人間が個別にプログラムを書いているため、時間や労力が掛かる割には、プログラムの信頼性が高くならないという課題がある。データベースのスキーマが変更になると、対応するアプリケーションプログラムを個別に修正しなければならず、さらに労力と時間がかかっている。また、データベースで使用できるデータ型とプログラム言語で使用できるデータ型が同じではなく、アプリケーションプログラムの開発においては、常にデータ型の違いを意識しなければならず、この点でバグを誘発しやすい。   As described above, in developing an application program that accesses a database, since a person writes a program individually, there is a problem that the reliability of the program does not increase even though it takes time and labor. When the database schema changes, the corresponding application program must be individually modified, which takes more effort and time. In addition, the data types that can be used in the database and the data types that can be used in the programming language are not the same. In developing an application program, it is necessary to always be aware of the difference between the data types, and it is easy to induce bugs in this respect.

GUIを通してデータベースを操作する技術は、人間との対話機能を重視しているため、この技術を転用して上記の問題を解決することはできない。   Since a technique for operating a database through a GUI places importance on a dialogue function with a human, the above problem cannot be solved by diverting this technique.

また、データベースの構造を対話形式により作成するツールが生成するCSV形式やXML形式によるスキーマを記述するファイルはテキスト形式であり、利用しやすい形式であるにもかかわらず、このようなファイルを利用してアプリケーションプログラムの開発の信頼性などを向上させることなどは、あまり行なわれていない。   In addition, files that describe the schema in CSV format or XML format generated by a tool that creates the database structure in an interactive format are in text format and are easy to use. There has been little progress in improving the reliability of application program development.

そこで、本発明においては、スキーマを記述するファイルなどを利用して、アプリケーションプログラムを効率よく開発するためのプログラムコード生成装置、プログラムコード生成方法を提供することを目的とする。   Therefore, an object of the present invention is to provide a program code generation apparatus and a program code generation method for efficiently developing an application program using a file describing a schema.

かかる目的を解決するために、本発明においては、スキーマ情報を取得し、また、データベース操作コードの雛形を保持しておき、取得されたスキーマ情報と保持されているデータベース操作コードの雛形とに基づいてプログラムコードを完成させるプログラム生成装置を提供する。これにより、データベースへアクセスするアプリケーションプログラムの開発工程が自動化され、アプリケーションプログラムの生産性が向上し、また、信頼性も向上することとなる。   In order to solve such an object, in the present invention, schema information is acquired and a database operation code template is stored, and based on the acquired schema information and the stored database operation code template. A program generation device for completing the program code is provided. Thereby, the development process of the application program for accessing the database is automated, the productivity of the application program is improved, and the reliability is also improved.

また、プログラムコード生成装置においては、データベースで使用されるデータ型とプログラム言語で使用されるデータ型との対応関係を有し、その対応関係を利用してプログラムコードが生成されるようになっていてもよい。これにより、プログラマがデータ型の違いを意識することが軽減され、バグが減少する。   In addition, the program code generation device has a correspondence between the data type used in the database and the data type used in the program language, and the program code is generated using the correspondence. May be. This alleviates programmers' awareness of data type differences and reduces bugs.

また、データベースの列名の命名規則とプログラム言語で使用するデータ型とを対応付けてもよい。これにより、列の役割に応じたアプリケーションプログラムが開発できることになる。   Further, the naming rules for database column names may be associated with data types used in the programming language. Thereby, an application program corresponding to the role of the column can be developed.

また、特定の列の値が特定の値を有するかどうかによりその列を含む行データが削除されたと扱う、いわゆる論理削除に対応したプログラムコードを生成することにより、論理削除という複雑な操作も自動的にプログラミングすることができ、生産性や信頼性の向上ができる。   In addition, by generating program code corresponding to so-called logical deletion that treats row data including the column as deleted depending on whether the value of a specific column has a specific value, complicated operations such as logical deletion are also automatically performed. Can be programmed and productivity and reliability can be improved.

また、生成されるプログラムコードは、継承(インヘリタンス)機構を持つプログラム言語で記述されるようになっていてもよい。これにより、生成されたプログラムコードを、継承機構を用いて人間が修正することが容易となる。   The generated program code may be written in a program language having an inheritance mechanism. This makes it easy for a human to modify the generated program code using the inheritance mechanism.

また、生成されたプログラムコードにおいて、テーブル名又は/及び列名の文字列を変数や定数などとして定義し、生成されたプログラムコードを継承するプログラム部分で、それらの変数や定数などを参照可能としてもよい。これにより、テーブル名や列名の変更があっても人間が修正したプログラムコードを修正する必要がなくなったり、テーブル名や列名の変更により、人間が修正したプログラムコードを修正する必要があることを容易に知ることができる。   Also, in the generated program code, character strings of table names and / or column names are defined as variables and constants, and those variables and constants can be referenced in the program part that inherits the generated program code. Also good. As a result, it is not necessary to modify the program code modified by humans even if the table name or column name is changed, or the program code modified by humans must be modified by changing the table name or column name. Can be easily known.

本発明により、データベースへアクセスするアプリケーションプログラムの開発工程が自動化され、アプリケーションプログラムの生産性が向上し、また、信頼性も向上するなどの効果が得られる。   According to the present invention, the development process of an application program that accesses a database is automated, so that the productivity of the application program is improved and the reliability is improved.

以下、本発明を実施するための最良の形態について、実施形態として図を用いて説明する。なお、本発明は、これら実施形態に何ら限定されるものではなく、その要旨を逸脱しない範囲において、種々なる態様で実施し得る。   Hereinafter, the best mode for carrying out the present invention will be described with reference to the drawings as an embodiment. Note that the present invention is not limited to these embodiments, and can be implemented in various modes without departing from the spirit of the present invention.

(実施形態1:主に請求項1、7、8について説明する)   (Embodiment 1: Claims 1, 7, and 8 will be mainly described)

本発明の実施形態1として、スキーマ情報を取得し、また、データベース操作コードの雛形を保持しておき、取得されたスキーマ情報と保持されているデータベース操作コードの雛形とに基づいてプログラムコードを完成させるプログラム生成装置、プログラム生成方法について説明する。   As Embodiment 1 of the present invention, schema information is acquired, a database operation code template is stored, and a program code is completed based on the acquired schema information and the stored database operation code template A program generation apparatus and a program generation method to be executed will be described.

(実施形態1:構成)
本実施形態に係るプログラムコード生成装置は、データベースへアクセスを行なうプログラムコードを生成する。「アクセス」とはデータベースを管理するサーバと通信を行なったり、あるいは、データベースを管理するためのライブラリを操作したりすることにより、データベースの内容を参照したり、変更したりすることである。
(Embodiment 1: Configuration)
The program code generation device according to the present embodiment generates program code for accessing a database. “Access” refers to referring to or changing the contents of a database by communicating with a server that manages the database or by operating a library for managing the database.

図2は、本実施形態に係るプログラムコード生成装置の機能ブロック図を例示する。プログラムコード生成装置200は、スキーマ情報取得部201と、操作コード雛形保持部202と、プログラムコード完成部203と、を有する。   FIG. 2 illustrates a functional block diagram of the program code generation device according to the present embodiment. The program code generation device 200 includes a schema information acquisition unit 201, an operation code template holding unit 202, and a program code completion unit 203.

なお、本実施形態に限らず、本発明のプログラムコード生成装置の構成要素である各部は、ハードウェア、ソフトウェア、ハードウェアとソフトウェア(プログラム)の両者、のいずれかによって構成することが可能であり、したがって、プログラムコード生成装置は、計算機を用いて実現することが可能である。たとえば、CPU、メモリ、バス、インターフェース、周辺装置などから構成されるハードウェアと、これらのハードウェア上にて実行可能なソフトウェアを用いて実現することができる。また、そのようなソフトウェア(プログラム)を媒体に記録することも可能である。   In addition, not only this embodiment but each part which is a component of the program code generation apparatus of this invention can be comprised by either of hardware, software, both of hardware and software (program). Therefore, the program code generation device can be realized using a computer. For example, it can be realized using hardware including a CPU, a memory, a bus, an interface, a peripheral device, and the like, and software that can be executed on these hardware. It is also possible to record such software (program) on a medium.

「スキーマ情報取得部」201は、スキーマ情報を取得する。「スキーマ情報」とは、前記データベースのスキーマを記述する情報である。すなわち、データベースの構造を表現する情報である。データベースとしてリレーショナルデータベースを使用する場合には、データベースは一または複数の列からなる表により構成される。したがって、この場合には、表の構造を表わす情報がスキーマ情報となる。   The “schema information acquisition unit” 201 acquires schema information. “Schema information” is information describing the schema of the database. That is, the information represents the structure of the database. When a relational database is used as the database, the database is configured by a table having one or a plurality of columns. Therefore, in this case, information representing the structure of the table is schema information.

図3は、リレーショナルデータベースの表を例示する。図3では、表としてTABLE_AとTABLE_Bとが示されている。TABLE_Aは、ID、A_CODE、A_FLAG、A_DATE、A_TIMESTAMP、DELETE_TIMESTAMPという名前の列からなる。また、TABLE_Bは、ID、TABLE_A_ID、B_NAMEという名前の列からなる。   FIG. 3 illustrates a relational database table. In FIG. 3, TABLE_A and TABLE_B are shown as a table. TABLE_A consists of columns named ID, A_CODE, A_FLAG, A_DATE, A_TIMESTAMP, and DELETE_TIMESTAMP. TABLE_B is composed of columns named ID, TABLE_A_ID, and B_NAME.

図4は、図3に例示されたデータベースの構造を記述するスキーマ情報を例示する。図4では、一行がテーブルの列の情報を記述している。なお、図4の第一行目は、「#」で始まっているので、コメント行として扱われ、コンマで区切られたそれぞれの部分が何を表わしているかを人間が理解しやすいように表わしている。すなわち、各行の最初の部分は、テーブルの名前を表わし、次の部分は、列の名前を表わし、以後順に、列のデータ型、列がプライマリキーであるかどうか、空値を格納することができるかどうか、列に対するコメント、を表わす。なお、「プライマリキー」とは、表に格納される行を一意に特定するための列を意味する。例えば、表に社員の情報を格納する場合、社員に一人一人に互いに異なるように与えられた社員番号により社員が一人特定できるので、社員番号を格納する列がプライマリキーとなる。また、「空値」とは、列の値が、特定されない、あるいは、不明であることを表わす特別な値である。   FIG. 4 illustrates schema information describing the structure of the database illustrated in FIG. In FIG. 4, one line describes the information of the table columns. Since the first line in FIG. 4 starts with “#”, it is treated as a comment line, and is expressed so that it is easy for humans to understand what each part separated by a comma represents. Yes. That is, the first part of each row represents the name of the table, the second part represents the name of the column, and the data type of the column, whether the column is a primary key, and a null value can be stored in order. Indicates whether it can be done or a comment on the column. The “primary key” means a column for uniquely specifying a row stored in the table. For example, when storing employee information in a table, each employee can be identified by an employee number given differently to each employee, so the column storing the employee number is the primary key. The “null value” is a special value indicating that the value of the column is not specified or unknown.

スキーマ情報取得部201は、例えば、図4に例示されたスキーマ情報を読み込むことを行ない、スキーマ情報の取得を行なう。もし、プログラムコード生成装置200が計算機を用いて実現される場合には、スキーマ情報の取得の結果としてスキーマ情報を表わすデータ構造が主記憶メモリに構築される。   For example, the schema information acquisition unit 201 reads the schema information illustrated in FIG. 4 and acquires the schema information. If the program code generation device 200 is implemented using a computer, a data structure representing the schema information is constructed in the main memory as a result of acquiring the schema information.

図5は、主記憶メモリに構築されるデータ構造であって、スキーマ情報を表わすデータ構造を例示する。ノード501は、TABLE_Aという表に対応して作られており、ノード503、504、505などは、TABLE_Aの各列に対応して作られたノードであり、各列の名前、データ型、プライマリキーかどうか、空値を格納できるかどうかが格納される。TABLE_Bという表に対応するノード502も同様に作られる。   FIG. 5 illustrates a data structure constructed in the main memory, which represents schema information. The node 501 is created corresponding to a table called TABLE_A, and the nodes 503, 504, 505, etc. are nodes created corresponding to the columns of TABLE_A, and the names, data types, primary keys of the columns. Whether or not a null value can be stored is stored. A node 502 corresponding to the table TABLE_B is similarly created.

「操作コード雛形保持部」202は、生成すべきプログラムコードと対応して、データベース操作コード雛形を保持する。「データベース操作コード雛形」とはプログラムコードを生成するために参照されるプログラムの雛形であるプロトタイプを意味する。例えば、関数を単位としてプログラムが構築されるC言語などでは、関数の雛形を意味する。また、「生成すべきプログラムコードと対応して」とは、生成されるプログラムコードそれぞれが、データベース操作コード雛形に基づいていることを意味する。操作コード雛形保持部202は、例えば、計算機のハードディスク領域にデータベース操作コード雛形を保持する。あるいは、プログラムコード生成装置を計算機で実現するためのプログラムのデータとしてデータベース操作コード雛形が保持されるようになっていてもよい。なお、プログラムのデータとしてデータベース操作コード雛形が保持されている場合には、図6などで例示するようにデータベース操作コード雛形が一まとまりになっている必要はなく、適宜分断された形式で保持されていてもよい。   The “operation code template holding unit” 202 holds a database operation code template corresponding to the program code to be generated. The “database operation code template” means a prototype that is a template of a program referred to for generating a program code. For example, in the C language in which a program is constructed in units of functions, it means a function template. Further, “corresponding to the program code to be generated” means that each generated program code is based on a database operation code template. The operation code template holding unit 202 holds, for example, a database operation code template in the hard disk area of the computer. Alternatively, a database operation code template may be held as program data for realizing the program code generation device with a computer. When a database operation code template is stored as program data, the database operation code template does not need to be grouped as illustrated in FIG. 6 and the like, and is stored in an appropriately divided format. It may be.

図6から図9は、データベース操作コード雛形を例示する。図6は、SQL文のSELECT文に対応する雛形であり、図7は、INSERT文に対応する雛形であり、図8は、UPDATE文に対応する雛形であり、図9は、DELETE文に対応する雛形である。   6 to 9 illustrate database operation code templates. 6 is a template corresponding to the SELECT statement of the SQL statement, FIG. 7 is a template corresponding to the INSERT statement, FIG. 8 is a template corresponding to the UPDATE statement, and FIG. 9 corresponds to the DELETE statement. It is a template to do.

図6から図9を代表し、図6に例示されたデータベース操作コード雛形について説明する。1行目は、関数名を表わす。なお、$とそれに続くアルファベットは、データベース操作コード雛形からプログラムコードを生成する際の変数を意味するものとする。例えば、$Tは、テーブル名を表わす。したがって、$Tは、TABLE_Aという値を取り得る。また、$Cは操作対象となる列名を表わす。例えば、$Cは、A_CODEという値を取り得る。したがって、select_$T_$Cは、select_TABLE_A_A_CODEに置換され得る。3行目から7行目は、関数の中で使用する作業用の変数である。   The database operation code template illustrated in FIG. 6 will be described on behalf of FIGS. The first line represents the function name. Note that $ and the alphabet following it mean variables for generating a program code from a database operation code template. For example, $ T represents a table name. Therefore, $ T can take the value TABLE_A. $ C represents a column name to be operated. For example, $ C can take the value A_CODE. Therefore, select_ $ T_ $ C can be replaced with select_TABLE_A_A_CODE. The third to seventh lines are working variables used in the function.

3行目の「EXEC SQL DECLARE SECTION」は、SQL文をプログラムに埋め込みコンパイルなどを可能とするためのSQLプリプロセッサへの指示を表わす。このように「EXEC SQL」で始まる行は、SQLプリプロセッサへの指示を表わす。3行目の指示は、SQLプリプロセッサが認識するべき変数の宣言の開始を意味する。また、7行目の指示は、SQLプリプロセッサが認識するべき変数の宣言の終了を意味する。したがって、spv、sov、stmtという変数がSQLプリプロセッサに認識される。   “EXEC SQL DECLARE SECTION” on the third line indicates an instruction to the SQL preprocessor for embedding an SQL statement in a program and enabling compiling. Thus, a line beginning with “EXEC SQL” represents an instruction to the SQL preprocessor. The instruction on the third line means the start of the declaration of a variable to be recognized by the SQL preprocessor. The instruction on the seventh line means the end of the declaration of the variable that should be recognized by the SQL preprocessor. Therefore, variables such as spv, sov, and stmt are recognized by the SQL preprocessor.

9行目は、関数に渡された引数の値、すなわち、変数pvの値をspvに代入する。また、10行目は、実行するべきSQL文を表わす文字列をstmtという変数に代入する。なお、ここの文字列に現れる$Pという変数は、プライマリキーを表わすとする。また、「?」は、文字列により表現されるSQL文が有するパラメータを示す記号である。   The ninth line substitutes the value of the argument passed to the function, that is, the value of the variable pv into spv. The 10th line substitutes a character string representing the SQL statement to be executed into a variable called stmt. Note that the variable $ P appearing in the character string here represents the primary key. “?” Is a symbol indicating a parameter included in an SQL sentence expressed by a character string.

12行目は、stmtという変数に代入された文字列をSQL文として実行するための準備を行ない、その準備が行なわれたSQL文にs_stmtという名前を付すことを表わしている。「実行するための準備」とは、例えば、文字列で表わされたSQL文に構文エラーがないかどうか、「?」で示されるパラメータの位置を管理するなどのことである。なお、:stmtに現れる「:」は、その次のstmtが、SQLプリプロセッサにより認識される変数であることを意味している。   The twelfth line indicates that the character string assigned to the variable stmt is prepared to be executed as an SQL statement, and the prepared SQL statement is named s_stmt. “Preparation for execution” means, for example, managing whether or not there is a syntax error in the SQL statement represented by the character string, and the position of the parameter indicated by “?”. Note that “:” appearing in: stmt means that the next stmt is a variable recognized by the SQL preprocessor.

13行目では、s_stmtという名前を付されたSQL文のパラメータにspvの値を代入して実行し、その結果をsovという変数に代入するべきことを意味する。これにより、プライマリキーの値がspvに代入されものである行が検索され、その行の$Cという名前の列の値がsovに代入されることになる。   The 13th line means that the value of spv is assigned to the parameter of the SQL statement named s_stmt and executed, and the result is assigned to a variable called sov. As a result, the row in which the value of the primary key is assigned to spv is searched, and the value of the column named $ C in that row is assigned to sov.

14行目では、s_stmtという名前が付されたSQL文の情報を破棄する。例えば、12行目や13行目で動的にメモリ領域が確保された場合には、そのメモリ領域の破棄を行なう。   In the 14th line, the information of the SQL statement with the name s_stmt is discarded. For example, when a memory area is dynamically secured in the 12th or 13th line, the memory area is discarded.

16行目では、sovの値を返すことを行なう。   In the 16th line, the value of sov is returned.

したがって、図6に例示されたデータベース操作コード雛形は、$Tという表の行のうち、引数に与えられた値をプライマリキーの列の値として持つ行を検索し、その行の$Cという列に格納されている値を得る関数を表わしていることになる。   Therefore, the database operation code model illustrated in FIG. 6 searches for a row having a value given as an argument as a primary key column value in a row of a table called $ T, and a column called $ C in that row. Represents a function that obtains the value stored in.

以下、図7は、引数として与えられた値をプライマリキーとして持つ行を$Tという表に挿入する関数を表わす。図8は、$Tという表の行のうち、プライマリキーの列の値が最初の引数となっている行の$Cという列の値を第二引数の値に変更する関数を表わす。図9は、引数として与えられた値をプライマリキーとして持つ行を$Tという表から削除する関数を表わしている。   Hereinafter, FIG. 7 shows a function for inserting a row having a value given as an argument as a primary key into a table $ T. FIG. 8 shows a function for changing the value of the column $ C in the row where the value of the primary key column is the first argument in the row of the table $ T to the value of the second argument. FIG. 9 shows a function for deleting a row having a value given as an argument as a primary key from the table $ T.

なお、図6から図9に例示されたデータベース操作コード雛形は、あくまでも例であり、種々の変形などが可能である。例えば、図6においては、一つの列の値を指定して検索を行なっているが、複数の列の値を指定して検索するようにデータベース操作コード雛形を変形することは当業者にとって容易であるし、値を指定する列をプライマリキーに制限される理由もなく、任意の列を指定するようにすることもできる。また、図7では、検索結果が一であることを想定しているが、より複雑な記述をすることにより、検索結果が0または複数である場合にも対応が可能である。同様に、図7、図8においては、複数の列の値を挿入、あるいは変更するようにすることもできる。また、図9においてはプライマリキー以外の列の値を用いて行を削除するようにすることもできる。   The database operation code model illustrated in FIGS. 6 to 9 is merely an example, and various modifications can be made. For example, in FIG. 6, the search is performed by designating the value of one column, but it is easy for those skilled in the art to modify the database operation code template so as to perform the search by designating the values of a plurality of columns. It is also possible to specify an arbitrary column without reason to limit the column for specifying a value to the primary key. In FIG. 7, it is assumed that the search result is one, but it is possible to deal with cases where the search result is zero or plural by describing more complicatedly. Similarly, in FIG. 7 and FIG. 8, values in a plurality of columns can be inserted or changed. Further, in FIG. 9, it is possible to delete a row using a column value other than the primary key.

また、図6から図9においては、SQLプリプロセッサを必要としている言語の場合について説明したが、例えば、Java(登録商標)言語などのオブジェクト指向言語を使用することにより、SQLプリプロセッサを不要とすることができる。例えば、connがリレーショナルデータベース管理システムとのプロセス間通信を表わすオブジェクトを格納する変数であるとすると、
s_stmt = conn.PrepareStatement("select $C where $T where $P = ?");
という PrepareStatement というメソッド呼び出しにより、実行するべきSQL文の準備を行ない、その結果を示す情報を s_stmt という変数に代入し、
s_stmt.setValue(1, pv);
により、1番目のパラメータに変数 pv の値を設定し、
s_stmt.executeQuery();
により、パラメータの値が設定された準備されたSQL文を問い合わせ文として実行するようにできる。
6 to 9, the case of a language that requires an SQL preprocessor has been described. For example, by using an object-oriented language such as a Java (registered trademark) language, an SQL preprocessor is not required. Can do. For example, if conn is a variable that stores an object representing interprocess communication with a relational database management system,
s_stmt = conn.PrepareStatement ("select $ C where $ T where $ P =?");
Prepare the SQL statement to be executed by the method call PrepareStatement, assign the information indicating the result to the variable s_stmt,
s_stmt.setValue (1, pv);
Sets the value of the variable pv to the first parameter,
s_stmt.executeQuery ();
Thus, the prepared SQL statement in which the parameter value is set can be executed as an inquiry statement.

「プログラムコード完成部」203は、スキーマ情報取得部201で取得したスキーマ情報と、操作コード雛形保持部202に保持されているデータベース操作コード雛形に基づいてプログラムコードを完成させる。例えば、$T、$C、$T、$Pに適宜値を設定してデータベース操作コード雛形に現れる$T、$C、$T、$の置換を行ない、プログラムコードを生成する。   The “program code completion unit” 203 completes the program code based on the schema information acquired by the schema information acquisition unit 201 and the database operation code template stored in the operation code template storage unit 202. For example, values are appropriately set in $ T, $ C, $ T, and $ P, and $ T, $ C, $ T, and $ appearing in the database operation code template are replaced to generate a program code.

図10は、$TにTABLE_A、$CにA_CODE、$PにIDを設定して図6に例示されたデータベース操作コード雛形を置換して得られるプログラムコードを例示する。   FIG. 10 illustrates a program code obtained by substituting the database operation code template illustrated in FIG. 6 by setting TABLE_A in $ T, A_CODE in $ C, and ID in $ P.

なお、上述したように、複数の列の値を指定して検索などする場合には、複数の列の値だけの引数を有する関数を定義するようにしてもよいが、それでは、生成されるプログラムコードが複雑になるため、例えば、複数の値を一つにまとめるプログラム言語が有する機能を用いるようなプログラムコードを完成させるようにしてもよい。   As described above, when searching by specifying values of a plurality of columns, a function having arguments of only the values of the plurality of columns may be defined. Since the code becomes complicated, for example, a program code that uses a function of a programming language that combines a plurality of values into one may be completed.

図11は、プログラム言語の複数の値を一つにまとめる機能を有して、複数の列の値を挿入するプログラムコードの例を示す。図11(A)は、例えば、C言語やC++言語などでの構造体(あるいはクラス)として、TABLE_Aの行を表わすデータ構造を定義した例を示す。また、図11(B)は、図11(A)で定義された構造体を用いて、TABLE_Aにデータを挿入する関数の例を示す。   FIG. 11 shows an example of a program code that has a function of combining a plurality of values of a program language into one and inserts values of a plurality of columns. FIG. 11A shows an example in which a data structure representing a row of TABLE_A is defined as a structure (or class) in C language, C ++ language, or the like. FIG. 11B illustrates an example of a function that inserts data into TABLE_A using the structure defined in FIG.

(実施形態1:処理の流れ)
図12は、プログラムコード生成装置の処理の流れ図を例示する。プログラムコード生成装置は、スキーマ情報を取得するごとに、図12の流れ図を実行する。ステップS1201において、スキーマ情報取得部201によりスキーマ情報を取得する(スキーマ情報取得ステップ)。ステップS1202において、プログラムコードの生成を終了するべきかどうか判断する。この判断は、例えば、データベース操作コード雛形を全て使用したかどうか、あるいは、例えば、$T、$Cなどの変数の値の全ての組み合わせ、あるいは所定の組み合わせを用いてプログラムコードの生成が終了したかどうかなどに基づいて行なう。もし生成を終了するべきでないと判断されれば、ステップS1203へ処理を移行する。ステップS1203において、操作コード雛形保持部202よりデータベース操作コード雛形を読み出す(操作コード雛形読出ステップ)。データベース操作コード雛形が複数あれば、所定の順序で読み出し、あるいは、プログラムコード生成装置の操作者によりマウスやキーボードなどを用いて指示が行なわれていれば、その指示に従って読み出す。ステップS1204において、取得されたスキーマ情報と読み出されたデータベース操作コード雛形とに基づいて、プログラムコード完成部203により、プログラムコードを完成する。完成されたプログラムコードは、例えば、ファイルとして記録したり、プリンタに出力したりする。ステップS1204の処理が終了すれば、ステップS1202へ処理を戻す。
(Embodiment 1: Flow of processing)
FIG. 12 illustrates a flowchart of processing of the program code generation device. Each time the program code generation apparatus acquires schema information, the program code generation apparatus executes the flowchart of FIG. In step S1201, the schema information acquisition unit 201 acquires schema information (schema information acquisition step). In step S1202, it is determined whether or not the generation of the program code should be terminated. This determination is made by, for example, determining whether or not all database operation code templates have been used, for example, using all combinations of variable values such as $ T and $ C, or using predetermined combinations. It is based on whether or not. If it is determined that the generation should not be terminated, the process proceeds to step S1203. In step S1203, the database operation code template is read from the operation code template holding unit 202 (operation code template reading step). If there are a plurality of database operation code templates, they are read in a predetermined order, or if an instruction is given by the operator of the program code generation apparatus using a mouse, a keyboard, etc., they are read according to the instructions. In step S1204, the program code completion unit 203 completes the program code based on the acquired schema information and the read database operation code template. The completed program code is recorded, for example, as a file or output to a printer. When the process of step S1204 ends, the process returns to step S1202.

(実施形態1:主な効果)
本実施形態により、データベースへアクセスするアプリケーションプログラムの開発工程が自動化され、アプリケーションプログラムの生産性が向上し、また、信頼性も向上することとなる。
(Embodiment 1: Main effects)
According to the present embodiment, the development process of the application program that accesses the database is automated, the productivity of the application program is improved, and the reliability is also improved.

(実施形態2:主に請求項2について説明する)   (Embodiment 2: Claim 2 will be mainly described)

本発明の実施形態2として、実施形態1のプログラムコード生成装置であって、データベースで使用されるデータ型とプログラム言語で使用されるデータ型との対応関係を有し、その対応関係を利用してプログラムコードを生成するプログラムコード生成装置について説明する。実施形態1は、Perl言語やLisp言語などのデータ型についてあまり配慮する必要のないプログラミング言語に主に適していたが、実施形態1は、C言語など、データ型について配慮する必要のある言語に主に適した実施形態である。   Embodiment 2 of the present invention is a program code generation device according to Embodiment 1, which has a correspondence between a data type used in a database and a data type used in a program language, and uses the correspondence. A program code generation device that generates a program code will be described. The first embodiment is mainly suitable for programming languages that do not require much consideration for data types such as Perl language and Lisp language, but the first embodiment is a language that requires consideration for data types such as C language. This is a mainly suitable embodiment.

(実施形態2:構成)
図13は、本実施形態に係るプログラムコード生成装置の機能ブロック図を例示する。プログラムコード生成装置1300は、スキーマ情報取得部201と、操作コード雛形保持部202と、プログラムコード完成部203と、データ型対応表保持部1301を有し、プログラムコード完成部203は、データ型調整手段1302を有している。
(Embodiment 2: Configuration)
FIG. 13 illustrates a functional block diagram of the program code generation device according to the present embodiment. The program code generation device 1300 includes a schema information acquisition unit 201, an operation code template storage unit 202, a program code completion unit 203, and a data type correspondence table storage unit 1301, and the program code completion unit 203 performs data type adjustment. Means 1302 are provided.

したがって、本実施形態に係るプログラムコード生成装置は、実施形態1に係るプログラムコード生成装置が、さらにデータ型対応表保持部1301を有し、そのプログラムコード完成部203がデータ型調整手段1302を有する構成となっている。   Therefore, in the program code generation device according to the present embodiment, the program code generation device according to the first embodiment further includes the data type correspondence table holding unit 1301, and the program code completion unit 203 includes the data type adjustment unit 1302. It has a configuration.

「データ型対応表保持部」1301は、データ型対応表を保持する。「データ型対応表」とは、列データ型情報と変数データ型情報とを対応付ける表である。ここに、「列データ型情報」とは、前記スキーマ情報の記述で使用される列のデータ型を示す情報であり、「変数データ型情報」とは、前記プログラムコードにて使用される変数のデータ型を示す情報である。   A “data type correspondence table holding unit” 1301 holds a data type correspondence table. The “data type correspondence table” is a table associating column data type information with variable data type information. Here, the “column data type information” is information indicating the data type of the column used in the description of the schema information, and the “variable data type information” is the variable used in the program code. This is information indicating the data type.

図14は、データ型対応表の一例を示す。図14に例示された左の列には、列データ型情報が格納され、右の列には、変数データ型情報が格納されている。なお、図14に例示されている表の列データ型情報は、図4に例示されたデータ型に、not null や with null という空値可の値に対応する情報を加えた情報となっている。空値はプログラミング言語では特殊な扱いを必要とするためである。例えば、空値を取らない文字列型は、プログラミング言語では、文字列の配列とすることができるが、空値を取る場合には、プログラミング言語では、例えば文字列のアドレスを格納するポインタ型とし、NULLという値により空値を表わすようにする必要がある。同様に、ある列に整数型(Integer)であって空値を取らない値が格納される場合には、プログラミング言語で通常使用できるint型が使用できるが、空値を取り得る整数型には、Integerという特別な型(例えば、C++言語やJava(登録商標)言語ではクラスとして実装される)を用いる必要がある。   FIG. 14 shows an example of the data type correspondence table. The left column illustrated in FIG. 14 stores column data type information, and the right column stores variable data type information. Note that the column data type information of the table illustrated in FIG. 14 is information obtained by adding information corresponding to nullable values such as not null and with null to the data type illustrated in FIG. . This is because null values require special handling in programming languages. For example, a character string type that does not take a null value can be an array of character strings in the programming language, but if it takes a null value, it is a pointer type that stores the address of the character string in the programming language, for example. , NULL must be represented by the value NULL. Similarly, when a value that is an integer type (Integer) and does not take a null value is stored in a certain column, an int type that can be normally used in a programming language can be used, but an integer type that can take a null value is used. , And a special type called Integrer (for example, implemented as a class in the C ++ language or Java (registered trademark) language).

「データ型調整手段」1302は、データ型対応表保持部1301で保持されているデータ型対応表を利用してプログラムコードを完成させる。例えば、スキーマ情報取得部201で取得されたスキーマ情報に対応して構築されるデータ構造(図5参照)の各列に対応するノードにプログラムコードにて使用される変数のデータ型を示す情報を付加して、その付加された情報を参照しながらプログラムコードを完成させる。   The “data type adjusting unit” 1302 uses the data type correspondence table held in the data type correspondence table holding unit 1301 to complete the program code. For example, information indicating the data type of a variable used in the program code is stored in a node corresponding to each column of the data structure (see FIG. 5) constructed corresponding to the schema information acquired by the schema information acquisition unit 201. In addition, the program code is completed while referring to the added information.

図15は、図5に例示されたデータ構造の各列に対応するノードにプログラムコードにて使用される変数のデータ型を示す情報を、データ型調整手段などにより付加した例を示す。例えば、TABLE_Aという表のIDという列は、INTEGER型であり、空値をとらないので、intを表わすノード1501を付加し、ID_CHARという列の型は、CHAR(20)、すなわち、20バイトの長さの文字列型であるので、char[20]を表わすノード1502を付加する。データ型調整手段は、例えば、このように変数のデータ型を示す情報が付加されたデータ構造を参照して、適宜プログラムコードを完成させる。   FIG. 15 shows an example in which information indicating the data type of a variable used in the program code is added to a node corresponding to each column of the data structure illustrated in FIG. 5 by a data type adjusting unit or the like. For example, since the ID column in the table TABLE_A is an INTEGER type and does not take a null value, a node 1501 representing int is added, and the ID_CHAR column type is CHAR (20), that is, a length of 20 bytes. Therefore, a node 1502 representing char [20] is added. For example, the data type adjusting means refers to the data structure to which the information indicating the data type of the variable is added in this way, and appropriately completes the program code.

図16は、本実施形態で用いるべきデータベース操作コード雛形を例示する。実施形態1との違いは、変数がデータ型を有する点であり、$Pt、$Ctは、データ型対応表により、列のデータ型に対応付けられている変数のデータ型を表わす。例えば、$Ptには、int、$Ctには、char[20]が設定され、結果として、図17に例示されるプログラムコードが完成される。   FIG. 16 illustrates a database operation code template to be used in the present embodiment. The difference from the first embodiment is that the variable has a data type, and $ Pt and $ Ct represent the data type of the variable associated with the data type of the column by the data type correspondence table. For example, int is set in $ Pt and char [20] is set in $ Ct. As a result, the program code illustrated in FIG. 17 is completed.

(実施形態2:主な効果)
本実施形態により、プログラマがデータ型の違いを意識することが軽減され、バグが減少するなどの効果が生ずる。
(Embodiment 2: Main effects)
According to this embodiment, it is possible to reduce the programmer's awareness of the difference in data type, and to produce effects such as a reduction in bugs.

(実施形態3:主に請求項3について説明する)   (Third embodiment: Claim 3 will be mainly described.)

本発明の実施形態3として、実施形態1または2のプログラムコード生成装置であって、列名の命名規則とプログラム言語で使用するデータ型とを対応付けてプログラムコードを生成するプログラムコード生成装置について説明する。   As a third embodiment of the present invention, a program code generation apparatus according to the first or second embodiment, wherein the program code generation apparatus generates a program code by associating a column name naming rule with a data type used in a program language. explain.

(実施形態3:構成)
図18は、本実施形態に係るプログラムコード生成装置の機能ブロック図を例示する。プログラムコード生成装置1800は、スキーマ情報取得部201と、操作コード雛形保持部202と、プログラムコード完成部203と、第二データ型対応表保持部1801を有し、プログラムコード完成部203は、第二データ型調整手段1802を有している。また、本実施形態に係るプログラムコード生成装置は、データ型対応表保持部1301を有し、プログラムコード完成部203は、データ型調整手段を有していてもよい。例えば、図19に例示される機能ブロックで示される構成であってもよい。
(Embodiment 3: Configuration)
FIG. 18 illustrates a functional block diagram of the program code generation device according to this embodiment. The program code generation device 1800 includes a schema information acquisition unit 201, an operation code template storage unit 202, a program code completion unit 203, and a second data type correspondence table storage unit 1801. Two data type adjusting means 1802 is provided. In addition, the program code generation device according to the present embodiment may include a data type correspondence table holding unit 1301, and the program code completion unit 203 may include a data type adjustment unit. For example, the configuration illustrated by the functional blocks illustrated in FIG. 19 may be used.

したがって、本実施形態に係るプログラムコード生成装置は、実施形態1または2のプログラムコード生成装置が、第二データ型対応表保持部1801を有し、プログラムコード完成部203が第二データ型調整手段1802を有する構成となっている。   Therefore, in the program code generation device according to the present embodiment, the program code generation device of the first or second embodiment has the second data type correspondence table holding unit 1801, and the program code completion unit 203 is the second data type adjustment unit. 1802 is provided.

「第二データ型対応表保持部」1801は、第二データ型対応表を保持する。「第二データ型対応表」とは、列命名規則情報と変数データ型情報とを対応付ける表である。ここに、「列命名規則情報」とは、前記スキーマ情報の記述に現れる列の名前の命名規則を示す情報である。例えば、列の名前をワイルドカードを用いて表現したり、正規表現を用いて表現したりなどして、命名規則を示す。「変数データ型情報」とは、実施形態2と同じであり、前記プログラムコードにて使用される変数のデータ型を示す情報である。   The “second data type correspondence table holding unit” 1801 holds the second data type correspondence table. The “second data type correspondence table” is a table associating column naming rule information with variable data type information. Here, the “column naming rule information” is information indicating a naming rule for column names appearing in the description of the schema information. For example, the name of a column is expressed using a wild card or a regular expression to indicate a naming rule. “Variable data type information” is the same as in the second embodiment, and is information indicating the data type of a variable used in the program code.

図20は、第二データ型対応表の一例を示す。図20に例示された左の列には、列命名規則情報が格納され、右の列には、変数データ型情報が格納されている。なお、図20には例示されている表の列命名規則情報は、ワイルドカードを用いて命名規則を表わしている。例えば、「*_FLAG」とは、*の部分として任意の長さの文字列を用い、その後に_FLAGを連接するという命名規則を表わしている。一般に、名前の後半部分に_FLAGを有する列は、真か偽かを表わす場合が多い。そこで、プログラム言語では、例えば、unsigned intという型を用いる場合が多い。あるいは真偽値を表わす例えばBooleanという型があれば、その型を用いるように対応付けてもよい。また、名前の後半部分に_TIMESTAMPを有する列は、時刻を表わす場合がほとんどであるので、プログラム言語で時刻を表わす例えばtime_tという型を対応づけるようにしてもよい。   FIG. 20 shows an example of the second data type correspondence table. The left column illustrated in FIG. 20 stores column naming rule information, and the right column stores variable data type information. Note that the column naming rule information in the table illustrated in FIG. 20 represents a naming rule using a wild card. For example, “* _FLAG” represents a naming rule in which a character string having an arbitrary length is used as a portion of * and _FLAG is subsequently connected. In general, a column having _FLAG in the latter half of the name often indicates true or false. Therefore, in a programming language, for example, a type called unsigned int is often used. Alternatively, if there is, for example, a Boolean type representing a true / false value, the type may be associated with the type. In addition, since a column having _TIMESTAMP in the latter half of the name almost always represents time, a type such as time_t representing time in the programming language may be associated.

なお、本実施形態に係るプログラムコード生成装置がデータ型対応表保持部1301を有し、プログラムコード完成部203がデータ型調整手段1302を有する場合には、データ型調整手段1302によるデータ型と第二データ型調整手段1802によるデータ型とが異なる場合があるが、その場合には、その旨を画面に表示してプログラムコード生成装置の操作者にデータ型の選択を行なわせたり、あるいは、第二データ型調整手段1802によるデータ型を優先させたりしてもよい。また、図4に例示されたスキーマ情報のコメントなどに、どちらのデータ型を優先させるかの指定を含ませるようにしてもよい。   When the program code generation apparatus according to the present embodiment has the data type correspondence table holding unit 1301 and the program code completion unit 203 has the data type adjustment unit 1302, the data type and the data type by the data type adjustment unit 1302 are changed. The data type by the two data type adjusting means 1802 may be different. In that case, the fact is displayed on the screen and the operator of the program code generating device selects the data type, or The data type by the two data type adjusting means 1802 may be prioritized. In addition, the specification of which data type should be prioritized may be included in the comment or the like of the schema information illustrated in FIG.

(実施形態3:主な効果)
本実施形態により、列の役割に応じたアプリケーションプログラムが生成されることになり、プログラマにとって読みやすいアプリケーションプログラムが生成され、結果として、プログラマが修正しやすいアプリケーションプログラムが作成されることになる。
(Embodiment 3: Main effects)
According to the present embodiment, an application program corresponding to the role of the column is generated, and an application program that is easy for a programmer to read is generated. As a result, an application program that is easy for a programmer to correct is created.

(実施形態4:主に請求項4について説明する)   (Embodiment 4: Claim 4 will be mainly described)

本発明の実施形態4として、実施形態1から3のいずれか一のプログラムコード生成装置であって、論理削除に対応したプログラムコードを生成するプログラムコード生成装置について説明する。   As a fourth embodiment of the present invention, a program code generation device according to any one of the first to third embodiments, which generates a program code corresponding to logical deletion, will be described.

(実施形態4:構成)
図21は、本実施形態に係るプログラムコード生成装置の機能ブロック図を例示する。プログラムコード生成装置2100は、スキーマ情報取得部201と、操作コード雛形保持部202と、プログラムコード完成部203と、を有し、スキーマ情報取得部201は、論理削除列情報取得手段2101を有する。なお、図21は、本実施形態に係るプログラムコード生成装置2100の要部を示しているに過ぎず、プログラムコード生成装置2100は、さらにデータ型対応表保持部1301、第二データ型対応表保持部1801を有し、プログラムコード完成部203は、それぞれ、データ型調整手段1302、第二データ型調整手段1802を有していてもよい。
(Embodiment 4: Configuration)
FIG. 21 illustrates a functional block diagram of the program code generation device according to the present embodiment. The program code generation device 2100 includes a schema information acquisition unit 201, an operation code template storage unit 202, and a program code completion unit 203, and the schema information acquisition unit 201 includes a logical deletion sequence information acquisition unit 2101. FIG. 21 only shows the main part of the program code generation device 2100 according to the present embodiment. The program code generation device 2100 further includes a data type correspondence table holding unit 1301 and a second data type correspondence table holding. The program code completion unit 203 may include a data type adjustment unit 1302 and a second data type adjustment unit 1802, respectively.

したがって、本実施形態に係るプログラムコード生成装置は、実施形態1から3のいずれか一の実施形態に係るプログラムコード生成装置のスキーマ情報取得部201が論理削除列情報取得手段2101を有する構成となっている。   Therefore, the program code generation device according to the present embodiment has a configuration in which the schema information acquisition unit 201 of the program code generation device according to any one of the first to third embodiments includes the logical deletion column information acquisition unit 2101. ing.

「論理削除列情報取得手段」2101は、論理削除列情報を取得する。「論理削除列情報」とは、論理削除に使用する列を特定する情報であり、「論理削除」とは、特定の列が特定の値を有するかどうかによりその列の値を含む行データが削除されたと扱う手法をいう(例えば、<http://www.kei-ha.co.jp/magdb/magdb0001.html>参照。)。例えば、図3に例示されたTABLE_Aのある行のDELETE_TIMESTAMPという列に格納されている値が空値以外の値を取っていれば、その行は削除されたと扱うことをいう。   The “logical deletion column information acquisition unit” 2101 acquires logical deletion column information. “Logical deletion column information” is information for specifying a column used for logical deletion. “Logical deletion” is a method for determining whether row data including the value of the column depends on whether the specific column has a specific value. A method that treats as deleted (for example, see <http://www.kei-ha.co.jp/magdb/magdb0001.html>). For example, if a value stored in a column called DELETE_TIMESTAMP in a row of TABLE_A illustrated in FIG. 3 takes a value other than a null value, the row is treated as deleted.

図22は、XMLにより表現されている論理削除列情報を例示している。この例では、DELETE_TIMESTAMPというTimestamp型の列が、NULLすなわち空値であれば、削除されないとみなし(すなわち、有効(valid)な行として扱う)、空値でなければ削除されたとみなすことを表わしている。   FIG. 22 exemplifies logical deletion column information expressed in XML. In this example, if a TIMESTAMP column of DELETE_TIMESTAMP is NULL, that is, a null value, it is regarded as not deleted (that is, treated as a valid row), and if it is not a null value, it is regarded as deleted. Yes.

論理削除列情報取得手段2101は、図22に例示されるような論理削除列情報を読み取るなどして取得をして、例えば、図5に例示されるデータ構造の列に対応するノードにフラグなどを立てることにより、その列が論理削除に使用されることを表わす。   The logical deletion column information acquisition unit 2101 acquires the logical deletion column information as illustrated in FIG. 22 by reading the logical deletion column information as illustrated in FIG. 22, for example, a flag or the like for a node corresponding to the column of the data structure illustrated in FIG. To indicate that the column is used for logical deletion.

このように論理削除の手法を使用する場合には、表への挿入、削除が複雑となり、操作に対応するSQL文を単に実行するだけでは実現ができない。図23は挿入の際の処理の流れ図を例示している。プログラムコード完成部203は、例えば、図23の処理を表現するデータベース操作コード雛形に基づいてプログラムコードを完成させる。ステップS2301において、まず、insert文を実行する。ステップS2302において、エラーが発生したかどうかを判定する。エラーが発生しなければ、挿入の処理を終了する。もし、エラーが発生すれば、ステップS2303へ処理を移行させ、一意制約エラーが発生したかどうかを判定する。「一意制約エラー」とは、プライマリキーの値が、すでに表に挿入されている行のプライマリキーの列の値と重複したことによるエラーを意味する。もし、一意制約エラーが発生したと判定されれば、ステップS2304へ処理を移行させ、そうでなければ、ステップS2305へ処理を移行させる。   When the logical deletion method is used as described above, insertion and deletion into the table are complicated, and cannot be realized simply by executing the SQL statement corresponding to the operation. FIG. 23 exemplifies a flow chart of processing at the time of insertion. For example, the program code completion unit 203 completes the program code based on a database operation code template that represents the processing of FIG. In step S2301, first, an insert statement is executed. In step S2302, it is determined whether an error has occurred. If no error occurs, the insertion process is terminated. If an error occurs, the process proceeds to step S2303 to determine whether a unique constraint error has occurred. “Unique constraint error” means an error caused by the primary key value being duplicated with the primary key column value of a row that has already been inserted into the table. If it is determined that a unique constraint error has occurred, the process proceeds to step S2304; otherwise, the process proceeds to step S2305.

ステップS2304においては、論理削除用の列の値をvalidとして指定された値へ更新する。図22の場合には、空値に更新する。ステップS2305においては、一意制約エラー以外のエラーが発生したので、適切なエラー処理を行なう。   In step S2304, the value of the column for logical deletion is updated to the value specified as valid. In the case of FIG. 22, it is updated to a null value. In step S2305, since an error other than a unique constraint error has occurred, appropriate error processing is performed.

なお、ステップS2302におけるようなエラーが発生したかどうかは、例えば、sqlerrorという変数の値を調べることにより検出が可能である。あるいは、Java(登録商標)言語などの場合には、例外(exception)が発生したかどうかで検出が可能であり、try−catch節などにより検出できる。また、発生したエラーが一意制約エラーであるかどうかは、sqlerrorの値を分析したり、発生した例外の型やその値を分析することにより判定が可能である。   Whether or not an error has occurred in step S2302 can be detected, for example, by examining the value of a variable called squirer. Alternatively, in the case of a Java (registered trademark) language or the like, detection can be performed based on whether an exception has occurred, and can be detected by a try-catch clause or the like. Whether the error that has occurred is a unique constraint error or not can be determined by analyzing the value of sqlerror, or by analyzing the type and value of the exception that has occurred.

また、削除の場合には、SQL文のDELETE文を実行するのではなく、図24に例示されるように、論理削除用の列の値をdeletedとして指定された値へ更新することを行なう。図22の場合には、空値以外の値に変更する。具体的に例を挙げると、DELETE_TIMESTAMPの値を、現在の時刻を取得してその時刻の値に更新するなどである。   In the case of deletion, instead of executing the DELETE statement of the SQL statement, as shown in FIG. 24, the value of the logical deletion column is updated to the value designated as deleted. In the case of FIG. 22, the value is changed to a value other than the null value. As a specific example, the value of DELETE_TIMESTAMP is acquired to update the current time value to the current time value.

同様に検索の場合には、論理削除用の列の値が、validとして指定された値である行を検索するように、検索条件をandで付加を行なう。図22の場合には、「DELETE_TIMESTAMP isNull」という条件をandの一肢として付加を行なう。   Similarly, in the case of a search, a search condition is added with and so that a row in which the value of the logical deletion column is a value designated as valid is searched. In the case of FIG. 22, the condition “DELETE_TIMESTAMP isNull” is added as one limb.

(実施形態4:主な効果)
本実施形態により、論理削除という複雑な操作も自動的にプログラミングすることができ、生産性や信頼性の向上ができる。
(Embodiment 4: Main effects)
According to this embodiment, a complicated operation of logical deletion can be automatically programmed, and productivity and reliability can be improved.

(実施形態5:主に請求項5について説明する)   (Embodiment 5: Claim 5 will be mainly described)

本発明の実施形態5として、継承機構を持つプログラム言語で記述されたプログラムコードを生成するプログラムコード生成装置について説明する。   As a fifth embodiment of the present invention, a program code generation device that generates a program code described in a program language having an inheritance mechanism will be described.

(実施形態5:構成)
本実施形態に係るプログラムコード生成装置は、実施形態1から4のいずれか一に係るプログラムコード生成装置であって、そのプログラムコード完成部にて完成されるプログラムコードは、継承機構を持つプログラム言語で記述されているプログラムコード生成装置である。
(Embodiment 5: Configuration)
The program code generation device according to the present embodiment is the program code generation device according to any one of the first to fourth embodiments, and the program code completed by the program code completion unit is a program language having an inheritance mechanism. Is a program code generation device described in the above.

例えば、操作コード雛形保持部に保持されるデータベース操作コード雛形が、継承機構を持つプログラム言語にもとづいて記述されているプログラムコード生成装置である。   For example, it is a program code generation device in which a database operation code template held in the operation code template holding unit is described based on a program language having an inheritance mechanism.

なお、継承機構とは、オブジェクト指向言語などが有する機構であり、既に定義されているオブジェクト(対象)を基にして拡張や変更を加えたオブジェクトを定義することである。   The inheritance mechanism is a mechanism possessed by an object-oriented language or the like and defines an object that has been expanded or changed based on an object (target) that has already been defined.

図25は、継承について説明するための図であり、オブジェクトの一種であるクラス2501が既に定義され、自身に対する操作を表わすメソッド1とメソッド2とを有するとする。サブクラス2502は、クラス2501を基にして拡張や変更を加えるために定義されるクラスである。サブクラス2502は、メソッド2とメソッド3を有するが、サブクラス2502のメソッド2は、クラス2501のメソッド2を変更するメソッドとして扱われ、クラス2501に無いメソッド3は、クラス2501を拡張するメソッドとして扱われることになる。ここでは、メソッドについて説明したが、クラスの有する変数などについても同様のことが言える。   FIG. 25 is a diagram for explaining inheritance. It is assumed that a class 2501 which is a kind of object is already defined and has a method 1 and a method 2 representing an operation on itself. The subclass 2502 is a class that is defined for adding an extension or a change based on the class 2501. The subclass 2502 has the method 2 and the method 3, but the method 2 of the subclass 2502 is treated as a method for changing the method 2 of the class 2501, and the method 3 not in the class 2501 is treated as a method for extending the class 2501. It will be. Although the method has been described here, the same can be said for the variables of the class.

なお、図25の場合、サブクラス2502は、クラス2501を継承するといい、クラス2501のサブクラス(Subclass)であるという。また、クラス2501をサブクラス2501のスーパークラス(Superclass)または、上位クラスという。   In the case of FIG. 25, the subclass 2502 is said to inherit the class 2501 and is a subclass of the class 2501. The class 2501 is referred to as a superclass (superclass) of the subclass 2501 or an upper class.

そこで、本実施形態では、プログラムコード生成装置は、クラス2501に相当するクラスの定義をプログラムコードとして生成することとし、データベースへアクセスする操作をメソッドとして提供する。このようにすれば、サブクラス2502を例えば人間が定義することにより、プログラムコード生成装置が生成したプログラムコードを拡張したり変更したりすることが容易に行なえる。例えば、クラス2501とサブクラス2502との記述は異なるファイルで行なうことができるので、プログラムコード生成装置によりクラス2501の記述が新たに生成されても、直接にクラス2501の記述を人間などが変更してしまうと、プログラムコードを生成するたびに変更を加えないといけないが、サブクラスにより拡張や変更を行なうようにすれば、プログラムコードの生成を行なっても、サブクラス2502の記述には影響が及ばない。   Therefore, in this embodiment, the program code generation device generates a definition of a class corresponding to the class 2501 as a program code, and provides an operation for accessing a database as a method. In this way, by defining the subclass 2502 by, for example, a human, it is possible to easily extend or change the program code generated by the program code generation device. For example, since the description of the class 2501 and the subclass 2502 can be performed in different files, even if the description of the class 2501 is newly generated by the program code generation device, the description of the class 2501 is directly changed by a person or the like. In other words, a change must be made every time the program code is generated. However, if the extension or change is performed by the subclass, the description of the subclass 2502 is not affected even if the program code is generated.

(実施形態5:主な効果)
本実施形態により、プログラムコード生成装置で生成されたプログラムコードの修正拡張を容易に行なうことができる。
(Embodiment 5: Main effects)
According to the present embodiment, the program code generated by the program code generation device can be easily modified and expanded.

(実施形態6:主に請求項6について説明する)   (Embodiment 6: Claim 6 will be mainly described)

本発明の実施形態6として、実施形態5のプログラムコード生成装置であって、テーブル名又は/及び列名の文字列を定数として定義して、参照可能とするプログラムコード生成装置について説明する。   As a sixth embodiment of the present invention, a program code generation apparatus according to the fifth embodiment, in which a character string of a table name and / or column name is defined as a constant and can be referred to, will be described.

(実施形態6:構成)
本実施形態に係るプログラムコード生成装置は、実施形態5のプログラムコード生成装置であって、プログラムコード完成部にて完成されるプログラムコードは、テーブル名又は/及び列名の文字列を定義し、そのプログラムコードを継承するプログラム部分で参照可能とする。
(Embodiment 6: Configuration)
The program code generation device according to the present embodiment is the program code generation device of the fifth embodiment, and the program code completed by the program code completion unit defines a character string of a table name or / and a column name, The program code can be referred to in a program part that inherits the program code.

図26は、本実施形態に係るプログラムコード生成装置が生成するプログラムコードを例示する。プログラムコードは、TABLE_A_managerというクラスの定義であり、String型の変数として、表の名前を表わすために、TABLE_Aとして"TABLE_A"という文字列を定義し、ID、A_CODEなどの列の名前を表わすために、SQLColumn型の変数としてID、A_CODEを定義している。なお、変数であることは本質ではなく、値の変更が不可能な定数であってもよい。このように表の名前や列の名前を定義しておくことにより、サブクラスで、その定義を使用することができる。   FIG. 26 illustrates the program code generated by the program code generation device according to the present embodiment. The program code is a definition of a class called TABLE_A_manager, and as a String type variable, a character string “TABLE_A” is defined as TABLE_A to represent a table name, and a column name such as ID and A_CODE is represented. ID and A_CODE are defined as variables of the SQLColumn type. Note that the variable is not essential, and may be a constant whose value cannot be changed. By defining table names and column names in this way, subclasses can use the definitions.

図27は、TABLE_A_managerのサブクラスとしてA_managerを定義した例を示している。列であるA_CODEの値が特定の文字列と等しいことを示す条件式を生成するために、TABLE_A_managerで定義されたA_CODEという変数を参照している。このようにすることにより、A_CODEという列の名前が別の名前に変更になった場合には、TABLE_A_managerのA_CODEの定義の部分を修正するだけで済む。また、列名や表の名前が変更された場合には、列名や表の名前を表わす変数の名前も変更されるようにしておけば、列名や表の名前が変更されると、サブクラスのコンパイルでエラーが発生するので、列名や表の名前が変更になったことを容易に知ることができ、アプリケーションプログラムの信頼性が向上する。   FIG. 27 shows an example in which A_manager is defined as a subclass of TABLE_A_manager. In order to generate a conditional expression indicating that the value of the column A_CODE is equal to a specific character string, a variable A_CODE defined by TABLE_A_manager is referred to. In this way, when the name of the column A_CODE is changed to another name, it is only necessary to modify the A_CODE definition portion of TABLE_A_manager. Also, if the column name or table name is changed, the variable name that represents the column name or table name is also changed. If the column name or table name is changed, the subclass Since an error occurs in the compilation, it is easy to know that the column name or table name has been changed, and the reliability of the application program is improved.

(実施形態6:プログラムコード例)
図28と図29は、本実施形態に係るプログラムコード生成装置により生成されたプログラムコードを例示する。この例では、CUSTOMERという表が定義されており、CUSTOMERは、ID、NAME、BIRTH_DATE、CUSTOMER_CODE、という名前の列を有する。それぞれの列のデータ型は、INTEGER、VARCHAR、DATE、VARCHAR、である。図28は、CUSTOMERという表を操作するために生成されたAbstractCustomerManagerというクラスである。その中で、CustomerEntityというクラスが用いられているが、これは、CUSTOMERという表に格納される行データを表わすクラスである。CustomerEntityは、図29に定義されているAbstractCustomerEntityのサブクラスである。図29に示されているように、AbstractCustomerEntityは、列に対応するid、name、birthDate、customerCodeという変数を持ち、それぞれの変数に値をセットするメソッド(例えば、setId)と変数の値を取得するメソッド(例えば、getId)を持っている。
(Embodiment 6: Program code example)
28 and 29 illustrate program codes generated by the program code generation device according to the present embodiment. In this example, a table called CUSTOMER is defined, and CUSTOMER has columns named ID, NAME, BIRTH_DATE, and CUSTOMER_CODE. The data type of each column is INTERGER, VARCHAR, DATE, and VARCHAR. FIG. 28 shows a class called AbstractCustomerManager generated for operating a table called CUSTOMER. Among them, a class called CustomerEntity is used, which is a class representing row data stored in a table called CUSTOMER. CustomerEntity is a subclass of AbstractCustomerEntity defined in FIG. As shown in FIG. 29, AbstractCustomerEntity has a variable such as id, name, secondDate, and customerCode corresponding to a column, and obtains a method (for example, setId) that sets a value for each variable and the value of the variable. Has a method (eg, getId).

図30と図31は、図28と図29とに定義されたクラスを拡張あるいは変更するためのクラス定義を例示する。図30は、AbstractCustomerManagerというクラスのサブクラスとしてCustomerManagerを定義しており、CUSTOMER_CODEの列の値により検索を行なうfindByCustomerCodeというメソッドを定義している。この中で、AbstractCustomerManagerで定義されているCUSTOMER_CODEという変数を参照している。例えば、もし、CUSTOMER_CODEという列の名前が別の名前に変更されると、変数の名前が変更されるので、コンパイルエラーが発生し、CustomerManagerを修正しなければならないことを検出できる。なお、queryというメソッドは、AbstractCustomerManagerの上位クラスで定義されているメソッドである。図31は、AbstrctCustomerEntityのサブクラスであるCustomerEntityの定義である。   30 and 31 exemplify class definitions for extending or changing the classes defined in FIGS. 28 and 29. FIG. 30 defines CustomerManager as a subclass of a class called AbstractCustomerManager, and defines a method called findByCustomerCode for performing a search based on the value of the column of CUSTOMER_CODE. In this, a variable called CUSTOMER_CODE defined in AbstractCustomerManager is referenced. For example, if a column named CUSTOMER_CODE is renamed to another name, the variable is renamed, so that it can be detected that a compilation error has occurred and CustomerManager must be modified. Note that a method called query is a method defined in an upper class of AbstractCustomerManager. FIG. 31 shows the definition of CustomerEntity, which is a subclass of AbstractCustomerEntity.

(実施形態6:主な効果)
本実施形態により、列名や表の名前の変更に伴なうプログラムの変更を少なくしたり、あるいは、列名や表の名前に変更があり、プログラムを変更しなければならないことを簡単に知ることができ、信頼性の高いアプリケーションプログラムが開発できる。
(Embodiment 6: Main effects)
According to the present embodiment, it is possible to easily know that the program change accompanying the change of the column name or the table name is reduced, or that the program must be changed because the column name or the table name is changed. It is possible to develop a reliable application program.

本発明に係るプログラムコード生成装置、プログラムコード生成方法は、データベースへアクセスするアプリケーションプログラムの開発工程が自動化され、アプリケーションプログラムの生産性が向上し、また、信頼性も向上するなどの効果が得られ、産業上有用である。   The program code generation device and the program code generation method according to the present invention automate the development process of an application program that accesses a database, thereby improving the productivity of the application program and improving the reliability. , Industrially useful.

データベースへアクセスするアプリケーションプログラムの動作を説明する図Diagram explaining the operation of the application program that accesses the database 本発明の実施形態1に係るプログラムコード生成装置の機能ブロック図Functional block diagram of a program code generation device according to Embodiment 1 of the present invention リレーショナルデータベースの表の一例図Example of relational database table スキーマ情報の一例図Example of schema information 主記憶メモリに構築されるデータ構造であって、スキーマ情報を表わすデータ構造の一例図An example of a data structure constructed in the main memory and representing schema information データベース操作コード雛形の一例図Example of database operation code template データベース操作コード雛形の一例図Example of database operation code template データベース操作コード雛形の一例図Example of database operation code template データベース操作コード雛形の一例図Example of database operation code template データベース操作コード雛形を置換して得られるプログラムコードの一例図Example of program code obtained by replacing database operation code template プログラムコードの一例図Example of program code プログラムコード生成装置の処理の流れ図Flow chart of processing of program code generator 本発明の実施形態2に係るプログラムコード生成装置の機能ブロック図Functional block diagram of a program code generation device according to Embodiment 2 of the present invention データ型対応表の一例図Example of data type correspondence table 図5に例示されたデータ構造の各列に対応するノードにプログラムコードにて使用される変数のデータ型を示す情報を付加した状態を示す図The figure which shows the state which added the information which shows the data type of the variable used by a program code to the node corresponding to each column of the data structure illustrated in FIG. 本発明の実施形態2で用いるべきデータベース操作コード雛形の一例図Example of database operation code template to be used in Embodiment 2 of the present invention プログラムコードの一例図Example of program code 本発明の実施形態3に係るプログラムコード生成装置の機能ブロック図Functional block diagram of a program code generation device according to Embodiment 3 of the present invention 本発明の実施形態3に係るプログラムコード生成装置の機能ブロック図Functional block diagram of a program code generation device according to Embodiment 3 of the present invention 第二データ型対応表の一例図Example of second data type correspondence table 本発明の実施形態4に係るプログラムコード生成装置の機能ブロック図Functional block diagram of a program code generation device according to Embodiment 4 of the present invention 論理削除列情報の一例図Example of logical deletion column information 論理削除を用いる場合のプログラムコードにおける挿入の処理の流れ図Flow chart of insertion processing in program code when logical deletion is used 論理削除を用いる場合のプログラムコードにおける削除の処理の流れ図Flow chart of deletion processing in program code when logical deletion is used 継承について説明するための図Diagram for explaining inheritance 本発明の実施形態6に係るプログラムコード生成装置が生成するプログラムコードの一例図An example figure of the program code which the program code generating device concerning Embodiment 6 of the present invention generates TABLE_A_managerのサブクラスとしてA_managerを定義した一例図Example of defining A_manager as a subclass of TABLE_A_manager 生成されたプログラムコードの一例図Example of generated program code 生成されたプログラムコードの一例図Example of generated program code 生成されたプログラムコードのサブクラスの一例図Example of subclass of generated program code 生成されたプログラムコードのサブクラスの一例図Example of subclass of generated program code

符号の説明Explanation of symbols

200 プログラムコード生成装置
201 スキーマ情報取得部
202 操作コード雛形保持部
203 プログラムコード完成部
200 Program Code Generation Device 201 Schema Information Acquisition Unit 202 Operation Code Template Holding Unit 203 Program Code Completion Unit

Claims (8)

データベースへアクセスを行なうプログラムコードを生成するプログラムコード生成装置であって、
前記データベースのスキーマを記述する情報であるスキーマ情報を取得するスキーマ情報取得部と、
生成すべきプログラムコードと対応してデータベース操作コード雛形を保持する操作コード雛形保持部と、
前記スキーマ情報取得部で取得したスキーマ情報と前記操作コード雛形保持部に保持されているデータベース操作コード雛形とに基づいて、プログラムコードを完成させるプログラムコード完成部と、
を有するプログラムコード生成装置。
A program code generation device for generating a program code for accessing a database,
A schema information acquisition unit for acquiring schema information which is information describing the schema of the database;
An operation code template holding unit for holding a database operation code template corresponding to the program code to be generated;
A program code completion unit for completing the program code based on the schema information acquired by the schema information acquisition unit and the database operation code template stored in the operation code template storage unit;
A program code generation device having:
前記スキーマ情報の記述で使用される列のデータ型を示す列データ型情報と、前記プログラムコードにて使用される変数のデータ型を示す変数データ型情報とを対応付ける表であるデータ型対応表を保持するデータ型対応表保持部を有し、
前記プログラムコード完成部は、前記データ型対応表保持部で保持されているデータ型対応表を利用してプログラムコードを完成させるデータ型調整手段を有する請求項1に記載のプログラムコード生成装置。
A data type correspondence table that is a table associating column data type information indicating a data type of a column used in the description of the schema information with variable data type information indicating a data type of a variable used in the program code. It has a data type correspondence table holding part to hold,
2. The program code generation device according to claim 1, wherein the program code completion unit includes a data type adjustment unit that completes a program code using a data type correspondence table held in the data type correspondence table holding unit.
前記スキーマ情報の記述に現れる列の名前の命名規則を示す列命名規則情報と、前記プログラムコードにて使用される変数のデータ型を示す変数データ型情報とを対応付ける表である第二データ型対応表を保持する第二データ型対応表保持部を有し、
前記プログラムコード完成部は、前記第二データ型対応表保持部で保持されている第二データ型対応表を利用してプログラムコードを完成させる第二データ型調整手段を有する請求項1または2に記載のプログラムコード生成装置。
Corresponding to the second data type, which is a table associating column naming rule information indicating the naming rule of the column name appearing in the description of the schema information and variable data type information indicating the data type of the variable used in the program code A second data type correspondence table holding unit for holding a table;
The said program code completion part has the 2nd data type adjustment means which completes a program code using the 2nd data type correspondence table hold | maintained at the said 2nd data type correspondence table holding part. The program code generation device described.
前記スキーマ情報取得部は、取得されるスキーマ情報に、特定の列が特定の値を有するかどうかによりその列の値を含む行データが削除されたと扱う論理削除に使用する列を特定する情報である論理削除列情報を取得する論理削除列情報取得手段を有し、
前記操作コード雛形保持部は、論理削除のためのデータベース操作コード雛形を保持し、
前記プログラムコード完成部は、前記論理削除列情報取得手段で取得した論理削除列情報に基づいてプログラムコードを完成させる請求項1から3のいずれか一に記載のプログラムコード生成装置。
The schema information acquisition unit is information for specifying a column to be used for logical deletion in which the row data including the column value is deleted depending on whether or not the specific column has a specific value in the acquired schema information. Having logical deletion column information acquisition means for acquiring certain logical deletion column information;
The operation code template holding unit holds a database operation code template for logical deletion,
The program code generation device according to any one of claims 1 to 3, wherein the program code completion unit completes a program code based on the logical deletion sequence information acquired by the logical deletion sequence information acquisition unit.
前記プログラムコード完成部にて完成されるプログラムコードは、継承機構を持つプログラム言語で記述されている請求項1から4のいずれか一に記載のプログラムコード生成装置。   5. The program code generation device according to claim 1, wherein the program code completed by the program code completion unit is described in a program language having an inheritance mechanism. 前記プログラムコード完成部にて完成されるプログラムコードは、テーブル名又は/及び列名の文字列を定義し、前記プログラムコードを継承するプログラム部分で参照可能とする請求項5に記載のプログラムコード生成装置。   6. The program code generation according to claim 5, wherein the program code completed in the program code completion unit defines a character string of a table name or / and a column name and can be referred to by a program part that inherits the program code. apparatus. 前記プログラムコードは、データベースへのデータの挿入、データベースの更新、データの削除、データの検索のいずれか一又は二以上を実現するためのプログラムコードである請求項1から6のいずれか一に記載のプログラムコード生成装置。   7. The program code according to claim 1, wherein the program code is a program code for realizing one or more of data insertion into a database, database update, data deletion, and data search. 8. Program code generator. データベースへアクセスを行なうプログラムコードを生成するプログラムコード生成方法であって、
前記データベースのスキーマを記述する情報であるスキーマ情報を取得するスキーマ情報取得ステップと、
生成すべきプログラムコードと対応してデータベース操作コード雛形を読み出す操作コード雛形読出ステップと、
前記スキーマ情報取得ステップで取得したスキーマ情報と前記操作コード雛形読出ステップにて読み出されたデータベース操作コード雛形とに基づいて、プログラムコードを完成させるプログラムコード完成ステップと、
を含むプログラムコード生成方法。
A program code generation method for generating a program code for accessing a database,
A schema information acquisition step of acquiring schema information which is information describing the schema of the database;
An operation code template reading step for reading a database operation code template corresponding to the program code to be generated;
A program code completion step for completing a program code based on the schema information acquired in the schema information acquisition step and the database operation code template read out in the operation code template reading step;
A program code generation method including:
JP2004179418A 2004-06-17 2004-06-17 Program code generator Pending JP2006004145A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2004179418A JP2006004145A (en) 2004-06-17 2004-06-17 Program code generator

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2004179418A JP2006004145A (en) 2004-06-17 2004-06-17 Program code generator

Publications (1)

Publication Number Publication Date
JP2006004145A true JP2006004145A (en) 2006-01-05

Family

ID=35772498

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2004179418A Pending JP2006004145A (en) 2004-06-17 2004-06-17 Program code generator

Country Status (1)

Country Link
JP (1) JP2006004145A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010128995A (en) * 2008-11-28 2010-06-10 Nec Corp Information management apparatus, data processing method of the same, information management system, and computer program
JP2012113373A (en) * 2010-11-20 2012-06-14 Nomura Research Institute Ltd Program development support system and data utilization system
JP2013531321A (en) * 2010-07-20 2013-08-01 中▲興▼通▲訊▼股▲フン▼有限公司 Database backup data restoration method and apparatus
JP6370503B1 (en) * 2017-04-17 2018-08-08 三菱電機株式会社 Program creation device

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010128995A (en) * 2008-11-28 2010-06-10 Nec Corp Information management apparatus, data processing method of the same, information management system, and computer program
JP2013531321A (en) * 2010-07-20 2013-08-01 中▲興▼通▲訊▼股▲フン▼有限公司 Database backup data restoration method and apparatus
JP2012113373A (en) * 2010-11-20 2012-06-14 Nomura Research Institute Ltd Program development support system and data utilization system
JP6370503B1 (en) * 2017-04-17 2018-08-08 三菱電機株式会社 Program creation device

Similar Documents

Publication Publication Date Title
US7047249B1 (en) Method and apparatus for executing stored code objects in a database
US7003759B2 (en) Collection makefile generator
US5758160A (en) Method and apparatus for building a software program using dependencies derived from software component interfaces
JP5297802B2 (en) Metadata management for graph-type calculations
Loncaric et al. Fast synthesis of fast collections
JP2018501538A (en) Impact analysis
Hunter et al. ergm. userterms: A Template Package for Extending statnet
KR20040004619A (en) Method and system for transforming legacy software applications into modern object-oriented systems
US7792851B2 (en) Mechanism for defining queries in terms of data objects
JP3871832B2 (en) Data processing program automatic generation system and method, and computer-readable recording medium
Kramer et al. Change-driven consistency for component code, architectural models, and contracts
Yang et al. Powerstation: Automatically detecting and fixing inefficiencies of database-backed web applications in ide
JP2018510445A (en) Domain-specific system and method for improving program performance
Pârțachi et al. Flexeme: Untangling commits using lexical flows
Sukhov et al. MetaLanguage: a tool for creating visual domain-specific modeling languages
US11593076B2 (en) Method for merging architecture data
Khatchadourian et al. Detecting broken pointcuts using structural commonality and degree of interest
JP2006004145A (en) Program code generator
EP2919132A1 (en) Method for automatic generation of test data for testing a data warehouse system
US20040205690A1 (en) Integrated dynamic control flow and functionality generation for network computing environments
JP5600301B2 (en) System representation and handling technology
Beth A comparison of similarity techniques for detecting source code plagiarism
Cuadrado et al. Deriving OCL optimization patterns from benchmarks
JPH07146785A (en) Method for automatically generating program and device therefor
KR100564739B1 (en) The method for generating memory resident object-relational schema/query by using UML