Abstract:
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 elements 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. However, other data elements of the specified data set are not replaced by contents of the first data set.

Description:
BACKGROUND OF THE INVENTION 
       [0001]    1. Field of the Invention 
         [0002]    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. 
         [0003]    2. Description of the Related Art 
         [0004]    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. 
         [0005]    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. 
         [0006]    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. 
         [0007]    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. 
       SUMMARY OF THE INVENTION 
       [0008]    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. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0009]    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: 
           [0010]      FIG. 1  is a block diagram showing a network of data processing systems that may be used in implementing embodiments of the invention. 
           [0011]      FIG. 2  is a block diagram showing a computer or data processing system that may be used in implementing embodiments of the invention. 
           [0012]      FIG. 3  is a schematic diagram for illustrating concepts and principles of embodiments of the invention. 
           [0013]      FIG. 4  is a flowchart that depicts principal steps for an embodiment of the invention. 
       
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT 
       [0014]      FIGS. 1 and 2  are provided as exemplary diagrams of data processing environments in which embodiments of the present invention may be implemented. 
         [0015]      FIGS. 1 and 2  are only examples, and are not intended to limit embodiments of the invention in any way. Many modifications to the depicted environments may be made without departing from the spirit and scope of the present invention. 
         [0016]    Referring to  FIG. 1 , there is shown a pictorial representation of a network of computers or data processing systems in which embodiments of the present invention may be implemented. A configuration of linked or networked data processing systems  100  contains a network  102 , which is the medium used to provide communication links between various devices and computers connected together within configuration  100 . Network  102  may include connections, such as wire, wireless communication links, or fiber optic cables. In the depicted example, server  104  connects to network  102  along with storage unit  108 . In addition, clients  108 ,  110 , and  112  connect to network  102 . 
         [0017]    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. 
         [0018]    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).  FIG. 1  is intended as an example, and not as an architectural limitation for different embodiments of the present invention. 
         [0019]    Referring to  FIG. 2 , there is shown a data processing system  200  that may be used in implementing embodiments of the invention. Data processing system  200  is an example of a computer, such as server  104  or client  108  in  FIG. 1 , in which computer usable code or instructions implementing the processes for embodiments of the present invention may be located. Data processing system  200  employs a hub architecture including north bridge and memory controller hub (MCH)  202  and south bridge and input/output (I/O) controller hub (ICH)  204 . Processing unit  206 , main memory  208 , and graphics processor  210  are connected to north bridge and memory controller hub  202 . Graphics processor  210  may be connected to north bridge and memory controller hub  202  through an accelerated graphics port (AGP). 
         [0020]    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). 
         [0021]    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 . 
         [0022]    An operating system runs on processing unit  206  and coordinates and provides control of various components within data processing system  200  in  FIG. 2 . As a client, the operating system may be a commercially available operating system such as Microsoft® Windows® XP (Microsoft and Windows are trademarks of Microsoft Corporation in the United States, other countries, or both). An object-oriented programming system, such as the Java™ programming system, may run in conjunction with the operating system and provides calls to the operating system from Java programs or applications executing on data processing system  200  (Java is a trademark of Sun Microsystems, Inc. in the United States, other countries, or both). 
         [0023]    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. 
         [0024]    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 . 
         [0025]    Those of ordinary skill in the art will appreciate that the hardware in  FIGS. 1 and 2  may vary depending on the implementation. Also, the processes of the present invention may be applied to a multiprocessor data processing system. 
         [0026]    Referring to  FIG. 3 , there is shown a schematic diagram comprising a chart that extends along a timeline, in order to illustrate basic principles of an embodiment of the invention. More particularly,  FIG. 3  shows sets of events  302 - 308 , which occur in sequence at times T 1 -T 4 , respectively. 
         [0027]    At time T 1 , a user A retrieves a data set from a location in database  106  or the like, wherein the data set comprises discrete data elements (d 1 ,d 2 ,d 3 ,d 4 ). 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 (d 1 ,d 2 ,d 3 ,d 4 ), 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 T 1 . 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. 
         [0028]    At time T 2 , 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 T 1  and T 2  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 (d 1 ,d 2 ,d 3 ,d 4 ). Also at time T 2 , the two data sets I and II are again created, each initially comprising the elements (d 1 ,d 2 ,d 3 ,d 4 ). 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 T 2 . 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. 
         [0029]    At time T 3 , in connection with event set  306 , user A modifies data set I to produce a data set I A  (d 1 - a ,d 2 ,d 3 ,d 4 ). The data set I A  is then compared with the unchanged reference data set II, in order to identify any elements of data set I A  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 I A  with the corresponding data element of set II. Each element in set I A  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 d 1  was modified in set I A , to d 1 - a . Accordingly, only d 1 - a  is written to the data set at the database location, in order to replace the corresponding data element d 1  and to update such element to d 1 - 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 . 
         [0030]    At time T 4 , user B modifies data set I to produce a data set I B  (d 1 ,d 2 ,d 3 - b ,d 4 ). The data set I B  is then compared with the unchanged reference data set II, in order to identify any elements of data set I B  that were modified from the retrieved data set. In event set  308 , only the data element corresponding to d 3  was modified in I B , to d 3 - b . Thus, only d 3 - b  is written to the data set at the database location, to replace the corresponding data element d 3  and update such element position to d 3 - 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 . 
         [0031]    By following the procedure disclosed in  FIG. 3 , the data set in the database becomes (d 1 - a ,d 2 ,d 3 - b ,d 4 ), after the sessions of users A and B have both ended following time T 4 . This is clearly correct, since the data set includes all of the modifications made by both user A and user B that were not changed by later modifications. The same result would have been achieved if user B had ended his session before user A. 
         [0032]    On the other hand, if a prior art procedure had been used instead of the embodiment of the invention, data set I A , in its entirety, would have been used at T 3  to update the data set in the database. Thus, the data in the database would have become (d 1 - a ,d 2 ,d 3 ,d 4 ). Then, at time T 4  the entire data set I B  would have been written to the data set in the database. This would have made the final data set to be (d 1 ,d 2 ,d 3 - b ,d 4 ). This is clearly incorrect, since in this set the data element d 1 - a , the modification of user A, has been lost. 
         [0033]    Referring to  FIG. 4 , there is shown a flowchart summarizing principal steps for a method comprising an embodiment of the invention. The method of  FIG. 4  can be carried out by each of multiple users, wherein each user is authorized to access and modify specified data at the same time. At step  402 , a data set comprising the elements (d 1 ,d 2 ,d 3 ,d 4 ) is obtained from a database and loaded to a web page. At step  404 , this data is saved or formed into two initially identical data sets, data set  1  and data set  2 . 
         [0034]    Referring further to  FIG. 4 , step  406  shows that data set  1  is modified, for example, to change the data set to (d 1 - a ,d 2 ,d 3 ,d 4 ). As described above, after data has been loaded on a web page from the database, the data shown on the web page are saved into two data sets  1  and  2 . Data set  1  will be modified after the user has made modifications and then submits the modified web page. Step  406  further shows that data set  2  remains unchanged, while data set  1  is being modified. At step  408 , data sets  1  and  2  are compared, such as by using procedures described above. If the comparison indicates that there has been no modification made to data set  1  that must be written to the database, the method of  FIG. 4  ends. Otherwise, each modified data elements of data set  1  must be written to update the data set in the database, as shown at step  410 . 
         [0035]    While the method of  FIG. 4  shows only data element d 1  of data set being modified to d 1 - a , in general such method can be used to modify either single or multiple data elements, during any given web session. Moreover, it is anticipated that if multiple users are all authorized to modify the same data, and if each of them adheres to the method of  FIG. 4  when making data modifications, loss of data as described above would be avoided. 
         [0036]    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. 
         [0037]    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. 
         [0038]    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. 
         [0039]    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. 
         [0040]    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. 
         [0041]    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. 
         [0042]    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. 
         [0043]    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.