JPH04190434A - Device and method for data base control - Google Patents

Device and method for data base control

Info

Publication number
JPH04190434A
JPH04190434A JP2321616A JP32161690A JPH04190434A JP H04190434 A JPH04190434 A JP H04190434A JP 2321616 A JP2321616 A JP 2321616A JP 32161690 A JP32161690 A JP 32161690A JP H04190434 A JPH04190434 A JP H04190434A
Authority
JP
Japan
Prior art keywords
data
update
database
prerequisite
locking
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
JP2321616A
Other languages
Japanese (ja)
Inventor
Makoto Tokiwai
常磐井 誠
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.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric 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 Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP2321616A priority Critical patent/JPH04190434A/en
Publication of JPH04190434A publication Critical patent/JPH04190434A/en
Pending legal-status Critical Current

Links

Landscapes

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

Abstract

PURPOSE:To avoid long-time locking by locking and updating data in a data base by a data base control program when a premise data specification and an update data specification are inputted by an application program. CONSTITUTION:The application program 1 inputs the premise data specification 2 and updated data specification 3 and sends an updated request to the data base control program 4. The program 4 locks the data in the data base 8 by a lock means 5 according to the specifications 2 and 3. Then a comparing means 6 compares the specification 2 with the value of a specified data item in a file to decide whether data updated is allowed or not, and then updates the data base 8. Consequently, the data in the data base can be updated without long-time locking.

Description

【発明の詳細な説明】 [産業上の利用分野] 本発明は、データベース管理装置及びデータベース管理
方法に関するものであり、特に、並行処理される複数の
プロセスで共用されているデータベースの更新処理を行
なうデータベース管理プログラムに関するものである。
[Detailed Description of the Invention] [Industrial Application Field] The present invention relates to a database management device and a database management method, and in particular, to update processing of a database shared by a plurality of parallel processes. It relates to database management programs.

[従来の技術] 一般に同一のデータベースを複数のプロセスで同時に使
用する場合には、そのデータベースの一貫性を保つため
に、並行処理制御が必要となる。
[Prior Art] Generally, when the same database is used simultaneously by multiple processes, parallel processing control is required to maintain consistency of the database.

そのため従来から、例えば第7図に記述しているような
2相ロツキングプロトコルなどでこの制御を行なってい
る。
Therefore, conventionally, this control has been performed using a two-phase locking protocol as shown in FIG. 7, for example.

これは、Henry F、 Korth、 Abrah
am 5ilberschatz著rDATA BAS
E C0NCEPTSJ 375ペ一ジ1986年発行
McGraw−Hill Book Company社
刊に記述されている方法をフローチャート化したもので
あり、図において(26)〜C29)は、アプリケーシ
ョンプログラムとデータベース管理プログラムとで協調
動作して行なわれる処理のプログラムステップを表して
いる。
This is Henry F., Korth, Abraham
am 5ilberschatz rDATA BAS
E CONCEPTSJ Page 375 This is a flowchart of the method described in McGraw-Hill Book Company, published in 1986. In the figure, (26) to C29) are cooperative operations between the application program and the database management program. It represents the program steps of the process performed.

ステップ(26)で、データベースよりすべてのデータ
項目をロックした後読みとり、 ステップ(27)で、データ項目の変更値を設定しステ
ップ(28)で、データベースのデータを更新した後、 ステップ(29)で、ステップ(26)で行なったロッ
クを解除する。
In step (26), all data items are locked and read from the database, in step (27), the changed values of the data items are set, and in step (28), the data in the database is updated, and then in step (29) Then, release the lock made in step (26).

このようにして、並行処理される複数のプロセスで共用
するデータベースの更新が実行されるので、データベー
スの一貫性が保たれていた。
In this way, the database shared by multiple processes being processed in parallel is updated, so the consistency of the database is maintained.

ところで、データベースより入力したデータを端末に表
示し、端末操作者がその値を参照しながらデータの更新
する値を決定するような会話型処理においては、この端
末処理をステップ(27)で行なうことになる。
By the way, in interactive processing in which data input from a database is displayed on a terminal and the terminal operator refers to the value and determines the value to update the data, this terminal processing should be performed in step (27). become.

一般に、会話型処理の場合には、端末操作に要する時間
は端末オペレータの操作の仕方に依存し、速ければ数秒
で終了するが遅ければ数時間要する事もある。
In general, in the case of conversational processing, the time required for terminal operation depends on the terminal operator's method of operation; if it is fast, it can be completed in a few seconds, but if it is slow, it can take several hours.

この時間を事前に予想する事は不可能であるので、アプ
リケーションプログラムは最も時間を要する場合を想定
して作成する事が望ましい。
Since it is impossible to predict this time in advance, it is desirable to create an application program assuming the case where it will take the longest time.

この場合、ステップ(26)でロックされたデータは端
末処理の間、最悪の場合には数時間ロックされ続ける事
になる。
In this case, the data locked in step (26) will remain locked for several hours during terminal processing in the worst case.

データが長時間ロックされ続ける事がシステムの性能上
ふされしい事でないと判断される場合には、第2図に示
すような処理を行なうプログラムを作成していた。
If it was determined that it was inappropriate for the system's performance to keep data locked for a long time, a program was created to perform the process shown in Figure 2.

図において(30)〜(38)はアプリケーションプロ
グラムとデータベース管理プログラムとで協調動作して
行なわれる処理のプログラムステップを表している。
In the figure, (30) to (38) represent program steps of processing performed in cooperation with the application program and the database management program.

