CN117033480A - Database writing method and device, electronic equipment and storage medium - Google Patents

Database writing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN117033480A
CN117033480A CN202310995146.3A CN202310995146A CN117033480A CN 117033480 A CN117033480 A CN 117033480A CN 202310995146 A CN202310995146 A CN 202310995146A CN 117033480 A CN117033480 A CN 117033480A
Authority
CN
China
Prior art keywords
database
writing
data
logic
statement
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310995146.3A
Other languages
Chinese (zh)
Inventor
吴艳兵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Bank Co Ltd
Original Assignee
Ping An Bank Co Ltd
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 Ping An Bank Co Ltd filed Critical Ping An Bank Co Ltd
Priority to CN202310995146.3A priority Critical patent/CN117033480A/en
Publication of CN117033480A publication Critical patent/CN117033480A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/215Improving data quality; Data cleansing, e.g. de-duplication, removing invalid entries or correcting typographical errors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • YGENERAL 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
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application provides a database writing method, a device, electronic equipment and a storage medium, wherein the method comprises the following steps: in response to a logic add operation, cutting into first write logic of a first database in target item source code; responsive to a database write operation, writing the target item source code to a second database based on second write logic in the target item source code, and writing the target item source code to a first database based on the first write logic; wherein the first database is different from the second database. According to the application, double writing of the target project code is realized by the tangent plane method under the condition of not changing the original service code, so that the research and development efficiency is improved, and the stability of the original service logic is ensured.

Description

