/[xmltv_parser]/trunk/GBPVRProgramDatabaseFixer/SQLLITE.cs
ViewVC logotype

Diff of /trunk/GBPVRProgramDatabaseFixer/SQLLITE.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/GBPVRProgramDatabaseFixer/SQLLITE.cs	2013/03/16 21:04:37	193
+++ trunk/GBPVRProgramDatabaseFixer/SQLLITE.cs	2013/03/16 21:37:29	194
@@ -845,7 +845,7 @@
         }
         public void UpdateGBPVRPrograms(List<IOldNewProgram> programs)
         {
-            int STEP = 100;
+            int STEP = 500;
             List<List<IPROGRAMME>> array_list = new List<List<IPROGRAMME>>(); // holds a list of ~STEP programs per index
             for (int i = 0; i < programs.Count;)
             {
@@ -864,9 +864,14 @@
             }
             array_list.TrimExcess();
 
+            int total = programs.Count;
+            int index = 0;
+            double progress = 0;
             foreach (var p in array_list)
             {
-                gLog.Info.WriteLine("Inserting {0} gbpvr programs.", p.Count);
+                progress = 100.0 * (index / total);
+               
+                gLog.Info.WriteLine("Inserting {0} gbpvr programs.", p.Count);                
                 Stopwatch st = new Stopwatch();
                 st.Start();
                 if (!InsertProgramEntryDatabase(p))
@@ -875,6 +880,8 @@
                 }
                 st.Stop();
                 gLog.Warn.WriteLine("    operation took: {0:0.00000} minutes", st.Elapsed.TotalMinutes);
+                gLog.ReportProgress(this, new ReportProgressEventArgs((int)progress, string.Format("Inserting GBPVR Programs: {0:00}%", (int)progress)));
+                index += p.Count;
             }          
 
         }
@@ -1008,10 +1015,12 @@
                 insert into table1 (field1,field2) values (value1,value2);
                 insert into table1 (field1,field2) values (value1,value2)
              */
+            builder.AppendLine("begin transaction;");
             foreach (var t in list)
             {
                 builder.AppendLine(BuildGBPVRSingleInsertCommand(t));
             }
+            builder.AppendLine("end transaction;");
             return builder.ToString();
         }
 

 

  ViewVC Help
Powered by ViewVC 1.1.22