ステップ(30)で、データベースよりデータ項目をロ
ックせずに入力し、 ステップ(31)で、ステップ(35)で行なわれるデ
ータ更新の前提となるデータをワークエリアに保存し、 ステップ(32)で、端末処理を行ない、ステップ(3
3)で、データベースよりすべてのデータ項目をロック
した後、ロックしたデータを読みとり、 ステップ(34)で、ステップ(31)でワークエリア
に保存したデータとステップ(33)で入力した値とを
比較し、その値がすべて同一の場合には、ステップ(3
5)でデータベースの更新を行ない、ステップ(33)
で行なったロックをステップ(36)で解除する。
In step (30), data items are input from the database without locking them. In step (31), data that is a prerequisite for the data update performed in step (35) is saved in the work area. In step (32), data items are input without locking. , perform terminal processing, and step (3)
In step 3), after locking all data items from the database, read the locked data, and in step (34) compare the data saved in the work area in step (31) with the value entered in step (33). If the values are all the same, step (3)
Update the database in step 5), and then proceed to step (33).
The lock made in step (36) is released.

ここで、ステップ(35)のデータベースの更新は、通
常のアプリケ−、ジョンプログラムが上級言語で記述さ
れるので、上級言語の備えている更新命令を使うことに
なる。例えば、REWRITE命令を用いるとすると、
REWRITE命令は、通常、先ずデータを読み込み、
該当項目を更新して再書き込みをするルーチンでできて
いるので、このステップ(35)でもアプリケーション
プログラムの関知しないところで入力処理が行なわれて
いることになる。
Here, in updating the database in step (35), since normal application programs are written in a high-level language, update commands provided in the high-level language are used. For example, if you use the REWRITE instruction,
The REWRITE instruction usually first reads the data,
Since this step (35) is made up of a routine that updates and rewrites the relevant items, input processing is also performed outside the application program's knowledge.

さて、ステップ(34)の比較が異なる場合には、ステ
ップ(37)で例外処理として、端末操作者に対して、
更新が要求通り行なわれなかったこと通知し、ステップ
(33)で行なったロックをステップ(38)で解除し
た後、ステップ(31)より再実行する。
Now, if the comparison in step (34) is different, in step (37) as an exception handling,
After notifying that the update was not performed as requested and releasing the lock made in step (33) in step (38), the process is re-executed from step (31).

この手順によって、ロックの行なわれている時間を短く
して、データベースの更新を行なっていた。
This procedure shortens the locking time and updates the database.

[発明が解決しようとする課題] 従来の端末処理時間を予想できない会話処理によるデー
タベース更新では、上記のように長時間データに対して
ロックし続けるか、あるいは、同しデータに対する入力
を2度以上行なう必要があった。
[Problems to be Solved by the Invention] In conventional database updating using conversational processing where terminal processing time cannot be predicted, data must be kept locked for a long time as described above, or the same data must be input more than once. It was necessary to do it.

しかし、端末処理に手間取っていてロックが解除されて
いないのか、アプリケーションプログラムが異常終了し
たためロックが解除されていないのか、あるいは、アプ
リケーションプログラムに誤りがあるためロックが解除
されていないのか、を区別する事が困難であるため、通
常はデータベース管理プログラムが、ロックし続けられ
る時間を限定し、それ以上時間が経過したものについて
はロックを解除してしまい、後続の更新処理を排除して
いる。
However, it is possible to distinguish whether the lock has not been released because the terminal processing took time, whether the lock has not been released because the application program has terminated abnormally, or whether the lock has not been released because there is an error in the application program. Because this is difficult, database management programs usually limit the amount of time a lock can be held, and then release the lock after that period of time, eliminating subsequent update processing.

したがって、データのロックを行なってから端末処理を
行なう方法では、端末処理に使用できる時間はロックし
続ける事ができる時間のために限定されてしまうという
問題点があった。
Therefore, in the method of locking data and then performing terminal processing, there is a problem in that the time available for terminal processing is limited by the time that the lock can be continued.

また、同じデータに対する入力を2度行なう方法では、
計算機の負荷の大きい無駄な入力処理を2度以上行なわ
なければならないという問題点があった。
Also, in the method of inputting the same data twice,
There is a problem in that unnecessary input processing that places a large load on the computer must be performed more than once.

また、どちらの場合でも、データをロックする順序がア
プリケーションプログラムのコーディングに依存してい
たため、デッドロックが発生する可能性を回避できない
という問題点があった。
Furthermore, in either case, the order in which data is locked depends on the coding of the application program, so there is a problem that the possibility of deadlock occurring cannot be avoided.

本発明は、このような問題点を解消するためになされた
もので、データ項目の長時間に渡るロックを避け、デー
タの入力処理回数を減少させ、また、デッドロックを回
避してデータベースの更新を行なうことができるデータ
ベース管理装置及びデータベース管理方法を得ること目
的としている[課題を解決するための手段] 本発明に係るデータベース管理装置は、以下の要素を有
するものである。
The present invention was made to solve these problems, and it avoids locking data items for a long time, reduces the number of data input processes, and also avoids deadlocks and updates the database. [Means for Solving the Problems] A database management device according to the present invention has the following elements.

