1. Field of the Invention
The invention disclosed and claimed herein generally pertains to a method for preventing data from being lost or overwritten, when multiple authorized users edit the same data at the same time. More particularly, the invention pertains to a method of the above type wherein a two-set approach is used to avoid data loss, whenever a set of data from the database is accessed for editing. Even more particularly, the invention pertains to a two-set method of the above type wherein each authorized user can load the data onto a web page in order to modify the data.
2. Description of the Related Art
Very frequently, multiple administrators or other users are all authorized to access the same data, and are further authorized to edit or modify the data. In a common arrangement, each authorized user may access a website, whereupon the data is automatically loaded from a database onto a web page. The user may then work with the data, and change it or modify it as necessary. This arrangement could be used, for example, when software is being developed by a group comprising two or more members, including members that are located remotely from one another. Alternatively, the authorized users may have nothing to do with software development, but can modify a database through the provided web site. Generally, the most recently modified data is regarded as the most correct and accurate version thereof.
Typically, in arrangements of the above type a user will load a set of data from the database onto a web page, wherein the data set comprises a number of discrete data elements. The user then proceeds to modify some or all of the data elements in the set. At the end of his web session, he will write the data set from the web page back into the database. In accordance with a currently used write back procedure, each modified data element will replace the data element, in the original data set contained in the database, that corresponds to the modified data element. Also, each unmodified data element from the web page will replace its corresponding data element in the original data set in the database.
In the above currently used procedure, if the unmodified data elements from the web page are identical to the respective corresponding data elements they replace in the database, no problem will generally arise. However, it could happen, for example, that a first user accesses the original data set from the database, loads it to a web page, and modifies particular original data elements of the data set. While the first user is engaged in this effort, a second user also accesses the original data set from the database, and also modifies some of the original data elements, but does not modify the particular elements from their original forms. Then, if the first user writes his data set back to the database before the second user does so, the modified particular data elements will replace those elements in their respective original forms in the database. Thereafter, however, the second user will write his modified data set back to the database. When this happens, the unmodified data elements of the second user, that correspond to the particular data elements, will respectively replace the modified particular data elements in the database. The unmodified replacement elements, from the data set of the second user, are identical to the original particular data elements. Thus, the modifications made to the particular data elements by the first user are overwritten and lost.
It would be advantageous to provide a method or procedure for avoiding this type of data loss, wherein the procedure minimized the hardware and software resources needed therefor, and also minimized complexity.
A method is provided for modifying data in a database, wherein multiple users are each authorized to modify the data at the same time. The method comprises the steps of accessing a specified data set contained in the database, wherein the data set comprises multiple data elements, and forming first and second data sets that are initially both identical to the specified data set. At least some of the data elements of the first data set are selectively modified, while the second data set is kept or retained in an unchanged condition. The first and second data sets are then compared with one another in order to identify each of the modified data elements of the first data set, wherein each modified data element corresponds to a data element of the specified data set in the database. Each modified data element is written to the specified data set contained in the database, wherein each modified data element replaces its corresponding data element in the specified data set. However, other data elements of the specified data set are not replaced by any data elements of the first data set.
The novel features believed characteristic of the invention are set forth in the appended claims. The invention itself, however, as well as a preferred mode of use, further objectives and advantages thereof, will best be understood by reference to the following detailed description of an illustrative embodiment when read in conjunction with the accompanying drawings, wherein:
Referring to
Server 104 may be used to provide a website associated with a database 106 that contains specified data, wherein the specified data can be edited or modified by multiple authorized administrators or users. Each of the clients 108-112 is an exemplary computer or other work station, which can be operated by one of the authorized users to access the specified data from the database. Accessed data can be automatically loaded onto a web page at the website and displayed to a user. The user may then operate his workstation to edit the data and write the edited data back to the database, in accordance with an embodiment of the invention. Embodiments can be implemented by means of hardware and software components located at the server 104 and/or clients 108-112. Network configuration 100 may, of course, include additional servers, clients, and other devices not shown.
In the depicted example, network configuration 100 is the Internet, with network 102 representing a worldwide collection of networks and gateways that use the Transmission Control Protocol/Internet Protocol (TCP/IP) suite of protocols to communicate with one another. At the heart of the Internet is a backbone of high-speed data communication lines between major nodes or host computers, consisting of thousands of commercial, government, educational and other computer systems that route data and messages. Of course, network configuration 100 also may be implemented as a number of different types of networks, such as for example, an intranet, a local area network (LAN), or a wide area network (WAN).
Referring to
In data processing system 200, local area network (LAN) adapter 212 connects to south bridge and I/O controller hub 204. Audio adapter 216, keyboard and mouse adapter 220, modem 222, read only memory (ROM) 224, hard disk drive (HDD) 226, CD-ROM drive 230, universal serial bus (USB) ports and other communications ports 232, and PCI/PCIe devices 234 connect to south bridge and I/O controller hub 204 through bus 238 and bus 240. PCI/PCIe devices may include, for example, Ethernet adapters, add-in cards and PC cards for notebook computers. PCI uses a card bus controller, while PCIe does not. ROM 224 may be, for example, a flash binary input/output system (BIOS).
Hard disk drive 226 and CD-ROM drive 230 connect to south bridge and I/O controller hub 204 through bus 240. Hard disk drive 226 and CD-ROM drive 230 may use, for example, an integrated drive electronics (IDE) or serial advanced technology attachment (SATA) interface. Super I/O (SIO) device 236 may be connected to south bridge and I/O controller hub 204.
An operating system runs on processing unit 206 and coordinates and provides control of various components within data processing system 200 in
As a server, data processing system 200 may be, for example, an IBM eServer™ pSeries® computer system, running the Advanced Interactive Executive (AIX®) operating system or LINUX operating system (eServer, pSeries and AIX are trademarks of International Business Machines Corporation in the United States, other countries, or both while Linux is a trademark of Linus Torvalds in the United States, other countries, or both). Data processing system 200 may be a symmetric multiprocessor (SMP) system including a plurality of processors in processing unit 206. Alternatively, a single processor system may be employed.
Instructions for the operating system, the object-oriented programming system, and applications or programs are located on storage devices, such as hard disk drive 226, and may be loaded into main memory 208 for execution by processing unit 206. The processes for embodiments of the present invention are performed by processing unit 206 using computer usable program code, which may be located in a memory such as, for example, main memory 208, read only memory 224, or in one or more peripheral devices 226 and 230.
Those of ordinary skill in the art will appreciate that the hardware in
Referring to
At time T1, a user A retrieves a data set from a location in database 106 or the like, wherein the data set comprises discrete data elements (d1,d2,d3,d4). In accordance with the embodiment of the invention, two data sets I and II are formed or created from the retrieved data. Thus, data set I and data set II each comprises the data elements (d1,d2,d3,d4), so that initially the two data sets are identical. When a user accesses a web site, data retrieved from a database and displayed on the web page are saved into two data sets. More particularly the web program associated with the web site creates data sets which may be variable arrays (or may be discrete variables or any other form), wherein each variable array saves one set of the retrieved data. After the user modifies data on the web page, he clicks the submit button on the web page. The program will process to modify the data in the first data set (or first variable array), based on the data displayed on the web page, and then the program will compare the first data set (first variable array) with the second data set (second variable array), which is unchanged. The second data set thus serves as a reference. User A may operate a client such as client 108, in order to carry out the events of set 302 at time T1. Also, it is to be understood that user A is one of multiple administrators, who are each authorized to simultaneously edit or modify data that was retrieved from the database.
At time T2, in connection with events at 304, a user B retrieves the data set from the same database location that was accessed by user A. Moreover, the time period between T1 and T2 is quite short, so that the data set at the database location is not changed during such time period. Accordingly, the data set retrieved by user B likewise comprises the data elements (d1,d2,d3,d4). Also at time T2, the two data sets I and II are again created, each initially comprising the elements (d1,d2,d3,d4). Data set I is loaded onto a web page of the website, and is displayed on the web page to user B. Data set II is stored so that it will remain unchanged. User B operates a client such as client 110 in order to carry out the events of set 304, at time T2. Users A and B may be remotely located from one another, and user B, in like manner with user A, is one of multiple administrators authorized to edit data that is retrieved from the database.
At time T3, in connection with event set 306, user A modifies data set I to produce a data set IA (d1-a,d2,d3,d4). The data set IA is then compared with the unchanged reference data set II, in order to identify any elements of data set IA that were modified by user A from the retrieved data set I. Usefully, the comparison procedure is carried out by comparing each data element of data set IA with the corresponding data element of set II. Each element in set IA that is found to be different from its corresponding data set II element is considered to be a modified data element. In the event set 306, only the data element corresponding to d1 was modified in set IA, to d1-a. Accordingly, only d1-a is written to the data set at the database location, in order to replace the corresponding data element d1 and to update such element to d1-a. It is to be emphasized that no other change is made to the data set in the database, as the result of the events of event set 306.
At time T4, user B modifies data set I to produce a data set IB (d1,d2,d3-b,d4). The data set IB is then compared with the unchanged reference data set II, in order to identify any elements of data set IB that were modified from the retrieved data set. In event set 308, only the data element corresponding to d3 was modified in IB, to d3-b. Thus, only d3-b is written to the data set at the database location, to replace the corresponding data element d3 and update such element position to d3-b. No other change is made to the data set in the database, as a result of events of event set 308. It is anticipated that an algorithm could be readily constructed to carry out the comparing and data writing tasks described above in connection with the events of event sets 306 and 308.
By following the procedure disclosed in
On the other hand, if a prior art procedure had been used instead of the embodiment of the invention, data set IA, in its entirety, would have been used at T3 to update the data set in the database. Thus, the data in the database would have become (d1-a,d2,d3,d4). Then, at time T4 the entire data set IB would have been written to the data set in the database. This would have made the final data set to be (d1,d2,d3-b,d4). This is clearly incorrect, since in this set the data element d1-a, the modification of user A, has been lost.
Referring to
Referring further to
While the method of
The invention can take the form of an entirely software embodiment or an embodiment containing both hardware and software elements. In a preferred embodiment, the invention is implemented in software, which includes but is not limited to firmware, resident software, microcode, etc.
Furthermore, the invention can take the form of a computer program product accessible from a computer-usable or computer-readable medium providing program code for use by or in connection with a computer or any instruction execution system. For the purposes of this description, a computer-usable or computer readable medium can be any tangible apparatus that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device.
The medium can be an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system (or apparatus or device) or a propagation medium. Examples of a computer-readable medium include a semiconductor or solid state memory, magnetic tape, a removable computer diskette, a random access memory (RAM), a read-only memory (ROM), a rigid magnetic disk and an optical disk. Current examples of optical disks include compact disk-read only memory (CD-ROM), compact disk—read/write (CD-R/W) and DVD.
Further, a computer storage medium may contain or store a computer readable program code such that when the computer readable program code is executed on a computer, the execution of this computer readable program code causes the computer to transmit another computer readable program code over a communications link. This communications link may use a medium that is, for example without limitation, physical or wireless.
A data processing system suitable for storing and/or executing program code will include at least one processor coupled directly or indirectly to memory elements through a system bus. The memory elements can include local memory employed during actual execution of the program code, bulk storage, and cache memories which provide temporary storage of at least some program code in order to reduce the number of times code must be retrieved from bulk storage during execution.
Input/output or I/O devices (including but not limited to keyboards, displays, pointing devices, etc.) can be coupled to the system either directly or through intervening I/O controllers.
Network adapters may also be coupled to the system to enable the data processing system to become coupled to other data processing systems or remote printers or storage devices through intervening private or public networks. Modems, cable modem and Ethernet cards are just a few of the currently available types of network adapters.
The description of the present invention has been presented for purposes of illustration and description, and is not intended to be exhaustive or limited to the invention in the form disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art. The embodiment was chosen and described in order to best explain the principles of the invention, the practical application, and to enable others of ordinary skill in the art to understand the invention for various embodiments with various modifications as are suited to the particular use contemplated.