瀏覽代碼

Logging terminé\nCorrections bugs suite à test CTRL-A: \n- sauve les modules avant export\n- erreurs d'ecodage lors de l'export des tbldefs\n - passes printvars si report pas importé\n - erreur lors du sanitizing de certains forms/reports corrigée\n - caractères spéciaux dans noms d'objets remplacés par codes ascii pour nom de fichier\n- Import/Export des Database.Properties ok

olivier.massot 9 年之前
父節點
當前提交
c86e2b7c87

+ 1 - 0
.gitignore

@@ -5,6 +5,7 @@ errors/
 *.laccdb
 *.laccdb
 *.accda
 *.accda
 *.old
 *.old
+copy.cmd
 
 
 #[ automatically added by VCS
 #[ automatically added by VCS
 *.mdb
 *.mdb

+ 109 - 0
VCS.log

@@ -0,0 +1,109 @@
+**********************************
+04/11/2016 17:50:10 - make_sources - INFO - Optimizer: ask for confirmation
+04/11/2016 17:50:16 - make_sources - INFO - Updates sources date
+04/11/2016 17:50:16 - make_sources - INFO - Zip the app file
+04/11/2016 17:50:23 - zip_app_file - INFO - C:\APPLIS_PARC\VCS\vcs.accda zipped to C:\APPLIS_PARC\VCS\vcs.zip
+04/11/2016 17:50:23 - make_sources - INFO - Run VCS Export
+04/11/2016 17:50:23 - ExportAllSource - INFO - Begin 'Export all sources'
+04/11/2016 17:50:23 - ExportProperties - INFO - Try to export the properties of 'C:\APPLIS_PARC\VCS\vcs.accda' to 'C:\APPLIS_PARC\VCS\source\database.properties'
+04/11/2016 17:50:23 - ExportProperties - INFO - > 40 properties exported
+04/11/2016 17:50:23 - ClearTextFilesFromDir - INFO - Optimizer on: sub aborted
+04/11/2016 17:50:23 - ExportAllSource - INFO - Exporting queries...
+04/11/2016 17:50:23 - ExportAllSource - INFO - > 0 queries exported
+04/11/2016 17:50:23 - ExportAllSource - INFO - Sanitize queries...
+04/11/2016 17:50:23 - SanitizeTextFiles - INFO - > No file to sanitized
+04/11/2016 17:50:23 - ClearTextFilesFromDir - INFO - Optimizer on: sub aborted
+04/11/2016 17:50:23 - ExportAllSource - INFO - Exporting forms...
+04/11/2016 17:50:23 - ExportAllSource - INFO - > 1 forms exported
+04/11/2016 17:50:23 - ExportAllSource - INFO - Sanitizing forms
+04/11/2016 17:50:23 - SanitizeTextFiles - INFO - > Files C:\APPLIS_PARC\VCS\source\forms\*.bas sanitized
+04/11/2016 17:50:23 - ClearTextFilesFromDir - INFO - Optimizer on: sub aborted
+04/11/2016 17:50:23 - ExportAllSource - INFO - Exporting reports...
+04/11/2016 17:50:23 - ExportAllSource - INFO - > 0 reports exported
+04/11/2016 17:50:23 - ExportAllSource - INFO - Sanitizing reports
+04/11/2016 17:50:23 - SanitizeTextFiles - INFO - > No file to sanitized
+04/11/2016 17:50:23 - ClearTextFilesFromDir - INFO - Optimizer on: sub aborted
+04/11/2016 17:50:23 - ExportAllSource - INFO - Exporting macros...
+04/11/2016 17:50:23 - ExportAllSource - INFO - > 0 macros exported
+04/11/2016 17:50:23 - ExportAllSource - INFO - Sanitizing macros
+04/11/2016 17:50:23 - SanitizeTextFiles - INFO - > No file to sanitized
+04/11/2016 17:50:23 - ClearTextFilesFromDir - INFO - Optimizer on: sub aborted
+04/11/2016 17:50:23 - ExportAllSource - INFO - Exporting modules...
+04/11/2016 17:50:24 - ExportAllSource - INFO - > 19 modules exported
+04/11/2016 17:50:24 - ExportReferences - INFO - 5 references exported toC:\APPLIS_PARC\VCS\source\references.csv
+04/11/2016 17:50:24 - ClearTextFilesFromDir - INFO - Optimizer on: sub aborted
+04/11/2016 17:50:24 - ClearTextFilesFromDir - INFO - Optimizer on: sub aborted
+04/11/2016 17:50:24 - ClearTextFilesFromDir - INFO - Optimizer on: sub aborted
+04/11/2016 17:50:24 - ExportAllSource - INFO - Exporting tbldef...
+04/11/2016 17:50:24 - ExportAllSource - INFO - > 4 tbldef exported
+04/11/2016 17:50:24 - ExportAllSource - INFO - > 2 table's datas exported
+04/11/2016 17:50:24 - ExportAllSource - INFO - Export relations
+04/11/2016 17:50:24 - ExportAllSource - INFO - > 0 relations exported
+04/11/2016 17:50:24 - CleanDirs - INFO - Optimizer ON: cleans the directories from C:\APPLIS_PARC\VCS\source\
+04/11/2016 17:50:24 - ExportAllSource - INFO - Export done
+**********************************
+04/11/2016 17:51:29 - make_sources - INFO - Updates sources date
+04/11/2016 17:51:29 - make_sources - INFO - Zip the app file
+04/11/2016 17:51:30 - zip_app_file - INFO - C:\APPLIS_PARC\VCS\vcs.accda zipped to C:\APPLIS_PARC\VCS\vcs.zip
+04/11/2016 17:51:30 - make_sources - INFO - Run VCS Export
+04/11/2016 17:51:30 - ExportAllSource - INFO - Begin 'Export all sources'
+04/11/2016 17:51:30 - ExportProperties - INFO - Try to export the properties of 'C:\APPLIS_PARC\VCS\vcs.accda' to 'C:\APPLIS_PARC\VCS\source\database.properties'
+04/11/2016 17:51:30 - ExportProperties - INFO - > 40 properties exported
+04/11/2016 17:51:30 - ExportAllSource - INFO - Exporting queries...
+04/11/2016 17:51:30 - ExportAllSource - INFO - > 0 queries exported
+04/11/2016 17:51:30 - ExportAllSource - INFO - Sanitize queries...
+04/11/2016 17:51:30 - SanitizeTextFiles - INFO - > No file to sanitized
+04/11/2016 17:51:30 - ExportAllSource - INFO - Exporting forms...
+04/11/2016 17:51:31 - ExportAllSource - INFO - > 1 forms exported
+04/11/2016 17:51:31 - ExportAllSource - INFO - Sanitizing forms
+04/11/2016 17:51:31 - SanitizeTextFiles - INFO - > Files C:\APPLIS_PARC\VCS\source\forms\*.bas sanitized
+04/11/2016 17:51:31 - ExportAllSource - INFO - Exporting reports...
+04/11/2016 17:51:31 - ExportAllSource - INFO - > 0 reports exported
+04/11/2016 17:51:31 - ExportAllSource - INFO - Sanitizing reports
+04/11/2016 17:51:31 - SanitizeTextFiles - INFO - > No file to sanitized
+04/11/2016 17:51:31 - ExportAllSource - INFO - Exporting macros...
+04/11/2016 17:51:31 - ExportAllSource - INFO - > 0 macros exported
+04/11/2016 17:51:31 - ExportAllSource - INFO - Sanitizing macros
+04/11/2016 17:51:31 - SanitizeTextFiles - INFO - > No file to sanitized
+04/11/2016 17:51:31 - ExportAllSource - INFO - Exporting modules...
+04/11/2016 17:51:32 - ExportAllSource - INFO - > 19 modules exported
+04/11/2016 17:51:32 - ExportReferences - INFO - 5 references exported toC:\APPLIS_PARC\VCS\source\references.csv
+04/11/2016 17:51:32 - ExportAllSource - INFO - Exporting tbldef...
+04/11/2016 17:51:32 - ExportAllSource - INFO - > 4 tbldef exported
+04/11/2016 17:51:32 - ExportAllSource - INFO - > 2 table's datas exported
+04/11/2016 17:51:32 - ExportAllSource - INFO - Export relations
+04/11/2016 17:51:32 - ExportAllSource - INFO - > 0 relations exported
+04/11/2016 17:51:32 - ExportAllSource - INFO - Export done
+**********************************
+04/11/2016 17:53:48 - make_sources - INFO - Updates sources date
+04/11/2016 17:53:48 - make_sources - INFO - Zip the app file
+04/11/2016 17:53:48 - zip_app_file - INFO - C:\APPLIS_PARC\VCS\vcs.accda zipped to C:\APPLIS_PARC\VCS\vcs.zip
+04/11/2016 17:53:48 - make_sources - INFO - Run VCS Export
+04/11/2016 17:53:48 - ExportAllSource - INFO - Begin 'Export all sources'
+04/11/2016 17:53:48 - ExportProperties - INFO - Try to export the properties of 'C:\APPLIS_PARC\VCS\vcs.accda' to 'C:\APPLIS_PARC\VCS\source\database.properties'
+04/11/2016 17:53:48 - ExportProperties - INFO - > 40 properties exported
+04/11/2016 17:53:48 - ExportAllSource - INFO - Exporting queries...
+04/11/2016 17:53:48 - ExportAllSource - INFO - > 0 queries exported
+04/11/2016 17:53:48 - ExportAllSource - INFO - Sanitize queries...
+04/11/2016 17:53:48 - SanitizeTextFiles - INFO - > No file to sanitized
+04/11/2016 17:53:48 - ExportAllSource - INFO - Exporting forms...
+04/11/2016 17:53:49 - ExportAllSource - INFO - > 1 forms exported
+04/11/2016 17:53:49 - ExportAllSource - INFO - Sanitizing forms
+04/11/2016 17:53:50 - SanitizeTextFiles - INFO - > Files C:\APPLIS_PARC\VCS\source\forms\*.bas sanitized
+04/11/2016 17:53:50 - ExportAllSource - INFO - Exporting reports...
+04/11/2016 17:53:50 - ExportAllSource - INFO - > 0 reports exported
+04/11/2016 17:53:50 - ExportAllSource - INFO - Sanitizing reports
+04/11/2016 17:53:50 - SanitizeTextFiles - INFO - > No file to sanitized
+04/11/2016 17:53:50 - ExportAllSource - INFO - Exporting macros...
+04/11/2016 17:53:50 - ExportAllSource - INFO - > 0 macros exported
+04/11/2016 17:53:50 - ExportAllSource - INFO - Sanitizing macros
+04/11/2016 17:53:50 - SanitizeTextFiles - INFO - > No file to sanitized
+04/11/2016 17:53:50 - ExportAllSource - INFO - Exporting modules...
+04/11/2016 17:53:50 - ExportAllSource - INFO - > 19 modules exported
+04/11/2016 17:53:50 - ExportReferences - INFO - 5 references exported toC:\APPLIS_PARC\VCS\source\references.csv
+04/11/2016 17:53:50 - ExportAllSource - INFO - Exporting tbldef...
+04/11/2016 17:53:50 - ExportAllSource - INFO - > 4 tbldef exported
+04/11/2016 17:53:50 - ExportAllSource - INFO - > 2 table's datas exported
+04/11/2016 17:53:50 - ExportAllSource - INFO - Export relations
+04/11/2016 17:53:51 - ExportAllSource - INFO - > 0 relations exported
+04/11/2016 17:53:51 - ExportAllSource - INFO - Export done

二進制
original-MSAccess-VCS.zip


+ 40 - 0
source/database.properties

@@ -0,0 +1,40 @@
+Connect		12
+QueryTimeout	60	3
+ANSI Query Mode	0	4
+Themed Form Controls	1	4
+Use Microsoft Access 2007 compatible cache	0	4
+Clear Cache on Close	0	4
+Never Cache	0	4
+AccessVersion	09.50	10
+NavPane Category	0	4
+Show Navigation Pane Search Bar	1	4
+Build	727	4
+ProjVer	119	3
+HasOfflineLists	70	3
+UseMDIMode	0	2
+ShowDocumentTabs	Faux	1
+Picture Property Storage Format	0	4
+WebDesignMode	0	2
+CheckTruncatedNumFields	1	4
+Theme Resource Name	Office Theme	10
+StartUpShowDBWindow	Faux	1
+StartUpShowStatusBar	Faux	1
+AllowShortcutMenus	Faux	1
+AllowFullMenus	Faux	1
+AllowBuiltInToolbars	Faux	1
+AllowToolbarChanges	Faux	1
+AllowSpecialKeys	Faux	1
+UseAppIconForFrmRpt	Faux	1
+AllowDatasheetSchema	Faux	1
+DesignWithData	Faux	1
+Show Values Limit	1000	4
+Show Values in Indexed	1	4
+Show Values in Non-Indexed	1	4
+Show Values in Remote	0	4
+Auto Compact	0	4
+NavPane Closed	0	4
+NavPane Width	215	4
+NavPane View By	0	4
+NavPane Sort By	1	4
+AppTitle	VCS-AddIn	10
+Property Sheet Label Width	2745	4

+ 5 - 0
source/modules/VCS_Dir.bas

@@ -19,6 +19,7 @@ End Function
 Public Sub MkDirIfNotExist(ByVal path As String)
 Public Sub MkDirIfNotExist(ByVal path As String)
     On Error GoTo MkDirIfNotexist_noop
     On Error GoTo MkDirIfNotexist_noop
     MkDir path
     MkDir path
+    logger "MkDirIfNotExist", "INFO", "New dir created: " & path
 MkDirIfNotexist_noop:
 MkDirIfNotexist_noop:
     On Error GoTo 0
     On Error GoTo 0
 End Sub
 End Sub
@@ -27,6 +28,7 @@ End Sub
 Public Sub DelIfExist(ByVal path As String)
 Public Sub DelIfExist(ByVal path As String)
     On Error GoTo DelIfNotExist_Noop
     On Error GoTo DelIfNotExist_Noop
     Kill path
     Kill path
+    logger "DelIfExist", "INFO", "Killed: " & path
 DelIfNotExist_Noop:
 DelIfNotExist_Noop:
     On Error GoTo 0
     On Error GoTo 0
 End Sub
 End Sub