(a)データを記憶するデータベース、(b)データベ
ースに記憶されたデータの更新を要求するため以下の情
報を発するアプリケーションプログラム、ジョブ、タス
ク、あるいは、プロセス等を、動作させる手段、 (b1)データの更新をするための前提条件と成るデー
タを指定する前提データ指定、(b2)更新するデータ
の更新後のデータを指定する更新データ指定、 (c)以下の要素を有するデータベース管理工程(デー
タベース管理プログラム)、 (c1)アプリケーション手段(アプリケーションプロ
グラム)によって発せられる前提データ指定と更新デー
タ指定を入力とし、データベース中のデータをロックす
るロック手段(c2)前提データ指定とデータベース中
のデータの値を入力とし、これらの値を比較する比較手
段、 (c3)更新データ指定を入力とじ、比較手段の比較結
果に基づきデータベースのデータ更新を行なう更新手段
(a) a database that stores data; (b) means for operating an application program, job, task, or process that issues the following information to request updates to the data stored in the database; (b1) data; (b2) Update data specification that specifies the data after the data to be updated; (c) Database management process (database management) that has the following elements: (c1) Locking means for locking the data in the database by inputting the prerequisite data specification and update data specification issued by the application means (application program) (c2) Inputting the prerequisite data specification and the value of the data in the database and (c3) an updating means for inputting update data designation and updating data in the database based on the comparison result of the comparing means.

また、本発明に係るデータベース管理方法は、以下の工
程を有するものである。
Further, the database management method according to the present invention includes the following steps.

(a)データベースからデータを入力し、所定の処理後
、更新前提値と更新データを発することにより、データ
の更新要求を出すアプリケーション工程、 (b)以下の工程を有するデータベース管理工程(b1
)アプリケーション工程によって発せられるデータの更
新要求を入力し、データベース中のデータをロックして
入力するロック工程、 (b2)更新前提値とデータベース中のデータの値を入
力し、これらの値を比較する比較工程、 (b3)更新データを入力し、比較手段の比較結果に基
づきデータベースのデータ更新を行なう更新工程。
(a) An application process that inputs data from a database and, after predetermined processing, issues a data update request by issuing update prerequisite values and update data; (b) A database management process (b1) that includes the following steps:
) A locking process that inputs a data update request issued by the application process, locks and inputs the data in the database, (b2) inputs the update prerequisite value and the value of the data in the database, and compares these values. comparison step; (b3) update step of inputting update data and updating data in the database based on the comparison result of the comparison means;

(b4)ロック工程でロックされたデータのロックを解
除する解除工程。
(b4) An unlocking step for unlocking the data locked in the locking step.

[作用] 本発明においては、アプリケーションプログラムにより
1度目の入力を行ない、データベース管理プログラムに
更新要求を出す。データベース管理手段(データベース
管理プログラム)は、ロック手段において、アプリケー
ションプログラムより発せられる前提データ指定と更新
データ指定に基づきデータをロックし2度目の入力を行
ない、比較手段において、前提データ指定と、そこで指
定されたデータ項目のファイル中の値とを比較し、デー
タ更新の可否を判定し、更新手段において、更新データ
指定と、比較手段の判定した結果に基づいてデータの更
新を行ない、データベースの更新を行なう。
[Operation] In the present invention, the application program performs the first input and issues an update request to the database management program. The database management means (database management program) locks the data based on the prerequisite data specification and update data specification issued by the application program in the locking means and performs a second input, and in the comparison means, the data is inputted for the second time based on the prerequisite data specification and the update data specification issued by the application program. The value of the data item in the file is compared with the value in the file to determine whether the data can be updated, and the updating means updates the data based on the update data specification and the result determined by the comparison means, and updates the database. Let's do it.

このように、ロックは、データベース管理プログラムに
おいて、2度目のデータ入力からその更新を行なうまで
の間しか行なわれないので長時間に渡るロックが回避さ
れる。
In this manner, locking is performed in the database management program only from the second data entry until the data is updated, thereby avoiding locking for a long time.

また、データベース管理プログラムは、効率を高める為
低級言語で記述されるので、更新時の無用の入力をしな
い様に記述することができる。
Furthermore, since the database management program is written in a low-level language to improve efficiency, it can be written in a manner that avoids unnecessary input during updating.

更に、データベース管理プログラムは、システムに一つ
しかなく、並行して実行される複数のアプリケーション
プログラムは、このデータベース管理プログラムのロッ
ク手段を使用する為、デッドロックを回避することがで
きる。
Furthermore, since there is only one database management program in the system and multiple application programs executed in parallel use the locking means of this database management program, deadlocks can be avoided.

[実施例] 第1図はこの発明に係るデータベース管理装置の一実施
例を示すものであり、この図において、(1)はアプリ
ケーションプログラム、(2)はデータの更新をするた
めの前提条件と成るデータを指定する前提データ指定、 (3)は更新するデータの更新後のデータを指定する更
新データ指定、 (4)はデータベース管理手段となるデータベース管理
プログラム、 (5)はロック手段、 (6)は比較手段、 (7)は更新手段、 (8)はデータベース、 (10)は更新データレコード、 (11)は終了コードである。
[Embodiment] Figure 1 shows an embodiment of a database management device according to the present invention. In this figure, (1) indicates an application program, and (2) indicates a precondition for updating data. (3) is an update data specification that specifies the updated data of the data to be updated; (4) is a database management program that serves as a database management means; (5) is a locking means; (6) ) is a comparison means, (7) is an update means, (8) is a database, (10) is an update data record, and (11) is an end code.

