|
|
@@ -190,7 +190,7 @@ next_doc:
|
|
|
Call SysCmd(4, "Export tables")
|
|
|
obj_path = source_path & "tables\"
|
|
|
VCS_Dir.MkDirIfNotExist Left$(obj_path, InStrRev(obj_path, "\"))
|
|
|
- VCS_Dir.ClearTextFilesFromDir obj_path, "txt"
|
|
|
+ VCS_Dir.ClearTextFilesFromDir obj_path, "txt", True
|
|
|
|
|
|
Dim td As DAO.TableDef
|
|
|
Dim tds As DAO.TableDefs
|
|
|
@@ -215,15 +215,14 @@ next_doc:
|
|
|
|
|
|
Debug.Print VCS_String.PadRight("Exporting " & obj_type_label & "...", 24);
|
|
|
|
|
|
+ Dim update_this_tabledef As Boolean
|
|
|
+
|
|
|
For Each td In tds
|
|
|
|
|
|
'### 11/10/2016: add optimizer
|
|
|
- If optimizer_activated() Then
|
|
|
- If Not is_dirty(acTable, td.name) Then
|
|
|
- obj_count = obj_count + 1
|
|
|
- GoTo next_td
|
|
|
- End If
|
|
|
- End If
|
|
|
+ 'only update the table definition if this is a complete export
|
|
|
+ 'or if the table definition has been modified since last export
|
|
|
+ update_this_tabledef = (Not optimizer_activated() Or is_dirty(acTable, td.name))
|
|
|
'###
|
|
|
|
|
|
If Not IsValidFileName(td.name) Then
|
|
|
@@ -239,7 +238,11 @@ next_doc:
|
|
|
Left$(td.name, 1) <> "~" Then
|
|
|
|
|
|
If Len(td.connect) = 0 Then ' this is not an external table
|
|
|
- VCS_Table.ExportTableDef Db, td, td.name, obj_path
|
|
|
+
|
|
|
+ If update_this_tabledef Then
|
|
|
+ VCS_Table.ExportTableDef Db, td, td.name, obj_path
|
|
|
+ End If
|
|
|
+
|
|
|
If include_tables = "*" Then
|
|
|
DoEvents
|
|
|
VCS_Table.ExportTableData CStr(td.name), source_path & "tables\"
|
|
|
@@ -258,7 +261,9 @@ Err_TableNotFound:
|
|
|
'else don't export table data
|
|
|
End If
|
|
|
Else
|
|
|
- VCS_Table.ExportLinkedTable td.name, obj_path
|
|
|
+ If update_this_tabledef Then
|
|
|
+ VCS_Table.ExportLinkedTable td.name, obj_path
|
|
|
+ End If
|
|
|
End If
|
|
|
|
|
|
obj_count = obj_count + 1
|
|
|
@@ -282,7 +287,7 @@ next_td:
|
|
|
obj_path = source_path & "relations\"
|
|
|
VCS_Dir.MkDirIfNotExist Left$(obj_path, InStrRev(obj_path, "\"))
|
|
|
|
|
|
- VCS_Dir.ClearTextFilesFromDir obj_path, "txt"
|
|
|
+ VCS_Dir.ClearTextFilesFromDir obj_path, "txt", True
|
|
|
|
|
|
Dim aRelation As DAO.Relation
|
|
|
|
|
|
@@ -298,6 +303,18 @@ next_td:
|
|
|
Next
|
|
|
Debug.Print "[" & obj_count & "]"
|
|
|
|
|
|
+ '### 13/10/2016: add optimizer
|
|
|
+ ' cleans the obsolete files (see CleanDirs in optimizer)
|
|
|
+ If optimizer_activated() Then
|
|
|
+ Call SysCmd(4, "Cleans the directories")
|
|
|
+ Debug.Print VCS_String.PadRight("Cleans the directories", 24);
|
|
|
+
|
|
|
+ Call CleanDirs
|
|
|
+
|
|
|
+ End If
|
|
|
+ '###
|
|
|
+
|
|
|
+ Call SysCmd(4, "Export done")
|
|
|
Debug.Print "Done."
|
|
|
End Sub
|
|
|
|
|
|
@@ -314,7 +331,7 @@ Public Sub ImportAllSource()
|
|
|
Dim obj_type_label As String
|
|
|
Dim obj_type_num As Integer
|
|
|
Dim obj_count As Integer
|
|
|
- Dim fileName As String
|
|
|
+ Dim filename As String
|
|
|
Dim obj_name As String
|
|
|
Dim ucs2 As Boolean
|
|
|
|
|
|
@@ -342,22 +359,22 @@ Public Sub ImportAllSource()
|
|
|
End If
|
|
|
|
|
|
obj_path = source_path & "queries\"
|
|
|
- fileName = dir$(obj_path & "*.bas")
|
|
|
+ filename = dir$(obj_path & "*.bas")
|
|
|
|
|
|
Dim tempFilePath As String
|
|
|
tempFilePath = VCS_File.TempFile()
|
|
|
|
|
|
- If Len(fileName) > 0 Then
|
|
|
+ If Len(filename) > 0 Then
|
|
|
Debug.Print VCS_String.PadRight("Importing queries...", 24);
|
|
|
obj_count = 0
|
|
|
- Do Until Len(fileName) = 0
|
|
|
+ Do Until Len(filename) = 0
|
|
|
DoEvents
|
|
|
- obj_name = Mid$(fileName, 1, InStrRev(fileName, ".") - 1)
|
|
|
- VCS_IE_Functions.ImportObject acQuery, obj_name, obj_path & fileName, VCS_File.UsingUcs2
|
|
|
+ obj_name = Mid$(filename, 1, InStrRev(filename, ".") - 1)
|
|
|
+ VCS_IE_Functions.ImportObject acQuery, obj_name, obj_path & filename, VCS_File.UsingUcs2
|
|
|
VCS_IE_Functions.ExportObject acQuery, obj_name, tempFilePath, VCS_File.UsingUcs2
|
|
|
VCS_IE_Functions.ImportObject acQuery, obj_name, tempFilePath, VCS_File.UsingUcs2
|
|
|
obj_count = obj_count + 1
|
|
|
- fileName = dir$()
|
|
|
+ filename = dir$()
|
|
|
Loop
|
|
|
Debug.Print "[" & obj_count & "]"
|
|
|
End If
|
|
|
@@ -369,12 +386,12 @@ Public Sub ImportAllSource()
|
|
|
|
|
|
' restore table definitions
|
|
|
obj_path = source_path & "tbldef\"
|
|
|
- fileName = dir$(obj_path & "*.sql")
|
|
|
- If Len(fileName) > 0 Then
|
|
|
+ filename = dir$(obj_path & "*.sql")
|
|
|
+ If Len(filename) > 0 Then
|
|
|
Debug.Print VCS_String.PadRight("Importing tabledefs...", 24);
|
|
|
obj_count = 0
|
|
|
- Do Until Len(fileName) = 0
|
|
|
- obj_name = Mid$(fileName, 1, InStrRev(fileName, ".") - 1)
|
|
|
+ Do Until Len(filename) = 0
|
|
|
+ obj_name = Mid$(filename, 1, InStrRev(filename, ".") - 1)
|
|
|
If DebugOutput Then
|
|
|
If obj_count = 0 Then
|
|
|
Debug.Print
|
|
|
@@ -384,7 +401,7 @@ Public Sub ImportAllSource()
|
|
|
End If
|
|
|
VCS_Table.ImportTableDef CStr(obj_name), obj_path
|
|
|
obj_count = obj_count + 1
|
|
|
- fileName = dir$()
|
|
|
+ filename = dir$()
|
|
|
Loop
|
|
|
Debug.Print "[" & obj_count & "]"
|
|
|
End If
|
|
|
@@ -393,12 +410,12 @@ Public Sub ImportAllSource()
|
|
|
SysCmd acSysCmdUpdateMeter, counter
|
|
|
|
|
|
' restore linked tables - we must have access to the remote store to import these!
|
|
|
- fileName = dir$(obj_path & "*.LNKD")
|
|
|
- If Len(fileName) > 0 Then
|
|
|
+ filename = dir$(obj_path & "*.LNKD")
|
|
|
+ If Len(filename) > 0 Then
|
|
|
Debug.Print VCS_String.PadRight("Importing Linked tabledefs...", 24);
|
|
|
obj_count = 0
|
|
|
- Do Until Len(fileName) = 0
|
|
|
- obj_name = Mid$(fileName, 1, InStrRev(fileName, ".") - 1)
|
|
|
+ Do Until Len(filename) = 0
|
|
|
+ obj_name = Mid$(filename, 1, InStrRev(filename, ".") - 1)
|
|
|
If DebugOutput Then
|
|
|
If obj_count = 0 Then
|
|
|
Debug.Print
|
|
|
@@ -408,7 +425,7 @@ Public Sub ImportAllSource()
|
|
|
End If
|
|
|
VCS_Table.ImportLinkedTable CStr(obj_name), obj_path
|
|
|
obj_count = obj_count + 1
|
|
|
- fileName = dir$()
|
|
|
+ filename = dir$()
|
|
|
Loop
|
|
|
Debug.Print "[" & obj_count & "]"
|
|
|
End If
|
|
|
@@ -418,16 +435,16 @@ Public Sub ImportAllSource()
|
|
|
|
|
|
' NOW we may load data
|
|
|
obj_path = source_path & "tables\"
|
|
|
- fileName = dir$(obj_path & "*.txt")
|
|
|
- If Len(fileName) > 0 Then
|
|
|
+ filename = dir$(obj_path & "*.txt")
|
|
|
+ If Len(filename) > 0 Then
|
|
|
Debug.Print VCS_String.PadRight("Importing tables...", 24);
|
|
|
obj_count = 0
|
|
|
- Do Until Len(fileName) = 0
|
|
|
+ Do Until Len(filename) = 0
|
|
|
DoEvents
|
|
|
- obj_name = Mid$(fileName, 1, InStrRev(fileName, ".") - 1)
|
|
|
+ obj_name = Mid$(filename, 1, InStrRev(filename, ".") - 1)
|
|
|
VCS_Table.ImportTableData CStr(obj_name), obj_path
|
|
|
obj_count = obj_count + 1
|
|
|
- fileName = dir$()
|
|
|
+ filename = dir$()
|
|
|
Loop
|
|
|
Debug.Print "[" & obj_count & "]"
|
|
|
End If
|
|
|
@@ -437,17 +454,17 @@ Public Sub ImportAllSource()
|
|
|
|
|
|
'load Data Macros - not DRY!
|
|
|
obj_path = source_path & "tbldef\"
|
|
|
- fileName = dir$(obj_path & "*.xml")
|
|
|
- If Len(fileName) > 0 Then
|
|
|
+ filename = dir$(obj_path & "*.xml")
|
|
|
+ If Len(filename) > 0 Then
|
|
|
Debug.Print VCS_String.PadRight("Importing Data Macros...", 24);
|
|
|
obj_count = 0
|
|
|
- Do Until Len(fileName) = 0
|
|
|
+ Do Until Len(filename) = 0
|
|
|
DoEvents
|
|
|
- obj_name = Mid$(fileName, 1, InStrRev(fileName, ".") - 1)
|
|
|
+ obj_name = Mid$(filename, 1, InStrRev(filename, ".") - 1)
|
|
|
'VCS_Table.ImportTableData CStr(obj_name), obj_path
|
|
|
VCS_DataMacro.ImportDataMacros obj_name, obj_path
|
|
|
obj_count = obj_count + 1
|
|
|
- fileName = dir$()
|
|
|
+ filename = dir$()
|
|
|
Loop
|
|
|
Debug.Print "[" & obj_count & "]"
|
|
|
End If
|
|
|
@@ -471,27 +488,27 @@ Public Sub ImportAllSource()
|
|
|
obj_path = source_path & obj_type_label & "\"
|
|
|
|
|
|
|
|
|
- fileName = dir$(obj_path & "*.bas")
|
|
|
- If Len(fileName) > 0 Then
|
|
|
+ filename = dir$(obj_path & "*.bas")
|
|
|
+ If Len(filename) > 0 Then
|
|
|
Debug.Print VCS_String.PadRight("Importing " & obj_type_label & "...", 24);
|
|
|
obj_count = 0
|
|
|
- Do Until Len(fileName) = 0
|
|
|
+ Do Until Len(filename) = 0
|
|
|
' DoEvents no good idea!
|
|
|
- obj_name = Mid$(fileName, 1, InStrRev(fileName, ".") - 1)
|
|
|
+ obj_name = Mid$(filename, 1, InStrRev(filename, ".") - 1)
|
|
|
If obj_type_label = "modules" Then
|
|
|
ucs2 = False
|
|
|
Else
|
|
|
ucs2 = VCS_File.UsingUcs2
|
|
|
End If
|
|
|
If IsNotVCS(obj_name) Then
|
|
|
- VCS_IE_Functions.ImportObject obj_type_num, obj_name, obj_path & fileName, ucs2
|
|
|
+ VCS_IE_Functions.ImportObject obj_type_num, obj_name, obj_path & filename, ucs2
|
|
|
obj_count = obj_count + 1
|
|
|
Else
|
|
|
If ArchiveMyself Then
|
|
|
MsgBox "Module " & obj_name & " could not be updated while running. Ensure latest version is included!", vbExclamation, "Warning"
|
|
|
End If
|
|
|
End If
|
|
|
- fileName = dir$()
|
|
|
+ filename = dir$()
|
|
|
Loop
|
|
|
Debug.Print "[" & obj_count & "]"
|
|
|
|
|
|
@@ -507,13 +524,13 @@ Public Sub ImportAllSource()
|
|
|
obj_count = 0
|
|
|
|
|
|
obj_path = source_path & "reports\"
|
|
|
- fileName = dir$(obj_path & "*.pv")
|
|
|
- Do Until Len(fileName) = 0
|
|
|
+ filename = dir$(obj_path & "*.pv")
|
|
|
+ Do Until Len(filename) = 0
|
|
|
DoEvents
|
|
|
- obj_name = Mid$(fileName, 1, InStrRev(fileName, ".") - 1)
|
|
|
- VCS_Report.ImportPrintVars obj_name, obj_path & fileName
|
|
|
+ obj_name = Mid$(filename, 1, InStrRev(filename, ".") - 1)
|
|
|
+ VCS_Report.ImportPrintVars obj_name, obj_path & filename
|
|
|
obj_count = obj_count + 1
|
|
|
- fileName = dir$()
|
|
|
+ filename = dir$()
|
|
|
Loop
|
|
|
Debug.Print "[" & obj_count & "]"
|
|
|
|
|
|
@@ -521,12 +538,12 @@ Public Sub ImportAllSource()
|
|
|
Debug.Print VCS_String.PadRight("Importing Relations...", 24);
|
|
|
obj_count = 0
|
|
|
obj_path = source_path & "relations\"
|
|
|
- fileName = dir$(obj_path & "*.txt")
|
|
|
- Do Until Len(fileName) = 0
|
|
|
+ filename = dir$(obj_path & "*.txt")
|
|
|
+ Do Until Len(filename) = 0
|
|
|
DoEvents
|
|
|
- VCS_Relation.ImportRelation obj_path & fileName
|
|
|
+ VCS_Relation.ImportRelation obj_path & filename
|
|
|
obj_count = obj_count + 1
|
|
|
- fileName = dir$()
|
|
|
+ filename = dir$()
|
|
|
Loop
|
|
|
Debug.Print "[" & obj_count & "]"
|
|
|
DoEvents
|