CN101256577B - Method for implementing trigger in built-in database - Google Patents

Method for implementing trigger in built-in database Download PDF

Info

Publication number
CN101256577B
CN101256577B CN 200810066301 CN200810066301A CN101256577B CN 101256577 B CN101256577 B CN 101256577B CN 200810066301 CN200810066301 CN 200810066301 CN 200810066301 A CN200810066301 A CN 200810066301A CN 101256577 B CN101256577 B CN 101256577B
Authority
CN
China
Prior art keywords
database
trigger
application module
notification message
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN 200810066301
Other languages
Chinese (zh)
Other versions
CN101256577A (en
Inventor
陈幼柏
Original Assignee
ZTE 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 ZTE Corp filed Critical ZTE Corp
Priority to CN 200810066301 priority Critical patent/CN101256577B/en
Publication of CN101256577A publication Critical patent/CN101256577A/en
Application granted granted Critical
Publication of CN101256577B publication Critical patent/CN101256577B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

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

Abstract

The invention discloses a trigger realization method in an embedding database, which comprises the following steps: A. registering a inform massage trigger to a database; B. sending a inform massage containing the database changing state to the application mould in case of detecting a retouching operation of the database. The invention real-timely ensures the coherence of affair data and data in the database via sending a inform massage to the application. The method of the invention can remove complex affair ruler constraint relationships in an embedding database such as index constraint, value constraint and outer key constraint etc. to ensure the data in the database is valid data which accords to affairs' claim. By utilizing the inform massage trigger, the invention real-timely ensures the coherence of affair data and data in the database, ensures a system's normal operation and improves operation efficiency of the system.

Description

A kind of implementation method of trigger in built-in database
Technical field
The present invention relates to a kind of method that realizes in the trigger in built-in database function, be specifically related to a kind of trigger implementation method with powerful notification message.
Background technology
In embedded database, diversity and particularity due to the business rule of system, this just causes the complicacy of business datum Relations Among, is difficult to come with existing constraint rule (as codomain constraint, external key, table mutual exclusion etc.) relation of this complexity of perfect representation.For the restriction relation that realizes this complexity just must realize this constraint rule at allocation window, because the isolation in allocation window and database data district must relate to the action of tabling look-up, like this will inevitably very complex, and also efficient is not high yet.
Random, concurrent to database manipulation in wireless communication system, certain upper layer application is after operating database like this, cause the data in database to change, another may be also worked remaining under original data, the consistance that keeps this data, a kind of method is the mutual notice of upper layer application, and another kind is to use regularly Query Database, the consistance of service data.Can increase so unnecessary reciprocal process a lot of between application, increase the degree of coupling of application module.
In database, trigger is the special storing process of a class, is defined in and automatically performs special business rule when his-and-hers watches or view are sent out UPDATE, INSERT or DELET statement.The function that realizes trigger in embedded database can be to the data check of recording or field has special constraint rule to require, and making the data that record in database is composite services rule " legal " data.Can in time notify related application when simultaneously a kind of trigger of notification message can the data in database has any variation, guarantee the operation of business and the consistance of data, improve system's treatment effeciency.
Summary of the invention
The object of the present invention is to provide a kind of reliable implementation method of trigger in built-in database, the trigger function in its existing database is extended, to form a kind of trigger with powerful notification message.
To achieve these goals, the present invention adopts following technical scheme:
Method of the present invention comprises following treatment step:
A, to the trigger of database registration notification message;
B, when database being detected retouching operation arranged, send the notification message that contains the database change state to described application module.
Wherein, described steps A is further comprising the steps of: the correctness of the trigger of database verification Application module registration, and after verification is passed through is inserted into the registration content of trigger in internal memory.
Wherein, described method is carried out the verification of trigger correctness by following steps:
By trigger is carried out the constraint rule inspection, and the value in the trigger registration content is carried out the legitimacy check.
Wherein, described internal memory comprises the trigger registration table.
Wherein, described step B comprises the following steps:
B1, application module are to the database operation of modifying;
B2, database judge whether the retouching operation instruction from described application module; If so, carry out B3;
B3, traversal trigger registration table judge whether to exist the trigger of the notification message of described application module registration; If so, step B4;
B4, database carry out constraint checking to the data of retouching operation;
B5, database carry out the data modification operation;
B6, execution trigger send a notification message to described application module;
B7, described application module carry out the self operation according to the content of described notification message.
Wherein, further comprising the steps of between described step B4 and step B3:
When there was the trigger of notification message of described application module registration in judgement, database sent notification message about confirming whether retouching operation continues to carry out to described application module.
Wherein, whether described application module continues to carry out to retouching operation and confirms according to the notification message that receives, if described application module stops retouching operation, sends and interrupts preventing the database operation of modifying.
Wherein, in described step B6, database to what described application module sent is: about the notification message of database update state.
Wherein, comprise in described notification message: the interior perhaps trend of data variation in database.
The present invention is by sending a notification message to application module, come the consistance of data in real-time ensuring business datum and database, use method of the present invention can realize removing the complicated business rule restriction relation such as index constraint, value constraint, foreign key constraint in embedded database, guarantee that in database, data are the legal data that meet business need; The present invention utilizes the trigger of notification message to guarantee in real time the consistance of data in business datum and database, has guaranteed the normal operation of system, has improved the operational efficiency of system.
Description of drawings
Fig. 1 is the process flow diagram of the inventive method.
Embodiment
Describe technical scheme of the present invention in detail below in conjunction with accompanying drawing.
As shown in Figure 1, the core concept of the reliable implementation method of trigger in built-in database of the present invention is: if application module (being the functional module of completing a certain business in embedded OS) needs the variation of monitor database, can have to database registration the trigger of notification message, when in case database has modification, this trigger can send the notification message record modification information to application module, and application module can keep the consistance with database at any time so.Its method mainly comprises the following steps:
Step 1, application module are to the database registration trigger.
Data in database generally have a plurality of application modules to read and write or retouching operation, the constraint rule of each application module also is not quite similar, general constraint rule function is first collected business rule by the database design personnel, then retrains according to different business realizing in function.
The registration content of the trigger of notification message comprises following information:
Application identities number: expression is the trigger which uses registration.
Table: table handle or table name or table sequence number etc.
Triggered time: before (before data change), after (after data change).
Trigger rank: record level or field level.
Trigger event: insert (insertion), update (renewal), delete (deletion) etc., when level record, three kinds of methods had, during field level generally only for update.
Field description: generally use field name.
The correctness of step 2, database detection triggers.
The condition that at first trigger of application module registration must satisfy is: meet the general constraint rules such as index constraint, value constraint, foreign key constraint.For the special rules of application module customization, realize in the mode of function, general passes through code walkthrough or goes in actual applications verification.And for the trigger of notification message, can be to wherein time, method, type these get specific value and carry out the legitimacy verification, and his-and-hers watches, index, field etc. judge relatively with data in database whether it exists, and also will prevent duplicate registration content simultaneously.After registration content is by verification, registration content is saved in internal memory.For the ease of searching, the application module registration content can be saved in corresponding data structure, such as being saved in the trigger registration table.
Step 3, application module are to the database operation of modifying, and its retouching operation comprises: the insertion of record level, deletion, renewal operation, and the renewal of field value is revised.
Step 4, judge whether the retouching operation instruction from described application module; If so, execution in step 5; If not, return to step 3.
Step 5, traversal trigger registration table judge whether to exist the trigger of the notification message of this application module registration; If so, step 6; If not, return to the trigger that step 3 continues to seek at the trigger registration table coupling, if do not find all the time the trigger of coupling, flow process is carried out the retouching operation of database routinely.
Step 6, database send the notification message that whether continues to carry out about the confirmation retouching operation to application module.
When certain retouching operation is carried out this step, can first send to application module the notification message that whether continues to carry out about the confirmation retouching operation.Whether above-mentioned application module continues to carry out to retouching operation and confirms according to the notification message that receives, if application module stops retouching operation in advance, sends and interrupts preventing the database operation of modifying, and stops carrying out following step 8.Can avoid the maloperation of database like this.
Step 7, database carry out constraint checking according to flow sequence to the data of retouching operation.
Step 8, database carry out data and carry out actual retouching operation, such as amendment record or field.
Step 9, execution trigger are to the notification message of described application module transmission about the database update state.
Receive the operational order of application module at database, and before will carrying out actual operation, at first want the special constraint rule of check data, when only having all constraint rules all to satisfy, database just can carry out actual operation, particularly about the additions and deletions operation of data, said constraint rule comprises index constraint, value constraint, foreign key constraint etc. here.When having the variation of record or field for database, when having carried out constraint checking, and check has been when having registered the trigger of notification message, operated database just effective after, also to send a notification message to application module.Singularity due to service application, the interior perhaps trend that comprises variation in the business need notification message just must be preserved " new and old data " in notification message, only preserves new record during as increase, only preserve old record during deletion, when upgrading operation, new and old record is all preserved.
Step 10, the notified message of application module are also correspondingly processed.
After using notified message, carry out the renewal of its data, can safeguard the data of other module relevant with self module simultaneously, guarantee the normal operation of system.
Step 11, application module are nullified the trigger Register as required.
If application module is not nullified trigger, repeating step 3 to 10 goes on foot.If the cancellation trigger is just disposed the related data in notification message trigger registration table.
The present invention extends the trigger function in database, realized a kind of trigger of powerful notification message, it is applied to the embedded database in a kind of wireless system, the particular service rule limits is being arranged, carry out constraint checking, guarantee " legitimacy " of data, the notice related service is used when data change, in time correctly process, guarantee the consistance of application and database internal data.
Illustrating of above-mentioned each concrete steps is comparatively concrete, can not therefore think the restriction to scope of patent protection of the present invention, and scope of patent protection of the present invention should be as the criterion with claims.

Claims (8)

1. the implementation method of a trigger in built-in database, is characterized in that, said method comprising the steps of to carry out:
A, application module pass through the mode of call function to the trigger of database registration notification message, retrain according to different business realizing in described function;
B, when described database detects database retouching operation is arranged, carry out described trigger, send the notification message that contains the database change state to described application module;
Wherein, described step B comprises the following steps:
B1, application module are to the database operation of modifying;
B2, database judge whether the retouching operation instruction from described application module; If so, carry out B3;
B3, traversal trigger registration table judge whether to exist the trigger of the notification message of described application module registration; If so, step B4;
B4, database carry out constraint checking to the data of retouching operation;
B5, database carry out the data modification operation;
B6, execution trigger send a notification message to described application module;
B7, described application module carry out the self operation according to the content of described notification message.
2. method according to claim 1, is characterized in that, described steps A is further comprising the steps of:
The correctness of the trigger of database verification Application module registration, and after verification is passed through is inserted into the registration content of trigger in internal memory.
3. method according to claim 2, is characterized in that, described method is carried out the verification of trigger correctness by following steps:
By trigger is carried out the constraint rule inspection, and the value in the trigger registration content is carried out the legitimacy check.
4. method according to claim 2, is characterized in that, described internal memory comprises described trigger registration table.
5. want 1 described method according to right, it is characterized in that, further comprising the steps of between described step B4 and step B3:
When there was the trigger of notification message of described application module registration in judgement, database sent notification message about confirming whether retouching operation continues to carry out to described application module.
6. method according to claim 5, it is characterized in that, whether described application module continues to carry out to retouching operation and confirms according to the notification message that receives, if described application module stops retouching operation, send to interrupt prevent the database operation of modifying.
7. method according to claim 1, is characterized in that, in described step B6, database to what described application module sent is: about the notification message of database update state.
8. method according to claim 7, is characterized in that, comprises in described notification message: the interior perhaps trend of data variation in database.
CN 200810066301 2008-03-18 2008-03-18 Method for implementing trigger in built-in database Expired - Fee Related CN101256577B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 200810066301 CN101256577B (en) 2008-03-18 2008-03-18 Method for implementing trigger in built-in database

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 200810066301 CN101256577B (en) 2008-03-18 2008-03-18 Method for implementing trigger in built-in database

Publications (2)

Publication Number Publication Date
CN101256577A CN101256577A (en) 2008-09-03
CN101256577B true CN101256577B (en) 2013-06-05

Family

ID=39891404

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 200810066301 Expired - Fee Related CN101256577B (en) 2008-03-18 2008-03-18 Method for implementing trigger in built-in database

Country Status (1)

Country Link
CN (1) CN101256577B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107579971A (en) * 2017-08-31 2018-01-12 上海欣方智能系统有限公司 A kind of intranet and extranet method for interchanging data based on security platform
CN112860740B (en) * 2019-11-27 2022-12-20 金篆信科有限责任公司 Method and device for realizing trigger

Also Published As

Publication number Publication date
CN101256577A (en) 2008-09-03

Similar Documents

Publication Publication Date Title
CN102810057B (en) A kind of method of log
CN102087615A (en) Automated merger of logically associated messages in a message queue
CN102542382B (en) The method of operating of business rule and device
KR100843495B1 (en) A method for sending service data to an rfid tag while an attached computer system is powered off and a computer system therefor
CN100492290C (en) Method for acquiring and converting the state of component in the time of operation during software dynamic evolvement
CN103559231B (en) A kind of file system quota management method, apparatus and system
CN103403680A (en) Contextual history of computing objects
CN101772764A (en) Multi-threaded business programming library
CN104160381A (en) Managing tenant-specific data sets in a multi-tenant environment
CN104715001A (en) Method and system performing wirite operation on shared resource in cluster of data processing system
CN101755271A (en) Method and apparatus for managing access privilege in cldc osgi environment
CN107735774A (en) A kind of SMR perceives only additional file system
CN101944119B (en) Real-time event management method for intelligent electronic equipment
WO2011147887A1 (en) Context aware data protection
CN103617167B (en) A kind of general metadata/Hibernate
CN103593257A (en) Data backup method and device
CN101256577B (en) Method for implementing trigger in built-in database
CN113595788A (en) API gateway management method and device based on plug-in
CN102236698B (en) Embeddable project data
CN108989288A (en) A kind of mobile digital literary property protection method and device based on block chain
CN101180825B (en) Identity system for use in a computing environment
CN101056210B (en) An event processing system and method of network central management platform
CN111045928B (en) Interface data testing method, device, terminal and storage medium
CN102171696B (en) The generation method and apparatus of customization data
CN103957210B (en) Smart card and its method of controlling security, device and system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CB03 Change of inventor or designer information

Inventor after: Lu Mingchang

Inventor after: Chen Youbai

Inventor before: Chen Youbai

CB03 Change of inventor or designer information
TR01 Transfer of patent right

Effective date of registration: 20170825

Address after: 201100, Shanghai, Hongqiao Town, Minhang District Road, Lane 335, No. 32, Hongqiao Fu Fu, 2 floor, block D

Patentee after: Lu Mingchang

Address before: 518057 Nanshan District Guangdong high tech Industrial Park, South Road, science and technology, ZTE building, Ministry of Justice

Patentee before: ZTE Corporation

TR01 Transfer of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20130605

Termination date: 20180318

CF01 Termination of patent right due to non-payment of annual fee