CN116401230A - Method, system, equipment and storage medium for changing relational database - Google Patents
Method, system, equipment and storage medium for changing relational database Download PDFInfo
- Publication number
- CN116401230A CN116401230A CN202310188031.3A CN202310188031A CN116401230A CN 116401230 A CN116401230 A CN 116401230A CN 202310188031 A CN202310188031 A CN 202310188031A CN 116401230 A CN116401230 A CN 116401230A
- Authority
- CN
- China
- Prior art keywords
- change
- database
- statement
- grammar
- work order
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 41
- 230000008859 change Effects 0.000 claims abstract description 366
- 238000012508 change request Methods 0.000 claims abstract description 12
- 230000015654 memory Effects 0.000 claims description 12
- 238000012986 modification Methods 0.000 claims description 7
- 230000004048 modification Effects 0.000 claims description 7
- 230000009286 beneficial effect Effects 0.000 abstract description 2
- 238000012795 verification Methods 0.000 abstract 1
- 238000012550 audit Methods 0.000 description 9
- 238000010586 diagram Methods 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 239000003607 modifier Substances 0.000 description 3
- 230000008569 process Effects 0.000 description 3
- 230000004044 response Effects 0.000 description 3
- 230000005856 abnormality Effects 0.000 description 2
- 238000003491 array Methods 0.000 description 2
- 239000000463 material Substances 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000002159 abnormal effect Effects 0.000 description 1
- 238000004458 analytical method Methods 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 230000001419 dependent effect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000007689 inspection Methods 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/21—Design, administration or maintenance of databases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/28—Databases characterised by their database models, e.g. relational or object models
- G06F16/284—Relational databases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/253—Grammatical analysis; Style critique
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/30—Computing systems specially adapted for manufacturing
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Computational Linguistics (AREA)
- General Health & Medical Sciences (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention relates to a method, a system, equipment and a storage medium for changing a relational database, belonging to the technical field of computers. The invention comprises the following steps: responding to a database change request, and acquiring a database change work order; the database change worksheet comprises change sentences and worksheet information, and the worksheet information comprises a database to be changed and a change type; and carrying out grammar judgment on the change statement according to the configured grammar specification of the database, determining whether the change statement accords with the specification, and if the change statement accords with the specification, executing change operation on the database to be changed according to the change statement. The method and the device are beneficial to solving the problems of long time consumption and low accuracy caused by the fact that the change of the relational database in the prior art needs manual verification and judgment and manual execution.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, a system, an apparatus, and a storage medium for changing a relational database.
Background
As an enterprise grows larger, databases become more and more, resulting in more and more frequent database changes.
In the traditional mode, database change of a plurality of enterprises describes change requirements through SQL change sentences, submits database change worksheets through mails, and after the database change worksheets are checked by layer-by-layer mails, database management staff judges and checks the SQL change sentences in the database change worksheets manually, and logs in the database after the database change worksheets pass the checking, and the database change is manually executed. This traditional mode is very loaded down with trivial details, and consuming time is longer, and judges the audit through the manual work, and the rate of accuracy is lower.
In addition, if the database after the change is to be restored to the state before the change, the database manager needs to manually acquire the execution time of the database change work order and SQL change sentences, enter the database server to perform binlog log analysis, and re-execute the data before the execution of the binlog log record so as to achieve the purpose of rollback and restore to the state before the change. In the traditional mode, rollback operation is complicated, the safety coefficient is low, various database types are not combined, and a mobile terminal is not provided.
Disclosure of Invention
Accordingly, the present invention is directed to a method, a system, a device, and a storage medium for changing a relational database, so as to solve the problems of long time consumption and low accuracy caused by the need of manual checking and judging and manual execution of the change of the relational database in the prior art.
According to a first aspect of an embodiment of the present invention, there is provided a method for changing a relational database, including:
responding to a database change request, and acquiring a database change work order; the database change worksheet comprises change sentences and worksheet information, and the worksheet information comprises a database to be changed and a change type;
and carrying out grammar judgment on the change statement according to the configured grammar specification of the database, determining whether the change statement accords with the specification, and if the change statement accords with the specification, executing change operation on the database to be changed according to the change statement.
Preferably, the determining the grammar of the change sentence according to the configured grammar specification of the database includes:
analyzing the change statement and determining the type of the database to be changed;
determining corresponding database grammar specifications according to the types of the databases to be changed, wherein one database type corresponds to one database grammar specification;
and carrying out grammar judgment on the change statement according to the corresponding database grammar specification, and determining that the change statement accords with the specification if the change statement accords with the corresponding database grammar specification.
Preferably, the executing the changing operation on the database to be changed according to the changing statement includes:
according to the change type in the change worksheet, acquiring corresponding change permission;
according to the corresponding change permission, automatically logging in the database to be changed;
analyzing the change statement to determine a change command;
and changing the database to be changed according to the change command.
Preferably, if the change statement meets the specification, before executing the change operation on the database to be changed according to the change statement, the method further includes:
obtaining auditing personnel information in the work order information, and sending an auditing request to the auditing personnel;
and receiving an auditing result of the auditing personnel, and executing changing operation on the database to be changed according to the changing statement if the auditing result is passed.
Preferably, the method further includes:
returning the execution result of the change operation to be successful or failed, and if the execution result of the change operation is successful, changing the state of the database change work order to be successful, so as to obtain a changed database;
and if the execution result of the change operation is failure, changing the state of the database change work order into the execution failure, and obtaining the database before the change operation is executed.
Preferably, the method further comprises:
and if the state of the database change work order is successful in execution, triggering rollback operation and generating a rollback work order according to a user request, so that the changed database returns to the state before the execution of the change operation. .
According to a second aspect of an embodiment of the present invention, there is provided a modification system of a relational database, including:
the change work order acquisition module is used for responding to the database change request and acquiring a database change work order; the database change worksheet comprises change sentences and worksheet information, and the worksheet information comprises a database to be changed and a change type;
and the change work order execution module is used for carrying out grammar judgment on the change statement according to the configured grammar specification of the database, determining whether the change statement accords with the specification, and executing change operation on the database to be changed according to the change statement if the change statement accords with the specification.
Preferably, when the grammar of the change statement is judged according to the configured grammar specification of the database, the change work order execution module is further used for analyzing the change statement to determine the type of the database to be changed;
determining corresponding database grammar specifications according to the types of the databases to be changed, wherein one database type corresponds to one database grammar specification;
and carrying out grammar judgment on the change statement according to the corresponding database grammar specification, and judging that the change statement meets the specification if the change statement meets the corresponding database grammar specification.
According to a third aspect of the embodiment of the present invention, there is provided a change apparatus of a relational database, including:
a memory having an executable program stored thereon;
a processor for executing the executable program in the memory to perform the steps of the method of any one of the above.
According to a fourth aspect of embodiments of the present invention, there is provided a computer readable storage medium storing computer instructions for causing a computer to perform the steps of any one of the methods described above.
The technical scheme provided by the embodiment of the invention can comprise the following beneficial effects:
the method comprises the steps of responding to a database change request of a user to obtain a database change work order, wherein the database change work order comprises change sentences and work order information, the work order information comprises a database to be changed and change types, grammar judgment is carried out on the change sentences according to configured database grammar specifications, whether the change sentences accord with the specifications is determined, automatic grammar judgment on the change sentences is realized, manual judgment is not needed, and judgment efficiency and accuracy can be improved; and if the change statement accords with the specification, the change operation is executed on the database to be changed according to the change statement, the change of the database is automatically realized, manual operation is not needed, and the change efficiency is improved, so that the problems of long time consumption and low accuracy caused by the fact that the change of the relational database in the prior art needs manual checking and judging and manual execution are effectively solved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention as claimed.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
FIG. 1 is a flow diagram illustrating a method of altering a relational database, according to an example embodiment;
FIG. 2 is a block diagram illustrating a change system for a relational database, according to an example embodiment.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the invention. Rather, they are merely examples of apparatus and methods consistent with aspects of the invention as detailed in the accompanying claims.
At present, in an express company, a relational database is modified by filling in a database change work order by an applicant, manually submitting the database change work order, transmitting the database change work order to related auditors through a company internal system or a mailbox, transmitting the database change work order to a database manager after the auditors audit, logging in a database to be changed by the database manager (DBA) by using corresponding login rights, and executing change operation according to change sentences in the database change work order. The database change worksheets are manually checked and the change operation is carried out on the database to be changed, so that time and labor are wasted, and the checking is dependent on manual work, so that the checking accuracy is affected. If the database change work order is found to be wrong after the database change work order is executed, the database is required to be rolled back to the data state before the change operation is executed, and the mode of manually checking the database change work order and executing the change operation is complicated, and the safety coefficient is low.
The invention provides a method for changing a relational database, referring to fig. 1, fig. 1 is a flow chart of a method for changing a relational database according to an exemplary embodiment, and the method comprises the following steps:
step S11, responding to a database change request, and acquiring a database change work order; the database change worksheet comprises change sentences and worksheet information, and the worksheet information comprises a database to be changed and a change type;
and step S12, carrying out grammar judgment on the change statement according to the configured grammar specification of the database, determining whether the change statement accords with the specification, and if so, executing change operation on the database to be changed according to the change statement.
Specifically, in response to a change request of a developer or related personnel to a relational database, a database change work order created by the developer or related personnel is obtained and used for changing a database to be changed. The database change work order comprises change sentences and work order information, wherein the change sentences are SQL language description of change operation, and the work order information is basic information of the database change work order. The work order information comprises a database to be changed and a change type.
It should be noted that the databases in the invention are relational databases, the relational databases are MySQL and Oracle databases, and the SQL language descriptions of different databases are different. According to the change permission, the change types are divided into data change and table structure change, and the specific account number and the password are used for logging in to obtain the change permission of the corresponding change types so as to execute the corresponding change.
In one example, the database alters the work order information in the work order, including the following: applicant (personnel creating a database change work order), auditor (product manager and development manager who performs inspection on the database change work order) information, application time (establishment time of the database change work order), audit time (time of audit on the database change work order by the auditor), execution time (time of starting execution of change operation on a database to be changed in the database change work order), state (execution state of the database change work order, which may be execution success, execution failure, execution, waiting for DBA execution, to be checked or submitted), work order name (name of the database change work order), change type (data change or form structure change), and the like.
Specifically, according to different types of databases, corresponding database grammar specifications are configured, the configured database grammar specifications are called, and grammar judgment is carried out on change sentences in a database change work order. If the change statement accords with the configured grammar specification of the database, determining that the change statement accords with the specification, triggering the automatic execution program to enter the database to be changed, and executing the change operation on the database to be changed according to the change statement; if the change statement does not accord with the configured grammar specification of the database, determining that the change statement does not accord with the specification, wherein the database change work order cannot be executed, triggering a return program, stopping the execution of the database change work order, and sending an exception notification to the applicant.
It can be understood that, according to the technical scheme provided by the embodiment, the database change work order is obtained by responding to the database change request of the user, wherein the database change work order comprises change sentences and work order information, the work order information comprises a database to be changed and change types, grammar judgment is performed on the change sentences according to the configured grammar specification of the database, whether the change sentences conform to the specification is determined, automatic grammar judgment is performed on the change sentences, manual judgment is not needed, and judgment efficiency and accuracy can be improved; and if the change statement accords with the specification, the change operation is executed on the database to be changed according to the change statement, the change of the database is automatically realized, manual operation is not needed, and the change efficiency is improved, so that the problems of long time consumption and low accuracy caused by the fact that the change of the relational database in the prior art needs manual checking and judging and manual execution are effectively solved.
Preferably, in step S12, the determining, according to the configured database grammar specification, the grammar of the change sentence includes:
analyzing the change statement and determining the type of the database to be changed;
determining corresponding database grammar specifications according to the types of the databases to be changed, wherein one database type corresponds to one database grammar specification;
and carrying out grammar judgment on the change statement according to the corresponding database grammar specification, and determining that the change statement accords with the specification if the change statement accords with the corresponding database grammar specification.
It should be noted that, in different types of databases, the SQL language description of the change statement and the grammar specification of the database are also different. For example, the database grammar specification corresponding to the change sentence of the MySQL database is the MySQL database grammar specification, and the database grammar specification corresponding to the change sentence of the Oracle database is the Oracle database grammar specification.
As shown in the following table 1MySQL database grammar specification, for the change statement of the MySQL database, the corresponding SQL language description is configured to the corresponding MySQL database grammar specification, as shown in the following table 2Oracle database grammar specification, for the change statement of the Oracle database, the corresponding SQL language description is configured to the corresponding Oracle database grammar specification.
Table 1mysql database grammar specification
Table 2Oracle database syntax Specification
Specifically, analyzing a change statement in a database change work order, wherein the SQL language of the change statement is described as MySQL or Oracle, and if the SQL language of the change statement is described as MySQL, determining that the type of the database to be changed is a MySQL database; because the MySQL database grammar specification is configured in advance in the database, grammar judgment is carried out on the change statement according to the configured MySQL database grammar specification, if the change statement accords with the MySQL database grammar specification, the change statement is judged to accord with the specification, and the subsequent steps can be carried out; if the change statement does not accord with the grammar specification of the MySQL database, judging that the change statement does not accord with the specification, and cannot carry out subsequent steps, stopping the execution of the database change work order, displaying abnormality, and feeding back to the personnel creating the database change work order.
If the SQL language description of the change statement is Oracle, determining the type of the database to be changed as an Oracle database; because the Oracle database grammar specification is also configured in advance in the database, grammar judgment is carried out on the change statement according to the configured Oracle database grammar specification, if the change statement accords with the Oracle database grammar specification, the change statement is judged to accord with the specification, and the subsequent step can be carried out; if the change statement does not accord with the grammar specification of the Oracle database, judging that the change statement does not accord with the specification, and cannot carry out subsequent steps, stopping the execution of the database change work order, displaying abnormality, and feeding back to the personnel creating the database change work order.
When the database change work order is displayed abnormally and the execution condition of the change work order is fed back to the person who creates the database change work order, the feedback mode is not particularly limited in the invention.
In one example, if the change statement is "CREATE TABLE' zto _table
The main key 'is added automatically by' id 'big (20) unsigned NOT NULL AUTO _ INCREMENT COMMENT',
' var_exam ' var (15) NOT NULL DEFAULT ' COMMENT ' character ',
the 'big_exam' big (20) NOT NULL DEFAULT '0' COMMENT 'big type',
the 'int_exam' int (11) NOT NULL DEFAULT '0' component 'int type',
the 'dec_exam' decximal (10, 2) NOT NULL DEFAULT '0.00' COMMENT 'decximal type',
type_exam 'tinyint (4) NOT NULL DEFAULT'0 'component' type, such as: if 1 is, 0 is no, default no',
the 'gmt _create' timestamp NOT NULL DEFAULT CURRENT _time_account 'creation time',
the "gmt modified" timestamp NOT NULL DEFAULTCURRENT _ TIMESTAMP ON UPDATE CURRENT _ TIMESTAMP COMMENT 'modification time',
the 'creator' distributor (15) NOT NULL DEFAULT "COMMENT 'creator',
the modifier ' modifier (15) NOT NULL DEFAULT "COMMENT ' modifier ',
version ' int (11) NOT NULL DEFAULT '0' COMMENT ' data version number ',
PRIMARY KEY(`id`),
UNIQUE KEY`uk_int_exam`(`int_exam`),
KEY`idx_dec_exam`(`dec_exam`)
)ENGINE=InnoDB COMMENT”。
the database to be changed of the database change work order in the example is determined to be a MySQL database, SQL is described as creating a new table (Create table), the type of the database to be changed is the MySQL database, grammar judgment is carried out according to the MySQL database grammar specification corresponding to the sequence number 1 in the table 1, the judgment change statement comprises an auto-increment main key ' id ' of a new build table ' zto _table ', the field type is ' big (20) ", all fields are annotated, the creation time field and the modification time field are included, and the judgment change statement accords with the MySQL database grammar specification, namely accords with the specification, and the follow-up steps can be carried out.
It can be appreciated that, according to the technical scheme provided by the embodiment, the type of the database to be changed is determined by analyzing the change statement, then the corresponding database grammar specification is determined according to the type of the database to be changed, grammar judgment is performed on the change statement according to the corresponding database grammar specification, if the change statement accords with the corresponding database grammar specification, the change statement is determined to accord with the specification, automatic grammar judgment is performed on the change statement, no manual judgment is needed, and the judgment efficiency and accuracy can be improved, so that the problems of long time consumption and low accuracy caused by manual checking judgment required for changing the relational database in the prior art are effectively solved.
Preferably, in the step S12, the executing a change operation on the database to be changed according to the change statement includes:
acquiring corresponding change permission according to the change type in the change work order;
according to the corresponding change permission, automatically logging in the database to be changed;
analyzing the change statement to determine a change command;
and changing the database to be changed according to the change command.
When the database is changed, the change type is different, and the required change authority is also different. Changes to the database may be categorized into table changes in the database and data changes in the database tables.
Specifically, the change worksheet includes a change type, and the corresponding change authority is determined according to the change type in the change worksheet as a table change or a data change. If the change type is table change, corresponding table change permission (specific account number and password) is acquired from the database, the database to be changed is automatically registered according to the table change permission, a change statement is analyzed, a table change command is obtained, and a change operation is executed on the table in the database to be changed according to the table change command. If the change type is data change, acquiring corresponding data change authority (specific account number and password) from the database, automatically logging in the database to be changed according to the data change authority, analyzing the change statement to obtain a data change command, and executing change operation on the data in the database to be changed according to the data change command.
Preferably, in step S12, if the change statement meets the specification, before executing the change operation on the database to be changed according to the change statement, the method further includes:
obtaining auditing personnel information in the work order information, and sending an auditing request to the auditing personnel;
and receiving an auditing result of the auditing personnel, and executing changing operation on the database to be changed according to the changing statement if the auditing result is passed.
In practical situations, if the change statement is judged to be in accordance with the specification, the related auditor is required to audit the database change worksheet before the change operation is executed, so as to ensure that the change of the database is necessary and in accordance with the related system.
Specifically, the information of the auditor of the database change work order is configured in the work order information, and after the change statement is judged to accord with the specification according to the information of the auditor selected when the database change work order is created, an audit request is sent to the auditor, so that the auditor can receive the audit request in time. And after the auditing personnel audit, receiving the auditing result fed back by the auditing personnel. The auditing personnel can be one or more, and can send auditing requests to the auditing personnel for auditing by the auditing personnel at the same time, and can also send auditing requests to the auditing personnel in sequence according to the configured sequence for auditing by the auditing personnel.
If all auditing results of the auditing personnel pass, the auditing results of the database changing worksheet pass, and the changing operation is executed on the database to be changed according to the changing statement. If the auditing result of any one auditing person is not passed, the auditing result of the database changing work order is not passed, the execution of the database changing work order is stopped, and an abnormal prompt is sent to the applicant.
It can be understood that each step is sequentially executed in the grammar judgment and auditing process of the database change work order, so that auditing personnel can be automatically reminded to audit the database change work order, and communication cost and flow timeliness are saved.
Preferably, in step S12, the method further includes:
returning the execution result of the change operation to be successful or failed, and if the execution result of the change operation is successful, changing the state of the database change work order to be successful, so as to obtain a changed database;
and if the execution result of the change operation is failure, changing the state of the database change work order into the execution failure, and obtaining the database before the change operation is executed.
Specifically, after the change operation is executed or the execution is stopped for each database change work order, the execution result of the change operation is returned, and if the returned execution result of the change operation is successful, the state of the database change work order is changed to be successfully executed, so that the changed database is obtained. If the execution result of the change operation is failure, changing the state of the database change work order to the execution failure, obtaining a database before executing the change operation,
it should be noted that, the above-mentioned different relational databases and the changing operations are all packaged into a system, the same database changing worksheet is just a state change, and the auditing personnel and the applicant can realize the tracing and backup of the database change as long as the mobile phone can link with a specific website, so that the system is safe and reliable, and the mobile office of the related applicant and the auditing personnel is realized.
Preferably, the method further comprises:
and if the state of the database change work order is successful in execution, triggering rollback operation and generating a rollback work order according to a user request, so that the changed database returns to the state before the execution of the change operation.
Specifically, since the database change work order includes the modification time and the creation time, if the state of the database change work order is successful in execution, the rollback operation is triggered and the rollback work order is generated according to the user request, and the rollback work order is used as the current database change work order to enable the current database formed by the database after the previous change to return to the state before the execution of the change operation according to the modification time and the creation time, thereby realizing tracing and backup, and conveniently, quickly, safely and effectively performing data maintenance.
It can be understood that, according to the technical scheme provided by the embodiment, the database change work order is obtained by responding to the database change request of the user, wherein the database change work order comprises change sentences and work order information, the work order information comprises a database to be changed and change types, grammar judgment is performed on the change sentences according to the configured grammar specification of the database, whether the change sentences conform to the specification is determined, automatic grammar judgment is performed on the change sentences, manual judgment is not needed, and judgment efficiency and accuracy can be improved; and if the change statement accords with the specification, the change operation is executed on the database to be changed according to the change statement, the change of the database is automatically realized, manual operation is not needed, and the change efficiency is improved, so that the problems of long time consumption and low accuracy caused by the fact that the change of the relational database in the prior art needs manual checking and judging and manual execution are effectively solved.
Referring to FIG. 2, FIG. 2 is a block diagram illustrating a change system for a relational database, according to one illustrative embodiment, comprising:
a change work order acquisition module 21, configured to acquire a database change work order in response to a database change request; the database change worksheet comprises change sentences and worksheet information, and the worksheet information comprises a database to be changed and a change type;
and the change work order execution module 22 is configured to perform grammar judgment on the change statement according to the configured database grammar specification, determine whether the change statement meets the specification, and if the change statement meets the specification, execute a change operation on the database to be changed according to the change statement.
Preferably, when the grammar of the change statement is determined according to the configured grammar specification of the database, the change work order execution module 22 is further configured to parse the change statement to determine the type of the database to be changed;
determining corresponding database grammar specifications according to the types of the databases to be changed, wherein one database type corresponds to one database grammar specification;
and carrying out grammar judgment on the change statement according to the corresponding database grammar specification, and judging that the change statement meets the specification if the change statement meets the corresponding database grammar specification.
It can be understood that, in the technical solution provided in this embodiment, since the database change work order is obtained in response to the database change request of the user mentioned in the foregoing embodiment, where the database change work order includes a change statement and work order information, and the work order information includes a database to be changed and a change type, according to the configured grammar specification of the database, the grammar judgment is performed on the change statement, and whether the change statement meets the specification is determined, so that automatic grammar judgment is performed on the change statement, without manual judgment, and the judgment efficiency and accuracy can be improved; and if the change statement accords with the specification, the change operation is executed on the database to be changed according to the change statement, the change of the database is automatically realized, manual operation is not needed, and the change efficiency is improved, so that the problems of long time consumption and low accuracy caused by the fact that the change of the relational database in the prior art needs manual checking and judging and manual execution are effectively solved.
The invention also provides a change device of the relational database, which comprises:
a memory having an executable program stored thereon;
a processor for executing the executable program in the memory to implement the steps of any of the methods described above.
Furthermore, the present invention provides a computer readable storage medium storing computer instructions for causing a computer to perform the steps of any one of the methods described above. Wherein the storage medium may be a magnetic Disk, an optical Disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a Flash Memory (Flash Memory), a Hard Disk (HDD), or a Solid State Drive (SSD); the storage medium may also comprise a combination of memories of the kind described above.
It is to be understood that the same or similar parts in the above embodiments may be referred to each other, and that in some embodiments, the same or similar parts in other embodiments may be referred to.
It should be noted that in the description of the present invention, the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. Furthermore, in the description of the present invention, unless otherwise indicated, the meaning of "plurality" means at least two.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and further implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present invention.
It is to be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above-described embodiments, the various steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, may be implemented using any one or combination of the following techniques, as is well known in the art: discrete logic circuits having logic gates for implementing logic functions on data signals, application specific integrated circuits having suitable combinational logic gates, programmable Gate Arrays (PGAs), field Programmable Gate Arrays (FPGAs), and the like.
Those of ordinary skill in the art will appreciate that all or a portion of the steps carried out in the method of the above-described embodiments may be implemented by a program to instruct related hardware, where the program may be stored in a computer readable storage medium, and where the program, when executed, includes one or a combination of the steps of the method embodiments.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing module, or each unit may exist alone physically, or two or more units may be integrated in one module. The integrated modules may be implemented in hardware or in software functional modules. The integrated modules may also be stored in a computer readable storage medium if implemented in the form of software functional modules and sold or used as a stand-alone product.
The above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, or the like.
In the description of the present specification, a description referring to terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiments or examples. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
While embodiments of the present invention have been shown and described above, it will be understood that the above embodiments are illustrative and not to be construed as limiting the invention, and that variations, modifications, alternatives and variations may be made to the above embodiments by one of ordinary skill in the art within the scope of the invention.
Claims (10)
1. A method for changing a relational database, comprising:
responding to a database change request, and acquiring a database change work order; the database change worksheet comprises change sentences and worksheet information, and the worksheet information comprises a database to be changed and a change type;
and carrying out grammar judgment on the change statement according to the configured grammar specification of the database, determining whether the change statement accords with the specification, and if the change statement accords with the specification, executing change operation on the database to be changed according to the change statement.
2. The method according to claim 1, wherein the performing the grammar determination on the change sentence according to the configured database grammar specification includes:
analyzing the change statement and determining the type of the database to be changed;
determining corresponding database grammar specifications according to the types of the databases to be changed, wherein one database type corresponds to one database grammar specification;
and carrying out grammar judgment on the change statement according to the corresponding database grammar specification, and determining that the change statement accords with the specification if the change statement accords with the corresponding database grammar specification.
3. The method according to claim 2, wherein said performing a change operation on said database to be changed according to said change statement comprises:
acquiring corresponding change permission according to the change type in the change work order;
according to the corresponding change permission, automatically logging in the database to be changed;
analyzing the change statement to determine a change command;
and changing the database to be changed according to the change command.
4. The method according to claim 1, wherein if the change statement meets a specification, before performing a change operation on the database to be changed according to the change statement, further comprising:
obtaining auditing personnel information in the work order information, and sending an auditing request to the auditing personnel;
and receiving an auditing result of the auditing personnel, and executing changing operation on the database to be changed according to the changing statement if the auditing result is passed.
5. The method of claim 1, wherein the performing a change operation on the database to be changed, after which the method further comprises:
returning the execution result of the change operation to be successful or failed, and if the execution result of the change operation is successful, changing the state of the database change work order to be successful, so as to obtain a changed database;
and if the execution result of the change operation is failure, changing the state of the database change work order into the execution failure, and obtaining the database before the change operation is executed.
6. The method of claim 5, wherein the method further comprises:
and if the state of the database change work order is successful in execution, triggering rollback operation and generating a rollback work order according to a user request, so that the changed database returns to the state before the execution of the change operation.
7. A system for altering a relational database, the system comprising:
the change work order acquisition module is used for responding to the database change request and acquiring a database change work order; the database change worksheet comprises change sentences and worksheet information, and the worksheet information comprises a database to be changed and a change type;
and the change work order execution module is used for carrying out grammar judgment on the change statement according to the configured grammar specification of the database, determining whether the change statement accords with the specification, and executing change operation on the database to be changed according to the change statement if the change statement accords with the specification.
8. The system according to claim 7, wherein when the change statement is determined according to the configured database grammar specification, the change work order execution module is further configured to parse the change statement to determine a type of the database to be changed;
determining corresponding database grammar specifications according to the types of the databases to be changed, wherein one database type corresponds to one database grammar specification;
and carrying out grammar judgment on the change statement according to the corresponding database grammar specification, and judging that the change statement meets the specification if the change statement meets the corresponding database grammar specification.
9. A relational database modification apparatus comprising:
a memory having an executable program stored thereon;
a processor for executing said executable program in said memory to implement the steps of the method of any one of claims 1 to 6.
10. A computer readable storage medium having stored thereon computer instructions for causing a computer to perform the steps of the method according to any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310188031.3A CN116401230A (en) | 2023-03-01 | 2023-03-01 | Method, system, equipment and storage medium for changing relational database |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310188031.3A CN116401230A (en) | 2023-03-01 | 2023-03-01 | Method, system, equipment and storage medium for changing relational database |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116401230A true CN116401230A (en) | 2023-07-07 |
Family
ID=87016862
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310188031.3A Pending CN116401230A (en) | 2023-03-01 | 2023-03-01 | Method, system, equipment and storage medium for changing relational database |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116401230A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117348916A (en) * | 2023-12-06 | 2024-01-05 | 中邮消费金融有限公司 | Script generation method, device, equipment and storage medium |
-
2023
- 2023-03-01 CN CN202310188031.3A patent/CN116401230A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117348916A (en) * | 2023-12-06 | 2024-01-05 | 中邮消费金融有限公司 | Script generation method, device, equipment and storage medium |
CN117348916B (en) * | 2023-12-06 | 2024-03-26 | 中邮消费金融有限公司 | Script generation method, device, equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7953744B2 (en) | Database change verifier | |
US9274936B2 (en) | Database code testing framework | |
CN112395325A (en) | Data management method, system, terminal equipment and storage medium | |
US20150169431A1 (en) | Process for displaying test coverage data during code reviews | |
US20100058114A1 (en) | Systems and methods for automated management of compliance of a target asset to predetermined requirements | |
CN106575227B (en) | Automatic software update framework | |
KR101579493B1 (en) | Staging control method for source code, Computer program for the same, Recording medium storing computer program for the same | |
WO2019000963A1 (en) | Pre-inspection method for service system, server, and computer readable storage medium | |
CN111767340A (en) | Data processing method, device, electronic equipment and medium | |
CN109284331B (en) | Certificate making information acquisition method based on service data resources, terminal equipment and medium | |
CN116401230A (en) | Method, system, equipment and storage medium for changing relational database | |
CN111045935B (en) | Automatic version auditing method, device, equipment and storage medium | |
CN110063042A (en) | A kind of response method and its terminal of database failure | |
CN111367982A (en) | Method and device for importing TRIRIGA basic data, computer equipment and storage medium | |
CN112015715A (en) | Industrial Internet data management service testing method and system | |
CN110716922A (en) | Incep-based database operation and maintenance method and device, computer equipment and storage medium | |
US11740995B2 (en) | Source quality check service | |
CN110807037B (en) | Data modification method and device, electronic equipment and storage medium | |
US10963331B2 (en) | Collecting repeated diagnostics data from across users participating in a document collaboration session | |
CN110362464B (en) | Software analysis method and equipment | |
EP3208758A1 (en) | Systems and methods for electronic mail communication based data management | |
CN115576959B (en) | Real-time quality inspection method and device, electronic equipment and storage medium | |
US11693765B2 (en) | Unified regression platform for regression testing | |
CN112950138B (en) | Collaborative development state management method, device and server | |
CN116662297A (en) | One-stop database work order management method and platform |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |