Branch data Line data Source code
1 : : #include "precizer.h"
2 : :
3 : : /**
4 : : *
5 : : * The VACUUM command rebuilds the database file,
6 : : * repacking it into a minimal amount of disk space.
7 : : *
8 : : */
9 : 613 : Return db_primary_consider_vacuum(void)
10 : : {
11 : : /* Status returned by this function through provide()
12 : : Default value assumes successful completion */
13 : 613 : Return status = SUCCESS;
14 : :
15 : : /* Interrupt the function smoothly */
16 : : /* Interrupt when Ctrl+C */
17 [ - + ]: 613 : if(global_interrupt_flag == true)
18 : : {
19 : 0 : provide(status);
20 : : }
21 : :
22 : : // Don't do anything
23 [ + + ]: 613 : if(config->compare == true)
24 : : {
25 : 142 : slog(TRACE,"Comparison mode is enabled. The primary database doesn't require vacuuming\n");
26 : 142 : provide(status);
27 : :
28 [ + + ]: 471 : } else if(config->dry_run == true){
29 : 115 : slog(TRACE,"Dry Run mode is enabled. The primary database doesn't require vacuuming\n");
30 : 115 : provide(status);
31 : :
32 [ + + ]: 356 : } else if(config->db_primary_file_modified == false){
33 : 41 : slog(TRACE,"No changes were made. The primary database doesn't require vacuuming\n");
34 : 41 : provide(status);
35 : : }
36 : :
37 : : /* Vacuum the primary database */
38 : 315 : status = db_vacuum(confstr(db_primary_file_path));
39 : :
40 : 315 : provide(status);
41 : : }
|