@@ -38,10 +40,13 @@ Public Sub ClearTextFilesFromDir(ByVal path As String, ByVal Ext As String, Opti
     ' we don't want to clear the text files of the objects which will not be exported
     ' we don't want to clear the text files of the objects which will not be exported
     'BUT we still want to clear obsolete files: see CleanDirs in optimizer
     'BUT we still want to clear obsolete files: see CleanDirs in optimizer
     If optimizer_activated() And Not force Then
     If optimizer_activated() And Not force Then
+        logger "ClearTextFilesFromDir", "INFO", "Optimizer on: sub aborted"
         Exit Sub
         Exit Sub
     End If
     End If
     '###
     '###
     
     
+    logger "ClearTextFilesFromDir", "DEBUG", "Clear dir: " & path & "*." & Ext
+
     Dim fso As Object
     Dim fso As Object
     Set fso = CreateObject("Scripting.FileSystemObject")
     Set fso = CreateObject("Scripting.FileSystemObject")
     If Not fso.FolderExists(path) Then Exit Sub
     If Not fso.FolderExists(path) Then Exit Sub

+ 16 - 1
source/modules/VCS_File.bas

@@ -258,7 +258,7 @@ Public Function ReadFile(filepath As String, Optional encoding As String = "utf-
     Dim objStream As ADODB.Stream
     Dim objStream As ADODB.Stream
     Set objStream = New ADODB.Stream
     Set objStream = New ADODB.Stream
 
 
-    objStream.Charset = "x-ansi"
+    objStream.Charset = encoding
     objStream.Open
     objStream.Open
     objStream.LoadFromFile (filepath)
     objStream.LoadFromFile (filepath)
     ReadFile = objStream.ReadText()
     ReadFile = objStream.ReadText()
@@ -267,6 +267,21 @@ Public Function ReadFile(filepath As String, Optional encoding As String = "utf-
     Set objStream = Nothing
     Set objStream = Nothing
 End Function
 End Function
 
 
+Public Sub MakeFile(filepath As String, content As String, Optional encoding As String = "utf-8")
+    Dim objStream As ADODB.Stream
+    
+    Set objStream = CreateObject("ADODB.Stream")
+    objStream.Open
+    objStream.Type = 2 'Text
+    objStream.Charset = encoding
+    objStream.WriteText content
+    objStream.SaveToFile (filepath)
+    objStream.Close
+
+End Sub
+
+
+
 
 
 
 
 
 

+ 24 - 1
source/modules/VCS_IE_Functions.bas

@@ -34,6 +34,8 @@ Public Sub ExportObject(ByVal obj_type_num As Integer, ByVal obj_name As String,
     Else
     Else
         Application.SaveAsText obj_type_num, obj_name, file_path
         Application.SaveAsText obj_type_num, obj_name, file_path
     End If
     End If
+    
+    logger "ExportObject", "DEBUG", "Object of type " & obj_type_num & " named " & obj_name & " exported to " & file_path
 End Sub
 End Sub
 
 
 ' Import a database object with optional UTF-8-to-UCS2 conversion.
 ' Import a database object with optional UTF-8-to-UCS2 conversion.
@@ -60,6 +62,9 @@ Public Sub ImportObject(ByVal obj_type_num As Integer, ByVal obj_name As String,
     Else
     Else
         Application.LoadFromText obj_type_num, obj_name, file_path
         Application.LoadFromText obj_type_num, obj_name, file_path
     End If
     End If
+    
+    logger "ImportObject", "DEBUG", "Object of type " & obj_type_num & " named " & obj_name & " imported from " & file_path
+
 Exit Sub
 Exit Sub
 err:
 err:
     logger "ImportObject", "CRITICAL", "Unable to import the object " & obj_name & " (" & obj_type_num & ")" & "[" & err.Description & "]"
     logger "ImportObject", "CRITICAL", "Unable to import the object " & obj_name & " (" & obj_type_num & ")" & "[" & err.Description & "]"
@@ -111,6 +116,11 @@ Public Sub SanitizeTextFiles(ByVal path As String, ByVal Ext As String)
     rxLine.Pattern = srchPattern
     rxLine.Pattern = srchPattern
     Dim filename As String
     Dim filename As String
     filename = dir$(path & "*." & Ext)
     filename = dir$(path & "*." & Ext)
+    If Len(filename) = 0 Then
+        logger "SanitizeTextFiles", "INFO", "> No file to sanitized"
+        Exit Sub
+    End If
+    
     Dim isReport As Boolean
     Dim isReport As Boolean
     isReport = False
     isReport = False
     
     
@@ -193,9 +203,14 @@ Public Sub SanitizeTextFiles(ByVal path As String, ByVal Ext As String)
         Dim thisFile As Object
         Dim thisFile As Object
         Set thisFile = fso.GetFile(path & obj_name & ".sanitize")
         Set thisFile = fso.GetFile(path & obj_name & ".sanitize")
         thisFile.Move (path & filename)
         thisFile.Move (path & filename)
+        
+        logger "SanitizeTextFiles", "DEBUG", "> File " & path & filename & " sanitized"
+
         filename = dir$()
         filename = dir$()
     Loop
     Loop
 
 
+    logger "SanitizeTextFiles", "INFO", "> Files " & path & "*." & Ext & " sanitized"
+
 End Sub
 End Sub
 
 
 Public Function to_filename(object_name As String) As String
 Public Function to_filename(object_name As String) As String
@@ -226,10 +241,14 @@ Public Function to_filename(object_name As String) As String
         result = Replace(result, Chr(CInt(ascii_code)), "[" & ascii_code & "]")
         result = Replace(result, Chr(CInt(ascii_code)), "[" & ascii_code & "]")
     Next
     Next
 
 
+    If result <> object_name Then
+        logger "to_filename", "DEBUG", "> Object's name " & object_name & " transformed to " & result
+    End If
+
     to_filename = result
     to_filename = result
 Exit Function
 Exit Function
 err:
 err:
-    Call logger("to_accessname", "ERROR", "Unable to convert object's name " & object_name & " to file's name")
+    Call logger("to_filename", "ERROR", "Unable to convert object's name " & object_name & " to file's name")
     to_filename = object_name
     to_filename = object_name
 End Function
 End Function
 
 
@@ -248,6 +267,10 @@ On Error GoTo err
         result = Replace(result, "[" & ascii_code & "]", Chr(CInt(ascii_code)))
         result = Replace(result, "[" & ascii_code & "]", Chr(CInt(ascii_code)))
     Next
     Next
 
 
+    If result <> file_name Then
+        logger "to_accessname", "DEBUG", "> File's name " & file_name & " transformed to " & result
+    End If
+
     to_accessname = result
     to_accessname = result
 Exit Function
 Exit Function
 err:
 err:

+ 61 - 103
source/modules/VCS_ImportExport.bas

@@ -63,21 +63,32 @@ Public Sub ExportAllSource()
     Dim ucs2 As Boolean
     Dim ucs2 As Boolean
     Dim full_path As String
     Dim full_path As String
 
 
+    logger "ExportAllSource", "INFO", "Begin 'Export all sources'"
+
     include_tables = get_include_tables()
     include_tables = get_include_tables()
     
     
+    logger "ExportAllSource", "DEBUG", "Include_tables: " & include_tables
+    logger "ExportAllSource", "DEBUG", "Optimizer on: " & optimizer_activated()
+    
+    logger "ExportAllSource", "DEBUG", "Save project"
+    CurrentProject.Application.RunCommand acCmdSave
+    
     Set Db = CurrentDb
     Set Db = CurrentDb
 
 
     CloseFormsReports
     CloseFormsReports
     'InitUsingUcs2
     'InitUsingUcs2
 
 
     source_path = VCS_Dir.ProjectPath() & "source\"
     source_path = VCS_Dir.ProjectPath() & "source\"
+    logger "ExportAllSource", "DEBUG", "source_path: " & source_path
+
     VCS_Dir.MkDirIfNotExist source_path
     VCS_Dir.MkDirIfNotExist source_path
 
 
+    Call ExportProperties(CurrentDb, source_path & "database.properties")
+    
     obj_path = source_path & "queries\"
     obj_path = source_path & "queries\"
     VCS_Dir.ClearTextFilesFromDir obj_path, "bas"
     VCS_Dir.ClearTextFilesFromDir obj_path, "bas"
     
     
-    
-    Debug.Print VCS_String.PadRight("Exporting queries...", 24);
+    logger "ExportAllSource", "INFO", "Exporting queries..."
     
     
     obj_count = 0
     obj_count = 0
     For Each qry In Db.QueryDefs
     For Each qry In Db.QueryDefs
@@ -85,6 +96,7 @@ Public Sub ExportAllSource()
         '### 11/10/2016: add optimizer
         '### 11/10/2016: add optimizer
         If optimizer_activated() Then
         If optimizer_activated() Then
             If Not needs_export(acQuery, qry.name) > 0 Then
             If Not needs_export(acQuery, qry.name) > 0 Then
+                logger "ExportProperties", "DEBUG", "Query " & qry.name & " skipped"
                 obj_count = obj_count + 1
                 obj_count = obj_count + 1
                 GoTo next_qry
                 GoTo next_qry
             End If
             End If
@@ -99,14 +111,12 @@ Public Sub ExportAllSource()
         End If
         End If
         
         
 next_qry:
 next_qry:
-
         Call SysCmd(4, "Export query: " & obj_count & " on " & Db.QueryDefs.count)
         Call SysCmd(4, "Export query: " & obj_count & " on " & Db.QueryDefs.count)
     Next
     Next
+    logger "ExportAllSource", "INFO", "> " & obj_count & " queries exported"
     
     
-    Call SysCmd(4, "Sanitize queries")
-    Debug.Print VCS_String.PadRight("Sanitizing...", 15);
+    logger "ExportAllSource", "INFO", "Sanitize queries..."
     VCS_IE_Functions.SanitizeTextFiles obj_path, "bas"
     VCS_IE_Functions.SanitizeTextFiles obj_path, "bas"
-    Debug.Print "[" & obj_count & "]"
         
         
     For Each obj_type In Split( _
     For Each obj_type In Split( _
         "forms|Forms|" & acForm & "," & _
         "forms|Forms|" & acForm & "," & _
@@ -125,7 +135,7 @@ next_qry:
         'a retirer
         'a retirer
         VCS_Dir.ClearTextFilesFromDir obj_path, "bas"
         VCS_Dir.ClearTextFilesFromDir obj_path, "bas"
         
         
-        Debug.Print VCS_String.PadRight("Exporting " & obj_type_label & "...", 24);
+        logger "ExportAllSource", "INFO", "Exporting " & obj_type_label & "..."
         
         
         For Each doc In Db.Containers(obj_type_name).Documents
         For Each doc In Db.Containers(obj_type_name).Documents
         
         
@@ -133,6 +143,7 @@ next_qry:
             If optimizer_activated() Then
             If optimizer_activated() Then
                 If Not needs_export(obj_type_num, doc.name) > 0 Then
                 If Not needs_export(obj_type_num, doc.name) > 0 Then
                     obj_count = obj_count + 1
                     obj_count = obj_count + 1
+                    logger "ExportAllSource", "DEBUG", obj_type_label & " '" & doc.name & " skipped"
                     GoTo next_doc
                     GoTo next_doc
                 End If
                 End If
             End If
             End If
@@ -142,6 +153,7 @@ next_qry:
             
             
             If (Left$(doc.name, 1) <> "~") And _
             If (Left$(doc.name, 1) <> "~") And _
                (IsNotVCS(doc.name) Or ArchiveMyself) Then
                (IsNotVCS(doc.name) Or ArchiveMyself) Then
+                
                 If obj_type_label = "modules" Then
                 If obj_type_label = "modules" Then
                     ucs2 = False
                     ucs2 = False
                 Else
                 Else
@@ -163,24 +175,21 @@ next_qry:
                         
                         
 next_doc:
 next_doc:
         Next
         Next
-
-        Call SysCmd(4, "Sanitizing")
-        Debug.Print VCS_String.PadRight("Sanitizing...", 15);
+        
+        logger "ExportAllSource", "INFO", "> " & obj_count & " " & obj_type_label & " exported"
         
         
         If obj_type_label <> "modules" Then
         If obj_type_label <> "modules" Then
+            logger "ExportAllSource", "INFO", "Sanitizing " & obj_type_label
             VCS_IE_Functions.SanitizeTextFiles obj_path, "bas"
             VCS_IE_Functions.SanitizeTextFiles obj_path, "bas"
         End If
         End If
-                
-        Debug.Print "[" & obj_count & "]"
         
         
     Next
     Next
     
     
-    Call SysCmd(4, "Export references")
     VCS_Reference.ExportReferences source_path
     VCS_Reference.ExportReferences source_path
 
 
 '-------------------------table export------------------------
 '-------------------------table export------------------------
 
 
-    Call SysCmd(4, "Export tables")
+
     obj_path = source_path & "tables\"
     obj_path = source_path & "tables\"
     VCS_Dir.MkDirIfNotExist Left$(obj_path, InStrRev(obj_path, "\"))
     VCS_Dir.MkDirIfNotExist Left$(obj_path, InStrRev(obj_path, "\"))
     VCS_Dir.ClearTextFilesFromDir obj_path, "txt", True
     VCS_Dir.ClearTextFilesFromDir obj_path, "txt", True
@@ -206,7 +215,7 @@ next_doc:
     Dim IncludeTablesCol As Collection
     Dim IncludeTablesCol As Collection
     Set IncludeTablesCol = StrSetToCol(include_tables, ",")
     Set IncludeTablesCol = StrSetToCol(include_tables, ",")
     
     
-    Debug.Print VCS_String.PadRight("Exporting " & obj_type_label & "...", 24);
+    logger "ExportAllSource", "INFO", "Exporting " & obj_type_label & "..."
     
     
     Dim update_this_tabledef As Boolean
     Dim update_this_tabledef As Boolean
     
     
@@ -217,14 +226,7 @@ next_doc:
         'or if the table definition has been modified since last export
         'or if the table definition has been modified since last export
         update_this_tabledef = (Not optimizer_activated() Or needs_export(acTable, td.name) > 0)
         update_this_tabledef = (Not optimizer_activated() Or needs_export(acTable, td.name) > 0)
         '###
         '###
-    
-        If Not IsValidFileName(td.name) Then
-            Debug.Print "ERROR:" & td.name & " is not a valid file name, table_def has been ignored"
-            obj_count = obj_count + 1
-            GoTo next_td
-        End If
-    
-    
+
         ' This is not a system table
         ' This is not a system table
         ' this is not a temporary table
         ' this is not a temporary table
         If Left$(td.name, 4) <> "MSys" And _
         If Left$(td.name, 4) <> "MSys" And _
@@ -234,6 +236,8 @@ next_doc:
                 
                 
                 If update_this_tabledef Then
                 If update_this_tabledef Then
                     VCS_Table.ExportTableDef Db, td, VCS_IE_Functions.to_filename(td.name), obj_path
                     VCS_Table.ExportTableDef Db, td, VCS_IE_Functions.to_filename(td.name), obj_path
+                Else
+                    logger "ExportAllSource", "DEBUG", "TableDef " & td.name & " skipped"
                 End If
                 End If
                 
                 
                 If include_tables = "*" Then
                 If include_tables = "*" Then
@@ -256,6 +260,8 @@ Err_TableNotFound:
             Else
             Else
                 If update_this_tabledef Then
                 If update_this_tabledef Then
                     VCS_Table.ExportLinkedTable td.name, obj_path
                     VCS_Table.ExportLinkedTable td.name, obj_path
+                Else
+                    logger "ExportAllSource", "DEBUG", "TableDef " & td.name & " skipped"
                 End If
                 End If
             End If
             End If
             
             
@@ -264,17 +270,13 @@ Err_TableNotFound:
             Call SysCmd(4, "Export table definition: " & obj_count & " on " & tds.count)
             Call SysCmd(4, "Export table definition: " & obj_count & " on " & tds.count)
             
             
         End If
         End If
-
+        
 next_td:
 next_td:
     Next
     Next
+    logger "ExportAllSource", "INFO", "> " & obj_count & " tbldef exported"
+    logger "ExportAllSource", "INFO", "> " & obj_data_count & " table's datas exported"
     
     
-    Debug.Print "[" & obj_count & "]"
-    If obj_data_count > 0 Then
-      Debug.Print VCS_String.PadRight("Exported data...", 24) & "[" & obj_data_count & "]"
-    End If
-
-    Call SysCmd(4, "Export relations")
-    Debug.Print VCS_String.PadRight("Exporting Relations...", 24);
+    logger "ExportAllSource", "INFO", "Export relations"
     
     
     obj_count = 0
     obj_count = 0
     obj_path = source_path & "relations\"
     obj_path = source_path & "relations\"
@@ -294,21 +296,17 @@ next_td:
             obj_count = obj_count + 1
             obj_count = obj_count + 1
         End If
         End If
     Next
     Next
-    Debug.Print "[" & obj_count & "]"
+    
+    logger "ExportAllSource", "INFO", "> " & obj_count & " relations exported"
     
     
     '### 13/10/2016: add optimizer
     '### 13/10/2016: add optimizer
     ' cleans the obsolete files (see CleanDirs in optimizer)
     ' cleans the obsolete files (see CleanDirs in optimizer)
     If optimizer_activated() Then
     If optimizer_activated() Then
-        Call SysCmd(4, "Cleans the directories")
-        Debug.Print VCS_String.PadRight("Cleans the directories", 24);
-        
         Call CleanDirs
         Call CleanDirs
-        
     End If
     End If
     '###
     '###
     
     
-    Call SysCmd(4, "Export done")
-    Debug.Print "Done."
+    logger "ExportAllSource", "INFO", "Export done"
 End Sub
 End Sub
 
 
 
 
@@ -328,27 +326,23 @@ Public Sub ImportAllSource()
     Dim obj_name As String
     Dim obj_name As String
     Dim ucs2 As Boolean
     Dim ucs2 As Boolean
 
 
+    logger "ImportAllSource", "INFO", "Begin 'Import all sources'"
+    logger "ImportAllSource", "DEBUG", "Optimizer on: " & optimizer_activated()
+    
     Set fso = CreateObject("Scripting.FileSystemObject")
     Set fso = CreateObject("Scripting.FileSystemObject")
 
 
-    SysCmd acSysCmdInitMeter, "Importing: ", 11
-    Dim counter As Integer
-    counter = 0
-    SysCmd acSysCmdUpdateMeter, counter
-
     CloseFormsReports
     CloseFormsReports
     'InitUsingUcs2
     'InitUsingUcs2
 
 
     source_path = VCS_Dir.ProjectPath() & "source\"
     source_path = VCS_Dir.ProjectPath() & "source\"
     If Not fso.FolderExists(source_path) Then
     If Not fso.FolderExists(source_path) Then
         logger "ImportAllSource", "CRITICAL", "No source found at:" & source_path
         logger "ImportAllSource", "CRITICAL", "No source found at:" & source_path
-        Call err.Raise(60000, "Critical error", "Critical error occured, see the log file for more informations")
     End If
     End If
 
 
-    Debug.Print
+    Call ImportProperties(CurrentDb, source_path & "database.properties")
     
     
     If Not VCS_Reference.ImportReferences(source_path) Then
     If Not VCS_Reference.ImportReferences(source_path) Then
-        Debug.Print "Info: no references file in " & source_path
-        Debug.Print
+        logger "ImportAllSource", "INFO", "Info: no references file in " & source_path
     End If
     End If
 
 
     obj_path = source_path & "queries\"
     obj_path = source_path & "queries\"
@@ -358,7 +352,7 @@ Public Sub ImportAllSource()
     tempFilePath = VCS_File.TempFile()
     tempFilePath = VCS_File.TempFile()
     
     
     If Len(filename) > 0 Then
     If Len(filename) > 0 Then
-        Debug.Print VCS_String.PadRight("Importing queries...", 24);
+        logger "ImportAllSource", "INFO", "Importing queries..."
         obj_count = 0
         obj_count = 0
         Do Until Len(filename) = 0
         Do Until Len(filename) = 0
             DoEvents
             DoEvents
@@ -370,11 +364,8 @@ Public Sub ImportAllSource()
             obj_count = obj_count + 1
             obj_count = obj_count + 1
             filename = dir$()
             filename = dir$()
         Loop
         Loop
-        Debug.Print "[" & obj_count & "]"
+        logger "ImportAllSource", "INFO", "> " & obj_count & " queries imported"
     End If
     End If
-
-    counter = counter + 1
-    SysCmd acSysCmdUpdateMeter, counter
     
     
     VCS_Dir.DelIfExist tempFilePath
     VCS_Dir.DelIfExist tempFilePath
 
 
@@ -382,58 +373,38 @@ Public Sub ImportAllSource()
     obj_path = source_path & "tbldef\"
     obj_path = source_path & "tbldef\"
     filename = dir$(obj_path & "*.sql")
     filename = dir$(obj_path & "*.sql")
     If Len(filename) > 0 Then
     If Len(filename) > 0 Then
-        Debug.Print VCS_String.PadRight("Importing tabledefs...", 24);
+        logger "ImportAllSource", "INFO", "Importing TblDefs..."
         obj_count = 0
         obj_count = 0
         Do Until Len(filename) = 0
         Do Until Len(filename) = 0
             obj_name = Mid$(filename, 1, InStrRev(filename, ".") - 1)
             obj_name = Mid$(filename, 1, InStrRev(filename, ".") - 1)
             obj_name = VCS_IE_Functions.to_accessname(obj_name)
             obj_name = VCS_IE_Functions.to_accessname(obj_name)
-            If DebugOutput Then
-                If obj_count = 0 Then
-                    Debug.Print
-                End If
-                Debug.Print "  [debug] table " & obj_name;
-                Debug.Print
-            End If
             VCS_Table.ImportTableDef CStr(obj_name), obj_path
             VCS_Table.ImportTableDef CStr(obj_name), obj_path
             obj_count = obj_count + 1
             obj_count = obj_count + 1
             filename = dir$()
             filename = dir$()
         Loop
         Loop
-        Debug.Print "[" & obj_count & "]"
+        logger "ImportAllSource", "INFO", "> " & obj_count & " TblDefs imported"
     End If
     End If
     
     
-    counter = counter + 1
-    SysCmd acSysCmdUpdateMeter, counter
-    
     ' restore linked tables - we must have access to the remote store to import these!
     ' restore linked tables - we must have access to the remote store to import these!
     filename = dir$(obj_path & "*.LNKD")
     filename = dir$(obj_path & "*.LNKD")
     If Len(filename) > 0 Then
     If Len(filename) > 0 Then
-        Debug.Print VCS_String.PadRight("Importing Linked tabledefs...", 24);
+        logger "ImportAllSource", "INFO", "Importing Linked TblDefs..."
         obj_count = 0
         obj_count = 0
         Do Until Len(filename) = 0
         Do Until Len(filename) = 0
             obj_name = Mid$(filename, 1, InStrRev(filename, ".") - 1)
             obj_name = Mid$(filename, 1, InStrRev(filename, ".") - 1)
             obj_name = VCS_IE_Functions.to_accessname(obj_name)
             obj_name = VCS_IE_Functions.to_accessname(obj_name)
-            If DebugOutput Then
-                If obj_count = 0 Then
-                    Debug.Print
-                End If
-                Debug.Print "  [debug] table " & obj_name;
-                Debug.Print
-            End If
             VCS_Table.ImportLinkedTable CStr(obj_name), obj_path
             VCS_Table.ImportLinkedTable CStr(obj_name), obj_path
             obj_count = obj_count + 1
             obj_count = obj_count + 1
             filename = dir$()
             filename = dir$()
         Loop
         Loop
-        Debug.Print "[" & obj_count & "]"
+        logger "ImportAllSource", "INFO", "> " & obj_count & " Linked TblDefs imported"
     End If
     End If
     
     
-    counter = counter + 1
-    SysCmd acSysCmdUpdateMeter, counter
-    
     ' NOW we may load data
     ' NOW we may load data
     obj_path = source_path & "tables\"
     obj_path = source_path & "tables\"
     filename = dir$(obj_path & "*.txt")
     filename = dir$(obj_path & "*.txt")
     If Len(filename) > 0 Then
     If Len(filename) > 0 Then
-        Debug.Print VCS_String.PadRight("Importing tables...", 24);
+        logger "ImportAllSource", "INFO", "Importing table's data..."
         obj_count = 0
         obj_count = 0
         Do Until Len(filename) = 0
         Do Until Len(filename) = 0
             DoEvents
             DoEvents
@@ -443,17 +414,14 @@ Public Sub ImportAllSource()
             obj_count = obj_count + 1
             obj_count = obj_count + 1
             filename = dir$()
             filename = dir$()
         Loop
         Loop
-        Debug.Print "[" & obj_count & "]"
+        logger "ImportAllSource", "INFO", "> " & obj_count & " table's data imported"
     End If
     End If
-
-    counter = counter + 1
-    SysCmd acSysCmdUpdateMeter, counter
     
     
     'load Data Macros - not DRY!
     'load Data Macros - not DRY!
     obj_path = source_path & "tbldef\"
     obj_path = source_path & "tbldef\"
     filename = dir$(obj_path & "*.xml")
     filename = dir$(obj_path & "*.xml")
     If Len(filename) > 0 Then
     If Len(filename) > 0 Then
-        Debug.Print VCS_String.PadRight("Importing Data Macros...", 24);
+        logger "ImportAllSource", "INFO", "Importing Data Macros..."
         obj_count = 0
         obj_count = 0
         Do Until Len(filename) = 0
         Do Until Len(filename) = 0
             DoEvents
             DoEvents
@@ -464,14 +432,8 @@ Public Sub ImportAllSource()
             obj_count = obj_count + 1
             obj_count = obj_count + 1
             filename = dir$()
             filename = dir$()
         Loop
         Loop
-        Debug.Print "[" & obj_count & "]"
+        logger "ImportAllSource", "INFO", "> " & obj_count & " DataMacros imported"
     End If
     End If
-    
-    counter = counter + 1
-    SysCmd acSysCmdUpdateMeter, counter
-
-        'import Data Macros
-    
 
 
     For Each obj_type In Split( _
     For Each obj_type In Split( _
         "forms|" & acForm & "," & _
         "forms|" & acForm & "," & _
@@ -488,7 +450,7 @@ Public Sub ImportAllSource()
             
             
         filename = dir$(obj_path & "*.bas")
         filename = dir$(obj_path & "*.bas")
         If Len(filename) > 0 Then
         If Len(filename) > 0 Then
-            Debug.Print VCS_String.PadRight("Importing " & obj_type_label & "...", 24);
+            logger "ImportAllSource", "INFO", "Importing " & obj_type_label & "..."
             obj_count = 0
             obj_count = 0
             Do Until Len(filename) = 0
             Do Until Len(filename) = 0
                 ' DoEvents no good idea!
                 ' DoEvents no good idea!
@@ -509,17 +471,14 @@ Public Sub ImportAllSource()
                 End If
                 End If
                 filename = dir$()
                 filename = dir$()
             Loop
             Loop
-            Debug.Print "[" & obj_count & "]"
+            logger "ImportAllSource", "INFO", "> " & obj_count & " " & obj_type_label & " imported"
         
         
         End If
         End If
-        
-        counter = counter + 1
-        SysCmd acSysCmdUpdateMeter, counter
     
     
     Next
     Next
     
     
     'import Print Variables
     'import Print Variables
-    Debug.Print VCS_String.PadRight("Importing Print Vars...", 24);
+    logger "ImportAllSource", "INFO", "Importing Print Vars..."
     obj_count = 0
     obj_count = 0
     
     
     obj_path = source_path & "reports\"
     obj_path = source_path & "reports\"
@@ -532,10 +491,10 @@ Public Sub ImportAllSource()
         obj_count = obj_count + 1
         obj_count = obj_count + 1
         filename = dir$()
         filename = dir$()
     Loop
     Loop
-    Debug.Print "[" & obj_count & "]"
+    logger "ImportAllSource", "INFO", "> " & obj_count & " Print Vars imported"
     
     
     'import relations
     'import relations
-    Debug.Print VCS_String.PadRight("Importing Relations...", 24);
+    logger "ImportAllSource", "INFO", "Importing Relations..."
     obj_count = 0
     obj_count = 0
     obj_path = source_path & "relations\"
     obj_path = source_path & "relations\"
     filename = dir$(obj_path & "*.txt")
     filename = dir$(obj_path & "*.txt")
@@ -545,12 +504,10 @@ Public Sub ImportAllSource()
         obj_count = obj_count + 1
         obj_count = obj_count + 1
         filename = dir$()
         filename = dir$()
     Loop
     Loop
-    Debug.Print "[" & obj_count & "]"
+    logger "ImportAllSource", "INFO", "> " & obj_count & " Relations imported"
     DoEvents
     DoEvents
     
     
-    SysCmd acSysCmdRemoveMeter
-    
-    Debug.Print "Done."
+    logger "ImportAllSource", "INFO", "Import Done"
 End Sub
 End Sub
 
 
 ' Main entry point for ImportProject.
 ' Main entry point for ImportProject.
@@ -659,6 +616,8 @@ End Sub
 ' Close all open forms.
 ' Close all open forms.
 Private Sub CloseFormsReports()
 Private Sub CloseFormsReports()
     On Error GoTo errorHandler
     On Error GoTo errorHandler
+    logger "CloseFormsReports", "DEBUG", "Close any opened form or report"
+    
     Do While Forms.count > 0
     Do While Forms.count > 0
         DoCmd.Close acForm, Forms(0).name
         DoCmd.Close acForm, Forms(0).name
         DoEvents
         DoEvents
@@ -670,8 +629,7 @@ Private Sub CloseFormsReports()
     Exit Sub
     Exit Sub
 
 
 errorHandler:
 errorHandler:
-    Debug.Print "VCS_ImportExport.CloseFormsReports: Error #" & err.number & vbCrLf & _
-                err.Description
+    logger "CloseFormsReports", "CRITICAL", "Error #" & err.number & err.Description
 End Sub
 End Sub
 
 
 
 

+ 26 - 5
source/modules/VCS_Log.bas

@@ -1,21 +1,33 @@
 Option Compare Database
 Option Compare Database
 Dim log_file_path As String
 Dim log_file_path As String
+Dim debug_level As Boolean
 
 
 Public Function log_file()
 Public Function log_file()
     log_file = log_file_path
     log_file = log_file_path
 End Function
 End Function
 
 
-Public Sub logger(origin As String, level As String, msg As String)
+Public Sub set_debug_mode()
+    debug_level = True
+End Sub
+
+Public Sub logger(ByVal origin As String, ByVal level As String, ByVal msg As String)
     Dim fso As Object
     Dim fso As Object
     Dim oFile As Object
     Dim oFile As Object
+    Dim line As String
+    Dim new_session As Boolean
+    new_session = False
+    
+    If level = "DEBUG" And Not debug_level = True Then Exit Sub
 
 
     Set fso = CreateObject("Scripting.FileSystemObject")
     Set fso = CreateObject("Scripting.FileSystemObject")
 
 
     If Not Len(log_file_path) > 0 Then
     If Not Len(log_file_path) > 0 Then
     
     
-        log_file_path = CurrentProject.path & "\" & "logVCS_" & Format(Now, "yymmdd_hhMMss") & ".log"
-        
+        log_file_path = CurrentProject.path & "\" & "VCS.log"
         Debug.Print log_file_path
         Debug.Print log_file_path
+        
+        new_session = True
+        
         If Not fso.FileExists(log_file_path) Then
         If Not fso.FileExists(log_file_path) Then
             Set oFile = fso.CreateTextFile(log_file_path)
             Set oFile = fso.CreateTextFile(log_file_path)
             oFile.Close
             oFile.Close
@@ -25,10 +37,19 @@ Public Sub logger(origin As String, level As String, msg As String)
 
 
     Set oFile = fso.OpenTextFile(log_file_path, ForAppending)
     Set oFile = fso.OpenTextFile(log_file_path, ForAppending)
 
 
+    If new_session Then oFile.WriteLine ("**********************************")
+
     'oFile.WriteBlankLines (2)
     'oFile.WriteBlankLines (2)
-    oFile.WriteLine (CStr(Now) + " - " + origin + " - " + level + " - " + msg)
-    
+    line = CStr(Now) + " - " + origin + " - " + level + " - " + msg
+    Debug.Print line
+    oFile.WriteLine (line)
+
     oFile.Close
     oFile.Close
     Set fso = Nothing
     Set fso = Nothing
     Set oFile = Nothing
     Set oFile = Nothing
+    
+    If level = "CRITICAL" Then
+        Call err.Raise(60000, "Critical error", "Critical error occured, see the log file for more informations")
+    End If
+    
 End Sub
 End Sub

+ 29 - 30
source/modules/VCS_Main.bas

@@ -25,6 +25,8 @@ Dim step As String
 
 
     make_sources = opInterrupted
     make_sources = opInterrupted
     
     
+    If InStr(options, "-d") Then set_debug_mode
+    
     step = "Initialization"
     step = "Initialization"
     
     
     ' backup of the sources date, in case of error
     ' backup of the sources date, in case of error
@@ -38,7 +40,7 @@ Dim step As String
         If old_sources_date > #1/1/1900# Then
         If old_sources_date > #1/1/1900# Then
 
 
             msg = msg_list_to_export()
             msg = msg_list_to_export()
-            
+            logger "make_sources", "INFO", "Optimizer: ask for confirmation"
             If Not Len(msg) > 0 Then
             If Not Len(msg) > 0 Then
                 msg = "** VCS OPTIMIZER **" & vbNewLine & ">> Nothing new to export" & vbNewLine & _
                 msg = "** VCS OPTIMIZER **" & vbNewLine & ">> Nothing new to export" & vbNewLine & _
                             "Only the following will be exported:" & vbNewLine & _
                             "Only the following will be exported:" & vbNewLine & _
@@ -63,33 +65,30 @@ Dim step As String
         End If
         End If
         
         
         If MsgBox(msg, vbOKCancel + vbExclamation, "Export") = vbCancel Then GoTo cancelOp
         If MsgBox(msg, vbOKCancel + vbExclamation, "Export") = vbCancel Then GoTo cancelOp
-        
+        logger "make_sources", "INFO", "Activates Optimizer"
     End If
     End If
 
 
 
 
     ' new sources date, before export so that date will be exported with tbl_vsc
     ' new sources date, before export so that date will be exported with tbl_vsc
     step = "Updates sources date"
     step = "Updates sources date"
-    Debug.Print step
+    logger "make_sources", "INFO", step
     Call update_sources_date
     Call update_sources_date
-    Debug.Print "> done"
 
 
     ' zip the app file
     ' zip the app file
     step = "Zip the app file"
     step = "Zip the app file"
-    Debug.Print step
+    logger "make_sources", "INFO", step
     Call zip_app_file
     Call zip_app_file
-    Debug.Print "> done"
     
     
     ' run the export
     ' run the export
     step = "Run VCS Export"
     step = "Run VCS Export"
-    Debug.Print step
+    logger "make_sources", "INFO", step
     Call ExportAllSource
     Call ExportAllSource
-    Debug.Print "> done"
 
 
     make_sources = opCompleted
     make_sources = opCompleted
     Exit Function
     Exit Function
 err:
 err:
     Call update_vcs_param("sources_date", CStr(old_sources_date))
     Call update_vcs_param("sources_date", CStr(old_sources_date))
-    MsgBox "make_sources - Unknown error at: " & step & vbNewLine & err.Description, vbCritical, "Error"
+    logger "make_sources", "CRITICAL", "Unknown error at: " & step & " - " & err.Description
     Exit Function
     Exit Function
 cancelOp:
 cancelOp:
     make_sources = opCancelled
     make_sources = opCancelled
@@ -100,23 +99,24 @@ End Function
 Public Function update_from_sources(Optional ByVal options As String = "") As Integer
 Public Function update_from_sources(Optional ByVal options As String = "") As Integer
 'updates the application from the sources
 'updates the application from the sources
 
 
-Dim backup As Boolean
-Dim step, msg As String
+    Dim backup As Boolean
+    Dim step, msg As String
+    
+    update_from_sources = opInterrupted
 
 
-update_from_sources = opInterrupted
+    If InStr(options, "-d") Then set_debug_mode
 
 
     step = "Creates a backup of the app file"
     step = "Creates a backup of the app file"
-    Debug.Print step
+    logger "update_from_sources", "INFO", step
     backup = make_backup()
     backup = make_backup()
     
     
-    If backup Then
-        Debug.Print "> done"
-    Else
+    If Not backup Then
+        logger "update_from_sources", "ERROR", "Error: unable to backup the app file, do it manually, then click OK"
         MsgBox "Error: unable to backup the app file, do it manually, then click OK", vbExclamation, "Backup"
         MsgBox "Error: unable to backup the app file, do it manually, then click OK", vbExclamation, "Backup"
     End If
     End If
 
 
     step = "Check for unexported work"
     step = "Check for unexported work"
-    Debug.Print step
+    logger "update_from_sources", "INFO", step
     msg = msg_list_to_export()
     msg = msg_list_to_export()
     If Len(msg) > 0 Then
     If Len(msg) > 0 Then
         msg = "** IMPORT WARNING **" & vbNewLine & _
         msg = "** IMPORT WARNING **" & vbNewLine & _
@@ -130,20 +130,18 @@ update_from_sources = opInterrupted
     End If
     End If
 
 
     step = "Run VCS Import"
     step = "Run VCS Import"
-    Debug.Print step
+    logger "update_from_sources", "INFO", step
     Call ImportAllSource
     Call ImportAllSource
-    Debug.Print "> done"
    
    
     ' new sources date to keep the optimizer working
     ' new sources date to keep the optimizer working
     step = "Updates sources date"
     step = "Updates sources date"
-    Debug.Print step
+    logger "update_from_sources", "INFO", step
     Call update_sources_date
     Call update_sources_date
-    Debug.Print "> done"
    
    
     update_from_sources = opCompleted
     update_from_sources = opCompleted
     Exit Function
     Exit Function
 err:
 err:
-    MsgBox "update_from_sources - Unknown error at: " & vbNewLine & step & vbNewLine & err.Description, vbCritical, "Error"
+    logger "update_from_sources", "CRITICAL", "Unknown error at: " & step & " - " & err.Description
     Exit Function
     Exit Function
 cancelOp:
 cancelOp:
     update_from_sources = opCancelled
     update_from_sources = opCancelled
@@ -208,7 +206,7 @@ End Function
 
 
 
 
 Public Function zip_app_file() As Boolean
 Public Function zip_app_file() As Boolean
-    On Error GoTo err
+    On Error GoTo UnknownErr
     Dim command, shortname As String
     Dim command, shortname As String
     
     
     zip_app_file = False
     zip_app_file = False
@@ -230,17 +228,15 @@ Public Function zip_app_file() As Boolean
             "ren tmp_" & shortname & ".zip" & " " & shortname & ".zip" & _
             "ren tmp_" & shortname & ".zip" & " " & shortname & ".zip" & _
             " & exit")
             " & exit")
     
     
-    
+    logger "zip_app_file", "INFO", CurrentProject.path & "\" & CurrentProject.name & " zipped to " & CurrentProject.path & "\" & shortname & ".zip"
     zip_app_file = True
     zip_app_file = True
 
 
-fin:
+end_:
     Exit Function
     Exit Function
 UnknownErr:
 UnknownErr:
+    logger "zip_app_file", "ERROR", "Unable to zip " & CurrentProject.path & "\" & CurrentProject.name & " - " & err.Description
     MsgBox "Unknown error: unable to ZIP the app file, do it manually"
     MsgBox "Unknown error: unable to ZIP the app file, do it manually"
-    GoTo fin
-err:
-    MsgBox "Error while zipping file app: " & err.Description
-    GoTo fin
+    GoTo end_
 End Function
 End Function
 
 
 Public Function make_backup() As Boolean
 Public Function make_backup() As Boolean
@@ -254,8 +250,11 @@ Public Function make_backup() As Boolean
     Call cmd("copy " & Chr(34) & CurrentProject.path & "\" & CurrentProject.name & Chr(34) & _
     Call cmd("copy " & Chr(34) & CurrentProject.path & "\" & CurrentProject.name & Chr(34) & _
              " " & Chr(34) & CurrentProject.path & "\" & CurrentProject.name & ".old" & Chr(34))
              " " & Chr(34) & CurrentProject.path & "\" & CurrentProject.name & ".old" & Chr(34))
     
     
+    logger "make_backup", "INFO", CurrentProject.path & "\" & CurrentProject.name & " copied to " & CurrentProject.path & "\" & CurrentProject.name & ".old"
+    
     make_backup = True
     make_backup = True
     Exit Function
     Exit Function
 err:
 err:
-        MsgBox "Error during backup: " & err.Description
+    logger "make_backup", "ERROR", "Error during the backup of " & CurrentProject.name & ": " & err.Description
+    MsgBox "Error during the backup of " & CurrentProject.name & ": " & err.Description & vbNewLine & "Do it manually"
 End Function
 End Function

+ 7 - 0
source/modules/VCS_Optimizer.bas

@@ -157,9 +157,13 @@ End Function
 
 
 Public Sub update_sources_date()
 Public Sub update_sources_date()
     ' update the sources date with Now()
     ' update the sources date with Now()
+    Dim new_val As String
+    
+    new_val = CStr(Now)
     
     
     Call update_vcs_param("sources_date", CStr(Now))
     Call update_vcs_param("sources_date", CStr(Now))
 
 
+    logger "update_sources_date", "DEBUG", "Source's date updated to " & new_val
 End Sub
 End Sub
 '*****
 '*****
 
 
@@ -173,6 +177,8 @@ Public Function CleanDirs(Optional ByVal sim As Boolean = False)
     Dim source_path As String
     Dim source_path As String
     source_path = VCS_Dir.ProjectPath() & "source\"
     source_path = VCS_Dir.ProjectPath() & "source\"
     
     
+    logger "CleanDirs", "INFO", "Optimizer ON: cleans the directories from " & source_path
+    
     Dim rsSys As DAO.Recordset
     Dim rsSys As DAO.Recordset
     Dim sql As String
     Dim sql As String
     
     
@@ -215,6 +221,7 @@ Public Function CleanDirs(Optional ByVal sim As Boolean = False)
                 CleanDirs = CleanDirs & (Replace(file.path, CurrentProject.path, "."))
                 CleanDirs = CleanDirs & (Replace(file.path, CurrentProject.path, "."))
                 If Not sim Then
                 If Not sim Then
                     oFSO.DeleteFile file
                     oFSO.DeleteFile file
+                    logger "CleanDirs", "DEBUG", "> removed: " & file
                 End If
                 End If
             End If
             End If
             
             

+ 191 - 0
source/modules/VCS_Properties.bas

@@ -0,0 +1,191 @@
+Option Compare Database
+Option Explicit
+
+'****
+'*
+'* Import/Export the properties of DAO Objects
+'*
+'****
+
+Public Sub ExportProperties(daoObject As Object, file_path As String)
+'exports the properties of an Access DAO object (Database, Cintainer, TableDef, Querydef, Field)
+' to a file, with a TAB separator
+'
+    On Error GoTo err
+    
+    VCS_Dir.MkDirIfNotExist Left$(file_path, InStrRev(file_path, "\"))
+    
+    Dim prp As Object
+    Dim prp_name, prp_value, line As String
+    Dim prp_type As Integer
+    Dim count As Integer
+    count = 0
+    
+    Call logger("ExportProperties", "INFO", "Try to export the properties of '" & daoObject.name & "' to '" & file_path & "'")
+
+    Dim objStream As ADODB.Stream
+    
+    Set objStream = CreateObject("ADODB.Stream")
+    objStream.Open
+    objStream.Type = 2 'Text
+    objStream.Charset = "x-ansi"
+    
+    For Each prp In daoObject.Properties
+        
+        If Not isReadOnly(prp) Then
+            
+            prp_name = prp.name
+            prp_value = CStr(prp.value)
+            
+            line = prp_name & vbTab & prp_value & vbTab & CStr(prp.Type)
+            objStream.WriteText line, adWriteLine
+            count = count + 1
+            
+        End If
+        
+    Next prp
+
+    Call logger("ExportProperties", "INFO", "> " & count & " properties exported")
+
+exitsub:
+    objStream.SaveToFile file_path, adSaveCreateOverWrite
+    objStream.Close
+    Exit Sub
+err:
+    Call logger("ExportProperties", "ERROR", "Error during database properties export: " & err.Description)
+    GoTo exitsub
+'err_prop:
+'    Call logger("ExportProperties", "ERROR", "Error while exporting property " & prp_name & "")
+'    GoTo next_prop
+End Sub
+
+Public Sub ImportProperties(daoObject As Object, file_path As String)
+'Import the properties of an EXISTING Access DAO object (Database, Cintainer, TableDef, Querydef, Field)
+'! warning, it is not really stable
+
+    On Error GoTo err
+    Dim splitted_line As Variant
+    Dim line, prp_name, prp_value As String
+    Dim prp_type As Integer
+    Dim buffer As String
+    Dim count As Integer
+
+    Call logger("ImportProperties", "INFO", "Try to import the properties of '" & daoObject.name & "' from '" & file_path & "'")
+
+    buffer = ReadFile(file_path, "x-ansi")
+    
+    count = 0
+    For Each line In Split(buffer, vbNewLine)
+        If Len(line) = 0 Then Exit For
+        count = count + 1
+        
+        splitted_line = Split(line, vbTab)
+        prp_name = splitted_line(0)
+        prp_value = splitted_line(1)
+        prp_type = CInt(splitted_line(2))
+        
+        If prp_value <> vbNullString Then
+            Call SetOrCreateProperty(daoObject, prp_name, prp_value, prp_type, True)
+        End If
+    Next
+
+    Call logger("ImportProperties", "INFO", "> Done")
+
+    Exit Sub
+err:
+    Call logger("ImportProperties", "ERROR", "Error during database properties import (line " & count & "): " & err.Description)
+End Sub
+
+Sub SetOrCreateProperty(ByRef daoObject As Object, ByVal prp_name As String, ByVal prp_value As String, ByVal prp_type As Integer, Optional ByVal IgnoreReadOnly As Boolean = False)
+    Dim prp As Object
+    On Error GoTo err
+        prp = daoObject.Properties(prp_name)
+        If prp.Inherited = True Then Exit Sub
+        prp.value = convert(prp_value, prp_type)
+        
+    Exit Sub
+err:
+    Select Case err.number
+        Case 3270
+            ' property not found
+            Call CreateProperty(daoObject, prp_name, prp_value, prp_type)
+        Case 3421
+            Call logger("SetOrCreateProperty", "ERROR", prp_name & " : Type is not compatible with property (" & prp_value & ", " & prp_type & ")")
+        Case Else
+            If Not IgnoreReadOnly Then
+                Call logger("SetOrCreateProperty", "ERROR", prp_name & " : Property is read only")
+            End If
+    End Select
+  
+End Sub
+
+Public Sub CreateProperty(ByRef daoObject As Object, ByVal prp_name As String, ByVal prp_value As String, ByVal prp_type As Integer)
+    On Error GoTo err
+    Dim prp As Object
+    Set prp = daoObject.CreateProperty(prp_name, prp_type, prp_value)
+    daoObject.Properties.Append prp
+    Exit Sub
+err:
+    Call logger("CreateProperty", "ERROR", prp_name & "> Unable to create the property (" & prp_value & ", " & prp_type & "): " & err.Description)
+End Sub
+
+
+
+Function convert(value As String, dbType As Integer)
+
+   Select Case dbType
+      Case dbBoolean
+         convert = CBool(convert)
+      Case dbByte
+         convert = CByte(value)
+      Case dbInteger
+         convert = CInt(value)
+      Case dbLong
+         convert = CLng(value)
+      Case dbCurrency
+         convert = CCur(value)
+      Case dbSingle
+         convert = CSng(value)
+      Case dbDouble
+         convert = CDbl(value)
+      Case dbDate
+         convert = CDate(value)
+      Case dbText
+         convert = CStr(value)
+      Case dbLongBinary
+         convert = CLng(value)
+      Case dbMemo
+         convert = CStr(value)
+      Case dbGUID
+         convert = CStr(value)
+      Case Else
+         convert = CVar(value)
+   End Select
+
+End Function
+
+Public Function isReadOnly(prp As DAO.Property) As Boolean
+    On Error GoTo err
+    If prp.Inherited = True Then GoTo err
+    
+    DAO.BeginTrans
+    prp.value = prp.value
+    isReadOnly = False
+    DAO.Rollback
+    
+    Exit Function
+err:
+    isReadOnly = True
+    DAO.Rollback
+End Function
+
+Sub test()
+    Dim prp As Object
+    
+    For Each prp In CurrentDb.Properties
+        Call isReadOnly(prp)
+        'Debug.Print prp.name, isReadOnly(prp)
+    
+    Next prp
+    
+End Sub

+ 14 - 2
source/modules/VCS_Reference.bas

@@ -15,7 +15,8 @@ Public Function ImportReferences(ByVal obj_path As String) As Boolean
     Dim Minor As Long
     Dim Minor As Long
     Dim filename As String
     Dim filename As String
     Dim refName As String
     Dim refName As String
-    
+    Dim count As Integer
+    count = 0
     filename = dir$(obj_path & "references.csv")
     filename = dir$(obj_path & "references.csv")
     If Len(filename) = 0 Then
     If Len(filename) = 0 Then
         ImportReferences = False
         ImportReferences = False
@@ -33,9 +34,11 @@ On Error GoTo failed_guid
           Major = CLng(item(1))
           Major = CLng(item(1))
           Minor = CLng(item(2))
           Minor = CLng(item(2))
           Application.References.AddFromGuid GUID, Major, Minor
           Application.References.AddFromGuid GUID, Major, Minor
+          count = count + 1
         Else
         Else
           refName = Trim$(item(0))
           refName = Trim$(item(0))
           Application.References.AddFromFile refName
           Application.References.AddFromFile refName
+          count = count + 1
         End If
         End If
 go_on:
 go_on:
     Loop
     Loop
@@ -43,6 +46,7 @@ On Error GoTo 0
     InFile.Close
     InFile.Close
     Set InFile = Nothing
     Set InFile = Nothing
     Set fso = Nothing
     Set fso = Nothing
+    logger "ImportReferences", "INFO", count & " imported from " & filename
     ImportReferences = True
     ImportReferences = True
     Exit Function
     Exit Function
     
     
@@ -63,7 +67,9 @@ Public Sub ExportReferences(ByVal obj_path As String)
     Dim OutFile As Object
     Dim OutFile As Object
     Dim line As String
     Dim line As String
     Dim ref As Reference
     Dim ref As Reference
-
+    Dim count As Integer
+    count = 0
+    
     Set fso = CreateObject("Scripting.FileSystemObject")
     Set fso = CreateObject("Scripting.FileSystemObject")
     Set OutFile = fso.CreateTextFile(obj_path & "references.csv", overwrite:=True, unicode:=False)
     Set OutFile = fso.CreateTextFile(obj_path & "references.csv", overwrite:=True, unicode:=False)
     For Each ref In Application.References
     For Each ref In Application.References
@@ -71,11 +77,17 @@ Public Sub ExportReferences(ByVal obj_path As String)
             If Not ref.BuiltIn Then
             If Not ref.BuiltIn Then
                 line = ref.GUID & "," & CStr(ref.Major) & "," & CStr(ref.Minor)
                 line = ref.GUID & "," & CStr(ref.Major) & "," & CStr(ref.Minor)
                 OutFile.WriteLine line
                 OutFile.WriteLine line
+                logger "ExportReferences", "DEBUG", "> Reference " & line & " exported"
+                count = count + 1
             End If
             End If
         Else
         Else
             line = ref.FullPath
             line = ref.FullPath
             OutFile.WriteLine line
             OutFile.WriteLine line
+            logger "ExportReferences", "DEBUG", "> Reference " & line & " exported"
+            count = count + 1
         End If
         End If
     Next
     Next
     OutFile.Close
     OutFile.Close
+    
+    logger "ExportReferences", "INFO", count & " references exported to" & obj_path & "references.csv"
 End Sub
 End Sub

+ 6 - 0
source/modules/VCS_Relation.bas

@@ -10,6 +10,8 @@ Public Sub ExportRelation(ByVal rel As DAO.Relation, ByVal filepath As String)
     Set fso = CreateObject("Scripting.FileSystemObject")
     Set fso = CreateObject("Scripting.FileSystemObject")
     Set OutFile = fso.CreateTextFile(filepath, overwrite:=True, unicode:=False)
     Set OutFile = fso.CreateTextFile(filepath, overwrite:=True, unicode:=False)
 
 
+    
+
     OutFile.WriteLine rel.Attributes 'RelationAttributeEnum
     OutFile.WriteLine rel.Attributes 'RelationAttributeEnum
     OutFile.WriteLine rel.name
     OutFile.WriteLine rel.name
     OutFile.WriteLine rel.table
     OutFile.WriteLine rel.table
@@ -25,6 +27,8 @@ Public Sub ExportRelation(ByVal rel As DAO.Relation, ByVal filepath As String)
     
     
     OutFile.Close
     OutFile.Close
 
 
+    logger "ExportRelation", "DEBUG", "Relation " & rel.name & " exported to " & filepath
+
 End Sub
 End Sub
 
 
 Public Sub ImportRelation(ByVal filepath As String)
 Public Sub ImportRelation(ByVal filepath As String)
@@ -58,4 +62,6 @@ Public Sub ImportRelation(ByVal filepath As String)
     
     
     CurrentDb.Relations.Append rel
     CurrentDb.Relations.Append rel
 
 
+    logger "ImportRelation", "DEBUG", "Relation " & rel.name & " imported from " & filepath
+
 End Sub
 End Sub

+ 5 - 0
source/modules/VCS_Report.bas

@@ -87,6 +87,8 @@ Public Sub ExportPrintVars(ByVal obj_name As String, ByVal filepath As String)
   Set rpt = Nothing
   Set rpt = Nothing
   
   
   DoCmd.Close acReport, obj_name, acSaveYes
   DoCmd.Close acReport, obj_name, acSaveYes
+  
+  logger "ExportPrintVars", "DEBUG", "PrintVars of report " & obj_name & " exported to " & filepath
 End Sub
 End Sub
 
 
 Public Sub ImportPrintVars(ByVal obj_name As String, ByVal filepath As String)
 Public Sub ImportPrintVars(ByVal obj_name As String, ByVal filepath As String)
@@ -137,6 +139,9 @@ Public Sub ImportPrintVars(ByVal obj_name As String, ByVal filepath As String)
   Set rpt = Nothing
   Set rpt = Nothing
   
   
   DoCmd.Close acReport, obj_name, acSaveYes
   DoCmd.Close acReport, obj_name, acSaveYes
+  
+  logger "ImportPrintVars", "DEBUG", "PrintVars of report " & obj_name & " imported from " & filepath
+
 Exit Sub
 Exit Sub
 err:
 err:
     logger "ImportPrintVars", "ERROR", "Report " & obj_name & " was not found, import print vars cancelled"
     logger "ImportPrintVars", "ERROR", "Report " & obj_name & " was not found, import print vars cancelled"

+ 26 - 7
source/modules/VCS_Table.bas

@@ -25,7 +25,7 @@ Public Sub ExportLinkedTable(ByVal tbl_name As String, ByVal obj_path As String)
     On Error GoTo Err_LinkedTable
     On Error GoTo Err_LinkedTable
     
     
     Dim tempFilePath As String
     Dim tempFilePath As String
-    
+
     tempFilePath = VCS_File.TempFile()
     tempFilePath = VCS_File.TempFile()
     
     
     Dim fso As Object
     Dim fso As Object
@@ -71,7 +71,11 @@ Err_LinkedTable_Fin:
     On Error Resume Next
     On Error Resume Next
     OutFile.Close
     OutFile.Close
     'save files as .odbc
     'save files as .odbc
-    VCS_File.ConvertUcs2Utf8 tempFilePath, obj_path & VCS_IE_Functions.to_filename(tbl_name) & ".LNKD"
+    Dim path As String
+    path = obj_path & VCS_IE_Functions.to_filename(tbl_name) & ".LNKD"
+    VCS_File.ConvertUcs2Utf8 tempFilePath, path
+    
+    logger "ExportLinkedTable", "DEBUG", "LinkedTable " & tbl_name & " exported to " & path
     
     
     Exit Sub
     Exit Sub
     
     
@@ -119,6 +123,7 @@ Public Sub ExportTableDef(Db As DAO.Database, td As DAO.TableDef, ByVal tableNam
     Dim fso As Object
     Dim fso As Object
     Dim OutFile As Object
     Dim OutFile As Object
     Dim ff As Object
     Dim ff As Object
+    
     'Debug.Print tableName
     'Debug.Print tableName
     Set fso = CreateObject("Scripting.FileSystemObject")
     Set fso = CreateObject("Scripting.FileSystemObject")
     Set OutFile = fso.CreateTextFile(filename, overwrite:=True, unicode:=False)
     Set OutFile = fso.CreateTextFile(filename, overwrite:=True, unicode:=False)
@@ -180,6 +185,8 @@ Public Sub ExportTableDef(Db As DAO.Database, td As DAO.TableDef, ByVal tableNam
     'exort Data Macros
     'exort Data Macros
     VCS_DataMacro.ExportDataMacros tableName, directory
     VCS_DataMacro.ExportDataMacros tableName, directory
     
     
+    logger "ExportTableDef", "DEBUG", "TblDef '" & tableName & "' exported to " & filename
+    
 End Sub
 End Sub
 
 
 Private Function formatReferences(Db As DAO.Database, ff As Object, _
 Private Function formatReferences(Db As DAO.Database, ff As Object, _
@@ -368,7 +375,7 @@ Public Sub ExportTableData(ByVal tbl_name As String, ByVal obj_path As String)
     
     
     ' Checks first
     ' Checks first
     If Not TableExists(tbl_name) Then
     If Not TableExists(tbl_name) Then
-        Debug.Print "Error: Table " & tbl_name & " missing"
+        logger "ExportTableData", "ERROR", "Table " & tbl_name & " missing"
         Exit Sub
         Exit Sub
     End If
     End If
     
     
@@ -419,8 +426,11 @@ Public Sub ExportTableData(ByVal tbl_name As String, ByVal obj_path As String)
     Loop
     Loop
     rs.Close
     rs.Close
     OutFile.Close
     OutFile.Close
-
-    VCS_File.ConvertUcs2Utf8 tempFileName, obj_path & VCS_IE_Functions.to_filename(tbl_name) & ".txt"
+    
+    Dim path As String
+    path = obj_path & VCS_IE_Functions.to_filename(tbl_name) & ".txt"
+    VCS_File.ConvertUcs2Utf8 tempFileName, path
+    logger "ExportTableData", "DEBUG", "Data from '" & tbl_name & "' exported to " & path
     fso.DeleteFile tempFileName
     fso.DeleteFile tempFileName
 End Sub
 End Sub
 
 
@@ -499,6 +509,8 @@ Err_CreateLinkedTable_Fin:
     sql = sql & ") WITH PRIMARY"
     sql = sql & ") WITH PRIMARY"
     CurrentDb.execute sql
     CurrentDb.execute sql
     
     
+    logger "ImportLinkedTable", "DEBUG", "LinkedTable " & tblName & " improted from " & obj_path & tblName & ".LNKD"
+
 Err_LinkPK_Fin:
 Err_LinkPK_Fin:
     On Error Resume Next
     On Error Resume Next
     InFile.Close
     InFile.Close
@@ -590,6 +602,8 @@ Public Sub ImportTableDef(ByVal tblName As String, ByVal directory As String)
     If Len(strMsg) > 0 Then
     If Len(strMsg) > 0 Then
         MsgBox strMsg, vbOKOnly, "Correct manually"
         MsgBox strMsg, vbOKOnly, "Correct manually"
         logger "ImportTableDef", "ERROR", strMsg & " - Correct manually"
         logger "ImportTableDef", "ERROR", strMsg & " - Correct manually"
+    Else
+        logger "ImportTableData", "DEBUG", "TableDef '" & tblName & "' imported from " & filepath
     End If
     End If
         
         
 End Sub
 End Sub
@@ -602,13 +616,15 @@ Public Sub ImportTableData(ByVal tblName As String, ByVal obj_path As String)
     Dim fso As Object
     Dim fso As Object
     Dim InFile As Object
     Dim InFile As Object
     Dim c As Long, buf As String, Values() As String, value As Variant
     Dim c As Long, buf As String, Values() As String, value As Variant
-
+    Dim path As String
+    
     Set fso = CreateObject("Scripting.FileSystemObject")
     Set fso = CreateObject("Scripting.FileSystemObject")
     
     
     Dim tempFileName As String
     Dim tempFileName As String
     tempFileName = VCS_File.TempFile()
     tempFileName = VCS_File.TempFile()
     
     
-    VCS_File.ConvertUtf8Ucs2 obj_path & tblName & ".txt", tempFileName
+    path = obj_path & tblName & ".txt"
+    VCS_File.ConvertUtf8Ucs2 path, tempFileName
     
     
     ' open file for reading with Create=False, Unicode=True (USC-2 Little Endian format)
     ' open file for reading with Create=False, Unicode=True (USC-2 Little Endian format)
     Set InFile = fso.OpenTextFile(tempFileName, iomode:=ForReading, create:=False, Format:=TristateTrue)
     Set InFile = fso.OpenTextFile(tempFileName, iomode:=ForReading, create:=False, Format:=TristateTrue)
@@ -645,5 +661,8 @@ Public Sub ImportTableData(ByVal tblName As String, ByVal obj_path As String)
 
 
     rs.Close
     rs.Close
     InFile.Close
     InFile.Close
+    
+    logger "ImportTableData", "DEBUG", "Table data '" & tblName & "' imported from " & path
+
     fso.DeleteFile tempFileName
     fso.DeleteFile tempFileName
 End Sub
 End Sub

+ 1 - 1
source/tables/ztbl_vcs.txt

@@ -1,3 +1,3 @@
 key	val
 key	val
 include_tables	ztbl_vcs,tbl_commands
 include_tables	ztbl_vcs,tbl_commands
-sources_date	03/11/2016 17:03:20
+sources_date	04/11/2016 17:53:48

二進制
vcs.zip