10.10.4. Securely adding rows to a database table

<< Click to Display Table of Contents >>

Navigation:  10. FAQ > 10.10. Working with Databases >

10.10.4. Securely adding rows to a database table

 

Let’s assume that we want to add a few rows in a table (i.e. we will not refresh the entire table as in the section 10.10.2. but just add a few rows). Let’s also assume that the computer might crash (or power off) while uploading these new rows into the database. In such situation, there will only be a small part of the rows that will be loaded into the database and it’s difficult to properly restart the upload procedure: i.e. If we simply restart from scratch the upload process a second time, we will have some duplicated rows. This section offers some simple solution that guarantee that no rows will ever be lost or duplicated, even in the case of computer crash (or power off).

 

Let’s categorize this “upload procedure” into 2 different problems:
 

1.There exist a Primary Key (that is an increasing number) inside the table to upload: See the next section 10.10.4.1.
 

2.There are no “usable” Primary Key inside the table to upload: See section 10.10.4.2.