また、第2図は、アプリケーションプログラム(1)が
′、データベース管理プログラム(4)に対して出す更
新要求命令の一例を示す図であり、ここでは、UPDA
TE命令とこの命令とともに発せれれる前提データ指定
(2)と更新データ指定(3)の例を示している。
FIG. 2 is a diagram showing an example of an update request command issued by the application program (1) to the database management program (4).
An example of the TE command and the prerequisite data designation (2) and update data designation (3) issued with this command are shown.

第2図の前提データ指定(2)は、 FILE番号1の RECORD番号4の 項目番号5の値が ”3” である場合には更新データ指定(3)で指定され値に更
新することを要求している。
Prerequisite data specification (2) in Figure 2 requests that if the value of item number 5 of RECORD number 4 of FILE number 1 is "3", it is updated to the value specified in update data specification (3). are doing.

すなわち、データベースが上記前提データ指定(2)に
指定された通りになっていれば、FILE番号lの RECORD番号4の 項目番号5の値を ”4” にすることを要求している。
That is, if the database is as specified in the above prerequisite data specification (2), it is requested that the value of item number 5 of RECORD number 4 of FILE number l be set to "4".

このように、アプリケーションプログラム(1)は、デ
ータベース管理プログラム(4)に対して、例えば、第
2図に示すようなUPDATE命令でデータの更新を依
頼し:前提データ指定(2)は、同じく第2図に示すよ
うに、アプリケーションプログラム(11よりデータベ
ース管理プログラム(4)に発せられるもので、複数の
データ項目指定とその値からなる。
In this way, the application program (1) requests the database management program (4) to update data using, for example, the UPDATE command as shown in FIG. As shown in Figure 2, it is issued from the application program (11) to the database management program (4) and consists of multiple data item specifications and their values.

また、更新データ指定(3)は、同じく第2図に示すよ
うに、アプリケーションプログラム(1)よりデータベ
ース管理プログラム(4)に発せられるもので、複数の
データ項目指定とその値からなるロック手段(5)は、
データベース管理プログラム(4)の一部分で、前提デ
ータ指定(2)と更新データ指定(3)とから、データ
のロックを行なう。
Also, as shown in FIG. 2, the update data designation (3) is issued from the application program (1) to the database management program (4), and is a locking means (3) consisting of multiple data item designations and their values. 5) is
A part of the database management program (4) locks data based on the prerequisite data specification (2) and the update data specification (3).

比較手段(6)は、データベース管理プログラム(4)
の一部分で、更新データレコード(io)と前提データ
指定(2)とから、データ更新の可否を決定する。
Comparison means (6) is a database management program (4)
In this part, it is determined whether data can be updated based on the update data record (io) and the prerequisite data specification (2).

データ更新手段(7)は、データベース管理プログラム
(4)の一部分で、比較手段の決定に基づき更新データ
指定(3)から更新データレコード(10]を更新する
The data update means (7) is a part of the database management program (4), and updates the update data record (10) from the update data designation (3) based on the determination by the comparison means.

更新データレコード(10)は、データベース(8)の
中のデータレコードである。
The update data record (10) is a data record in the database (8).

終了コード(11)は、データベース管理プログラム(
4)からアプリケーションプログラム(1)に発せられ
るものである。
The exit code (11) is the database management program (
4) to the application program (1).

このような構成のシステムにおいては第3図、第4図に
示すフローチャートに基づいてデータベースの更新がな
される。第3図、第4図は、この発明に係るデータベー
ス管理方法の一実施例を示すフローチャートであり、第
3図はアプリケーション工程となるアプリケーションプ
ログラム(1)の処理を示すフローチャート、第4図は
データベース管理工程となるデータベース管理プログラ
ム(4)のロック手段(5)、比較手段(6)、更新手
段(7)の処理を示すフローチャートである。
In a system having such a configuration, the database is updated based on the flowcharts shown in FIGS. 3 and 4. 3 and 4 are flowcharts showing an embodiment of the database management method according to the present invention, FIG. 3 is a flowchart showing the processing of the application program (1) which is the application step, and FIG. It is a flowchart showing the processing of the locking means (5), the comparing means (6), and the updating means (7) of the database management program (4), which are management steps.

まず、アプリケーションプログラム(1)は、第3図の
にフローに基づき処理を実行する。
First, the application program (1) executes processing based on the flow shown in FIG.

ステップ(12)で、データのロックを伴わず、データ
入力を行なう。第2図の例でいえば。
In step (12), data is input without locking the data. In the example of Figure 2.

FILE番号I RECORD番号4 項目番号5の値 ”3” を入力する。FILE number I RECORD number 4 Value of item number 5 “3” Enter.

ステップ(13)では、ステップ(12)で入力したデ
ータのうち、後のステップ(15)で行なう更新の際、
前提データ指定(2)として使用されるものをワークエ
リアに保存する。上記のステップ(12)で入力したデ
ータ、 FILE番号l °  RECORD番号4 項目番号5の値 ”3” をワークエリアに保存する。
In step (13), among the data input in step (12), when updating in the subsequent step (15),
Save what is used as prerequisite data specification (2) in the work area. Save the data input in step (12) above, FILE number l° RECORD number 4, value “3” of item number 5, in the work area.

