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 178 : Return db_primary_consider_vacuum(void)
10 : {
11 : /// The status that will be passed to return() before exiting.
12 : /// By default, the function worked without errors.
13 178 : Return status = SUCCESS;
14 :
15 : /* Interrupt the function smoothly */
16 : /* Interrupt when Ctrl+C */
17 178 : if(global_interrupt_flag == true)
18 : {
19 0 : provide(status);
20 : }
21 :
22 : // Don't do anything
23 178 : if(config->compare == true)
24 : {
25 32 : slog(TRACE,"Comparison mode is enabled. The primary database doesn't require vacuuming\n");
26 32 : provide(status);
27 :
28 146 : } else if(config->dry_run == true){
29 10 : slog(TRACE,"Dry Run mode is enabled. The primary database doesn't require vacuuming\n");
30 10 : provide(status);
31 :
32 136 : } else if(config->db_primary_file_modified == false){
33 20 : slog(TRACE,"No changes were made. The primary database doesn't require vacuuming\n");
34 20 : provide(status);
35 : }
36 :
37 : /* Vacuum the primary database */
38 116 : status = db_vacuum(config->db_primary_file_path);
39 :
40 116 : provide(status);
41 : }
|