فهرست منبع

réparation de l'export selectif des tables, conversion utf8 autmatisée selon format du fichier

olivier.massot 8 سال پیش
والد
کامیت
5303878e31

+ 1 - 0
.gitignore

@@ -8,5 +8,6 @@ copy_to_addin_dir.cmd
 *.log
 *.log
 tests/work/
 tests/work/
 tests/results/
 tests/results/
+_.gitlab-ci.yml
 
 
 
 

BIN
OpenAccess.zip


+ 2 - 3
README.md

@@ -11,7 +11,7 @@ Logo by [Freepik](http://www.freepik.com), from [Flaticon](http://www.flaticon.c
 INSTALLATION
 INSTALLATION
 ---------
 ---------
 
 
-Pour l'installer (Access 2010):  
+Pour l'installer (Access 2007 ou supérieur):  
 
 
 - Télécharger le fichier [OpenAccess.zip](http://codebox/dev/VCS/blob/master/OpenAccess.zip)
 - Télécharger le fichier [OpenAccess.zip](http://codebox/dev/VCS/blob/master/OpenAccess.zip)
 - Extraire le fichier 'OpenAccess.accda' de l'archive
 - Extraire le fichier 'OpenAccess.accda' de l'archive
@@ -27,7 +27,7 @@ OpenAccess est maintenant accessible depuis la liste des compléments pour tous
 UTILISATION
 UTILISATION
 -------
 -------
 
 
-Pour lancer OpenAccess (Access 2010):  
+Pour lancer OpenAccess (Access 2007 ou supérieur):  
 
 
 > Menu 'Outils de la base de données' > 'Compléments' > 'OpenAccess'  
 > Menu 'Outils de la base de données' > 'Compléments' > 'OpenAccess'  
 
 
@@ -56,4 +56,3 @@ L'export et l'import des procédures stockées n'a pas encore été testé.
 
 
 
 
 
 
-

+ 19 - 19
source/forms/OpenAccess.bas

@@ -21,9 +21,9 @@ Begin Form
     Width =6645
     Width =6645
     DatasheetFontHeight =11
     DatasheetFontHeight =11
     ItemSuffix =43
     ItemSuffix =43
-    Left =-22140
+    Left =-21750
     Top =2430
     Top =2430
-    Right =-7110
+    Right =-11625
     Bottom =14565
     Bottom =14565
     DatasheetGridlinesColor =14806254
     DatasheetGridlinesColor =14806254
     RecSrcDt = Begin
     RecSrcDt = Begin
@@ -275,7 +275,7 @@ Begin Form
                 Begin CommandButton
                 Begin CommandButton
                     OverlapFlags =223
                     OverlapFlags =223
                     TextFontFamily =49
                     TextFontFamily =49
-                    Left =5394
+                    Left =5281
                     Top =680
                     Top =680
                     Width =804
                     Width =804
                     Height =739
                     Height =739
@@ -327,9 +327,9 @@ Begin Form
                         0x0000000000000000
                         0x0000000000000000
                     End
                     End
 
 
-                    LayoutCachedLeft =5394
+                    LayoutCachedLeft =5281
                     LayoutCachedTop =680
                     LayoutCachedTop =680
-                    LayoutCachedWidth =6198
+                    LayoutCachedWidth =6085
                     LayoutCachedHeight =1419
                     LayoutCachedHeight =1419
                     ForeTint =100.0
                     ForeTint =100.0
                     Gradient =0
                     Gradient =0
@@ -362,7 +362,7 @@ Begin Form
                 Begin CommandButton
                 Begin CommandButton
                     OverlapFlags =223
                     OverlapFlags =223
                     TextFontFamily =49
                     TextFontFamily =49
-                    Left =5225
+                    Left =5281
                     Top =2947
                     Top =2947
                     Width =805
                     Width =805
                     Height =739
                     Height =739
@@ -414,9 +414,9 @@ Begin Form
                         0x7048b0ff7048b0ff
                         0x7048b0ff7048b0ff
                     End
                     End
 
 
-                    LayoutCachedLeft =5225
+                    LayoutCachedLeft =5281
                     LayoutCachedTop =2947
                     LayoutCachedTop =2947
-                    LayoutCachedWidth =6030
+                    LayoutCachedWidth =6086
                     LayoutCachedHeight =3686
                     LayoutCachedHeight =3686
                     ForeTint =100.0
                     ForeTint =100.0
                     Gradient =0
                     Gradient =0
@@ -477,7 +477,7 @@ Begin Form
                     FontSize =9
                     FontSize =9
                     TabIndex =8
                     TabIndex =8
                     Name ="cmd_open_log"
                     Name ="cmd_open_log"
-                    Caption ="Commande8"
+                    Caption ="Open log file"
                     OnClick ="[Event Procedure]"
                     OnClick ="[Event Procedure]"
                     FontName ="Consolas"
                     FontName ="Consolas"
                     ObjectPalette = Begin
                     ObjectPalette = Begin
@@ -566,7 +566,7 @@ Begin Form
                     FontSize =9
                     FontSize =9
                     TabIndex =9
                     TabIndex =9
                     Name ="cmd_open_log_dir"
                     Name ="cmd_open_log_dir"
-                    Caption ="Commande9"
+                    Caption ="Open log directory"
                     OnClick ="[Event Procedure]"
                     OnClick ="[Event Procedure]"
                     FontName ="Consolas"
                     FontName ="Consolas"
                     ControlTipText ="Open the log directory"
                     ControlTipText ="Open the log directory"
@@ -673,7 +673,7 @@ Begin Form
                     TabIndex =10
                     TabIndex =10
                     BorderColor =10921638
                     BorderColor =10921638
                     Name ="chk_debug_mode"
                     Name ="chk_debug_mode"
-                    DefaultValue ="True"
+                    DefaultValue ="False"
                     ControlTipText ="Activate debug mode (log file more verbose)"
                     ControlTipText ="Activate debug mode (log file more verbose)"
                     GridlineColor =10921638
                     GridlineColor =10921638
 
 
@@ -908,7 +908,7 @@ Begin Form
                     OverlapFlags =215
                     OverlapFlags =215
                     TextAlign =2
                     TextAlign =2
                     TextFontFamily =49
                     TextFontFamily =49
-                    Left =5385
+                    Left =5272
                     Top =1530
                     Top =1530
                     Width =794
                     Width =794
                     Height =226
                     Height =226
@@ -919,9 +919,9 @@ Begin Form
                     Caption ="Export"
                     Caption ="Export"
                     FontName ="Consolas"
                     FontName ="Consolas"
                     GridlineColor =10921638
                     GridlineColor =10921638
-                    LayoutCachedLeft =5385
+                    LayoutCachedLeft =5272
                     LayoutCachedTop =1530
                     LayoutCachedTop =1530
-                    LayoutCachedWidth =6179
+                    LayoutCachedWidth =6066
                     LayoutCachedHeight =1756
                     LayoutCachedHeight =1756
                     ThemeFontIndex =-1
                     ThemeFontIndex =-1
                     ForeTint =100.0
                     ForeTint =100.0
@@ -931,7 +931,7 @@ Begin Form
                     OverlapFlags =215
                     OverlapFlags =215
                     TextAlign =2
                     TextAlign =2
                     TextFontFamily =49
                     TextFontFamily =49
-                    Left =5215
+                    Left =5281
                     Top =3800
                     Top =3800
                     Width =825
                     Width =825
                     Height =225
                     Height =225
@@ -942,9 +942,9 @@ Begin Form
                     Caption ="Import"
                     Caption ="Import"
                     FontName ="Consolas"
                     FontName ="Consolas"
                     GridlineColor =10921638
                     GridlineColor =10921638
-                    LayoutCachedLeft =5215
+                    LayoutCachedLeft =5281
                     LayoutCachedTop =3800
                     LayoutCachedTop =3800
-                    LayoutCachedWidth =6040
+                    LayoutCachedWidth =6106
                     LayoutCachedHeight =4025
                     LayoutCachedHeight =4025
                     ThemeFontIndex =-1
                     ThemeFontIndex =-1
                     ForeTint =100.0
                     ForeTint =100.0
@@ -978,7 +978,7 @@ Begin Form
                     IMESentenceMode =3
                     IMESentenceMode =3
                     Left =1984
                     Left =1984
                     Top =1530
                     Top =1530
-                    Width =2057
+                    Width =3062
                     Height =270
                     Height =270
                     FontSize =9
                     FontSize =9
                     TabIndex =11
                     TabIndex =11
@@ -990,7 +990,7 @@ Begin Form
 
 
                     LayoutCachedLeft =1984
                     LayoutCachedLeft =1984
                     LayoutCachedTop =1530
                     LayoutCachedTop =1530
-                    LayoutCachedWidth =4041
+                    LayoutCachedWidth =5046
                     LayoutCachedHeight =1800
                     LayoutCachedHeight =1800
                     BorderThemeColorIndex =0
                     BorderThemeColorIndex =0
                     BorderTint =50.0
                     BorderTint =50.0

+ 6 - 7
source/modules/OA_Documents.bas

@@ -2,12 +2,11 @@ Option Compare Database
 Option Private Module
 Option Private Module
 Option Explicit
 Option Explicit
 
 
-'Dim UTF8CONVERSION As Boolean
-'Public Sub activate_Utf8Conversion()
-'    UTF8CONVERSION = True
-'End Sub
+Public Function utf8_conversion() As Boolean
+' utf8 conversion is needed for Access 2007 and later
+    utf8_conversion = (CurrentProject.FileFormat >= acFileFormatAccess2007)
 
 
-Const UTF8CONVERSION = True
+End Function
 
 
 Public Function get_container_name(ByVal acType As Integer)
 Public Function get_container_name(ByVal acType As Integer)
 'return the name of an access object container from its acType
 'return the name of an access object container from its acType
@@ -40,7 +39,7 @@ Public Sub ExportDocument(ByVal acType As Integer, ByVal obj_name As String, ByV
     Application.SaveAsText acType, obj_name, file_path
     Application.SaveAsText acType, obj_name, file_path
 
 
     If acType <> acModule Then
     If acType <> acModule Then
-        If UTF8CONVERSION Then
+        If utf8_conversion() Then
             logger "ExportDocument", "DEBUG", "Encode file in UTF-8"
             logger "ExportDocument", "DEBUG", "Encode file in UTF-8"
             Dim tempFileName As String
             Dim tempFileName As String
             tempFileName = TempFile()
             tempFileName = TempFile()
@@ -67,7 +66,7 @@ Public Sub ImportDocument(ByVal acType As Integer, ByVal obj_name As String, ByV
     logger "ImportDocument", "DEBUG", "Try to import " & obj_name & "(type " & acType & ")  from: " & file_path
     logger "ImportDocument", "DEBUG", "Try to import " & obj_name & "(type " & acType & ")  from: " & file_path
     
     
     If acType <> acModule Then
     If acType <> acModule Then
-        If UTF8CONVERSION Then
+        If utf8_conversion() Then
             logger "ImportDocument", "DEBUG", "Encode in UCS2 before import"
             logger "ImportDocument", "DEBUG", "Encode in UCS2 before import"
             tempFileName = TempFile()
             tempFileName = TempFile()
             ConvertUtf8Ucs2 file_path, tempFileName
             ConvertUtf8Ucs2 file_path, tempFileName

+ 0 - 1
source/modules/OA_Log.bas

@@ -66,7 +66,6 @@ Public Sub logger(ByVal origin As String, ByVal level As String, ByVal msg As St
 
 
     If new_session Then oFile.WriteLine ("**********************************")
     If new_session Then oFile.WriteLine ("**********************************")
 
 
-    'oFile.WriteBlankLines (2)
     Line = CStr(Now) + " - " + origin + " - " + level + " - " + msg
     Line = CStr(Now) + " - " + origin + " - " + level + " - " + msg
     Debug.Print Line
     Debug.Print Line
     oFile.WriteLine (Line)
     oFile.WriteLine (Line)

+ 3 - 3
source/modules/OA_Optimizer.bas

@@ -59,7 +59,7 @@ Public Function get_last_update_date(ByVal acType As Integer, ByVal name As Stri
     
     
     Exit Function
     Exit Function
 err:
 err:
-    Debug.Print "get_last_update_date - erreur - " & acType & ", " & name & ": " & err.Description
+    logger "get_last_update_date", "ERROR", "" & acType & ", " & name & ": " & err.Description
     get_last_update_date = #1/1/1900#
     get_last_update_date = #1/1/1900#
 End Function
 End Function
 
 
@@ -305,9 +305,9 @@ Public Function files_exist_for(acType As Integer, name As String) As Boolean
         Case acTable
         Case acTable
             
             
             files_exist_for = ( _
             files_exist_for = ( _
-                                 dir(source_path & "tbldefs\" & name & ".xml") <> "" _
+                                 dir(source_path & "tables\" & name & ".xml") <> "" _
                                  Or _
                                  Or _
-                                 dir(source_path & "tbldefs\" & name & ".lnkd") <> "" _
+                                 dir(source_path & "tables\" & name & ".lnkd") <> "" _
                                )
                                )
         
         
         Case acMacro
         Case acMacro

+ 0 - 2
source/modules/OA_Path.bas

@@ -3,8 +3,6 @@ Option Private Module
 Option Explicit
 Option Explicit
 
 
 'operations on directories and path
 'operations on directories and path
-
-
 Public Function norm_path(ByVal path As String) As String
 Public Function norm_path(ByVal path As String) As String
 
 
     path = Replace(path, "/", "\")
     path = Replace(path, "/", "\")

+ 2 - 2
source/modules/VCS_Report.bas

@@ -69,7 +69,7 @@ Public Sub ExportPrintVars(ByVal obj_name As String, ByVal filepath As String)
   Else
   Else
     Set rpt = Nothing
     Set rpt = Nothing
     DoCmd.Close acReport, obj_name, acSaveNo
     DoCmd.Close acReport, obj_name, acSaveNo
-    Debug.Print "Warning: PrtDevMode is null"
+    logger "ExportPrintVars", "WARNING", "PrtDevMode is null"
     Exit Sub
     Exit Sub
   End If
   End If
   
   
@@ -116,7 +116,7 @@ Public Sub ImportPrintVars(ByVal obj_name As String, ByVal filepath As String)
   Else
   Else
     Set rpt = Nothing
     Set rpt = Nothing
     DoCmd.Close acReport, obj_name, acSaveNo
     DoCmd.Close acReport, obj_name, acSaveNo
-    Debug.Print "Warning: PrtDevMode is null"
+    logger "ImportPrintVars", "WARNING", "PrtDevMode is null"
     Exit Sub
     Exit Sub
   End If
   End If
   
   

+ 3 - 3
source/tables/USysOpenAccess.xml

@@ -49,7 +49,7 @@ AAAFAAAAAAAAAAAAAAAAAAAAAAA=
 <od:fieldProperty name="GUID" type="9" value="0yLhZuf89E6xw4A7qT+Xjw==
 <od:fieldProperty name="GUID" type="9" value="0yLhZuf89E6xw4A7qT+Xjw==
 "/>
 "/>
 <od:fieldProperty name="ColumnWidth" type="3" value="1650"/>
 <od:fieldProperty name="ColumnWidth" type="3" value="1650"/>
-<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="1"/>
 <od:fieldProperty name="ColumnHidden" type="1" value="0"/>
 <od:fieldProperty name="ColumnHidden" type="1" value="0"/>
 <od:fieldProperty name="TextAlign" type="2" value="0"/>
 <od:fieldProperty name="TextAlign" type="2" value="0"/>
 <od:fieldProperty name="AggregateType" type="4" value="-1"/>
 <od:fieldProperty name="AggregateType" type="4" value="-1"/>
@@ -99,14 +99,14 @@ AAAFAAAAAAAAAAAAAAAAAAAAAAA=
 </xsd:complexType>
 </xsd:complexType>
 </xsd:element>
 </xsd:element>
 </xsd:schema>
 </xsd:schema>
-<dataroot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" generated="2016-12-13T13:42:46">
+<dataroot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" generated="2017-02-20T13:49:47">
 <USysOpenAccess>
 <USysOpenAccess>
 <key>include_tables</key>
 <key>include_tables</key>
 <val>USysOpenAccess,USysRegInfo</val>
 <val>USysOpenAccess,USysRegInfo</val>
 </USysOpenAccess>
 </USysOpenAccess>
 <USysOpenAccess>
 <USysOpenAccess>
 <key>sources_date</key>
 <key>sources_date</key>
-<val>06/12/2016 16:56:23</val>
+<val>20/02/2017 13:44:34</val>
 </USysOpenAccess>
 </USysOpenAccess>
 </dataroot>
 </dataroot>
 </root>
 </root>

+ 1 - 1
source/tables/USysRegInfo.xml

@@ -119,7 +119,7 @@ AAAAAAAAAAAAAAAADAAAAAUAAAAAAAAAAAAAAAAAAAAAAA==
 </xsd:complexType>
 </xsd:complexType>
 </xsd:element>
 </xsd:element>
 </xsd:schema>
 </xsd:schema>
-<dataroot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" generated="2016-12-13T13:42:46">
+<dataroot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" generated="2017-02-20T13:49:47">
 <USysRegInfo>
 <USysRegInfo>
 <Subkey>HKEY_CURRENT_ACCESS_PROFILE\Menu Add-ins\OpenAccess</Subkey>
 <Subkey>HKEY_CURRENT_ACCESS_PROFILE\Menu Add-ins\OpenAccess</Subkey>
 <Type>0</Type>
 <Type>0</Type>

+ 0 - 28
tests/bac.py

@@ -1,28 +0,0 @@
-'''
-Created on 13 dec. 2016
-
-@author: olivier.massot
-'''
-import re
-
-
-CMP_IGNORE_LINES = ["<dataroot xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" generated=\"\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\">"]
-
-line = """<dataroot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" generated="2016-12-13T10:46:21">"""
-
-# print(re.match(CMP_IGNORE_LINES[0], str(line)))
-
-with open(r"C:\dev\access\OpenAccess\tests\reference\source\tables\TableTestAdvancedFields.xml", "rb") as source_file:
-    count= 0 
-    for line in source_file:
-        count += 1
-        if count == 198:
-            print(line)
-            print(str(line))
-        ignore = False
-        for ignore_regex in CMP_IGNORE_LINES:
-            if re.match(ignore_regex, str(line)) != None:
-                print(line)
-                ignore = True
-        
-