Database writing method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of database technologies, and in particular, to a method, an apparatus, an electronic device, and a storage medium for writing in a database.
Background
During the software development process, the operation of the database is also a very important part of the code-free process. In particular to financial software, due to the characteristics of high frequency, high timeliness and the like of financial products, the operation requirement on a database is more strict in the development process of software products.
Because of the adjustment and security requirements of the software architecture, the replacement and upgrade of the bottom database is a significant change for the service system, in order to ensure the stability and the data security of the service system, in the initial stage of the replacement and upgrade of the bottom database, two sets of databases before and after the replacement and upgrade are generally deployed in the environment at the same time, and in the service code, the service code logic is modified, and the two databases are written in at the same time, so that the stability and the data security of the system are ensured, but the following problems exist in this way:
and the database operation logic is repeated in the service logic code, and the database double-write logic is added, so that the current service logic is easily influenced, and the normal service is influenced.
When a problem occurs, code rollback is cumbersome, requiring multiple modifications to rollback.
Disclosure of Invention
Accordingly, an objective of the present application is to provide a method, an apparatus, an electronic device and a storage medium for writing a database, so as to overcome the problems in the prior art.
In a first aspect, an embodiment of the present application provides a method for writing in a database, where the method includes:
in response to a logic add operation, cutting into first write logic of a first database in target item source code;
responsive to a database write operation, writing the target item source code to a second database based on second write logic in the target item source code, and writing the target item source code to a first database based on the first write logic; wherein the first database is different from the second database.
In some embodiments of the present application, the method further includes:
verifying the first data written in the first database and the second data written in the second database;
and if the first data or the second data are abnormal, rollback is carried out on the written data of the first database and the second database.
In some aspects of the present application, before responding to the database write operation, the method further includes:
acquiring a database processing statement in the target item source code;
the rollback of the write data of the first database and the second database includes:
and using rollback sentences corresponding to the types of the database processing sentences to rollback the written data of the first database and the second database.
In some embodiments of the present application, the types of the database processing statement include a first type, a second type, a third type, and a fourth type, and the rollback statement includes a first statement, a second statement, a third statement, and a fourth statement; the method rolls back the write data of the first database and the second database by:
for a first type of the database processing statement, rollback is performed on the written data of the first database and the second database by using the first statement;
for a second type of the database processing statement, rollback is performed on the written data of the first database and the second database by using the second statement;
for a third type of the database processing statement, rollback is performed on the write data of the first database and the second database by using the third statement;
and for a fourth type of the database processing statement, using the fourth statement to rollback the written data of the first database and the second database.
In some embodiments of the present application, the responding to the logic adding operation cuts into the first writing logic of the first database in the source code of the target item includes:
and responding to the file adding operation, and adding the section file for realizing the first writing logic in the target item source code.
In some embodiments of the present application, the section file includes a first annotation identifier, and the method implements a first writing logic by:
in response to the annotation operation, a write operation to the first database is configured after the first annotation identification.
In some embodiments of the present application, the section file includes a second annotation identifier and a third annotation identifier, and the method further includes:
responding to annotation operation, and configuring extraction operation of database processing sentences in the source codes of the target items after the second annotation identification;
in response to an annotation operation, a validation operation is configured for the first data written in the first database and the second data written in the second database after the third annotation identification.
In a second aspect, an embodiment of the present application provides a database writing apparatus, where the apparatus includes:
the first response module is used for responding to the logic adding operation and cutting in first writing logic of the first database in the target item source code;
the second response module is used for responding to database writing operation, writing the target item source code into a second database based on second writing logic in the target item source code, and writing the target item source code into a first database based on the first writing logic; wherein the first database is different from the second database.
In a third aspect, an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor, where the steps of the method for writing in a database are implemented when the processor executes the computer program.
In a fourth aspect, embodiments of the present application provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method of database writing described above.
The technical scheme provided by the embodiment of the application can comprise the following beneficial effects:
the method comprises the steps of responding to a logic adding operation, cutting into first writing logic of a first database in target item source codes; responsive to a database write operation, writing the target item source code to a second database based on second write logic in the target item source code, and writing the target item source code to a first database based on the first write logic; wherein the first database is different from the second database. According to the application, double writing of the target project code is realized by the tangent plane method under the condition of not changing the original service code, so that the research and development efficiency is improved, and the stability of the original service logic is ensured.
In order to make the above objects, features and advantages of the present application more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method for writing a database according to an embodiment of the present application;
FIG. 2 shows a schematic diagram of one embodiment of the present application;
FIG. 3 is a schematic diagram of an apparatus for writing a database according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described with reference to the accompanying drawings in the embodiments of the present application, and it should be understood that the drawings in the present application are for the purpose of illustration and description only and are not intended to limit the scope of the present application. In addition, it should be understood that the schematic drawings are not drawn to scale. A flowchart, as used in this disclosure, illustrates operations implemented according to some embodiments of the present application. It should be understood that the operations of the flow diagrams may be implemented out of order and that steps without logical context may be performed in reverse order or concurrently. Moreover, one or more other operations may be added to or removed from the flow diagrams by those skilled in the art under the direction of the present disclosure.
In addition, the described embodiments are only some, but not all, embodiments of the application. The components of the embodiments of the present application generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the application, as presented in the figures, is not intended to limit the scope of the application, as claimed, but is merely representative of selected embodiments of the application. All other embodiments, which can be made by a person skilled in the art without making any inventive effort, are intended to be within the scope of the present application.
It should be noted that the term "comprising" will be used in embodiments of the application to indicate the presence of the features stated hereafter, but not to exclude the addition of other features.
During the software development process, the operation of the database is also a very important part of the code-free process. In particular to financial software, due to the characteristics of high frequency, high timeliness and the like of financial products, the operation requirement on a database is more strict in the development process of software products.
Because of the adjustment and security requirements of the software architecture, the replacement and upgrade of the bottom database is a significant change for the service system, in order to ensure the stability and the data security of the service system, in the initial stage of the replacement and upgrade of the bottom database, two sets of databases before and after the replacement and upgrade are generally deployed in the environment at the same time, and in the service code, the service code logic is modified, and the two databases are written in at the same time, so that the stability and the data security of the system are ensured, but the following problems exist in this way:
and the database operation logic is repeated in the service logic code, and the database double-write logic is added, so that the current service logic is easily influenced, and the normal service is influenced.
When a problem occurs, code rollback is cumbersome, requiring multiple modifications to rollback.
Based on this, the embodiment of the application provides a method, a device, an electronic device and a storage medium for writing a database, and the description is given below by way of embodiments.
FIG. 1 is a flowchart of a method for writing a database according to an embodiment of the present application, wherein the method includes steps S101-S102; specific:
s101, responding to logic adding operation, and cutting into first writing logic of a first database in target item source codes;
s102, responding to a database writing operation, writing the target item source code into a second database based on second writing logic in the target item source code, and writing the target item source code into a first database based on the first writing logic; wherein the first database is different from the second database.
According to the application, double writing of the target project code is realized by the tangent plane method under the condition of not changing the original service code, so that the research and development efficiency is improved, and the stability of the original service logic is ensured.
Some embodiments of the application are described in detail below. The following embodiments and features of the embodiments may be combined with each other without conflict.
The embodiment of the application provides a method for writing a database, wherein the database is a warehouse for organizing, storing and managing data according to a data structure. Is a collection of large amounts of data stored in a computer for a long period of time, organized, sharable, and uniformly managed. The database is a repository for data. The storage space is large, and millions, tens of millions and hundreds of millions of data can be stored. However, the database does not store the data randomly, and there is a certain rule, otherwise the query efficiency is low. The world today is an internet world filled with data, which is filled with large amounts of data. I.e. this internet world is the data world. There are many sources of data such as travel records, consumption records, web pages browsed, messages sent, etc. In addition to text type data, images, music, sound are all data. A database is a computer software system that stores and manages data in data structures. The concept of a database actually includes two layers of meaning: (1) The database is an entity which is a 'warehouse' capable of reasonably keeping data, and a user stores transaction data to be managed in the 'warehouse', and two concepts of the 'data' and the 'database' are combined into the database. (2) Databases are new methods and techniques for data management that enable more appropriate organization of data, more convenient maintenance of data, tighter control of data, and more efficient utilization of data. Databases are the most important base software, being the cornerstone that ensures stable operation of computer systems.
For the development process of financial software, the financial software needs to be upgraded due to the change of contents such as financial products or transaction means, and the like, so that the development process is suitable for different market demands. In the upgrading process of the financial software, the codes of the financial software need to be stored in the corresponding databases. At the time of storage, two different databases (a first database and a second database) are generally set in the prior art, and service codes are sequentially stored in the two databases.
In order to achieve a better writing effect, the embodiment of the application adds the first writing logic of the first database into the target item source code, and combines the second writing logic contained in the target item source code, so that the target item source code can be simultaneously written into the first database and the second database respectively when the target item source code is operated, and compared with a mode of sequential writing in the prior art, the writing efficiency is improved. The second write logic is the write logic designed by the target project source code itself at the time of development.
Furthermore, the embodiment of the application adds the first writing logic of the first database into the source code of the target item based on the AOP technology. AOP is an abbreviation for Aspect Oriented Programming, meaning: a technique for realizing unified maintenance of program functions by a precompiled mode and dynamic agents during running is oriented to tangent plane programming. AOP is a continuation of OOP, a hotspot in software development, and an important content in Spring framework, and is a derivative model of functional programming. The AOP is utilized to isolate each part of the business logic, so that the coupling degree among the parts of the business logic is reduced, the reusability of the program is improved, and the development efficiency is improved. That is, the first writing logic for writing the first database in the target item source code does not change the original code logic of the target item source code, so that the stability of the original target item source code is ensured.
In the specific implementation, the project source code of a certain financial software can be acquired from the project code management platform through a gate class command. For convenience of description, the item source code to be written with data is referred to as target item source code in the embodiment of the present application. After the target item source code is obtained, the embodiment of the application needs to add the first writing logic of the first database into the target item source code. The specific adding process is that a section file is added into the source code of the target item, and the section file is used for realizing the first writing logic. After the section file is added, the section file needs to be configured. When the section file is configured, the configuration is performed according to the annotation identifier contained in the section file.
In the embodiment of the application, the section file comprises a plurality of annotation identifiers, which are called a first annotation identifier, a second annotation identifier and a third annotation identifier for distinguishing. The operation for the first annotation identification is: a write operation to the first database is configured after the first annotation identification. The operation for the second annotation identification is: and configuring extraction operation of the database processing statement in the source code of the target item after the second annotation identification. The operations for the third annotation identifier are: and after the third annotation identification, configuring a verification operation for the first data written in the first database and the second data written in the second database.
Specifically, aop section class database server priority. Java for realizing database double-write logic is added in the source code of the target item in the embodiment of the application, and the class is marked as aop section class through @ aspect annotation. In aop slice class file database with dual write logic, dual write interception of data is realized by annotation configuration of @ pointer (database operation method). If the database operation method under the pointer is needed, the database operation is configured to pass @ pointer (pointer. Times.) in order to ensure consistency of two database data, in general, three operations of at least one of the access layer pointer/update/delete of the data need to be switched into the database dual write logic.
In the cut plane method, interception is realized by annotating @ Before ()) an interface method that needs to prevent resubmitting. Before the execution of the cut-in point method, executing a method under the cut-face @ before annotation, wherein the logic of the method under the @ before annotation in the cut-face file is as follows: the sql statement in the current mapper method is obtained through the SqlHelper. GetNamespaceql, the field names and the field values of each table in the current sql statement are extracted (data rollback in order to write data into abnormality), and the sql statement is executed in the database B through an execute (sql statement) method. For convenience of description, the double-written database is database a and database B, wherein database a is an original business history database and database B is an updated or to-be-replaced database.
In an alternative embodiment, when writing to the database, the written data may be abnormal due to a network or the like. In order to ensure the accuracy of the data written into the first database and the second database, after the write operation is performed on the first database and the second database, the embodiment of the application also verifies the first data written into the first database and the second data written into the second database. And determining whether the first data and the second data are identical or not by comparing and analyzing the first data and the second data. If the first data is the same as the second data, the first data written in the first database and the second data written in the second database are in a normal state. If the first data and the second data are different, the first data written in the first database and the second data written in the second database are in abnormal states.
Because the writing mode in the embodiment of the application is different from the writing mode in the prior art, when the writing data is abnormal, the writing mode in the prior art can carry out data rollback only after the rollback codes of a plurality of positions are required to be modified. In the embodiment of the application, the rollback operation code is configured in the section file, so that when the abnormality of the written data is determined, the written data can be rolled back directly without modifying the code in the source code of the target item.
Because the configuration is carried out for different types of operations when the configuration is carried out in the section file, when the rollback is carried out, the database processing statement in the target item source code is obtained first, and then the rollback statement corresponding to the type of the database processing statement is used for rollback of the written data of the first database and the second database.
In the embodiment of the application, the types of database processing sentences comprise a first type, a second type, a third type and a fourth type, and the rollback sentences comprise a first sentence, a second sentence, a third sentence and a fourth sentence;
the method rolls back the write data of the first database and the second database by:
for a first type of the database processing statement, rollback is performed on the written data of the first database and the second database by using the first statement;
for a second type of the database processing statement, rollback is performed on the written data of the first database and the second database by using the second statement;
for a third type of the database processing statement, rollback is performed on the write data of the first database and the second database by using the third statement;
and for a fourth type of the database processing statement, using the fourth statement to rollback the written data of the first database and the second database.
Specifically, the annotation method is configured in the section file @ after (pointcut ()). The code under the annotation is executed after the execution of the section method is completed, and the method logic under the annotation @ after in the section file is that whether the abnormality occurs in the process of writing, updating and deleting the data of the current method is captured through the ExceptionCatch, and if the abnormality does not occur, the double writing is successful.
If abnormal occurs, corresponding rollback is needed according to the executed sql statement, if the executed insert statement is executed, delete statement is used for deleting rollback according to the field name and the field value of the database stored before, if the executed insert statement is an update statement, update statement is used according to the field name and the field value of the database stored before, and if the executed insert statement is a delete statement, insert statement is used according to the field name and the field value of the database stored before.
The embodiment of the application adds the double-writing logic of the database in the tangent plane method by an AOP (tangent plane programming) mode and then cuts into the data access layer method, and the mode has the following advantages:
the double-writing logic of the service code database can be realized under the condition of not modifying the original service code, thereby reducing the influence of increasing the double-writing logic of the database on the original service, and improving the research and development efficiency because of less code change. Similarly, when the database double-write abnormality occurs, the original business logic can be ensured to be unchanged by only stopping the cutting method from cutting into the data access layer method, the rollback of the business logic can be rapidly realized, and the stability of the project is ensured.
As an alternative embodiment, it may be performed in the manner shown in fig. 2 when it is embodied.
Fig. 3 is a schematic structural diagram of an apparatus for writing a database according to an embodiment of the present application, where the apparatus includes:
the first response module is used for responding to the logic adding operation and cutting in first writing logic of the first database in the target item source code;
the second response module is used for responding to database writing operation, writing the target item source code into a second database based on second writing logic in the target item source code, and writing the target item source code into a first database based on the first writing logic; wherein the first database is different from the second database.
The apparatus further comprises:
the verification module is used for verifying the first data written in the first database and the second data written in the second database;
and if the first data or the second data are abnormal, rollback is carried out on the written data of the first database and the second database.
Before responding to a database write operation, the apparatus further comprises:
the acquisition module is used for acquiring database processing sentences in the target item source codes;
the rollback of the write data of the first database and the second database includes:
and using rollback sentences corresponding to the types of the database processing sentences to rollback the written data of the first database and the second database.
The types of the database processing sentences comprise a first type, a second type, a third type and a fourth type, and the rollback sentences comprise a first sentence, a second sentence, a third sentence and a fourth sentence; the method rolls back the write data of the first database and the second database by:
for a first type of the database processing statement, rollback is performed on the written data of the first database and the second database by using the first statement;
for a second type of the database processing statement, rollback is performed on the written data of the first database and the second database by using the second statement;
for a third type of the database processing statement, rollback is performed on the write data of the first database and the second database by using the third statement;
and for a fourth type of the database processing statement, using the fourth statement to rollback the written data of the first database and the second database.
The first write logic to cut into the first database in the target item source code in response to the logic add operation, comprising:
and responding to the file adding operation, and adding the section file for realizing the first writing logic in the target item source code.
In response to the annotation operation, a write operation to the first database is configured after the first annotation identification.
The section file comprises a second annotation identifier and a third annotation identifier, and the method further comprises the steps of:
responding to annotation operation, and configuring extraction operation of database processing sentences in the source codes of the target items after the second annotation identification;
in response to an annotation operation, a validation operation is configured for the first data written in the first database and the second data written in the second database after the third annotation identification.
As shown in fig. 4, an embodiment of the present application provides an electronic device for performing a method for writing a database in the present application, where the device includes a memory, a processor, a bus, and a computer program stored on the memory and capable of running on the processor, where the steps of the method for writing a database are implemented when the processor executes the computer program.
In particular, the above memory and processor may be general-purpose memory and processor, which are not limited herein, and the above method for writing a database can be performed when the processor runs a computer program stored in the memory.
Corresponding to the method for writing the database in the application, the embodiment of the application also provides a computer readable storage medium, and the computer readable storage medium stores a computer program, and the computer program executes the steps of the method for writing the database when being executed by a processor.
In particular, the storage medium can be a general-purpose storage medium, such as a removable disk, a hard disk, or the like, on which a computer program is executed that is capable of performing the above-described method of database writing.
In the embodiments provided in the present application, it should be understood that the disclosed system and method may be implemented in other manners. The system embodiments described above are merely illustrative, e.g., the division of the elements is merely a logical functional division, and there may be additional divisions in actual implementation, and e.g., multiple elements or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some communication interface, system or unit indirect coupling or communication connection, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments provided in the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
It should be noted that: like reference numerals and letters in the following figures denote like items, and thus once an item is defined in one figure, no further definition or explanation of it is required in the following figures, and furthermore, the terms "first," "second," "third," etc. are used merely to distinguish one description from another and are not to be construed as indicating or implying relative importance.
Finally, it should be noted that: the above examples are only specific embodiments of the present application, and are not intended to limit the scope of the present application, but it should be understood by those skilled in the art that the present application is not limited thereto, and that the present application is described in detail with reference to the foregoing examples: any person skilled in the art may modify or easily conceive of the technical solution described in the foregoing embodiments, or perform equivalent substitution of some of the technical features, while remaining within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the corresponding technical solutions. Are intended to be encompassed within the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A method of database writing, the method comprising:
in response to a logic add operation, cutting into first write logic of a first database in target item source code;
responsive to a database write operation, writing the target item source code to a second database based on second write logic in the target item source code, and writing the target item source code to a first database based on the first write logic; wherein the first database is different from the second database.
2. The method according to claim 1, wherein the method further comprises:
verifying the first data written in the first database and the second data written in the second database;
and if the first data or the second data are abnormal, rollback is carried out on the written data of the first database and the second database.
3. The method of claim 2, wherein prior to responding to a database write operation, the method further comprises:
acquiring a database processing statement in the target item source code;
the rollback of the write data of the first database and the second database includes:
and using rollback sentences corresponding to the types of the database processing sentences to rollback the written data of the first database and the second database.
4. The method of claim 3, wherein the types of database processing statements include a first type, a second type, a third type, and a fourth type, and the rollback statements include a first statement, a second statement, a third statement, and a fourth statement; the method rolls back the write data of the first database and the second database by:
for a first type of the database processing statement, rollback is performed on the written data of the first database and the second database by using the first statement;
for a second type of the database processing statement, rollback is performed on the written data of the first database and the second database by using the second statement;
for a third type of the database processing statement, rollback is performed on the write data of the first database and the second database by using the third statement;
and for a fourth type of the database processing statement, using the fourth statement to rollback the written data of the first database and the second database.
5. The method of claim 1, wherein the cutting into the target item source code into the first write logic of the first database in response to the logic add operation comprises:
and responding to the file adding operation, and adding the section file for realizing the first writing logic in the target item source code.
6. The method of claim 5, wherein the section file includes a first annotation identification therein, the method implementing first write logic by:
in response to the annotation operation, a write operation to the first database is configured after the first annotation identification.
7. The method of claim 5, wherein the section file includes a second annotation identifier and a third annotation identifier, the method further comprising:
responding to annotation operation, and configuring extraction operation of database processing sentences in the source codes of the target items after the second annotation identification;
in response to an annotation operation, a validation operation is configured for the first data written in the first database and the second data written in the second database after the third annotation identification.
8. An apparatus for database writing, the apparatus comprising:
the first response module is used for responding to the logic adding operation and cutting in first writing logic of the first database in the target item source code;
the second response module is used for responding to database writing operation, writing the target item source code into a second database based on second writing logic in the target item source code, and writing the target item source code into a first database based on the first writing logic; wherein the first database is different from the second database.
9. An electronic device, comprising: a processor, a memory and a bus, said memory storing machine readable instructions executable by said processor, said processor and said memory communicating over the bus when the electronic device is running, said machine readable instructions when executed by said processor performing the steps of the method of database writing according to any of claims 1 to 7.
10. A computer-readable storage medium, characterized in that it has stored thereon a computer program which, when executed by a processor, performs the steps of the method of database writing according to any of claims 1 to 7.
CN202310995146.3A 2023-08-08 2023-08-08 Database writing method and device, electronic equipment and storage medium Pending CN117033480A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310995146.3A CN117033480A (en) 2023-08-08 2023-08-08 Database writing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310995146.3A CN117033480A (en) 2023-08-08 2023-08-08 Database writing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117033480A true CN117033480A (en) 2023-11-10

