@@ -52,37 +52,41 @@ public long Rebuild(RebuildOptions options)
5252 reader . Open ( ) ;
5353
5454 // open new engine to recive all data readed from FileReader
55- using var engine = new LiteEngine ( new EngineSettings
55+ using ( var engine = new LiteEngine ( new EngineSettings
5656 {
5757 Filename = tempFilename ,
5858 Collation = options . Collation ,
5959 Password = options . Password ,
60- } ) ;
61- // copy all database to new Log file with NO checkpoint during all rebuild
62- engine . Pragma ( Pragmas . CHECKPOINT , 0 ) ;
60+ } ) )
61+ {
62+ // copy all database to new Log file with NO checkpoint during all rebuild
63+ engine . Pragma ( Pragmas . CHECKPOINT , 0 ) ;
64+ // copy all database to new Log file with NO checkpoint during all rebuild
65+ engine . Pragma ( Pragmas . CHECKPOINT , 0 ) ;
6366
64- // rebuild all content from reader into new engine
65- engine . RebuildContent ( reader ) ;
67+ // rebuild all content from reader into new engine
68+ engine . RebuildContent ( reader ) ;
6669
67- // insert error report
68- if ( options . IncludeErrorReport && options . Errors . Count > 0 )
69- {
70- var report = options . GetErrorReport ( ) ;
70+ // insert error report
71+ if ( options . IncludeErrorReport && options . Errors . Count > 0 )
72+ {
73+ var report = options . GetErrorReport ( ) ;
7174
72- engine . Insert ( "_rebuild_errors" , report , BsonAutoId . Int32 ) ;
73- }
75+ engine . Insert ( "_rebuild_errors" , report , BsonAutoId . Int32 ) ;
76+ }
7477
75- // update pragmas
76- var pragmas = reader . GetPragmas ( ) ;
78+ // update pragmas
79+ var pragmas = reader . GetPragmas ( ) ;
7780
78- engine . Pragma ( Pragmas . CHECKPOINT , pragmas [ Pragmas . CHECKPOINT ] ) ;
79- engine . Pragma ( Pragmas . TIMEOUT , pragmas [ Pragmas . TIMEOUT ] ) ;
80- engine . Pragma ( Pragmas . LIMIT_SIZE , pragmas [ Pragmas . LIMIT_SIZE ] ) ;
81- engine . Pragma ( Pragmas . UTC_DATE , pragmas [ Pragmas . UTC_DATE ] ) ;
82- engine . Pragma ( Pragmas . USER_VERSION , pragmas [ Pragmas . USER_VERSION ] ) ;
81+ engine . Pragma ( Pragmas . CHECKPOINT , pragmas [ Pragmas . CHECKPOINT ] ) ;
82+ engine . Pragma ( Pragmas . TIMEOUT , pragmas [ Pragmas . TIMEOUT ] ) ;
83+ engine . Pragma ( Pragmas . LIMIT_SIZE , pragmas [ Pragmas . LIMIT_SIZE ] ) ;
84+ engine . Pragma ( Pragmas . UTC_DATE , pragmas [ Pragmas . UTC_DATE ] ) ;
85+ engine . Pragma ( Pragmas . USER_VERSION , pragmas [ Pragmas . USER_VERSION ] ) ;
8386
84- // after rebuild, copy log bytes into data file
85- engine . Checkpoint ( ) ;
87+ // after rebuild, copy log bytes into data file
88+ engine . Checkpoint ( ) ;
89+ }
8690 }
8791
8892 // if log file exists, rename as backup file
0 commit comments