CN115563086B - Data modification method and device for database - Google Patents
Data modification method and device for database Download PDFInfo
- Publication number
- CN115563086B CN115563086B CN202211402301.8A CN202211402301A CN115563086B CN 115563086 B CN115563086 B CN 115563086B CN 202211402301 A CN202211402301 A CN 202211402301A CN 115563086 B CN115563086 B CN 115563086B
- Authority
- CN
- China
- Prior art keywords
- data
- lines
- modification
- value
- change information
- 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.)
- Active
Links
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
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The application discloses a data modification method and device of a database. Wherein, the method comprises the following steps: receiving a modification instruction of the first data, wherein the modification instruction at least comprises identification and change information of the first data; under the condition that the modification instruction passes verification, determining target data to be modified from multiple lines of second data, and modifying the target data according to the change information, wherein the multiple lines of second data are obtained by splitting the first data; and after the target data is modified, sending indication information, wherein the indication information is used for indicating that the first data is modified completely. The method and the device solve the technical problem that the data in the database is low in modification efficiency.
Description
Technical Field
The present application relates to the field of data processing, and in particular, to a method and an apparatus for modifying data of a database.
Background
Database is used as the bottom data storage product of the commonly used information system, mutual blocking between sessions is a very common situation, and in various existing popular relational database products, functions of mvcc (multi-version concurrent control) are almost realized, namely: the read data and the modified data do not affect each other at the default isolation level, but the modified data mutually exists exclusive lock blocking between different sessions, namely: when session 1 modifies a certain piece of data, session 2 must wait for session 2 to modify after session 1 is executed, and similarly, if session 3, session 4, and session n all need to modify the piece of data, they form a queue, and must wait for the previous session to modify, and then can execute the modification itself, that is: blocking waiting of the exclusive lock is formed, resulting in a reduction in the efficiency of data modification in the database.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the application provides a data modification method and device of a database, and aims to at least solve the technical problem of low data modification efficiency in the database.
According to an aspect of an embodiment of the present application, there is provided a data modification method for a database, including: receiving a modification instruction of first data, wherein the modification instruction at least comprises identification and change information of the first data; under the condition that the modification instruction passes verification, determining target data to be modified from multiple lines of second data of a database, and modifying the target data according to the change information, wherein the multiple lines of second data are obtained by splitting the first data; and after the target data is modified, sending indication information, wherein the indication information is used for indicating that the first data is modified.
Optionally, the first data is split into a plurality of lines of second data by: determining an identity of the first data as an identity of the plurality of lines of second data; distributing the first data to the plurality of lines of second data according to a preset rule, wherein the plurality of lines of second data jointly form the first data; and marking line serial numbers for the plurality of lines of second data from small to large according to the arrangement sequence of the plurality of lines of second data to finish splitting.
Optionally, determining target data to be modified from the plurality of lines of second data includes: in the case that the modification instruction is issued by one dialog, selecting one row of second data from the plurality of rows of second data, and determining the selected row of second data as the target data; and in the case that the modification instruction is respectively sent out by a plurality of dialogs and a plurality of modification instructions exist, selecting a plurality of lines of second data from the plurality of lines of second data and determining the lines of second data as the target data, wherein each line of second data corresponds to one of the plurality of dialogs.
Optionally, determining target data to be modified from the plurality of lines of second data includes: determining the change information from the modification instruction; and determining one or more lines of second data of which the modification strategies are matched with the change information as target data from the plurality of lines of second data.
Optionally, determining one or more rows of the second data with the modification strategy matching the variation information as target data from the plurality of rows of the second data comprises: when the change information is a numerical value and the numerical value corresponding to the change information is larger than a preset value, determining that the numerical value corresponding to the change information is a first numerical value; determining one or more lines of second data from the plurality of lines of second data as target data, wherein a modification strategy of the target data supports modification of a value in the target data according to the first value; under the condition that the value corresponding to the change information is smaller than the preset value, determining the value corresponding to the change information as a second value; and determining one or more lines of second data from the plurality of lines of second data as target data, wherein the modification strategy of the target data supports the modification of the numerical value in the target data according to the second numerical value.
Optionally, the modification instruction is verified by the following means, including: acquiring change information in the modification instruction; and determining that the modification instruction passes the verification under the condition that the value corresponding to the change information is matched with the value in the first data.
Optionally, the method further comprises: the plurality of lines of second data further comprise preset data, and the modification strategy of the preset data supports the modification of the numerical values in the preset data according to any target numerical value, wherein the target numerical value is a numerical value corresponding to the change information.
Optionally, in a case that the value in the preset data does not match the target value, the method further includes: and modifying the numerical value in the preset data, wherein the numerical value in the modified preset data is not greater than the numerical value in the first data.
According to another aspect of the embodiments of the present application, there is also provided a data modification apparatus for a database, including: the receiving module is used for receiving a modification instruction of the first data, wherein the modification instruction at least comprises an identifier and change information of the first data; the modification module is used for determining target data to be modified from multiple lines of second data under the condition that the modification instruction passes verification, and modifying the target data according to the change information, wherein the multiple lines of second data are obtained by splitting the first data; and the sending module is used for sending out indication information after the target data is modified, wherein the indication information is used for indicating that the first data is modified.
According to another aspect of the embodiments of the present application, a nonvolatile storage medium is further provided, where the nonvolatile storage medium includes a stored program, and when the program runs, a device where the nonvolatile storage medium is located is controlled to execute the data modification method for the database.
According to still another aspect of the embodiments of the present application, there is provided a computer device, including a memory and a processor, where the processor is configured to execute a program, where the program executes a data modification method of the database.
In the embodiment of the application, a modification instruction for receiving first data is adopted, and the modification instruction at least comprises identification and change information of the first data; under the condition that the modification instruction passes verification, determining target data to be modified from multiple lines of second data, and modifying the target data according to the change information, wherein the multiple lines of second data are obtained by splitting the first data; after the target data is modified, indicating information is sent, wherein the indicating information is used for indicating the mode that the first data is modified, the first data is divided into a plurality of pieces of second data, and then the second data is modified according to the change information in the modification instruction, so that the purpose of enabling different modification instructions to modify different pieces of second data is achieved, the technical effect of improving the database data modification efficiency is achieved, and the technical problem of low data modification efficiency in the database is solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1 is a block diagram of a hardware structure of a computer terminal (or a mobile device) for a data modification method of a database according to an embodiment of the present application;
FIG. 2 is a flow chart of a method of data modification of a database according to the present application;
fig. 3 is a schematic structural diagram of an alternative database data modification method according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the accompanying drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
There is also provided, in accordance with an embodiment of the present application, an embodiment of a method for modifying data of a database, it being noted that the steps illustrated in the flowchart of the drawings may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowchart, in some cases the steps illustrated or described may be performed in an order different than here.
The method provided by the embodiment of the application can be executed in a mobile terminal, a computer terminal, a cloud server or a similar operation device. Fig. 1 shows a hardware configuration block diagram of a computer terminal (or mobile device) for implementing a data modification method of a database. As shown in fig. 1, the computer terminal 10 (or mobile device 10) may include one or more (shown as 102a, 102b, \8230;, 102 n) processors 102 (processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 104 for storing data, and a transmission module 106 for communication functions. In addition, the method can also comprise the following steps: a display, an input/output interface (I/O interface), a Universal Serial Bus (USB) port (which may be included as one of the ports of the I/O interface), a network interface, a power source, and/or a camera. It will be understood by those skilled in the art that the structure shown in fig. 1 is only an illustration and is not intended to limit the structure of the electronic device. For example, the computer terminal 10 may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
It should be noted that the one or more processors 102 and/or other data processing circuitry described above may be referred to generally herein as "data processing circuitry". The data processing circuitry may be embodied in whole or in part in software, hardware, firmware, or any combination thereof. Further, the data processing circuit may be a single stand-alone processing module or incorporated, in whole or in part, into any of the other elements in the computer terminal 10 (or mobile device). As referred to in the embodiments of the application, the data processing circuit acts as a processor control (e.g. selection of variable resistance termination paths connected to the interface).
The memory 104 may be used to store software programs and modules of application software, such as program instructions/data storage devices corresponding to the data modification method of the database in the embodiment of the present application, and the processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, so as to implement the data modification method of the database. The memory 104 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory located remotely from the processor 102, which may be connected to the computer terminal 10 over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission module 106 is used to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission module 106 includes a Network adapter (NIC) that can be connected to other Network devices through a base station to communicate with the internet. In one example, the transmission module 106 may be a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
The display may be, for example, a touch screen type Liquid Crystal Display (LCD) that may enable a user to interact with a user interface of the computer terminal 10 (or mobile device).
In accordance with an embodiment of the present application, there is provided an embodiment of a method for modifying data of a database, it should be noted that the steps illustrated in the flowchart of the drawings may be performed in a computer system such as a set of computer executable instructions, and that while a logical order is illustrated in the flowchart, in some cases the steps illustrated or described may be performed in an order different than that herein.
Fig. 2 is a flowchart of a data modification method of a database according to an embodiment of the present application, as shown in fig. 2, the method includes the following steps:
step S202, receiving a modification instruction of the first data, wherein the modification instruction at least comprises identification and change information of the first data;
step S204, under the condition that the modification instruction passes verification, determining target data to be modified from multiple lines of second data, and modifying the target data according to the change information, wherein the multiple lines of second data are obtained by splitting the first data;
step S206, after the target data is modified, sending out indication information, wherein the indication information is used for indicating that the first data is modified.
Through the steps, the first data can be split into the plurality of pieces of second data, and then the second data can be modified according to the change information in the modification instruction, so that the purpose of modifying different second data by different modification instructions is achieved, the technical effect of improving the database data modification efficiency is achieved, and the technical problem of low data modification efficiency in the database is solved.
In step S202, the first data may be a row of data in the database, the row of data may be data corresponding to the quantity, such as the stock quantity, the number of tasks, the number of prawns, and the like of the commodity, and the modification instruction is transmitted through a session between the terminal and the database. The number of sessions may be one or more, and the number of modification instructions may be one or more.
In step S204, the verification that the modification instruction passes may be used to indicate that the modification instruction is sent through the verification-passed session, and may also indicate that a value corresponding to the change information carried in the modification instruction matches a value in the first data, for example: if the change information is negative 1 and the value in the first data is 3, it can be considered that the value in the first data is 3 and can be modified according to the change information, and then the modification instruction is considered to pass the verification.
It should be noted that, splitting the first data into multiple lines of the second data may be splitting a numerical value in the first data into multiple lines of the second data, for example: the value in the first data is 10000, the first data may be split into 100 rows of second data, and the value in each row of second data may be 100, or may be another value.
In step S206, the indication information is used to be sent to the terminal device for presentation.
It should be noted that, since the transaction log needs to be persisted to the disk after the data is modified in the database, if the disk is slower, the later session waiting time is longer; since the master database needs to wait until the slave database also commits the transaction log after committing the transaction log, the time spent by one modification is longer, and the later sessions wait longer due to the blocking of the former sessions.
In practical high concurrency scenarios, for example: the method comprises the steps that a certain commodity is discounted to cause a plurality of people to buy in a robbery mode, a row of data is stored in a table in a database according to a default mode, the data records the stock of the commodity, the stock value of the row of data can be modified when every person buys in the robbery mode, and long-time waiting can be caused when a large number of requests are modified under the condition that the same row of data is modified in the same time period.
According to the method provided by the application, for example: the inventory value of the commodity is recorded in 1000 rows of data instead of one row of data, if the inventory is 100000, the inventory value of each piece of data is 100000/1000, that is: 100, when a user buys a purchase, different users modify one of the thousand pieces of data, so that the data updated by the users are updated to different rows instead of the same row, and the blockage can be reduced, thereby improving the modification efficiency.
The above-mentioned steps S202 to S206 are explained in detail by specific examples.
In step S204, splitting the first data into multiple lines of second data may be performed in the following manner, and determining the identifier of the first data as the identifier of the multiple lines of second data; distributing numerical values in the first data to a plurality of lines of second data according to a preset rule, wherein the sum of the numerical values in the plurality of lines of second data is equal to the numerical value in the first data; and marking line serial numbers for the multiple lines of second data from small to large according to the arrangement sequence of the multiple lines of second data to finish splitting.
Taking the value in the first data as 10000 and the identifier of the first data as 235 as an example, it is determined that the identifiers of the plurality of lines of second data are all 235, and the value in the first data is divided into 100 parts, that is, divided into 100 second data, and then the value in each second data is 100. And the line sequence number of each second data is 1 to 100 in turn.
In a practical application scenario, the identifier of the first data may be an identifier of a product, an identifier of a task, or the like, for characterizing the object, and the value in the first data may be a value representing the number of the object, for example: the number of items.
In some embodiments of the present application, the target data to be modified determined from the plurality of lines of second data may be modified by, in particular, in a case where a modification instruction is issued by one dialog, selecting one line of second data from the plurality of lines of second data, and determining the selected line of second data as the target data; and under the condition that the modification instructions are respectively sent out by a plurality of dialogs and a plurality of modification instructions exist, selecting a plurality of lines of second data from the plurality of lines of second data and determining the second data as target data, wherein each line of second data corresponds to the plurality of dialogs one by one.
In an actual application scenario, in an optional manner, in the case that the change information is negative 1, a line of second data is determined as target data from multiple lines of second data by a modification instruction sent by the dialog 1; in another optional manner, a modification instruction is issued by dialog 1, dialog 2, and dialog 3 at the same time, and three lines of second data are selected from the multiple lines of second data in the case that all the change information is negative 1, where dialog 1, dialog 2, and dialog 3 respectively correspond to one line of second data, and the corresponding second data is modified, for example: dialog 1 corresponds to a value of 100 in the second data, which is 99 after modification according to the change information minus 1.
In an alternative, the change information is determined from the modification instruction; determining one or more lines of second data, which are matched with the change information, of the modification strategy from the multiple lines of second data as target data, and specifically determining the change information as a first value under the condition that the change information is a value and the value corresponding to the change information is greater than a preset value; determining one or more lines of second data as target data from the plurality of lines of second data, wherein the modification strategy of the target data supports the modification of the value in the target data according to the first value; determining the change information as a second numerical value under the condition that the numerical value corresponding to the change information is smaller than a preset value; and determining one or more lines of second data from the plurality of lines of second data as target data, wherein the modification strategy of the target data supports the modification of the value in the target data according to the second value.
Taking the preset value as minus 2 and the change information as minus 1 as an example, the plurality of lines of second data are divided into two parts, the second data of the first part support the modification of which the change information is minus 2, and the second data of the second part do not support the modification of which the change information is minus 2.
One optional verification method for the modification instruction is to acquire change information in the modification instruction; and in the case that the change information is matched with the value in the first data, determining that the modification instruction passes the verification.
Specifically, in an alternative manner, in the case that the sum of the value in the first data and the variation information is greater than zero, it is determined that the variation information matches the value in the first data.
In some embodiments of the present application, in a case where the sum of the value in the second data and the variation information is greater than zero, it is determined that the value in the second data matches the variation information.
It is to be understood that, in another alternative, in the case that the sum of the value in the second data and the variation information is smaller than the preset threshold, it is determined that the value in the second data matches the variation information. The matching rules may be set according to the actual scenario.
In other embodiments of the present application, the plurality of lines of second data further include preset data, and a modification policy of the preset data supports modification of a value in the preset data according to any change information, where the value in the preset data is modified when the value in the preset data does not match the change information, and the modified value in the preset data is not greater than the value in the first data.
In the case that the change information is negative 3, no modification policy exists in the plurality of lines of second data to support second data modified according to negative 3, or in the case that the sum of the value in the target data and negative 3 is less than zero, modifying the value by preset data according to the change information of negative 3, for example: if the numerical value in the preset data is 200, the numerical value is 197 after modification; in the case that the value in the preset data is 2, the value in the preset data needs to be modified, and taking the sum of the values in the second data except the preset data as 30 as an example, the value in the preset data can be modified to be a first value, and the range of the first value is not greater than 32.
In an actual application scenario, the line sequence number field is a line sequence number of the second data, for example: splitting a certain product into 1000 rows, then the product has 1000+1=1001 data, where the values corresponding to "row number" are 0, 1, 2, 3.
Connection sessions initiated by different terminal devices can be made to update different rows according to a preset modification policy, for example: in an alternative, the row number is 1 to 1000, and the stock for the user to buy is greater than 1, but there are 2 or 3 items that the user will buy, and then it may happen that the stock is not enough when the row number is modified, and at this time, we let the session modify the row with the row number 0.
The "inventory available status" field may be used to inquire whether an item has available inventory, and is to improve the inquiry performance, when each row of inventory of an item in the "item table" is 0, we will update this "inventory available status" field to be 0, that is: the inventory is not available and is returned immediately.
The method provided by the application can acquire the row sequence number of the second data through the sequence function carried in the database, and also can transmit an explicit 'row sequence number' from the outside for inventory modification without using the characteristics of the database, for example: when each dialogue modifies data in a database, the counter value is obtained by utilizing the redis, so that the value of the row sequence number is obtained, and the numerical value corresponding to a certain row sequence number can be directly modified when the data enter the database.
In an actual application scenario, on the basis of the data modification method of the database provided by the application, the embodiment of the application further provides a commodity robbery method, and the receiving of the modification instruction comprises the following steps: the first data identification (commodity identification) and the change information (number of the first data) pass the verification when the commodity stock number (numerical value in the first data) is larger than the change information (number of the first data), the value of the target row serial number is obtained by utilizing the sequence function carried by the database under the condition of passing the verification, the stock value in the target row serial number is modified, the stock value in the target row serial number is deducted under the condition that the stock value in the target row serial number is larger than the number of the first data, and the whole stock of the commodity can be transferred to the stock value in the target row serial number to be deducted under the condition that the stock value in the target row serial number is smaller than the number of the first data.
The data modification method for a database provided in the embodiment of the present application is also applied to a data modification method apparatus for a database provided in the embodiment of the present application, and as shown in fig. 3, the method includes: a receiving module 40, configured to receive a modification instruction of the first data, where the modification instruction at least includes an identifier and change information of the first data; the modification module 42 is configured to, when the modification instruction passes the verification, determine target data to be modified from multiple lines of second data, and modify the target data according to the change information, where the multiple lines of second data are obtained by splitting the first data; and the sending module 44 is configured to send indication information after the value in the target data is modified, where the indication information is used to indicate that the modification of the first data is completed.
The modification module 42 includes: the splitting submodule is used for determining the identifier of the first data as the identifier of a plurality of rows of second data; distributing numerical values in the first data to a plurality of lines of second data according to a preset rule, wherein the sum of the numerical values in the plurality of lines of second data is equal to the numerical value in the first data; and marking line serial numbers for the plurality of lines of second data from small to large according to the arrangement sequence of the plurality of lines of second data to finish splitting.
The split submodule includes: the device comprises a first determining unit and a second determining unit, wherein the first determining unit is used for selecting one line of second data from multiple lines of second data to determine the line of second data as target data under the condition that a modification instruction is sent by one dialogue; under the condition that modification instructions are respectively sent out by a plurality of dialogs and a plurality of modification instructions exist, selecting a plurality of lines of second data from the plurality of lines of second data and determining the second data as target data, wherein each line of second data corresponds to the plurality of dialogs one to one; the second determining unit determines the change information from the modification instruction; determining one or more lines of second data with the modification strategy matched with the change information as target data from the plurality of lines of second data;
the second determination unit includes: the device comprises a first determining subunit, a second determining subunit and a third determining subunit, wherein the first determining subunit is used for determining the change information as a first numerical value under the condition that the numerical value corresponding to the change information is greater than a preset value; determining one or more lines of second data as target data from the plurality of lines of second data, wherein the modification strategy of the target data supports modification of the target data according to a first numerical value; determining the change information as a second numerical value under the condition that the numerical value corresponding to the change information is smaller than a preset value; determining one or more lines of second data from the plurality of lines of second data as target data, wherein the modification strategy of the target data supports the modification of the numerical value in the target data according to the second numerical value; the second determining subunit is used for determining that the modification instruction passes the verification if the change information matches the value in the first data.
The third determining subunit is used for setting preset data in the plurality of lines of second data, and the modification strategy of the preset data supports modification of the numerical value in the preset data according to any change information, wherein the numerical value in the preset data is modified under the condition that the numerical value in the preset data is not matched with the change information, and the numerical value in the modified preset data is not larger than the numerical value in the first data.
According to another aspect of the embodiments of the present application, there is also provided a nonvolatile storage medium, including a stored program, where the apparatus in which the nonvolatile storage medium is located is controlled to execute the data modification method of the database when the program runs.
According to another aspect of the embodiments of the present application, there is further provided a computer device, including a memory and a processor, where the processor is configured to execute a program, where the program executes the method for modifying data of the database.
The computer equipment executes the customer service work order distribution method, the first data is divided into a plurality of pieces of second data, then the second data is modified according to the change information in the modification instruction, the purpose of enabling different modification instructions to modify different pieces of second data is achieved, the technical effect of improving the database data modification efficiency is achieved, the technical problem that the data modification efficiency in the database is low is solved, in an actual application scene, the time of serious blocking caused by continuous exclusive lock in a high-concurrency scene is reduced, the response time is obviously prolonged, and obvious performance improvement is brought.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
In the embodiments of the present application, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to the related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described apparatus embodiments are merely illustrative, and for example, a division of a unit may be a logical division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or may not be executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one position, or may be distributed on a plurality of units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit may be implemented in the form of hardware, or may also be implemented in the form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method of the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present application and it should be noted that those skilled in the art can make several improvements and modifications without departing from the principle of the present application, and these improvements and modifications should also be considered as the protection scope of the present application.
Claims (8)
1. A method for modifying data in a database, comprising:
receiving a modification instruction of first data, wherein the modification instruction at least comprises identification and change information of the first data;
under the condition that the modification instruction passes verification, determining target data to be modified from multiple lines of second data of a database, and modifying the target data according to the change information, wherein the multiple lines of second data are obtained by splitting the first data, and the identification of the first data is determined as the identification of the multiple lines of second data; distributing the first data into the plurality of lines of second data according to a preset rule, wherein the plurality of lines of second data jointly form the first data; marking line serial numbers for the plurality of lines of second data in sequence from small to large according to the arrangement sequence of the plurality of lines of second data to finish splitting;
selecting a plurality of lines of second data from the plurality of lines of second data to determine the second data as the target data when the modification instruction is respectively sent by a plurality of dialogues and the modification instruction exists in a plurality of lines, wherein each line of second data corresponds to the dialogues one to one;
determining the change information from the modification instruction; determining one or more lines of second data, which are matched with the change information in a modification strategy, from the plurality of lines of second data as target data, and determining the value corresponding to the change information as a first value under the condition that the change information is a value and the value corresponding to the change information is greater than a preset value;
determining one or more rows of second data from the plurality of rows of second data as target data, wherein a modification policy of the target data supports modifying values in the target data according to the first values;
under the condition that the value corresponding to the change information is smaller than the preset value, determining the value corresponding to the change information as a second value;
determining one or more lines of second data from the plurality of lines of second data as target data, wherein a modification strategy of the target data supports modification of a numerical value in the target data according to the second numerical value;
and after the target data is modified, sending indication information, wherein the indication information is used for indicating that the first data is modified.
2. The method of claim 1, wherein determining the target data to be modified from the plurality of lines of second data comprises:
in a case where the modification instruction is issued by one dialog, one line of second data is selected from the plurality of lines of second data, and the selected line of second data is determined as the target data.
3. The method of claim 1, wherein the modification instruction is verified by:
acquiring change information in the modification instruction;
and determining that the modification instruction passes the verification under the condition that the value corresponding to the change information is matched with the value in the first data.
4. The method of claim 1, further comprising:
the plurality of lines of second data further comprise preset data, and the modification strategy of the preset data supports the modification of the numerical values in the preset data according to any target numerical value, wherein the target numerical value is a numerical value corresponding to the change information.
5. The method of claim 4, wherein in case that the value in the preset data does not match the target value, the method further comprises:
and modifying the numerical value in the preset data, wherein the modified numerical value in the preset data is not greater than the numerical value in the first data.
6. An apparatus for modifying data in a database, comprising:
the device comprises a receiving module, a processing module and a processing module, wherein the receiving module is used for receiving a modification instruction of first data, and the modification instruction at least comprises identification and change information of the first data;
a modification module, configured to determine target data to be modified from multiple lines of second data when the modification instruction passes verification, and modify the target data according to the change information, where the multiple lines of second data are obtained by splitting the first data, and an identifier of the first data is determined as an identifier of the multiple lines of second data; distributing the first data into the plurality of lines of second data according to a preset rule, wherein the plurality of lines of second data jointly form the first data; marking line serial numbers for the plurality of lines of second data in sequence from small to large according to the arrangement sequence of the plurality of lines of second data to finish splitting;
selecting a plurality of lines of second data from the plurality of lines of second data to determine the second data as the target data when the modification instruction is respectively sent by a plurality of dialogues and the modification instruction exists in a plurality of lines, wherein each line of second data corresponds to the dialogues one to one;
determining the change information from the modification instruction; determining one or more rows of second data with a modification strategy matched with the change information as target data from the plurality of rows of second data, and determining the value corresponding to the change information as a first value under the condition that the change information is a value and the value corresponding to the change information is greater than a preset value;
determining one or more lines of second data from the plurality of lines of second data as target data, wherein a modification strategy of the target data supports modification of a value in the target data according to the first value;
under the condition that the value corresponding to the change information is smaller than the preset value, determining the value corresponding to the change information as a second value;
determining one or more lines of second data from the plurality of lines of second data as target data, wherein a modification strategy of the target data supports modification of a numerical value in the target data according to the second numerical value;
and the sending module is used for sending indication information after the target data is modified, wherein the indication information is used for indicating that the first data is modified.
7. A non-volatile storage medium, comprising a stored program, wherein when the program runs, a device in which the non-volatile storage medium is located is controlled to execute the data modification method of the database according to any one of claims 1 to 5.
8. A computer device comprising a memory and a processor, the processor being configured to run a program, wherein the program when executed performs a method of modifying data in a database as claimed in any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211402301.8A CN115563086B (en) | 2022-11-10 | 2022-11-10 | Data modification method and device for database |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211402301.8A CN115563086B (en) | 2022-11-10 | 2022-11-10 | Data modification method and device for database |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115563086A CN115563086A (en) | 2023-01-03 |
CN115563086B true CN115563086B (en) | 2023-03-10 |
Family
ID=84770657
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211402301.8A Active CN115563086B (en) | 2022-11-10 | 2022-11-10 | Data modification method and device for database |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115563086B (en) |
Family Cites Families (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10963435B1 (en) * | 2017-07-10 | 2021-03-30 | Amazon Technologies, Inc. | Data validation of data migrated from a source database to a target database |
CN107679081B (en) * | 2017-08-30 | 2020-06-30 | 平安科技(深圳)有限公司 | Information modification method and device, computer equipment and computer readable storage medium |
CN110222046B (en) * | 2019-04-28 | 2023-11-03 | 北京奥星贝斯科技有限公司 | List data processing method, device, server and storage medium |
CN111209293A (en) * | 2019-12-31 | 2020-05-29 | 江苏创好业科技有限公司 | Data processing method |
CN111309740B (en) * | 2020-01-16 | 2024-08-13 | 建信金融科技有限责任公司 | Data processing method, device, equipment and storage medium |
CN112883045B (en) * | 2021-03-31 | 2024-05-17 | 中国工商银行股份有限公司 | Database transaction splitting execution method and device |
CN114553559B (en) * | 2022-02-25 | 2023-05-23 | 北京华云安信息技术有限公司 | Method and device for modifying protocol data in router and readable storage medium |
-
2022
- 2022-11-10 CN CN202211402301.8A patent/CN115563086B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN115563086A (en) | 2023-01-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109739873A (en) | A kind of business datum querying method, device, equipment and readable storage medium storing program for executing | |
US20160275603A1 (en) | Service processing method, device, and terminal | |
US20160179836A1 (en) | Method for updating data table of keyvalue database and apparatus for updating table data | |
CN111142746B (en) | System quota calculation method and device | |
CN111709777A (en) | Payment mode recommendation method, system, terminal device and storage medium | |
CN106998314B (en) | Account interaction method and device | |
CN110704486A (en) | Data processing method, device, system, storage medium and server | |
CN110941634A (en) | Data processing method and device, storage medium and electronic device | |
CN109146444B (en) | Virtual account creating method and device and account information updating method and device | |
CN115563086B (en) | Data modification method and device for database | |
CN108874553B (en) | Message pushing method, device and system, storage medium and processor | |
CN115641180A (en) | Request processing method, related device and equipment | |
CN110858201A (en) | Data processing method and system, processor and storage medium | |
CN109450963A (en) | Information push method and terminal device | |
CN108460002A (en) | Affiliate's automatic butt method, apparatus, equipment and storage medium | |
CN111400266B (en) | Data processing method and system, and diagnosis processing method and device for operation event | |
CN110677824A (en) | Short message sending method, device and storage medium | |
WO2019201053A1 (en) | Java card multi-application management method and java card | |
CN115511024A (en) | Multi-card-type instant card making method, system, equipment and medium | |
CN112100208B (en) | Method and device for forwarding operation request | |
CN114579506A (en) | Inter-processor communication method, system, storage medium, and processor | |
CN110706051B (en) | Order data aggregation method and device and server | |
CN109901933B (en) | Operation method and device of business system, storage medium and electronic device | |
CN113448939A (en) | Data archiving and storing method and device and storage medium | |
CN112199191A (en) | Data matching method, device and system for virtual transaction |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |