Option Explicit
Option Compare Database
'------------------------------------------------------------------------
'//MC_DB Class
'
'//Each MC_DB object is a database to be compacted
'//MC_DB's should not be created directly but only through
'//the Add method of the MC_CompactDB Class
'------------------------------------------------------------------------
Private sDBPath As String
Private iBackupRetention As Long
Private sBackupFolder As String
Private sLogFilePath As String
Private bAttemptToDeleteLockFile As Boolean
Private mstrMB_Pre As String
Private mstrMB_Post As String
Private dummy As String
Public Property Get DBPath() As String
DBPath = sDBPath
End Property
Public Property Let DBPath(ByVal arg As String)
sDBPath = arg
End Property
Public Property Get BackupFolder() As String
BackupFolder = sBackupFolder
End Property
Public Property Let BackupFolder(ByVal FolderNameOrPath As String)
Dim s(2) As String
sBackupFolder = Trim(FolderNameOrPath)
'//Remove trailing path separator
If Right(sBackupFolder, "1") = "\" Then
sBackupFolder = Left(sBackupFolder, Len(sBackupFolder) - 1)
End If
'----------------------------------------------------------------------------------
'//Empty folder names --> use DB folder
If Len(sBackupFolder) = 0 Then
s(0) = sDBPath
s(1) = StrReverse(Left(StrReverse(s(0)), InStr(1, StrReverse(s(0)), "\") - 1))
sBackupFolder = Left(s(0), Len(s(0)) - Len(s(1)) - 1)
'//Folder names with directory paths --> full paths
ElseIf InStr(1, FolderNameOrPath, "\") > 0 Then
sBackupFolder = FolderNameOrPath
Else
'//Folder names without directory paths --> children of the DB folder
s(0) = sDBPath
s(1) = StrReverse(Left(StrReverse(s(0)), InStr(1, StrReverse(s(0)), "\") - 1))
s(2) = Left(s(0), Len(s(0)) - Len(s(1)) - 1)
sBackupFolder = s(2) & "\" & FolderNameOrPath
End If
'----------------------------------------------------------------------------------
End Property
Public Property Get BackupRetention() As Long
BackupRetention = iBackupRetention
End Property
Public Property Let BackupRetention(ByVal arg As Long)
iBackupRetention = arg
End Property
Public Property Get LogFilePath() As String
LogFilePath = sLogFilePath
End Property
Public Property Let LogFilePath(ByVal arg As String)
sLogFilePath = arg
End Property
Public Property Get AttemptToDeleteLockFile() As Boolean
AttemptToDeleteLockFile = bAttemptToDeleteLockFile
End Property
Public Property Let AttemptToDeleteLockFile(ByVal arg As Boolean)
bAttemptToDeleteLockFile = arg
End Property
Public Property Let MB_pre(ByVal arg As String)
Dim X As Double
If IsNumeric(arg) Then
If arg > 0 Then
X = CLng(arg)
mstrMB_Pre = Format(Round((X / 2 ^ 20), 1), "#0.0")
mstrMB_Pre = mstrMB_Pre & " MB"
End If
End If
End Property
Public Property Get MB_pre() As String
MB_pre = mstrMB_Pre
End Property
Public Property Let MB_post(ByVal arg As String)
Dim X As Double
If IsNumeric(arg) Then
If arg > 0 Then
X = CLng(arg)
mstrMB_Post = Format(Round((X / 2 ^ 20), 1), "#0.0")
mstrMB_Post = mstrMB_Post & " MB"
End If
End If
End Property
Public Property Get MB_post() As String
MB_post = mstrMB_Post
End Property