ステップ(14)では、端末処理を行い、ステップ(1
2)で入力したデータを端末に表示し、端末操作者にデ
ータの更新値を入力させる。第2図の例でいえば、 FILE番号I RECORD番号4 項目番号5の値 ”4″′ を入力する。
In step (14), terminal processing is performed, and step (1)
The data entered in step 2) is displayed on the terminal, and the terminal operator is prompted to input the updated data value. In the example of FIG. 2, enter the value "4''' for FILE number I RECORD number 4 and item number 5.

ステップ(15)では、ステップ(13)で保存したデ
ータを前提データ指定(2)とし、ステップ(15)で
端末操作者が指定したデータを更新データ指定(3)と
してデータベース管理プログラム(4)に対して、デー
タ更新要求を行なう。
In step (15), the data saved in step (13) is designated as prerequisite data (2), and the data specified by the terminal operator in step (15) is designated as update data (3) in the database management program (4). A data update request is made to the server.

ステップ(16)では、ステップ(15)のデータ更新
要求の結果を終了コード(11)から判断し、要求通り
更新が行なわれていない場合には、ステップ(17)の
例外処理で、端末操作者に対して更新が要求通り行なわ
れなかったこと通知し、ステップ(12)より再実行す
る。
In step (16), the result of the data update request in step (15) is determined from the completion code (11), and if the update has not been performed as requested, the terminal operator It notifies that the update was not performed as requested, and re-executes from step (12).

上記アプリケーションプログラム(1)のステップ(1
5)で行われるデータ更新要求は、第4図に示す処理手
順により、データベース管理プログラム(4)で処理さ
れる。
Step (1) of the above application program (1)
The data update request made in step 5) is processed by the database management program (4) according to the processing procedure shown in FIG.

