Download RELAXML
Transcript
4.4. Import 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 43 Int ommitInterval 1 to iOrder.length do tableList iOrder[i℄ while iterator has more data rows do row iterator.next() HandleDataRow(row, plan, tableList, 1) ounter ounter + 1 if (Int 6= 1) and (ounter mod Int = 0) then for i commit reparse - reset iterator if postponedColumns is not empty then while iterator has more data rows do row iterator.next() HandleDataRow(row, plan, postponedColumns, 2) ounter ounter + 1 if (Int 6= 1) and (ounter mod Int = 0) then commit commit As shown in the algorithm, we handle all non-postponed columns in phase 1 and as a final step we enter phase 2 and handle all the postponed columns in one run. In the following, we present the function HandleDataRow of the importer. The inserter, updater and merger have specializations of the functions HandlePKPresent and HandlePKNotPresent which we denote row handlers. Algorithm 4.6 HandleDataRow of the importer Requires: The data row to handle row, an execution plan plan, a tableList which refers to the list of the insertion order to handle now, the phase which shows if we should handle postponed columns Ensures: The data of row is imported to the database according to the chosen import operation. 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: function H ANDLE D ATA R OW(row, plan, tableList, phase) for each table t in tableList do for each concept which includes the table t (consider the columns of row) do if all columns ol of t that are included from are null then skip – outer joins implies null tuples else mathP K Â test for presence of primary key in the database if mathP K then HandlePKPresent(, t, row, phase) else HandlePKNotPresent(, t, row)