Family

ID=88622051

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310995146.3A Pending CN117033480A (en) 2023-08-08 2023-08-08 Database writing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117033480A (en)

Similar Documents

Publication Publication Date Title
CN101046821B (en) Generic database manipulator
US7886028B2 (en) Method and system for system migration
CN103890709A (en) Cache based key-value store mapping and replication
CN104572920A (en) Data arrangement method and data arrangement device
CN109885642B (en) Hierarchical storage method and device for full-text retrieval
CN105787058A (en) User label system and data pushing system based on same
CN105808653A (en) User label system-based data processing method and device
JP2022545303A (en) Generation of software artifacts from conceptual data models
CN112434015B (en) Data storage method and device, electronic equipment and medium
CN112000349A (en) Data upgrading method, equipment and medium based on software as a service (SaaS)
CN113138781B (en) CSV configuration updating method and storage medium
CN109815240A (en) For managing method, apparatus, equipment and the storage medium of index
CN115858488A (en) Parallel migration method and device based on data governance and readable medium
US8639657B2 (en) Reorganizing table-based data objects
CN114610959B (en) Data processing method, device, equipment and storage medium
CN113760354B (en) Ontology information version management and control method and device of dispatching automation system
US11960470B2 (en) Merging and unmerging entity representations via resolver trees
CN117033480A (en) Database writing method and device, electronic equipment and storage medium
CN113419752A (en) Data processing method and device, electronic equipment and storage medium
CN102754083B (en) Data base management system (DBMS)
CN114816470A (en) Metadata database management method and device, electronic equipment and medium
CN116821232A (en) Data synchronization method and related device
CN112817931B (en) Incremental version file generation method and device
CN113868138A (en) Method, system, equipment and storage medium for acquiring test data
KR102214697B1 (en) A computer program for providing space managrment for data storage in a database management system

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