ステップ(181、(19)は、ロック手段(5)の前
半部であるロック手段(前半部) (5a)である。
Steps (181, (19)) are locking means (first half) (5a) which is the first half of locking means (5).

これにより、データのロックと入力を行なう(ロック工
程)。
This locks and inputs data (locking process).

ステップ(18)で、アプリケーションプログラム(1
)から発せられる前提データ指定(2)と、更新データ
指定(3)で指定されるデータ項目を含むすべての更新
データレコード(10)をロックする。
In step (18), the application program (1
), all update data records (10) including the data items specified by the prerequisite data specification (2) and the update data specification (3) are locked.

このロックの順序は、例えば、次のように決定される。This locking order is determined, for example, as follows.

データレコードが異なるファイル上に存在する場合は、
データベース内で一意に付加されたファイル番号の順に
行なわれ、また、同じファイル中のデータレコードの場
合は、ファイル内で一意に付加されたレコード番号の順
に行なわれる。
If the data records are on different files,
Data records are processed in the order of uniquely added file numbers within the database, and in the case of data records in the same file, data records are processed in the order of uniquely added record numbers within the file.

したがって、このステップ(18)が、並行して実行さ
れる複数のプロセスあるいは、複数のアプリケーション
プログラムから呼ばれて実行されても、デッドロックは
発生しない。
Therefore, even if this step (18) is called and executed by multiple processes or multiple application programs that are executed in parallel, deadlock will not occur.

次に、ステップ(19)で、前提データ指定(2)と更
新データ指定(3)で指定されるデータ項目を含むすべ
ての更新データレコード(10)をデータベース(8)
からメモリ上のデータバッファに入力するここで行われ
るロックおよびデータレコードの入力は、異なるデータ
項目であっても、また、異なる指定によって行われるも
のであっても、同じデータレコードに含まれるものであ
れば、そのデータレコードに対し一回のロックおよび一
回の入力しか行わない。例えば、RECORD番号1の
項目3と項目5を更新したい場合、RECORD番号1
のRECORDを1度ロックし1度入力すれば良く、項
目ごとそれぞれロックしてそれぞれ入力する必要はない
Next, in step (19), all update data records (10) including data items specified by prerequisite data specification (2) and update data specification (3) are sent to the database (8).
The locks and data record inputs performed here are contained in the same data record, even if they are different data items or with different specifications. If so, only one lock and one input are performed on that data record. For example, if you want to update item 3 and item 5 of RECORD number 1, RECORD number 1
It is only necessary to lock RECORD once and input it once, and there is no need to lock each item and input each item individually.

次に、ステップ(20) 、 (21)からなる比較手
段(6)よって、更新の可否が判定される(比較工程)
前提データ指定(3)で指定されたデータ項目の値と、
その項目の、ステップ(19)で入力した更新データレ
コード(10)内での値とをステップ(20)で比較す
る。
Next, the comparison means (6) consisting of steps (20) and (21) determines whether or not the update is possible (comparison step).
The value of the data item specified in prerequisite data specification (3),
The value of that item in the update data record (10) input in step (19) is compared in step (20).

これがすべて同一の場合にζよ、この更新は有効としデ
ータ更新手段に制御が移される。
If all of these are the same, then this update is considered valid and control is transferred to the data update means.

異なる場合は、この更新は無効としステップ(21)で
無効用の終了コード「11」を設定し、アプリケーショ
ンプログラム(1)に対して更新が無効であったことを
通知する。
If it is different, this update is invalidated, and in step (21), an invalidation termination code "11" is set, and the application program (1) is notified that the update is invalid.

次に、上記の更新の可否判定の結果に基づきデータ更新
を行なう更新工程について説明する。
Next, an update process for updating data based on the result of the above-mentioned update availability determination will be described.

ステップ(22)〜(24)は、更新手段(7)であり
、ステップ(22)でメモリ上のデータバッファに入力
されている更新データレコード(10)のうち、更新デ
ータ指定(3)で指定されたデータ項目をそこで指定さ
れた値に変更した後、そのデータレコードを、ステップ
(23)でデータバッファからデータベース(8)に出
力する。
Steps (22) to (24) are update means (7), which is specified by the update data designation (3) among the update data records (10) input into the data buffer on the memory in step (22). After changing the specified data item to the specified value, the data record is output from the data buffer to the database (8) in step (23).

ここでの出力は、すでにステップ(19)でデータレコ
ードを入力しているので再び入力する必要はなく、単に
出力すればよい。
As for the output here, since the data record has already been input in step (19), there is no need to input it again, and it is sufficient to simply output it.

これは、データベース管理プログラムが低級言語で記述
されるため、必要最小限かつ柔軟性のあるのコーアンダ
が可能なことから達成でき、また、このことにより不必
要な入力を省けるため処理速度も向上する。
This is achieved because the database management program is written in a low-level language, which allows for minimal and flexible counders, and this also improves processing speed by eliminating unnecessary input. .

そして、ステップ(24)で更新OKの終了コード「0
0」を設定し、アプリケーションプログラム(1)に対
して更新が終了したことを通知する。
Then, in step (24), the update OK exit code is "0".
0" to notify the application program (1) that the update has been completed.

最後にステップ(25)からなるロック手段(5)の後
半部であるロック手段(後半部) (5blにより、デ
ータのロックを解除する(解除工程)。
Finally, the locking means (second half) (5bl), which is the second half of the locking means (5) consisting of step (25), unlocks the data (release step).

上記動作により、データベースの更新がなされる。The above operation updates the database.

なお、上記実施例では、前提データ指定(2)で指定さ
れるデータ項目と更新データ指定(3)で指定されるデ
ータ項目が、同じ場合を示したが、第5図に示すように
、前提データ指定(2)で指定されるデータ項目と更新
データ指定(3)で指定されるデータ項目が異なる場合
でもよい。
In the above embodiment, the data item specified in the premise data specification (2) and the data item specified in the update data specification (3) are the same, but as shown in FIG. The data item specified by data specification (2) and the data item specified by update data specification (3) may be different.

第5図において(9)は比較データレコードであり、比
較データレコード(9)は、データベース(8)の中の
データレコードであり、アプリケーションプログラム(
1)から発せられる前提データ指定(2)で指定される
データ項目と比較されるものである。例えば、 FILE番号I RECORD番号4 項目番号5の値 ′3” の場合に FILE番号I RECORD番号O R間番号lの値 ”8” にしたい場合、比較データレコード(9)は、FILE
番号I RECORD番号4 であり、更新データレコード(lO)は、FILE番号
I RECORD番号O R間り、前提データ指定(2)で指定されるデータ項目
と更新データ指定(3)で指定されるデータ項目が異な
る場合である。
In FIG. 5, (9) is a comparison data record, and the comparison data record (9) is a data record in the database (8), and the application program (
It is compared with the data item specified by the prerequisite data specification (2) issued from 1). For example, if the value of FILE number I RECORD number 4 item number 5 is ``3'' and you want to change the value of FILE number I RECORD number OR number l to ``8'', the comparison data record (9) is
Number I RECORD number 4, and the update data record (lO) is between FILE number I RECORD number OR, the data item specified by prerequisite data specification (2) and the data specified by update data specification (3) This is a case where the items are different.

このような場合でも、ステップ(19)で、更新データ
レコード(1a)と同様に比較データレコード(9)を
ロックして入力し、ステップ(20)で、更新データレ
コード(10)の変わりに比較データレコード(9)を
前提データ指定(2)で指定さてたデータと比較すれば
、上記実施例と同様な効果を奏するまた、第6図は、第
4図に示したデータベース管理工程の他の実施例を示し
たものである。ステップ(26)は、ステップ(19)
の入力処理が成功したかを判定するステップである。ス
テップ(19)の入力処理の時点ですでに更新データレ
コード(10)、あるいは、比較データレコード(9)
が他の要求により削除されている場合がある。この場合
、ステップ(19)の入力処理は、エラーになるため後
の処理が実行できなくなる。そこで、入力エラー用の終
了コード「01」を設定する処理を追加したものである
。なお、この例では、ステップ(19)の入力処理後に
判定しているが、ステップ(18)のロック処理におい
てエラーを検出できるならステップ(18)のロック処
理直後に、判定しても良い。
Even in such a case, in step (19), the comparison data record (9) is locked and input in the same way as the update data record (1a), and in step (20), the comparison data record (9) is entered instead of the update data record (10). If the data record (9) is compared with the data specified in the prerequisite data specification (2), the same effect as in the above embodiment can be obtained. This shows an example. Step (26) is step (19)
This is the step of determining whether the input processing is successful. At the time of input processing in step (19), the update data record (10) or comparison data record (9) has already been created.
may have been deleted due to other requests. In this case, the input process in step (19) results in an error, making it impossible to execute subsequent processes. Therefore, processing for setting the end code "01" for input errors has been added. In this example, the determination is made after the input processing in step (19), but the determination may be made immediately after the lock processing in step (18) if an error can be detected in the lock processing in step (18).

また、上記実施例では、端末処理を伴うアプリケーショ
ンプログラムについて述べたが、その他の処理を行うア
プリケーションプログラムにも利用できることは言うま
でもない。
Further, in the above embodiment, an application program that involves terminal processing has been described, but it goes without saying that the present invention can also be used for application programs that perform other processing.

また、アプリケーションプログラムという名前でなけれ
ばならない必要はなく、プロセス、ジョブ、タスク等と
呼ばれるものであってもよい。
Further, the name does not necessarily have to be an application program, and it may be called a process, job, task, or the like.

また上記実施例では1、ロックの単位をデータレコード
としているが、この単位はこれより大きなファイル単位
やブロック単位でも良いし、また、データレコードの一
部分や、1つのデータ項目単位でも良い。
Further, in the above embodiment, the unit of locking is a data record, but this unit may be a larger file unit or a block unit, or may be a part of a data record, or a single data item unit.

また、ファイルの入出力の単位をデータベ−スとしてい
るが、ロックの単位と同じか、より小さい単位であれば
、ファイル単位やデータブロック単位でも良いし、また
、データレコードの一部分や、1つのデータ項目単位で
も良い。
Also, although the unit of file input/output is a database, it may be a file unit or a data block unit as long as it is the same or smaller than a lock unit, or it can be a part of a data record or a single unit. It may be a data item unit.

また上記実施例では、ロックを行なう順序を各データの
単位に付加された一意の番号の順序で行なっているが、
この順序はロックを行なう順序が一意に定まる方法であ
れば他の方法でも良い。例えば、ロックするファイルの
順序はファイル名の順序でも良く、レコードの順序は物
理的なファイル上の位置の順序でも良い。
Furthermore, in the above embodiment, locking is performed in the order of unique numbers added to each data unit.
This order may be any other method as long as the order of locking is uniquely determined. For example, the order of files to be locked may be the order of file names, and the order of records may be the order of physical positions on the file.

また、上記実施例では、アプリケーションプログラムを
実行したばあいを説明したが、この発明に係るデータベ
ース管理装置は、アプリケーションプログラムを実行で
きる手段が備わっていれば良く、実際にアプリケーショ
ンプログラムを実行している必要はない。
Further, in the above embodiment, the case where the application program is executed is explained, but the database management device according to the present invention only needs to be equipped with a means for executing the application program, and the database management device according to the present invention only needs to be equipped with a means for executing the application program. There's no need.

また、上記実施例では、多くの部分をプログラムとして
説明したが、一部、あるいは、多くをハードウェア、あ
るいは、ファームウェアで実現してもよい。
Further, in the above embodiment, many parts have been explained as programs, but some or many parts may be realized by hardware or firmware.

[発明の効果] 以上説明したようにこの発明によれば、データベース管
理手段(工程)として、データをロックするロック手段
(工程)と、データ更新の可否を判定する比較手段(工
程)と、データの更新を行なう更新手段(工程)とを設
けたので、ファイル上のデータ項目に対して長時間ロッ
クをすることなく、データベースから不要な入力をする
ことなく、デッドロック発生する可能性を排除して、デ
ータベースのデータの更新をすることができるデータベ
ース管理装置及びデータベース管理方法を得ることがで
きる。
[Effects of the Invention] As explained above, according to the present invention, the database management means (process) includes a locking means (process) for locking data, a comparison means (process) for determining whether or not data can be updated, and a data management means (process) for locking data. Since we have provided an update means (process) to update the data items in the file, there is no need to lock data items on the file for a long time, there is no unnecessary input from the database, and the possibility of deadlock is eliminated. Thus, it is possible to obtain a database management device and a database management method that can update data in a database.

【図面の簡単な説明】[Brief explanation of the drawing]

第1図は、この発明におけるデータベース管理装置の一
実施例の全体構成図、 第2図は、この発明における更新命令、前提データ指定
及び更新データ指定の一実施例の図、第3図は、この発
明におけるデータ更新処理を行なうアプリケーション工
程の動作を示すフローチャート図、 第4図は、この発明におけるデータベース管理工程の更
新処理時の動作を示すフローチャート図第5図は、この
発明におけるデータベース管理装置の他の実施例の全体
構成図、 第6図は、この発明におけるデータベース管理工程の更
新処理時の他の動作を示すフローチャート図、 第7図、第8図は、従来のデータベース処理の動作を示
すフローチャート図である。 (1)はアプリケーションプログラム、(2)は前提デ
ータ指定、 (3)は更新データ指定、 (4)はデータベース管理プログラム、(5)はロック
手段、 (6)は比較手段、 (力は更新手段、 (8)はデータベース、 (10)は更新データレコード、 (11)は終了コードである。 以上
FIG. 1 is an overall configuration diagram of an embodiment of a database management device according to the present invention, FIG. 2 is a diagram of an embodiment of update command, prerequisite data specification, and update data specification according to the present invention, and FIG. FIG. 4 is a flowchart showing the operation of the application process that performs the data update process in this invention; FIG. An overall configuration diagram of another embodiment; FIG. 6 is a flowchart showing other operations during update processing of the database management process in the present invention; FIGS. 7 and 8 show operations of conventional database processing. It is a flowchart figure. (1) is the application program, (2) is the prerequisite data specification, (3) is the update data specification, (4) is the database management program, (5) is the locking means, (6) is the comparison means, (power is the update means) , (8) is the database, (10) is the update data record, and (11) is the end code.

Claims (2)

【特許請求の範囲】[Claims] (1)以下の要素を有するデータベース管理装置(a)
データを記憶するデータベース、 (b)データベースに記憶されたデータの更新を要求す
るため以下の情報を発するアプリケーションプログラム
を、動作させる手段、 (b1)データの更新をするための前提条件と成るデー
タを指定する前提データ指定、 (b2)更新するデータの更新後のデータを指定する更
新データ指定、 (c)以下の要素を有するデータベース管理手段(c1
)アプリケーションプログラムによって発せられる前提
データ指定と更新データ指定を入力とし、データベース
中のデータをロックするロック手段、 (c2)前提データ指定とデータベース中のデータの値
を入力とし、これらの値を比較する比較手段、 (c3)更新データ指定を入力とし、比較手段の比較結
果に基づきデータベースのデータ更新を行なう更新手段
(1) Database management device (a) having the following elements:
a database that stores data; (b) means for operating an application program that issues the following information in order to request updates to the data stored in the database; (b1) data that is a prerequisite for updating the data; (b2) Update data specification that specifies the updated data of the data to be updated; (c) Database management means (c1) that has the following elements:
) A locking means that takes as input the prerequisite data specification and update data specification issued by the application program and locks the data in the database; (c2) Takes as input the prerequisite data specification and the value of data in the database and compares these values. Comparing means, (c3) Updating means that receives update data designation as input and updates data in the database based on the comparison result of the comparing means.
(2)以下の工程を有するデータベース管理方法(a)
データベースからデータを入力し、所定の処理後、更新
前提値と更新データを発することにより、データの更新
要求を出すアプリケーション工程、 (b)以下の工程を有するデータベース管理工程(b1
)アプリケーション工程によって発せられるデータの更
新要求を入力し、データベース中のデータをロックして
入力するロック工程、 (b2)更新前提値とデータベース中のデータの値を入
力し、これらの値を比較する比較工程、 (b3)更新データを入力し、比較手段の比較結果に基
づきデータベースのデータ更新を行なう更新工程。 (b4)ロック工程でロックされたデータのロックを解
除する解除工程。
(2) Database management method having the following steps (a)
An application process that issues data update requests by inputting data from a database and issuing update prerequisite values and update data after predetermined processing; (b) a database management process (b1) that includes the following steps;
) A locking process that inputs a data update request issued by the application process, locks and inputs the data in the database, (b2) inputs the update prerequisite value and the value of the data in the database, and compares these values. comparison step; (b3) update step of inputting update data and updating data in the database based on the comparison result of the comparison means; (b4) An unlocking step for unlocking the data locked in the locking step.
JP2321616A 1990-11-26 1990-11-26 Device and method for data base control Pending JPH04190434A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2321616A JPH04190434A (en) 1990-11-26 1990-11-26 Device and method for data base control

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2321616A JPH04190434A (en) 1990-11-26 1990-11-26 Device and method for data base control

Publications (1)

Publication Number Publication Date
JPH04190434A true JPH04190434A (en) 1992-07-08

Family

ID=18134515

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2321616A Pending JPH04190434A (en) 1990-11-26 1990-11-26 Device and method for data base control

Country Status (1)

Country Link
JP (1) JPH04190434A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008276475A (en) * 2007-04-27 2008-11-13 Daiwa Securities Group Inc Data processing system, terminal unit and program
JPWO2012108015A1 (en) * 2011-02-09 2014-07-03 富士通株式会社 Data synchronization method, data synchronization program, and data synchronization control device
CN111930759A (en) * 2020-07-20 2020-11-13 珠海格力电器股份有限公司 Data updating method, device, equipment and computer readable medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008276475A (en) * 2007-04-27 2008-11-13 Daiwa Securities Group Inc Data processing system, terminal unit and program
JPWO2012108015A1 (en) * 2011-02-09 2014-07-03 富士通株式会社 Data synchronization method, data synchronization program, and data synchronization control device
CN111930759A (en) * 2020-07-20 2020-11-13 珠海格力电器股份有限公司 Data updating method, device, equipment and computer readable medium

Similar Documents

Publication Publication Date Title
CN101495976B (en) Direct-update software transactional memory
US4791554A (en) Method and apparatus for preventing deadlock in a data base management system
JPH0713813B2 (en) Data access method and data processing system
KR940005819B1 (en) Consistent timestamping for transactions in distributed systems
JPH06332778A (en) Method for transaction management
JPH08328933A (en) File access control system for parallel processing system
US20090307442A1 (en) Memory Access Control
CN110377614B (en) Order processing lock system under distributed environment
JPH04190434A (en) Device and method for data base control
JP3970524B2 (en) Exclusive control method between multiple operations
JP2926873B2 (en) Computer system
JPH0588954A (en) Data base updating method
JP2980610B2 (en) Transaction management device
JP3575236B2 (en) Database exclusive control method and system and storage medium storing database exclusive control program
JPH09269912A (en) Information processing method and information processor
JP2607671B2 (en) Statistical information collection method of control table exclusive control in tightly coupled multiprocessor
JPH09114673A (en) Device and method for program loading
JPH05298125A (en) Recovery system for main memory data
JP2000315190A (en) Job recovery system
JPH04130949A (en) Simple method for starting system
JPH05204677A (en) Associative locking system
JPH0827752B2 (en) Resource status holding device
JP2623968B2 (en) Commit synchronization control method for journalless files
JP3608206B2 (en) Private branch exchange
JPH05143422A (en) Updated journal managing system