Browse Source

Ajout des fonctions ExportTable et ImportTable, qui remplacent ExportTableDef, ImportTableDef, ExportTableData, ImportTableData

olivier.massot 10 years ago
parent
commit
fe85a61739
56 changed files with 2095 additions and 861 deletions
  1. 2 1
      .gitignore
  2. BIN
      OpenAccess.zip
  3. 2 7
      README.md
  4. 1 1
      source/database.properties
  5. 6 2
      source/modules/OA_Documents.bas
  6. 27 67
      source/modules/OA_Export.bas
  7. 13 56
      source/modules/OA_Import.bas
  8. 23 15
      source/modules/OA_Main.bas
  9. 0 13
      source/modules/OA_Msg.bas
  10. 1 1
      source/modules/OA_Optimizer.bas
  11. 18 3
      source/modules/OA_Path.bas
  12. 173 11
      source/modules/OA_Properties.bas
  13. 46 0
      source/modules/OA_Table.bas
  14. 2 2
      source/modules/VCS_DataMacro.bas
  15. 2 0
      source/modules/VCS_File.bas
  16. 11 3
      source/modules/VCS_Relation.bas
  17. 4 566
      source/modules/VCS_Table.bas
  18. 4 2
      source/references.csv
  19. 0 3
      source/tables/USysOpenAccess.txt
  20. 112 0
      source/tables/USysOpenAccess.xml
  21. 0 5
      source/tables/USysRegInfo.txt
  22. 146 0
      source/tables/USysRegInfo.xml
  23. 0 4
      source/tbldef/USysOpenAccess.sql
  24. 0 6
      source/tbldef/USysRegInfo.sql
  25. 0 4
      source/tbldefs/USysOpenAccess.sql
  26. 0 6
      source/tbldefs/USysRegInfo.sql
  27. BIN
      tests/__pycache__/utilities.cpython-34.pyc
  28. 28 0
      tests/bac.py
  29. 13 5
      tests/readme.md
  30. 0 2
      tests/reference/source/tables/TableTestAdvancedFields.txt
  31. 215 0
      tests/reference/source/tables/TableTestAdvancedFields.xml
  32. 0 2
      tests/reference/source/tables/TableTestBaseFields.txt
  33. 398 0
      tests/reference/source/tables/TableTestBaseFields.xml
  34. 111 0
      tests/reference/source/tables/TableTestRelation1.xml
  35. 112 0
      tests/reference/source/tables/TableTestRelation2.xml
  36. 112 0
      tests/reference/source/tables/TableTestRelation3.xml
  37. 92 0
      tests/reference/source/tables/TableTestRelation4.xml
  38. 76 0
      tests/reference/source/tables/TableTestSpecialChars_éèà@~êëç_[92]_[47]_[58]_[42]_[63]_[60]_[62]_[124].xml
  39. 0 5
      tests/reference/source/tables/TableWithData.txt
  40. 121 0
      tests/reference/source/tables/TableWithData.xml
  41. 94 0
      tests/reference/source/tables/TableWithProperties.xml
  42. 0 3
      tests/reference/source/tables/USysOpenAccess.txt
  43. 111 0
      tests/reference/source/tables/USysOpenAccess.xml
  44. 0 0
      tests/reference/source/tables/linked_table.LNKD
  45. 0 7
      tests/reference/source/tbldefs/TableTestAdvancedFields.sql
  46. 0 17
      tests/reference/source/tbldefs/TableTestBaseFields.sql
  47. 0 5
      tests/reference/source/tbldefs/TableTestRelation1.sql
  48. 0 5
      tests/reference/source/tbldefs/TableTestRelation2.sql
  49. 0 5
      tests/reference/source/tbldefs/TableTestRelation3.sql
  50. 0 4
      tests/reference/source/tbldefs/TableTestRelation4.sql
  51. 0 3
      tests/reference/source/tbldefs/TableTestSpecialChars_éèà@~êëç_[92]_[47]_[58]_[42]_[63]_[60]_[62]_[124].sql
  52. 0 4
      tests/reference/source/tbldefs/TableWithData.sql
  53. 0 4
      tests/reference/source/tbldefs/TableWithProperties.sql
  54. 0 4
      tests/reference/source/tbldefs/USysOpenAccess.sql
  55. 3 3
      tests/test.py
  56. 16 5
      tests/utilities.py

+ 2 - 1
.gitignore

@@ -6,6 +6,7 @@
 *.old
 copy_to_addin_dir.cmd
 *.log
-
+tests/work/
+tests/results/
 
 

BIN
OpenAccess.zip


+ 2 - 7
README.md

@@ -39,18 +39,13 @@ LIMITES CONNUES
 Dans sa version actuelle, OpenAccess présente les limites suivantes:
 
 * Les types de champs suivants ne sont pas correctement exportés:
-  * Lien hypertexte
-  * Champ calculé
-  * Objets OLE
-  * Pièces jointes
   * Listes de choix 
   
-
 * Ne sont pas exporté(e)s:
-  * La mise en forme des tables  
+  * La mise en forme des tables
   * Les barres de menus / d'outils
   
-
+L'export et l'import des procédures stockées n'a pas encore été testé.
 
 
 

+ 1 - 1
source/database.properties

@@ -33,7 +33,7 @@ Show Values in Non-Indexed	1	4
 Show Values in Remote	0	4
 Auto Compact	0	4
 NavPane Closed	0	4
-NavPane Width	204	4
+NavPane Width	230	4
 NavPane View By	0	4
 NavPane Sort By	1	4
 AppTitle	OpenAccess	10

+ 6 - 2
source/modules/OA_Documents.bas

@@ -29,6 +29,7 @@ End Function
 
 ' Export a database object with optional UCS2-to-UTF-8 conversion.
 Public Sub ExportDocument(ByVal acType As Integer, ByVal obj_name As String, ByVal file_path As String)
+    On Error GoTo err
 ' encoding can be either 'UCS2' (default), either 'utf-8'
     
     logger "ExportDocument", "DEBUG", "Try to export " & obj_name & "(type " & acType & ")  from: " & file_path
@@ -51,8 +52,11 @@ Public Sub ExportDocument(ByVal acType As Integer, ByVal obj_name As String, ByV
         SanitizeFile file_path
     End If
     
-    logger "ExportDocument", "DEBUG", obj_name & " (type " & acType & ") exported to " & file_path
+    logger "ExportDocument", "DEBUG", "> exported"
 
+    Exit Sub
+err:
+    logger "ExportDocument", "CRITICAL", "Unable to export " & obj_name & " [" & err.Description & "]"
 End Sub
 
 ' Import a database object with optional UTF-8-to-UCS2 conversion.
@@ -82,5 +86,5 @@ end_:
 
     Exit Sub
 err:
-    logger "ImportDocument", "CRITICAL", "Unable to import " & obj_name & "[" & err.Description & "]"
+    logger "ImportDocument", "CRITICAL", "Unable to import " & obj_name & " [" & err.Description & "]"
 End Sub

+ 27 - 67
source/modules/OA_Export.bas

@@ -2,15 +2,12 @@ Option Compare Database
 Option Explicit
 
 Public Sub ExportAll(Optional ByVal newer_only As Boolean = False)
-    Dim db As DAO.Database
 
     logger "ExportAllSource", "INFO", "Begin 'Export all sources'"
     logger "ExportAllSource", "DEBUG", "> Newer only: " & newer_only
     
     ' try to save current project
     Call SaveProject
-    
-    Set db = CurrentDb
 
     ' close any opened form or report, except OpenAccess's form
     Call CloseFormsReports
@@ -28,9 +25,7 @@ Public Sub ExportAll(Optional ByVal newer_only As Boolean = False)
 
     Call ExportAllDocs(acModule, newer_only)
     
-    Call ExportAllTblDefs(newer_only)
-    
-    Call ExportAllTableDatas
+    Call ExportAllTables(newer_only)
     
     Call ExportReferences
     
@@ -71,13 +66,12 @@ Public Sub ExportAllQueries(Optional ByVal newer_only As Boolean = False)
         End If
     
         If newer_only Then
-            If Not needs_export(acQuery, qry.name) > 0 Then
+            If needs_export(acQuery, qry.name) = NoExportNeeded Then
                 logger "ExportAllQueries", "DEBUG", "Query " & qry.name & " skipped"
                 GoTo next_qry
             End If
         End If
         
-        'DoEvents 'utility?
         file_path = joinpaths(dirpath, to_filename(qry.name) & ".bas")
         
         ExportDocument acQuery, qry.name, file_path
@@ -134,7 +128,7 @@ Public Sub ExportAllDocs(ByVal acType As Integer, Optional ByVal newer_only As B
         End If
 
         If newer_only Then
-            If Not needs_export(acType, doc.name) > 0 Then
+            If needs_export(acType, doc.name) = NoExportNeeded Then
                 logger "ExportAllDocs", "DEBUG", doc_label & ": '" & doc.name & " skipped"
                 GoTo next_doc
             End If
@@ -161,22 +155,26 @@ next_doc:
 
 End Sub
 
-Public Sub ExportAllTblDefs(Optional ByVal newer_only As Boolean = False)
-'export table definitions
-    Dim dirpath, file_path As String
-    Dim count, total As Integer
+Public Sub ExportAllTables(Optional ByVal newer_only As Boolean = False)
+    'export table definitions and data (if the table is in include_tables list)
+    Dim dirpath As String
+    Dim file_path As String
+    
+    Dim count As Integer
+    Dim total As Integer
     Dim td As DAO.TableDef
     Dim tds As DAO.TableDefs
-        
+    Dim with_data As Boolean
+
     Dim db As DAO.Database
     Set db = CurrentDb()
     
-    dirpath = joinpaths(source_dir(), "tbldefs\")
+    dirpath = joinpaths(source_dir(), "tables\")
     mktree dirpath
     
-    logger "ExportTblDefs", "INFO", "Export tabledefs"
-    logger "ExportTblDefs", "DEBUG", "> export to: " & dirpath
-    logger "ExportTblDefs", "DEBUG", "> Newer only: " & newer_only
+    logger "ExportAllTables", "INFO", "Export tabledefs"
+    logger "ExportAllTables", "DEBUG", "> export to: " & dirpath
+    logger "ExportAllTables", "DEBUG", "> Newer only: " & newer_only
     
     Set tds = db.TableDefs
     count = 0
@@ -186,22 +184,28 @@ Public Sub ExportAllTblDefs(Optional ByVal newer_only As Boolean = False)
         total = tds.count
     End If
 
+    Dim include_tables As String
+    include_tables = get_include_tables()
+    Dim IncludeTablesCol As Collection
+    Set IncludeTablesCol = StrSetToCol(include_tables, ",")
+
     For Each td In tds
 
         If Left$(td.name, 1) = "~" Or Left$(td.name, 4) = "MSys" Then
-            logger "ExportAllTblDefs", "DEBUG", "tables: " & td.name & " ignored"
+            logger "ExportAllTables", "DEBUG", "tables: " & td.name & " ignored"
             GoTo next_td
         End If
 
         If newer_only Then
-            If Not needs_export(acTable, td.name) > 0 Then
-                logger "ExportAllTblDefs", "DEBUG", "tables: " & td.name & " skipped"
+            If needs_export(acTable, td.name) = NoExportNeeded Then
+                logger "ExportAllTables", "DEBUG", "tables: " & td.name & " skipped"
                 GoTo next_td
             End If
         End If
 
         If Len(td.connect) = 0 Then ' this is not an external table
-            ExportTableDef CurrentDb, td, dirpath
+            with_data = (InCollection(IncludeTablesCol, td.name) Or include_tables = "*")
+            ExportTable td.name, dirpath, with_data
         Else
             ExportLinkedTable td.name, dirpath
         End If
@@ -212,52 +216,8 @@ next_td:
     Next
     
     Call SysCmd(acSysCmdClearStatus)
-    logger "ExportAllTblDefs", "INFO", "> " & count & " tbldefs exported"
-    
-End Sub
-
-Public Sub ExportAllTableDatas()
-    Dim dirpath, include_tables As String
-    Dim count, total As Integer
-    Dim td As DAO.TableDef
-    
-    dirpath = joinpaths(source_dir(), "tables\")
-    mktree dirpath
-    
-    logger "ExportTableDatas", "INFO", "Export table's data"
-    logger "ExportTableDatas", "DEBUG", "> export to: " & dirpath
+    logger "ExportAllTables", "INFO", "> " & count & " tbldefs exported"
     
-
-    count = 0
-    
-    include_tables = get_include_tables()
-    count = 0
-    total = UBound(Split(include_tables, ",")) + 1
-    
-    Dim IncludeTablesCol As Collection
-    Set IncludeTablesCol = StrSetToCol(include_tables, ",")
-    
-    For Each td In CurrentDb.TableDefs()
-        
-        If InCollection(IncludeTablesCol, td.name) Or include_tables = "*" Then
-        
-            If Len(td.connect) <> 0 Then ' this is not an external table
-                logger "ExportTableDatas", "ERROR", td.name & " >> You can't export data from a linked table"
-                GoTo next_td
-            End If
-
-            ExportTableData CStr(td.name), dirpath
-            count = count + 1
-
-            Call SysCmd(4, "Export table's data: " & count & " on " & total)
-            
-        End If
-        
-next_td:
-    Next
-    
-    Call SysCmd(acSysCmdClearStatus)
-    logger "ExportTableDatas", "INFO", "> " & count & " table's datas exported"
 End Sub
 
 Public Sub ExportAllRelations()

+ 13 - 56
source/modules/OA_Import.bas

@@ -22,8 +22,8 @@ Public Sub ImportAll()
 
     Call ImportAllQueries
     
-    Call ImportAllTblDefs
-    Call ImportAllTableDatas
+    Call ImportAllTables
+    Call ImportAllLinkedTables
     Call ImportAllDataMacros
     
     Call ImportAllDocs(acForm)
@@ -87,39 +87,36 @@ Public Sub ImportAllQueries()
     
 End Sub
 
-Public Sub ImportAllTblDefs()
+Public Sub ImportAllTables()
     Dim dirpath, obj_name As String
     Dim filename As Variant
     Dim count, total As Integer
     
-    dirpath = joinpaths(source_dir(), "tbldefs\")
+    dirpath = joinpaths(source_dir(), "tables\")
     
-    logger "ImportAllTblDefs", "INFO", "Import table defs"
-    logger "ImportAllTblDefs", "DEBUG", "> import from: " & dirpath
+    logger "ImportAllTables", "INFO", "Import local tables"
+    logger "ImportAllTables", "DEBUG", "> import from: " & dirpath
     
     count = 0
     total = 0
     
     Dim to_import As String
-    to_import = list_files_in(dirpath, "*.sql")
+    to_import = list_files_in(dirpath, "*.xml")
     total = UBound(Split(to_import, "|")) + 1
     
     If Len(to_import) > 0 Then
         For Each filename In Split(to_import, "|")
-        
-            obj_name = Mid$(filename, 1, InStrRev(filename, ".") - 1)
-            obj_name = to_accessname(obj_name)
-            
-            ImportTableDef CStr(obj_name), dirpath
+      
+            ImportTable joinpaths(dirpath, filename)
             
             count = count + 1
-            Call SysCmd(acSysCmdSetStatus, "Import tabledef: " & count & " on " & total)
+            Call SysCmd(acSysCmdSetStatus, "Import local table: " & count & " on " & total)
             
         Next filename
         
-        logger "ImportAllTblDefs", "INFO", "> " & count & " TblDefs imported"
+        logger "ImportAllTables", "INFO", "> " & count & " local tables imported"
     Else
-        logger "ImportAllTblDefs", "INFO", "> No tabledef to import"
+        logger "ImportAllTables", "INFO", "> No local table to import"
     End If
     
     Call SysCmd(acSysCmdClearStatus)
@@ -131,7 +128,7 @@ Public Sub ImportAllLinkedTables()
     Dim filename As Variant
     Dim count, total As Integer
     
-    dirpath = joinpaths(source_dir(), "tbldef\")
+    dirpath = joinpaths(source_dir(), "tables\")
     
     logger "ImportAllLinkedTables", "INFO", "Import linked tables"
     logger "ImportAllLinkedTables", "DEBUG", "> import from: " & dirpath
@@ -166,46 +163,6 @@ Public Sub ImportAllLinkedTables()
     
 End Sub
 
-
-Public Sub ImportAllTableDatas()
-    Dim dirpath, obj_name As String
-    Dim filename As Variant
-    Dim count, total As Integer
-    
-    dirpath = joinpaths(source_dir(), "tables\")
-    
-    logger "ImportAllTableDatas", "INFO", "Import table datas"
-    logger "ImportAllTableDatas", "DEBUG", "> import from: " & dirpath
-    
-    count = 0
-    total = 0
-    
-    Dim to_import As String
-    to_import = list_files_in(dirpath, "*.txt")
-    total = UBound(Split(to_import, "|")) + 1
-
-    If Len(to_import) > 0 Then
-        For Each filename In Split(to_import, "|")
-        
-            obj_name = Mid$(filename, 1, InStrRev(filename, ".") - 1)
-            obj_name = to_accessname(obj_name)
-            
-            ImportTableData CStr(obj_name), dirpath
-            
-            count = count + 1
-            Call SysCmd(acSysCmdSetStatus, "Import table data: " & count & " on " & total)
-            
-        Next filename
-        
-        logger "ImportAllTableDatas", "INFO", "> " & count & " table's data imported"
-    Else
-        logger "ImportAllTableDatas", "INFO", "> " & count & " table's data imported"
-    End If
-
-    Call SysCmd(acSysCmdClearStatus)
-
-End Sub
-
 Public Sub ImportAllDataMacros()
     Dim dirpath, obj_name As String
     Dim filename As Variant

+ 23 - 15
source/modules/OA_Main.bas

@@ -23,20 +23,25 @@ Public Function main()
 
 End Function
 
-Public Function make_sources(Optional ByVal newer_only As Boolean = True, _
+Public Function make_sources(Optional ByVal newer_only As Boolean = False, _
                              Optional ByVal zip As Boolean = True) As Integer
-'exports the source-code of the app
-If Not debug_mode Then On Error GoTo err
-Dim step As String
-
-    make_sources = opInterrupted
+    'exports the source-code of the app
+    If Not debug_mode Then On Error GoTo err
+    Dim step As String
+    Dim msg As String
     
+    make_sources = opInterrupted
     step = "Initialization"
     
     'Save is needed to correctly list objects to export
     SaveProject
 
-    If Not prompt_for_export_confirmation(newer_only) Then
+    step = "Prompt for confirmation"
+    msg = "****   OPENACCESS EXPORT   ****" & vbNewLine & _
+          "You're going to export:" & vbNewLine & vbNewLine & _
+          msg_list_to_export(newer_only) & _
+          ""
+    If Not OA_MsgBox(msg, vbOKCancel + vbExclamation, "Confirm") = vbOK Then
         GoTo cancelOp
     End If
 
@@ -51,7 +56,7 @@ Dim step As String
     step = "Run Open Access Export"
     logger "make_sources", "INFO", step
     
-    Call ExportAll(newer_only)
+    ExportAll newer_only
 
     ' new sources date
     step = "Updates sources date"
@@ -59,7 +64,6 @@ Dim step As String
     Call update_sources_date
 
     ' cleans the obsolete files (see CleanDirs in optimizer)
-    Dim msg As String
     msg = CleanDirs(True)
     If Len(msg) > 0 Then
         msg = "# CLEANING # " & vbNewLine & "Following objects do not exist anymore, do you want to DELETE their source FILES?" & vbNewLine & _
@@ -96,10 +100,19 @@ Public Function update_from_sources(Optional ByVal backup As Boolean) As Integer
     If Not debug_mode Then On Error GoTo err
 
     Dim backup_ok As Boolean
-    Dim step, msg As String
+    Dim step As String
+    Dim msg As String
     
     update_from_sources = opInterrupted
     
+    step = "Prompt for confirmation"
+    msg = "****   OPENACCESS IMPORT   ****" & vbNewLine & _
+          "You're going to update " & UCase(CurrentProject.name) & " with the sources files" & vbNewLine & vbNewLine & _
+          "WARNING: Any non exported work would be lost!"
+    If Not OA_MsgBox(msg, vbOKCancel + vbExclamation, "Confirm") = vbOK Then
+        GoTo cancelOp
+    End If
+    
     If backup Then
         step = "Creates a backup of the app file"
         logger "update_from_sources", "INFO", step
@@ -111,11 +124,6 @@ Public Function update_from_sources(Optional ByVal backup As Boolean) As Integer
         End If
     End If
 
-    step = "Prompt for confirmation"
-    If Not prompt_for_import_confirmation Then
-        GoTo cancelOp
-    End If
-
     step = "Run Open Access Import"
     logger "update_from_sources", "INFO", step
     

+ 0 - 13
source/modules/OA_Msg.bas

@@ -49,19 +49,6 @@ End Function
 
 
 
-Public Function prompt_for_export_confirmation(ByVal newer_only As Boolean) As Boolean
-    Dim msg As String
-    
-    msg = "****   OPENACCESS EXPORT   ****" & vbNewLine & _
-          "You're going to export the following:" & vbNewLine & vbNewLine & _
-          msg_list_to_export(newer_only) & _
-          ""
-          
-    prompt_for_export_confirmation = (OA_MsgBox(msg, vbOKCancel + vbExclamation, "Confirm") = vbOK)
-    
-End Function
-
-
 Public Function prompt_for_import_confirmation() As Boolean
     Dim msg As String
     

+ 1 - 1
source/modules/OA_Optimizer.bas

@@ -305,7 +305,7 @@ Public Function files_exist_for(acType As Integer, name As String) As Boolean
         Case acTable
             
             files_exist_for = ( _
-                                 dir(source_path & "tbldefs\" & name & ".sql") <> "" _
+                                 dir(source_path & "tbldefs\" & name & ".xml") <> "" _
                                  Or _
                                  dir(source_path & "tbldefs\" & name & ".lnkd") <> "" _
                                )

+ 18 - 3
source/modules/OA_Path.bas

@@ -4,10 +4,20 @@ Option Explicit
 
 'operations on directories and path
 
+
+Public Function norm_path(ByVal path As String) As String
+
+    path = Replace(path, "/", "\")
+    Do Until path = Replace(path, "\\", "\")
+        path = Replace(path, "\\", "\")
+    Loop
+    norm_path = path
+    
+End Function
+
 Public Function norm_dir_path(ByVal dir_path As String) As String
     
-    dir_path = Replace(dir_path, "/", "\")
-    dir_path = Replace(dir_path, "\\", "\")
+    dir_path = norm_path(dir_path)
     If Right(dir_path, 1) <> "\" Then dir_path = dir_path & "\"
     norm_dir_path = dir_path
 
@@ -49,7 +59,12 @@ End Function
 
 Public Function joinpaths(ByVal path1 As String, ByVal path2 As String) As String
 
-    joinpaths = norm_dir_path(path1) & path2
+    path1 = norm_path(path1)
+    path2 = norm_path(path2)
+    If Not Right(path1, 1) = "\" Or Left(path2, 1) = "\" Then
+        path1 = path1 & "\"
+    End If
+    joinpaths = path1 & path2
 
 End Function
 

+ 173 - 11
source/modules/OA_Properties.bas

@@ -8,13 +8,13 @@ Option Explicit
 '*
 '****
 
-Public Sub ExportProperties(daoObject As Object, file_path As String)
+Public Sub ExportProperties(ByVal daoObject As Object, ByVal 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, "\"))
+    mktree parent_dir(file_path)
     
     Dim prp As Object
     Dim prp_name, prp_value, Line As String
@@ -97,10 +97,173 @@ err:
     Call logger("ImportProperties", "ERROR", "Error during database properties import (line " & count & "): " & err.Description)
 End Sub
 
+Public Sub test_prop()
+    Dim db As DAO.Database
+    Dim td As DAO.TableDef
+    
+    Call set_debug_mode
+'
+'    Set db = CurrentDb
+'    Set td = db.TableDefs("test")
+'
+'    ExportTableDef db, td, CurrentProject.path
+'    db.Close
+'    Set td = Nothing
+'    Set db = Nothing
+'
+    'Call ExportTableProperties("test", CurrentProject.path)
+'
+    'ImportTableDef "test", CurrentProject.path
+    Call ImportTableProperties("test", CurrentProject.path & "\test.properties.xml")
+
+End Sub
+
+
+
+Public Sub ExportTableProperties(table_name As String, dirpath As String)
+
+    Dim db As DAO.Database
+    Dim td, field As Object
+    Dim prp As Property
+    
+    Dim oXML As MSXML2.DOMDocument60
+    Dim oNode, oSubNode, oFieldNode As MSXML2.IXMLDOMNode
+    Dim oElt As MSXML2.IXMLDOMElement
+    Dim oAttribut As IXMLDOMAttribute
+    
+    dirpath = norm_dir_path(dirpath)
+    mktree dirpath
+    
+    Set oXML = New MSXML2.DOMDocument60
+    oXML.appendChild oXML.createProcessingInstruction("xml", "version=""1.0"" encoding=""UTF-8""")
+    Set oNode = oXML.appendChild(oXML.createElement("properties"))
+    Set oSubNode = oNode.appendChild(oXML.createElement("table"))
+
+    Set db = Application.CurrentDb
+    Set td = db.Containers("tables").Documents(table_name)
+    
+    For Each prp In td.Properties
+        
+        If Not isReadOnly(prp) Then
+            
+            Set oElt = oSubNode.appendChild(oXML.createElement(prp.name))
+            If prp.Type = 1 Then
+                oElt.Text = CStr(CByte(prp.value))
+            Else
+                oElt.Text = CStr(prp.value)
+            End If
+            
+            Set oAttribut = oXML.createAttribute("type")
+            oAttribut.Text = CStr(prp.Type)
+            oElt.setAttributeNode oAttribut
+
+        End If
+    Next prp
+    
+    Set oSubNode = oNode.appendChild(oXML.createElement("fields"))
+    
+    For Each field In db.TableDefs(table_name).Fields
+    
+        Set oFieldNode = oSubNode.appendChild(oXML.createElement(field.name))
+        
+        For Each prp In field.Properties
+            If Not isReadOnly(prp) Then
+                Set oElt = oFieldNode.appendChild(oXML.createElement(prp.name))
+                If prp.Type = 1 Then
+                    oElt.Text = CStr(CByte(prp.value))
+                Else
+                    oElt.Text = CStr(prp.value)
+                End If
+                Set oAttribut = oXML.createAttribute("type")
+                oAttribut.Text = CStr(prp.Type)
+                oElt.setAttributeNode oAttribut
+            End If
+        Next prp
+    Next field
+    
+    Dim file_path As String
+    file_path = joinpaths(dirpath, table_name & ".properties.xml")
+    oXML.Save file_path
+    
+    Call logger("ExportTableProperties", "DEBUG", "> " & table_name & " properties exported to " & file_path)
+end_:
+    Set oNode = Nothing
+    Set oXML = Nothing
+
+End Sub
+
+Public Sub ImportTableProperties(table_name As String, filepath As String)
+
+    Dim db As DAO.Database
+    Dim td As Object
+    Dim field As Object
+    Dim prp As Property
+    Dim prp_name As String
+    Dim prp_value As String
+    Dim prp_type As String
+    Dim buffer As String
+    
+    Dim oXML As MSXML2.DOMDocument60
+    Dim oNode As MSXML2.IXMLDOMNode
+    Dim oSubNode As MSXML2.IXMLDOMNode
+    Dim oFieldNode As MSXML2.IXMLDOMNode
+    Dim oElt As MSXML2.IXMLDOMElement
+    Dim oAttribut As IXMLDOMAttribute
+    
+    filepath = norm_path(filepath)
+    buffer = ReadFile(filepath, "x-ansi")
+    
+    Set oXML = New MSXML2.DOMDocument60
+    oXML.loadXML buffer
+
+    Set db = Application.CurrentDb
+    'Set td = db.Containers("tables").Documents(table_name)
+    Set td = db.TableDefs(table_name)
+    
+    Set oNode = oXML.childNodes(1)
+    
+    ' "table" node
+    Set oSubNode = oNode.childNodes(0)
+    For Each oElt In oSubNode.childNodes
+    
+        prp_name = oElt.nodeName
+        prp_value = oElt.Text
+        prp_type = oElt.Attributes(0).Text
+    
+        SetOrCreateProperty td, prp_name, prp_value, prp_type
+    Next oElt
+    
+    ' "fields" node
+    Set oSubNode = oNode.childNodes(1)
+    For Each oFieldNode In oSubNode.childNodes
+    
+        Set field = db.TableDefs(table_name).Fields(oFieldNode.nodeName)
+        
+        For Each oElt In oFieldNode.childNodes
+        
+            prp_name = oElt.nodeName
+            prp_value = oElt.Text
+            prp_type = oElt.Attributes(0).Text
+        
+            SetOrCreateProperty field, prp_name, prp_value, prp_type
+
+        Next oElt
+        
+    Next oFieldNode
+    
+    Call logger("ImportTableProperties", "DEBUG", "> " & table_name & " properties imported from " & filepath)
+end_:
+    Set oNode = Nothing
+    Set oXML = Nothing
+
+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)
+
+        Set prp = daoObject.Properties(prp_name)
         If prp.Inherited = True Then Exit Sub
         prp.value = convert(prp_value, prp_type)
         
@@ -109,25 +272,24 @@ err:
     Select Case err.Number
         Case 3270
             ' property not found
-            Call CreateProperty(daoObject, prp_name, prp_value, prp_type)
+            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 & ")")
+            logger "SetOrCreateProperty", "ERROR", daoObject.name & " - " & 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
+            logger "SetOrCreateProperty", "ERROR", daoObject.name & " - " & prp_name & " : " & err.Description
     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)
+Public Sub CreateProperty(ByRef daoObject As Variant, ByVal prp_name As String, ByVal prp_value As String, ByVal prp_type As Integer)
     On Error GoTo err
     Dim prp As Object
+    prp_value = convert(prp_value, prp_type)
     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)
+    Call logger("CreateProperty", "ERROR", "> Unable to create the property (" & daoObject.name & " - " & prp_name & ": " & prp_value & ", " & prp_type & "): " & err.Description)
 End Sub
 
 
@@ -154,7 +316,7 @@ Function convert(value As String, dbType As Integer)
       Case dbText
          convert = CStr(value)
       Case dbLongBinary
-         convert = CLng(value)
+         convert = CStr(value)
       Case dbMemo
          convert = CStr(value)
       Case dbGUID

+ 46 - 0
source/modules/OA_Table.bas

@@ -0,0 +1,46 @@
+Option Compare Database
+
+Option Private Module
+Option Explicit
+
+'Export a local table: definition (schema), data (is asked), properties, ## stored procedures? ##
+Public Sub ExportTable(ByVal tbl_name As String, _
+                       ByVal dirpath As String, _
+                       Optional withData As Boolean = True)
+    On Error GoTo err
+    Dim file_path As String
+
+    dirpath = norm_dir_path(dirpath)
+    mktree dirpath
+    file_path = joinpaths(dirpath, to_filename(tbl_name) & ".xml")
+
+    Application.ExportXML _
+        ObjectType:=acExportTable, _
+        DataSource:=tbl_name, _
+        DataTarget:=file_path, _
+        encoding:=acUTF8, _
+        OtherFlags:=acExportAllTableAndFieldProperties + acEmbedSchema, _
+        WhereCondition:="(" & CInt(withData) & ")"
+
+    logger "ExportTable", "DEBUG", "Local Table " & tbl_name & " exported (withData=" & withData & ") to " & file_path
+
+    Exit Sub
+err:
+    logger "ExportTable", "CRITICAL", "Unable to export " & tbl_name & " [" & err.Description & "]"
+End Sub
+
+Public Sub ImportTable(ByVal file_path As String)
+    On Error GoTo err
+
+    logger "ImportTable", "DEBUG", "Try to import local table from " & file_path
+
+    file_path = norm_path(file_path)
+    
+    Application.ImportXML file_path, acStructureAndData
+
+    logger "ImportTable", "DEBUG", "> imported"
+
+    Exit Sub
+err:
+    logger "ImportTable", "CRITICAL", "Unable to import " & file_path & " [" & err.Description & "]"
+End Sub

+ 2 - 2
source/modules/VCS_DataMacro.bas

@@ -13,7 +13,7 @@ Public Sub ExportDataMacros(ByVal tableName As String, ByVal directory As String
     Dim filepath As String
     
     mktree directory
-    filepath = directory & to_filename(tableName) & ".xml"
+    filepath = joinpaths(directory, to_filename(tableName) & ".xml")
 
     ExportDocument acTableDataMacro, tableName, filepath
     FormatDataMacro filepath
@@ -28,7 +28,7 @@ Public Sub ImportDataMacros(ByVal tableName As String, ByVal directory As String
     On Error GoTo Err_import
     Dim filepath As String
     
-    filepath = directory & to_filename(tableName) & ".xml"
+    filepath = joinpaths(directory, to_filename(tableName) & ".xml")
     ImportDocument acTableDataMacro, tableName, filepath
     
     Exit Sub

+ 2 - 0
source/modules/VCS_File.bas

@@ -133,6 +133,8 @@ Public Sub ConvertUcs2Utf8(ByVal Source As String, ByVal dest As String)
     Dim in_low As Integer
     Dim in_high As Integer
 
+    logger "ConvertUcs2Utf8", "DEBUG", "Convert UCS2 file " & Source & " to Utf8 File " & dest
+    
     f_in = BinOpen(Source, "r")
     f_out = BinOpen(dest, "w")
 

+ 11 - 3
source/modules/VCS_Relation.bas

@@ -5,6 +5,7 @@ Option Explicit
 
 
 Public Sub ExportRelation(ByVal rel As DAO.Relation, ByVal filepath As String)
+    On Error GoTo err
     Dim FSO As Object
     Dim OutFile As Object
     
@@ -20,7 +21,7 @@ Public Sub ExportRelation(ByVal rel As DAO.Relation, ByVal filepath As String)
     OutFile.WriteLine rel.table
     OutFile.WriteLine rel.foreignTable
     
-    Dim f As DAO.Field
+    Dim f As DAO.field
     For Each f In rel.Fields
         OutFile.WriteLine "Field = Begin"
         OutFile.WriteLine f.name
@@ -32,9 +33,13 @@ Public Sub ExportRelation(ByVal rel As DAO.Relation, ByVal filepath As String)
 
     logger "ExportRelation", "DEBUG", "Relation " & relname & " exported to " & filepath
 
+    Exit Sub
+err:
+    logger "ImportRelation", "ERROR", "Unable to import relation " & relname & " [" & err.Description & "]"
 End Sub
 
 Public Sub ImportRelation(ByVal filepath As String)
+    On Error GoTo err
     Dim FSO As Object
     Dim InFile As Object
     Set FSO = CreateObject("Scripting.FileSystemObject")
@@ -50,10 +55,10 @@ Public Sub ImportRelation(ByVal filepath As String)
     rel.table = InFile.readline
     rel.foreignTable = InFile.readline
     
-    Dim f As DAO.Field
+    Dim f As DAO.field
     Do Until InFile.AtEndOfStream
         If "Field = Begin" = InFile.readline Then
-            Set f = New DAO.Field
+            Set f = New DAO.field
             f.name = InFile.readline
             f.ForeignName = InFile.readline
             If "End" <> InFile.readline Then
@@ -72,4 +77,7 @@ next_rel:
 
     logger "ImportRelation", "DEBUG", "Relation " & relname & " imported from " & filepath
 
+    Exit Sub
+err:
+    logger "ImportRelation", "ERROR", "Unable to import relation " & relname & " [" & err.Description & "]"
 End Sub

+ 4 - 566
source/modules/VCS_Table.bas

@@ -3,24 +3,6 @@ Option Compare Database
 Option Private Module
 Option Explicit
 
-' --------------------------------
-' Structures
-' --------------------------------
-
-' Structure to keep track of "on Update" and "on Delete" clauses
-' Access does not in all cases execute such queries
-Private Type structEnforce
-    foreignTable As String
-    foreignFields() As String
-    table As String
-    refFields() As String
-    isUpdate As Boolean
-End Type
-
-' keeping "on Update" relations to be complemented after table creation
-Private k() As structEnforce
-
-
 Public Sub ExportLinkedTable(ByVal tbl_name As String, ByVal dirpath As String)
     On Error GoTo Err_LinkedTable
     
@@ -56,7 +38,7 @@ Public Sub ExportLinkedTable(ByVal tbl_name As String, ByVal dirpath As String)
     Set db = CurrentDb
     Dim td As DAO.TableDef
     Set td = db.TableDefs(tbl_name)
-    Dim idx As DAO.index
+    Dim idx As DAO.Index
     
     For Each idx In td.Indexes
         If idx.Primary Then
@@ -86,384 +68,6 @@ Err_LinkedTable:
     Resume Err_LinkedTable_Fin
 End Sub
 
-' This requires Microsoft ADO Ext. 2.x for DLL and Security
-' See reference: https://social.msdn.microsoft.com/Forums/office/en-US/883087ba-2c25-4571-bd3c-706061466a11/how-can-i-programmatically-access-scale-property-of-a-decimal-data-type-field?forum=accessdev
-Private Function formatDecimal(ByVal tableName As String, ByVal fieldName As String) As String
-
-    Dim cnn As ADODB.Connection
-    Dim cat As ADOX.Catalog
-    Dim col As ADOX.Column
-    
-    Set cnn = New ADODB.Connection
-    Set cat = New ADOX.Catalog
-    
-
-    Set cnn = CurrentProject.Connection
-    Set cat.ActiveConnection = cnn
-
-    Set col = cat.Tables(tableName).Columns(fieldName)
-
-    formatDecimal = "(" & col.Precision & ", " & col.NumericScale & ")"
-
-    Set col = Nothing
-    Set cat = Nothing
-    Set cnn = Nothing
-
-End Function
-
-' Save a Table Definition as SQL statement
-Public Sub ExportTableDef(ByRef db As DAO.Database, ByRef td As DAO.TableDef, ByVal directory As String)
-    Dim tableName, filename As String
-    
-    tableName = td.name
-    filename = directory & to_filename(tableName) & ".sql"
-    
-    Dim sql As String
-    Dim fieldAttributeSql As String
-    Dim idx As DAO.index
-    Dim fi As DAO.Field
-    Dim FSO As Object
-    Dim OutFile As Object
-    Dim ff As Object
-    
-    'Debug.Print tableName
-    Set FSO = CreateObject("Scripting.FileSystemObject")
-    Set OutFile = FSO.CreateTextFile(filename, overwrite:=True, unicode:=False)
-    
-    sql = "CREATE TABLE " & strName(tableName) & " (" & vbCrLf
-    
-    For Each fi In td.Fields
-        sql = sql & "  " & strName(fi.name) & " "
-        If (fi.Attributes And dbAutoIncrField) Then
-            sql = sql & "AUTOINCREMENT"
-        Else
-            sql = sql & strType(fi.Type) & " "
-        End If
-        Select Case fi.Type
-            Case dbText, dbVarBinary
-                sql = sql & "(" & fi.Size & ")"
-            Case dbDecimal
-                sql = sql & formatDecimal(tableName, fi.name)
-            Case Else
-        End Select
-        For Each idx In td.Indexes
-            fieldAttributeSql = vbNullString
-            If idx.Fields.count = 1 And idx.Fields(0).name = fi.name Then
-                If idx.Primary Then fieldAttributeSql = fieldAttributeSql & " PRIMARY KEY "
-                If idx.Unique Then fieldAttributeSql = fieldAttributeSql & " UNIQUE "
-                If idx.Required Then fieldAttributeSql = fieldAttributeSql & " NOT NULL "
-                If idx.Foreign Then
-                    Set ff = idx.Fields
-                    fieldAttributeSql = fieldAttributeSql & formatReferences(db, ff, tableName)
-                End If
-                If Len(fieldAttributeSql) > 0 Then fieldAttributeSql = " CONSTRAINT " & strName(idx.name) & fieldAttributeSql
-            End If
-            sql = sql & fieldAttributeSql
-        Next
-        sql = sql & "," & vbCrLf
-    Next
-    sql = Left$(sql, Len(sql) - 3) ' strip off last comma and crlf
-    
-    Dim constraintSql As String
-    For Each idx In td.Indexes
-        If idx.Fields.count > 1 Then
-            If Len(constraintSql) = 0 Then constraintSql = constraintSql & " CONSTRAINT "
-            If idx.Primary Then constraintSql = constraintSql & formatConstraint("PRIMARY KEY", idx)
-            If Not idx.Foreign Then
-                If Len(constraintSql) > 0 Then
-                    sql = sql & "," & vbCrLf & "  " & constraintSql
-                    sql = sql & formatReferences(db, idx.Fields, tableName)
-                End If
-            End If
-        End If
-    Next
-    sql = sql & vbCrLf & ")"
-
-    'Debug.Print sql
-    OutFile.WriteLine sql
-    
-    OutFile.Close
-    
-    'exort Data Macros
-    VCS_DataMacro.ExportDataMacros tableName, directory
-    
-    logger "ExportTableDef", "DEBUG", "TblDef '" & tableName & "' exported to " & filename
-    
-End Sub
-
-Private Function formatReferences(db As DAO.Database, ff As Object, _
-                                  ByVal tableName As String) As String
-
-    Dim rel As DAO.Relation
-    Dim sql As String
-    Dim f As DAO.Field
-    
-    For Each rel In db.Relations
-        If (rel.foreignTable = tableName) Then
-         If FieldsIdentical(ff, rel.Fields) Then
-          sql = " REFERENCES "
-          sql = sql & strName(rel.table) & " ("
-          For Each f In rel.Fields
-            sql = sql & strName(f.name) & ","
-          Next
-          sql = Left$(sql, Len(sql) - 1) & ")"
-          If rel.Attributes And dbRelationUpdateCascade Then
-            sql = sql + " ON UPDATE CASCADE "
-          End If
-          If rel.Attributes And dbRelationDeleteCascade Then
-            sql = sql + " ON DELETE CASCADE "
-          End If
-          Exit For
-         End If
-        End If
-    Next
-    
-    formatReferences = sql
-End Function
-
-Private Function formatConstraint(ByVal keyw As String, ByVal idx As DAO.index) As String
-    Dim sql As String
-    Dim fi As DAO.Field
-    
-    sql = strName(idx.name) & " " & keyw & " ("
-    For Each fi In idx.Fields
-        sql = sql & strName(fi.name) & ", "
-    Next
-    sql = Left$(sql, Len(sql) - 2) & ")" 'strip off last comma and close brackets
-    
-    'return value
-    formatConstraint = sql
-End Function
-
-Private Function strName(ByVal S As String) As String
-    strName = "[" & S & "]"
-End Function
-
-Private Function strType(ByVal i As Integer) As String
-    Select Case i
-    Case dbLongBinary
-        strType = "LONGBINARY"
-    Case dbBinary
-        strType = "BINARY"
-    Case dbBoolean
-        strType = "BIT"
-    Case dbAutoIncrField
-        strType = "COUNTER"
-    Case dbCurrency
-        strType = "CURRENCY"
-    Case dbDate, dbTime
-        strType = "DATETIME"
-    Case dbGUID
-        strType = "GUID"
-    Case dbMemo
-        strType = "LONGTEXT"
-    Case dbDouble
-        strType = "DOUBLE"
-    Case dbSingle
-        strType = "SINGLE"
-    Case dbByte
-        strType = "BYTE"
-    Case dbInteger
-        strType = "SHORT"
-    Case dbLong
-        strType = "LONG"
-    Case dbNumeric
-        strType = "NUMERIC"
-    Case dbText
-        strType = "VARCHAR"
-    Case dbDecimal
-        strType = "DECIMAL"
-    Case Else
-        strType = "VARCHAR"
-    End Select
-End Function
-
-Private Function FieldsIdentical(ff As Object, gg As Object) As Boolean
-    Dim f As DAO.Field
-    If ff.count <> gg.count Then
-        FieldsIdentical = False
-        Exit Function
-    End If
-    For Each f In ff
-        If Not FieldInFields(f, gg) Then
-        FieldsIdentical = False
-        Exit Function
-        End If
-    Next
-    
-    FieldsIdentical = True
-End Function
-
-Private Function FieldInFields(fi As DAO.Field, ff As DAO.Fields) As Boolean
-    Dim f As DAO.Field
-    For Each f In ff
-        If f.name = fi.name Then
-            FieldInFields = True
-            Exit Function
-        End If
-    Next
-    
-    FieldInFields = False
-End Function
-
-' Determine if a table or exists.
-' based on sample code of support.microsoftcom
-' ARGUMENTS:
-'    TName: The name of a table or query.
-'
-' RETURNS: True (it exists) or False (it does not exist).
-Private Function TableExists(ByVal TName As String) As Boolean
-    Dim db As DAO.Database
-    Dim Found As Boolean
-    Dim test As String
-    
-    Const NAME_NOT_IN_COLLECTION As Integer = 3265
-    
-     ' Assume the table or query does not exist.
-    Found = False
-    Set db = CurrentDb()
-    
-     ' Trap for any errors.
-    On Error Resume Next
-     
-     ' See if the name is in the Tables collection.
-    test = db.TableDefs(TName).name
-    If err.Number <> NAME_NOT_IN_COLLECTION Then Found = True
-    
-    ' Reset the error variable.
-    err = 0
-    
-    TableExists = Found
-End Function
-
-' Build SQL to export `tbl_name` sorted by each field from first to last
-Private Function TableExportSql(ByVal tbl_name As String) As String
-    Dim rs As Object ' DAO.Recordset
-    Dim fieldObj As Object ' DAO.Field
-    Dim sb() As String, count As Integer
-
-    Set rs = CurrentDb.OpenRecordset(tbl_name)
-    
-    sb = VCS_String.Sb_Init()
-    VCS_String.Sb_Append sb, "SELECT "
-    
-    count = 0
-    For Each fieldObj In rs.Fields
-        If count > 0 Then VCS_String.Sb_Append sb, ", "
-        VCS_String.Sb_Append sb, "[" & fieldObj.name & "]"
-        count = count + 1
-    Next
-    
-    VCS_String.Sb_Append sb, " FROM [" & tbl_name & "] ORDER BY "
-    
-    count = 0
-    For Each fieldObj In rs.Fields
-        DoEvents
-        If fieldObj.Type <> 109 And _
-           fieldObj.Type <> 101 And _
-           fieldObj.Type <> 11 Then   'ignore muliple choices fields, ole, and attached fields
-           
-            If count > 0 Then VCS_String.Sb_Append sb, ", "
-            VCS_String.Sb_Append sb, "[" & fieldObj.name & "]"
-            count = count + 1
-        End If
-    Next
-
-    TableExportSql = VCS_String.Sb_Get(sb)
-End Function
-
-' Export the lookup table `tblName` to `source\tables`.
-Public Sub ExportTableData(ByVal tbl_name As String, ByVal obj_path As String)
-On Error GoTo err
-    Dim FSO As Object
-    Dim OutFile As Object
-    Dim rs As DAO.Recordset ' DAO.Recordset
-    Dim fieldObj As Object ' DAO.Field
-    Dim c As Long, value As Variant
-    
-    ' Checks first
-    If Not TableExists(tbl_name) Then
-        logger "ExportTableData", "ERROR", "Table " & tbl_name & " missing"
-        Exit Sub
-    End If
-
-    Set rs = CurrentDb.OpenRecordset(TableExportSql(tbl_name))
-    If rs.RecordCount = 0 Then
-        'why is this an error? Debug.Print "Error: Table " & tbl_name & "  empty"
-        rs.Close
-        Exit Sub
-    End If
-
-    Set FSO = CreateObject("Scripting.FileSystemObject")
-    ' open file for writing with Create=True, Unicode=True (USC-2 Little Endian format)
-    VCS_Dir.MkDirIfNotExist obj_path
-    Dim tempFileName As String
-    tempFileName = VCS_File.TempFile()
-
-    Set OutFile = FSO.CreateTextFile(tempFileName, overwrite:=True, unicode:=True)
-
-    c = 0
-    For Each fieldObj In rs.Fields
-        If c <> 0 Then OutFile.Write vbTab
-        c = c + 1
-        OutFile.Write fieldObj.name
-    Next
-    OutFile.Write vbCrLf
-
-    rs.MoveFirst
-    Do Until rs.EOF
-        c = 0
-        For Each fieldObj In rs.Fields
-            DoEvents
-            If c <> 0 Then OutFile.Write vbTab
-            c = c + 1
-            value = rs(fieldObj.name)
-            If IsNull(value) Then
-                value = vbNullString
-            Else
-                On Error GoTo errData
-                value = Replace(value, "\", "\\")
-                value = Replace(value, vbCrLf, "\n")
-                value = Replace(value, vbCr, "\n")
-                value = Replace(value, vbLf, "\n")
-                value = Replace(value, vbTab, "\t")
-                On Error GoTo err
-            End If
-            OutFile.Write value
-        Next
-        OutFile.Write vbCrLf
-next_field:
-        rs.MoveNext
-    Loop
-    rs.Close
-    OutFile.Close
-    
-    Dim path As String
-    path = obj_path & to_filename(tbl_name) & ".txt"
-    
-    VCS_File.ConvertUcs2Utf8 tempFileName, path
-    
-    logger "ExportTableData", "DEBUG", "Data from '" & tbl_name & "' exported to " & path
-    Kill tempFileName
-    
-    Exit Sub
-err:
-    logger "ExportTableData", "ERROR", err.Description
-    Exit Sub
-errData:
-    logger "ExportTableData", "ERROR", "[" & fieldObj.name & "] field > Uneadable data"
-    Resume next_field
-End Sub
-
-
-' Kill Table if Exists
-Private Sub KillTable(ByVal tblName As String, db As Object)
-    If TableExists(tblName) Then
-        'Db.Execute "DROP TABLE [" & tblName & "]"
-        run_sql "DROP TABLE [" & tblName & "]"
-    End If
-End Sub
-
 Public Sub ImportLinkedTable(ByVal tblName As String, ByVal obj_path As String)
     Dim db As DAO.Database
     Dim FSO As Object
@@ -518,12 +122,12 @@ Err_CreateLinkedTable_Fin:
     
     Dim Fields As String
     Fields = InFile.readline()
-    Dim Field As Variant
+    Dim field As Variant
     Dim sql As String
     sql = "CREATE INDEX __uniqueindex ON " & td.name & " ("
     
-    For Each Field In Split(Fields, ";+")
-        sql = sql & "[" & Field & "]" & ","
+    For Each field In Split(Fields, ";+")
+        sql = sql & "[" & field & "]" & ","
     Next
     'remove extraneous comma
     sql = Left$(sql, Len(sql) - 1)
@@ -540,170 +144,4 @@ Err_LinkPK_Fin:
     InFile.Close
     Kill tempFilePath
     
-End Sub
-
-' Import Table Definition
-Public Sub ImportTableDef(ByVal tblName As String, ByVal directory As String)
-    Dim filepath As String
-    
-    filepath = directory & to_filename(tblName) & ".sql"
-    
-    Dim db As Object ' DAO.Database
-    Dim FSO As Object
-    Dim InFile As Object
-    Dim buf As String
-    Dim p As Integer
-    Dim p1 As Integer
-    Dim strMsg As String
-    Dim S As Variant
-    Dim N As Integer
-    Dim i As Integer
-    Dim j As Integer
-    Dim tempFileName As String
-    tempFileName = VCS_File.TempFile()
-
-    N = -1
-    Set FSO = CreateObject("Scripting.FileSystemObject")
-
-    VCS_File.ConvertUtf8Ucs2 filepath, tempFileName
-    
-    ' 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 db = CurrentDb
-    
-    KillTable tblName, db
-
-    buf = ReadFile(filepath, "x-ansi")
-    
-    ' The following block is needed because "on update" actions may cause problems
-    For Each S In Split("UPDATE|DELETE", "|")
-    
-      p = InStr(buf, "ON " & S & " CASCADE")
-      Do While p > 0
-          N = N + 1
-          ReDim Preserve k(N)
-          k(N).table = tblName
-          k(N).isUpdate = (S = "UPDATE")
-          
-          buf = Left$(buf, p - 1) & Mid$(buf, p + 18)
-          p = InStrRev(buf, "REFERENCES", p)
-          p1 = InStr(p, buf, "(")
-          k(N).foreignFields = Split(VCS_String.SubString(p1, buf, "(", ")"), ",")
-          k(N).foreignTable = Trim$(Mid$(buf, p + 10, p1 - p - 10))
-          p = InStrRev(buf, "CONSTRAINT", p1)
-          p1 = InStrRev(buf, "FOREIGN KEY", p1)
-          If (p1 > 0) And (p > 0) And (p1 > p) Then
-          ' multifield index
-              k(N).refFields = Split(VCS_String.SubString(p1, buf, "(", ")"), ",")
-          ElseIf p1 = 0 Then
-          ' single field
-          End If
-          p = InStr(p, "ON " & S & " CASCADE", buf)
-      Loop
-    Next
-    
-    On Error Resume Next
-    
-    For i = 0 To N
-        strMsg = k(i).table & " to " & k(i).foreignTable
-        strMsg = strMsg & "(  "
-        For j = 0 To UBound(k(i).refFields)
-            strMsg = strMsg & k(i).refFields(j) & ", "
-        Next j
-        strMsg = Left$(strMsg, Len(strMsg) - 2) & ") to ("
-        For j = 0 To UBound(k(i).foreignFields)
-            strMsg = strMsg & k(i).foreignFields(j) & ", "
-        Next j
-        strMsg = Left$(strMsg, Len(strMsg) - 2) & ") Check "
-        If k(i).isUpdate Then
-            strMsg = strMsg & " on update cascade " & vbCrLf
-        Else
-            strMsg = strMsg & " on delete cascade " & vbCrLf
-        End If
-    Next
-    
-    On Error GoTo 0
-    'Db.Execute buf
-    run_sql buf
-    
-    If Len(strMsg) > 0 Then
-        OA_MsgBox strMsg, vbOKOnly, "Correct manually"
-        logger "ImportTableDef", "ERROR", strMsg & " - Correct manually"
-    Else
-        logger "ImportTableData", "DEBUG", "TableDef '" & tblName & "' imported from " & filepath
-    End If
-    
-    On Error Resume Next
-    Kill tempFileName
-End Sub
-
-' Import the lookup table `tblName` from `source\tables`.
-Public Sub ImportTableData(ByVal tblName As String, ByVal obj_path As String)
-    'On Error GoTo err
-    Dim db As Object ' DAO.Database
-    Dim rs As Object ' DAO.Recordset
-    Dim fieldObj As Object ' DAO.Field
-    Dim FSO As Object
-    Dim InFile As Object
-    Dim c As Long, buf As String, Values() As String, value As Variant
-    Dim path As String
-    
-    Set FSO = CreateObject("Scripting.FileSystemObject")
-    
-    Dim tempFileName As String
-    tempFileName = VCS_File.TempFile()
-    
-    path = obj_path & tblName & ".txt"
-    
-    VCS_File.ConvertUtf8Ucs2 path, tempFileName
-    
-    ' 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 db = CurrentDb
-
-    'Db.Execute "DELETE FROM [" & tblName & "]"
-    run_sql "DELETE FROM [" & tblName & "]"
-    Set rs = db.OpenRecordset(tblName)
-    buf = InFile.readline()
-    
-    Do Until InFile.AtEndOfStream
-        buf = InFile.readline()
-        If Len(Trim$(buf)) > 0 Then
-            Values = Split(buf, vbTab)
-            c = 0
-            rs.AddNew
-            For Each fieldObj In rs.Fields
-                On Error GoTo errField
-                DoEvents
-                value = Values(c)
-                If Len(value) = 0 Then
-                    value = Null
-                Else
-                    value = Replace(value, "\t", vbTab)
-                    value = Replace(value, "\n", vbCrLf)
-                    value = Replace(value, "\\", "\")
-                End If
-                '** correct a bug due to internationalization
-                If fieldObj.Type = dbBoolean Then value = CBool(value)
-                '**
-                rs(fieldObj.name) = value
-                On Error GoTo err
-                c = c + 1
-            Next
-            rs.update
-        End If
-    Loop
-
-    rs.Close
-    InFile.Close
-    
-    logger "ImportTableData", "DEBUG", "Table data '" & tblName & "' imported from " & path
-
-    Kill tempFileName
-    Exit Sub
-err:
-    logger "ImportTableData", "ERROR", "Table data '" & tblName & "' : Unable to import"
-    Exit Sub
-errField:
-    logger "ImportTableData", "ERROR", fieldObj.name & " > this field can not be updated"
 End Sub

+ 4 - 2
source/references.csv

@@ -1,5 +1,7 @@
 {00020430-0000-0000-C000-000000000046},2,0
 {4AC9E1DA-5BAD-4AC7-86E3-24F4CDCECA28},12,0
-{2A75196C-D9EB-4129-B803-931327F72D5C},2,8
-{00000600-0000-0010-8000-00AA006D2EA4},2,8
 {420B2830-E718-11CF-893D-00A0C9054228},1,0
+{F5078F18-C551-11D3-89B9-0000F81FE221},6,0
+{00000300-0000-0010-8000-00AA006D2EA4},6,0
+{00000600-0000-0010-8000-00AA006D2EA4},6,0
+{B691E011-1797-432E-907A-4D8C69339129},6,1

+ 0 - 3
source/tables/USysOpenAccess.txt

@@ -1,3 +0,0 @@
-key	val
-include_tables	USysOpenAccess,USysRegInfo
-sources_date	06/12/2016 14:44:40

+ 112 - 0
source/tables/USysOpenAccess.xml

@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:od="urn:schemas-microsoft-com:officedata">
+<xsd:schema>
+<xsd:element name="dataroot">
+<xsd:complexType>
+<xsd:sequence>
+<xsd:element ref="USysOpenAccess" minOccurs="0" maxOccurs="unbounded"/>
+</xsd:sequence>
+<xsd:attribute name="generated" type="xsd:dateTime"/>
+</xsd:complexType>
+</xsd:element>
+<xsd:element name="USysOpenAccess">
+<xsd:annotation>
+<xsd:appinfo>
+<od:tableProperty name="GUID" type="9" value="rzgpe9vwiEaRn9utiqd6LA==
+"/>
+<od:tableProperty name="Orientation" type="2" value="0"/>
+<od:tableProperty name="OrderByOn" type="1" value="0"/>
+<od:tableProperty name="NameMap" type="11" value="CswOVQAAAACvOCl72/CIRpGf262Kp3osAAAAAFM6f2XX2uRAAAAAAAAAAABVAFMA
+eQBzAE8AcABlAG4AQQBjAGMAZQBzAHMAAAAAAAAA0yLhZuf89E6xw4A7qT+XjwcA
+AACvOCl72/CIRpGf262Kp3osawBlAHkAAAAAAAAAfPUJ81A7rEqf93ye9rGTjgcA
+AACvOCl72/CIRpGf262Kp3osdgBhAGwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwA
+AAAFAAAAAAAAAAAAAAAAAAAAAAA=
+"/>
+<od:tableProperty name="DefaultView" type="2" value="2"/>
+<od:tableProperty name="DisplayViewsOnSharePointSite" type="2" value="1"/>
+<od:tableProperty name="TotalsRow" type="1" value="0"/>
+<od:tableProperty name="FilterOnLoad" type="1" value="0"/>
+<od:tableProperty name="OrderByOnLoad" type="1" value="1"/>
+<od:tableProperty name="HideNewField" type="1" value="0"/>
+<od:tableProperty name="BackTint" type="6" value="100"/>
+<od:tableProperty name="BackShade" type="6" value="100"/>
+<od:tableProperty name="ThemeFontIndex" type="4" value="-1"/>
+<od:tableProperty name="AlternateBackThemeColorIndex" type="4" value="-1"/>
+<od:tableProperty name="AlternateBackTint" type="6" value="100"/>
+<od:tableProperty name="AlternateBackShade" type="6" value="100"/>
+<od:tableProperty name="ReadOnlyWhenDisconnected" type="1" value="0"/>
+<od:tableProperty name="DatasheetGridlinesThemeColorIndex" type="4" value="-1"/>
+<od:tableProperty name="DatasheetForeThemeColorIndex" type="4" value="-1"/>
+<od:tableProperty name="PublishToWeb" type="2" value="1"/>
+<od:tableProperty name="Description" type="10" value="Configuration Table for OpenAccess"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:complexType>
+<xsd:sequence>
+<xsd:element name="key" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="0yLhZuf89E6xw4A7qT+Xjw==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="1650"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+<od:fieldProperty name="Required" type="1" value="0"/>
+<od:fieldProperty name="AllowZeroLength" type="1" value="1"/>
+<od:fieldProperty name="DisplayControl" type="3" value="109"/>
+<od:fieldProperty name="IMEMode" type="2" value="0"/>
+<od:fieldProperty name="IMESentenceMode" type="2" value="3"/>
+<od:fieldProperty name="UnicodeCompression" type="1" value="0"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:simpleType>
+<xsd:restriction base="xsd:string">
+<xsd:maxLength value="255"/>
+</xsd:restriction>
+</xsd:simpleType>
+</xsd:element>
+<xsd:element name="val" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="fPUJ81A7rEqf93ye9rGTjg==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="6465"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+<od:fieldProperty name="Required" type="1" value="0"/>
+<od:fieldProperty name="AllowZeroLength" type="1" value="1"/>
+<od:fieldProperty name="DisplayControl" type="3" value="109"/>
+<od:fieldProperty name="IMEMode" type="2" value="0"/>
+<od:fieldProperty name="IMESentenceMode" type="2" value="3"/>
+<od:fieldProperty name="UnicodeCompression" type="1" value="0"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:simpleType>
+<xsd:restriction base="xsd:string">
+<xsd:maxLength value="255"/>
+</xsd:restriction>
+</xsd:simpleType>
+</xsd:element>
+</xsd:sequence>
+</xsd:complexType>
+</xsd:element>
+</xsd:schema>
+<dataroot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" generated="2016-12-13T13:42:46">
+<USysOpenAccess>
+<key>include_tables</key>
+<val>USysOpenAccess,USysRegInfo</val>
+</USysOpenAccess>
+<USysOpenAccess>
+<key>sources_date</key>
+<val>06/12/2016 16:56:23</val>
+</USysOpenAccess>
+</dataroot>
+</root>

+ 0 - 5
source/tables/USysRegInfo.txt

@@ -1,5 +0,0 @@
-Subkey	Type	ValName	Value
-HKEY_CURRENT_ACCESS_PROFILE\\Menu Add-ins\\OpenAccess	0		
-HKEY_CURRENT_ACCESS_PROFILE\\Menu Add-ins\\OpenAccess	1	Expression	=main()
-HKEY_CURRENT_ACCESS_PROFILE\\Menu Add-ins\\OpenAccess	1	Library	|ACCDIR\\openaccess.accda
-HKEY_CURRENT_ACCESS_PROFILE\\Menu Add-ins\\OpenAccess	1	Version	3

+ 146 - 0
source/tables/USysRegInfo.xml

@@ -0,0 +1,146 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:od="urn:schemas-microsoft-com:officedata">
+<xsd:schema>
+<xsd:element name="dataroot">
+<xsd:complexType>
+<xsd:sequence>
+<xsd:element ref="USysRegInfo" minOccurs="0" maxOccurs="unbounded"/>
+</xsd:sequence>
+<xsd:attribute name="generated" type="xsd:dateTime"/>
+</xsd:complexType>
+</xsd:element>
+<xsd:element name="USysRegInfo">
+<xsd:annotation>
+<xsd:appinfo>
+<od:tableProperty name="GUID" type="9" value="e8Bu4SG24kKGgIdTup5LFw==
+"/>
+<od:tableProperty name="Orientation" type="2" value="0"/>
+<od:tableProperty name="OrderByOn" type="1" value="0"/>
+<od:tableProperty name="NameMap" type="11" value="CswOVQAAAAB7wG7hIbbiQoaAh1O6nksXAAAAAOEZqeYt1+RAAAAAAAAAAABVAFMA
+eQBzAFIAZQBnAEkAbgBmAG8AAAAAAAAAW8dco/v7pE2y3vFlIID5FQcAAAB7wG7h
+IbbiQoaAh1O6nksXUwB1AGIAawBlAHkAAAAAAAAAmISv0wZ4rEOk3bHqgkSifwcA
+AAB7wG7hIbbiQoaAh1O6nksXVAB5AHAAZQAAAAAAAAAsZx7fWmWESJ/ByHFsKIcp
+BwAAAHvAbuEhtuJChoCHU7qeSxdWAGEAbABOAGEAbQBlAAAAAAAAAMArYHXm0ERE
+t6+q/VsLrccHAAAAe8Bu4SG24kKGgIdTup5LF1YAYQBsAHUAZQAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAADAAAAAUAAAAAAAAAAAAAAAAAAAAAAA==
+"/>
+<od:tableProperty name="DefaultView" type="2" value="2"/>
+<od:tableProperty name="DisplayViewsOnSharePointSite" type="2" value="1"/>
+<od:tableProperty name="TotalsRow" type="1" value="0"/>
+<od:tableProperty name="FilterOnLoad" type="1" value="0"/>
+<od:tableProperty name="OrderByOnLoad" type="1" value="1"/>
+<od:tableProperty name="HideNewField" type="1" value="0"/>
+<od:tableProperty name="BackTint" type="6" value="100"/>
+<od:tableProperty name="BackShade" type="6" value="100"/>
+<od:tableProperty name="ThemeFontIndex" type="4" value="-1"/>
+<od:tableProperty name="AlternateBackThemeColorIndex" type="4" value="-1"/>
+<od:tableProperty name="AlternateBackTint" type="6" value="100"/>
+<od:tableProperty name="AlternateBackShade" type="6" value="100"/>
+<od:tableProperty name="ReadOnlyWhenDisconnected" type="1" value="0"/>
+<od:tableProperty name="DatasheetGridlinesThemeColorIndex" type="4" value="-1"/>
+<od:tableProperty name="DatasheetForeThemeColorIndex" type="4" value="-1"/>
+<od:tableProperty name="PublishToWeb" type="2" value="1"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:complexType>
+<xsd:sequence>
+<xsd:element name="Subkey" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="W8dco/v7pE2y3vFlIID5FQ==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="6165"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="1"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:simpleType>
+<xsd:restriction base="xsd:string">
+<xsd:maxLength value="255"/>
+</xsd:restriction>
+</xsd:simpleType>
+</xsd:element>
+<xsd:element name="Type" minOccurs="0" od:jetType="longinteger" od:sqlSType="int" type="xsd:int">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="mISv0wZ4rEOk3bHqgkSifw==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="-1"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+</xsd:element>
+<xsd:element name="ValName" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="LGce31plhEifwchxbCiHKQ==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="-1"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:simpleType>
+<xsd:restriction base="xsd:string">
+<xsd:maxLength value="255"/>
+</xsd:restriction>
+</xsd:simpleType>
+</xsd:element>
+<xsd:element name="Value" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="wCtgdebQRES3r6r9Wwutxw==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="2700"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:simpleType>
+<xsd:restriction base="xsd:string">
+<xsd:maxLength value="255"/>
+</xsd:restriction>
+</xsd:simpleType>
+</xsd:element>
+</xsd:sequence>
+</xsd:complexType>
+</xsd:element>
+</xsd:schema>
+<dataroot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" generated="2016-12-13T13:42:46">
+<USysRegInfo>
+<Subkey>HKEY_CURRENT_ACCESS_PROFILE\Menu Add-ins\OpenAccess</Subkey>
+<Type>0</Type>
+</USysRegInfo>
+<USysRegInfo>
+<Subkey>HKEY_CURRENT_ACCESS_PROFILE\Menu Add-ins\OpenAccess</Subkey>
+<Type>1</Type>
+<ValName>Expression</ValName>
+<Value>=main()</Value>
+</USysRegInfo>
+<USysRegInfo>
+<Subkey>HKEY_CURRENT_ACCESS_PROFILE\Menu Add-ins\OpenAccess</Subkey>
+<Type>1</Type>
+<ValName>Library</ValName>
+<Value>|ACCDIR\openaccess.accda</Value>
+</USysRegInfo>
+<USysRegInfo>
+<Subkey>HKEY_CURRENT_ACCESS_PROFILE\Menu Add-ins\OpenAccess</Subkey>
+<Type>1</Type>
+<ValName>Version</ValName>
+<Value>3</Value>
+</USysRegInfo>
+</dataroot>
+</root>

+ 0 - 4
source/tbldef/USysOpenAccess.sql

@@ -1,4 +0,0 @@
-CREATE TABLE [USysOpenAccess] (
-  [key] VARCHAR (255),
-  [val] VARCHAR (255)
-)

+ 0 - 6
source/tbldef/USysRegInfo.sql

@@ -1,6 +0,0 @@
-CREATE TABLE [USysRegInfo] (
-  [Subkey] VARCHAR (255),
-  [Type] LONG ,
-  [ValName] VARCHAR (255),
-  [Value] VARCHAR (255)
-)

+ 0 - 4
source/tbldefs/USysOpenAccess.sql

@@ -1,4 +0,0 @@
-CREATE TABLE [USysOpenAccess] (
-  [key] VARCHAR (255),
-  [val] VARCHAR (255)
-)

+ 0 - 6
source/tbldefs/USysRegInfo.sql

@@ -1,6 +0,0 @@
-CREATE TABLE [USysRegInfo] (
-  [Subkey] VARCHAR (255),
-  [Type] LONG ,
-  [ValName] VARCHAR (255),
-  [Value] VARCHAR (255)
-)

BIN
tests/__pycache__/utilities.cpython-34.pyc


+ 28 - 0
tests/bac.py

@@ -0,0 +1,28 @@
+'''
+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
+        
+

+ 13 - 5
tests/readme.md

@@ -1,5 +1,11 @@
 # TESTS OPENACCESS
 
+## Lancer les tests
+
+* Fermer toutes vos applications Access
+* Executer `python test.py`
+* Contrôler les résultats
+
 ## Notes sur l'utilisation des tests
 
 #### Si le projet de test project0.accdb est modifié
@@ -15,7 +21,7 @@ Il faut penser:
 * Créer un projet 'freestyle'
 * Configurer le projet (nom, description, repo git...)
 * Ajouter une étape au build: lancer une commande batch
-* Y ajouter: `python run_tests.py`
+* Y ajouter: `python test.py`
 
 
 POUR LE PREMIER LANCEMENT ou EN CAS DE PROBLEME lors de l'éxecution des macros access (timeout, stuck):
@@ -68,7 +74,7 @@ Le répertoire `.\work\source` est créé
 
 * L'existence du fichier `.\work\project0.zip` créé par l'export est contrôlée
 
-* Les fichiers `.\work\source\modules\test_methods.bas`, `.\work\source\macros\test_export.bas` et `.\work\source\macros\test_import.bas` sont supprimés (ils ne font pas partie du périmètre des tests et leur présence provoquera des erreurs à l'import)
+* Les fichiers `.\work\source\modules\test_methods.bas`, `.\work\source\macros\test_export.bas` et `.\work\source\macros\test_import.bas` sont supprimés (ils ne font pas partie du périmètre des tests et leur présence provoquera des erreurs à l'étape suivante)
 
 **ATTENTION à s'assurer que ces fichiers ont aussi été supprimés de .\reference\source!**
 
@@ -76,7 +82,7 @@ Le répertoire `.\work\source` est créé
 
 #### Contrôle des résultats
 
-* La fonction compare.py est utilisée pour comparer le contenu des sous-répertoires et des fichiers sources ainsi créés à ceux contenus dans le répertoire `.\reference\source`
+* La fonction compare_dirs de utilities.py est utilisée pour comparer le contenu des sous-répertoires et des fichiers sources ainsi créés à ceux contenus dans le répertoire `.\reference\source`. Si des différences sont remarquées, celles ci sont signalées et les tests s'arrêtent là.
 
 #### Import des sources dans une base vide
 
@@ -124,8 +130,10 @@ De plus, on peut vérifier les résultats dans le répertoire .\results:
 * result3.accdb contient le résultat de l'improt des sources dans project0.accdb
 * source2 contient le résultat de l'export des sources de result2.accdb
 * source3 contient le résultat de l'export des sources de result3.accdb
-* 
+
+**Les tests actuels ne permettent pas de remarquer d'éventuelles propriétés, objets... non intégrés à l'export OpenAccess. Une comparaison manuelle entre les result.accdb et le projet de départ sont donc importantes!**
+
 ## Commande batch
 
-Voir [run_tests.py](http://codebox/dev/OpenAccess/blob/master/tests/run_tests.py)
+Voir [test.py](http://codebox/dev/OpenAccess/blob/master/tests/test.py)
 

+ 0 - 2
tests/reference/source/tables/TableTestAdvancedFields.txt

@@ -1,2 +0,0 @@
-monetary	hypertext	calculated	combobox	combobox_multichoice
-101	www.wikipedia.com#http://www.wikipedia.com#	2	a	

+ 215 - 0
tests/reference/source/tables/TableTestAdvancedFields.xml

@@ -0,0 +1,215 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:od="urn:schemas-microsoft-com:officedata">
+<xsd:schema>
+<xsd:element name="dataroot">
+<xsd:complexType>
+<xsd:sequence>
+<xsd:element ref="TableTestAdvancedFields" minOccurs="0" maxOccurs="unbounded"/>
+</xsd:sequence>
+<xsd:attribute name="generated" type="xsd:dateTime"/>
+</xsd:complexType>
+</xsd:element>
+<xsd:element name="TableTestAdvancedFields">
+<xsd:annotation>
+<xsd:appinfo>
+<od:tableProperty name="GUID" type="9" value="l/v+6PQ7UkGFvftsyeN28g==
+"/>
+<od:tableProperty name="Orientation" type="2" value="0"/>
+<od:tableProperty name="OrderByOn" type="1" value="0"/>
+<od:tableProperty name="NameMap" type="11" value="CswOVQAAAACX+/7o9DtSQYW9+2zJ43byAAAAALibQ0MW2eRAAAAAAAAAAABUAGEA
+YgBsAGUAVABlAHMAdABBAGQAdgBhAG4AYwBlAGQARgBpAGUAbABkAHMAAAAAAAAA
+q4CmWD0VeUizxIww5a+ljwcAAACX+/7o9DtSQYW9+2zJ43bybQBvAG4AZQB0AGEA
+cgB5AAAAAAAAAOM3hjJg0fBAqrgj3eZvLv0HAAAAl/v+6PQ7UkGFvftsyeN28mgA
+eQBwAGUAcgB0AGUAeAB0AAAAAAAAAKn/hMT931tMqMdn04igzOoHAAAAl/v+6PQ7
+UkGFvftsyeN28mMAYQBsAGMAdQBsAGEAdABlAGQAAAAAAAAAw27JNDIR80aVqYLo
+CzEUqQcAAACX+/7o9DtSQYW9+2zJ43byYwBvAG0AYgBvAGIAbwB4AAAAAAAAAHED
+KjczwY5PtfFBj2BLc1EHAAAAl/v+6PQ7UkGFvftsyeN28mMAbwBtAGIAbwBiAG8A
+eABfAG0AdQBsAHQAaQBjAGgAbwBpAGMAZQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+DAAAAAUAAAAAAAAAAAAAAAAAAAAAAA==
+"/>
+<od:tableProperty name="DefaultView" type="2" value="2"/>
+<od:tableProperty name="DisplayViewsOnSharePointSite" type="2" value="1"/>
+<od:tableProperty name="TotalsRow" type="1" value="0"/>
+<od:tableProperty name="FilterOnLoad" type="1" value="0"/>
+<od:tableProperty name="OrderByOnLoad" type="1" value="1"/>
+<od:tableProperty name="HideNewField" type="1" value="0"/>
+<od:tableProperty name="BackTint" type="6" value="100"/>
+<od:tableProperty name="BackShade" type="6" value="100"/>
+<od:tableProperty name="ThemeFontIndex" type="4" value="1"/>
+<od:tableProperty name="AlternateBackThemeColorIndex" type="4" value="1"/>
+<od:tableProperty name="AlternateBackTint" type="6" value="100"/>
+<od:tableProperty name="AlternateBackShade" type="6" value="95"/>
+<od:tableProperty name="ReadOnlyWhenDisconnected" type="1" value="0"/>
+<od:tableProperty name="DatasheetGridlinesThemeColorIndex" type="4" value="3"/>
+<od:tableProperty name="DatasheetForeThemeColorIndex" type="4" value="0"/>
+<od:tableProperty name="PublishToWeb" type="2" value="1"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:complexType>
+<xsd:sequence>
+<xsd:element name="monetary" minOccurs="0" od:jetType="currency" od:sqlSType="money" type="xsd:double">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="q4CmWD0VeUizxIww5a+ljw==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="-1"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="Format" type="10" value="#,##0.00 €;-#,##0.00 €"/>
+<od:fieldProperty name="DecimalPlaces" type="2" value="255"/>
+<od:fieldProperty name="Required" type="1" value="0"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="1036"/>
+</xsd:appinfo>
+</xsd:annotation>
+</xsd:element>
+<xsd:element name="hypertext" minOccurs="0" od:jetType="hyperlink" od:sqlSType="ntext" od:hyperlink="yes">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="4zeGMmDR8ECquCPd5m8u/Q==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="-1"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="Required" type="1" value="0"/>
+<od:fieldProperty name="AllowZeroLength" type="1" value="1"/>
+<od:fieldProperty name="IMEMode" type="2" value="0"/>
+<od:fieldProperty name="IMESentenceMode" type="2" value="3"/>
+<od:fieldProperty name="UnicodeCompression" type="1" value="1"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AppendOnly" type="1" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:simpleType>
+<xsd:restriction base="xsd:string">
+<xsd:maxLength value="536870910"/>
+</xsd:restriction>
+</xsd:simpleType>
+</xsd:element>
+<xsd:element name="calculated" minOccurs="0" od:jetType="integer" od:sqlSType="smallint" od:expression="1+1" type="xsd:short">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="Expression" type="12" value="1+1"/>
+<od:fieldProperty name="ResultType" type="2" value="3"/>
+<od:fieldProperty name="GUID" type="9" value="qf+ExP3fW0yox2fTiKDM6g==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="-1"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="DisplayControl" type="3" value="109"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+<od:fieldProperty name="DecimalPlaces" type="2" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+</xsd:element>
+<xsd:element name="combobox" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="w27JNDIR80aVqYLoCzEUqQ==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="-1"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="Required" type="1" value="0"/>
+<od:fieldProperty name="AllowZeroLength" type="1" value="1"/>
+<od:fieldProperty name="DisplayControl" type="3" value="111"/>
+<od:fieldProperty name="RowSourceType" type="10" value="Value List"/>
+<od:fieldProperty name="RowSource" type="12" value="&quot;a&quot;;&quot;b&quot;;&quot;c&quot;"/>
+<od:fieldProperty name="BoundColumn" type="3" value="1"/>
+<od:fieldProperty name="ColumnCount" type="3" value="1"/>
+<od:fieldProperty name="ColumnHeads" type="1" value="0"/>
+<od:fieldProperty name="ColumnWidths" type="10" value="1440"/>
+<od:fieldProperty name="ListRows" type="3" value="16"/>
+<od:fieldProperty name="ListWidth" type="10" value="1440twip"/>
+<od:fieldProperty name="LimitToList" type="1" value="1"/>
+<od:fieldProperty name="IMEMode" type="2" value="0"/>
+<od:fieldProperty name="IMESentenceMode" type="2" value="3"/>
+<od:fieldProperty name="UnicodeCompression" type="1" value="1"/>
+<od:fieldProperty name="AllowMultipleValues" type="1" value="0"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AllowValueListEdits" type="1" value="1"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ShowOnlyRowSourceValues" type="1" value="0"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:simpleType>
+<xsd:restriction base="xsd:string">
+<xsd:maxLength value="255"/>
+</xsd:restriction>
+</xsd:simpleType>
+</xsd:element>
+<xsd:element name="combobox_multichoice" minOccurs="0" od:jetType="complex" od:jetComplexType="MSysComplexType_Text" maxOccurs="unbounded">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="AllowMultipleValues" type="1" value="1"/>
+<od:fieldProperty name="GUID" type="9" value="cQMqNzPBjk+18UGPYEtzUQ==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="2595"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="Required" type="1" value="0"/>
+<od:fieldProperty name="AllowZeroLength" type="1" value="1"/>
+<od:fieldProperty name="DisplayControl" type="3" value="110"/>
+<od:fieldProperty name="RowSourceType" type="10" value="Value List"/>
+<od:fieldProperty name="RowSource" type="12" value="&quot;a&quot;;&quot;b&quot;;&quot;c&quot;;&quot;d&quot;;&quot;e&quot;"/>
+<od:fieldProperty name="BoundColumn" type="3" value="1"/>
+<od:fieldProperty name="ColumnCount" type="3" value="1"/>
+<od:fieldProperty name="ColumnHeads" type="1" value="0"/>
+<od:fieldProperty name="ColumnWidths" type="10" value="1440"/>
+<od:fieldProperty name="ListRows" type="3" value="16"/>
+<od:fieldProperty name="ListWidth" type="10" value="1440twip"/>
+<od:fieldProperty name="LimitToList" type="1" value="0"/>
+<od:fieldProperty name="IMEMode" type="2" value="0"/>
+<od:fieldProperty name="IMESentenceMode" type="2" value="3"/>
+<od:fieldProperty name="UnicodeCompression" type="1" value="1"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AllowValueListEdits" type="1" value="1"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ShowOnlyRowSourceValues" type="1" value="0"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:complexType>
+<xsd:sequence>
+<xsd:element name="Value" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
+<xsd:simpleType>
+<xsd:restriction base="xsd:string">
+<xsd:maxLength value="255"/>
+</xsd:restriction>
+</xsd:simpleType>
+</xsd:element>
+</xsd:sequence>
+</xsd:complexType>
+</xsd:element>
+</xsd:sequence>
+</xsd:complexType>
+</xsd:element>
+</xsd:schema>
+<dataroot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" generated="2016-12-13T10:46:21">
+<TableTestAdvancedFields>
+<monetary>101</monetary>
+<hypertext>www.wikipedia.com#http://www.wikipedia.com#</hypertext>
+<calculated>2</calculated>
+<combobox>a</combobox>
+<combobox_multichoice>
+<Value>a</Value>
+</combobox_multichoice>
+<combobox_multichoice>
+<Value>c</Value>
+</combobox_multichoice>
+<combobox_multichoice>
+<Value>e</Value>
+</combobox_multichoice>
+</TableTestAdvancedFields>
+</dataroot>
+</root>

+ 0 - 2
tests/reference/source/tables/TableTestBaseFields.txt

@@ -1,2 +0,0 @@
-auto_number	string	long_string	integer	long_int	real	real_one_decimal	real_double	decimal	datetime	boolean	string_with_default	numeric_with_condition	nonnull_date	indexed_integer_no_decimal
-1	foo	foobar	1	1000000	1,608201E+07	1608,202	1,23123123123123E+17		27/04/2008	Vrai	default value	1	5/12/2011	123

+ 398 - 0
tests/reference/source/tables/TableTestBaseFields.xml

@@ -0,0 +1,398 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:od="urn:schemas-microsoft-com:officedata">
+<xsd:schema>
+<xsd:element name="dataroot">
+<xsd:complexType>
+<xsd:sequence>
+<xsd:element ref="TableTestBaseFields" minOccurs="0" maxOccurs="unbounded"/>
+</xsd:sequence>
+<xsd:attribute name="generated" type="xsd:dateTime"/>
+</xsd:complexType>
+</xsd:element>
+<xsd:element name="TableTestBaseFields">
+<xsd:annotation>
+<xsd:appinfo>
+<od:index index-name="indexed_integer" index-key="indexed_integer_no_decimal " primary="no" unique="no" clustered="no" order="asc"/>
+<od:index index-name="PrimaryKey" index-key="auto_number " primary="yes" unique="yes" clustered="no" order="asc"/>
+<od:tableProperty name="GUID" type="9" value="6wBskeSlEkaf27SIviJ8fA==
+"/>
+<od:tableProperty name="Orientation" type="2" value="0"/>
+<od:tableProperty name="OrderByOn" type="1" value="0"/>
+<od:tableProperty name="NameMap" type="11" value="CswOVQAAAADrAGyR5KUSRp/btIi+Inx8AAAAAJ2Vx5UT2eRAAAAAAAAAAABUAGEA
+YgBsAGUAVABlAHMAdABCAGEAcwBlAEYAaQBlAGwAZABzAAAAAAAAAC1isiy2N91M
+tT6Hiyo5bcsHAAAA6wBskeSlEkaf27SIviJ8fGEAdQB0AG8AXwBuAHUAbQBiAGUA
+cgAAAAAAAAC9z0VEA7/CS48HGoTK4fb5BwAAAOsAbJHkpRJGn9u0iL4ifHxzAHQA
+cgBpAG4AZwAAAAAAAACQ54LKY8dSRryuwMLx/vPoBwAAAOsAbJHkpRJGn9u0iL4i
+fHxsAG8AbgBnAF8AcwB0AHIAaQBuAGcAAAAAAAAAEDgxFd3PS0CJpHirrFO4zwcA
+AADrAGyR5KUSRp/btIi+Inx8aQBuAHQAZQBnAGUAcgAAAAAAAABfulSmCm8mSI6p
+0Gv4rXQ+BwAAAOsAbJHkpRJGn9u0iL4ifHxsAG8AbgBnAF8AaQBuAHQAAAAAAAAA
+weCQ7aPEZESCZhOn2D+Z0gcAAADrAGyR5KUSRp/btIi+Inx8cgBlAGEAbAAAAAAA
+AACnqhtsm+GnToi12oFA8mx1BwAAAOsAbJHkpRJGn9u0iL4ifHxyAGUAYQBsAF8A
+bwBuAGUAXwBkAGUAYwBpAG0AYQBsAAAAAAAAAOFcY3sgSflJrx2eeRPMZGAHAAAA
+6wBskeSlEkaf27SIviJ8fHIAZQBhAGwAXwBkAG8AdQBiAGwAZQAAAAAAAADu6hrw
+UbEjSY3nEJ4MmZrKBwAAAOsAbJHkpRJGn9u0iL4ifHxkAGUAYwBpAG0AYQBsAAAA
+AAAAAH80231gcDlEoZ922GU+1GkHAAAA6wBskeSlEkaf27SIviJ8fGQAYQB0AGUA
+dABpAG0AZQAAAAAAAABZqPNA8kOPQZiG3AWd3yOgBwAAAOsAbJHkpRJGn9u0iL4i
+fHxiAG8AbwBsAGUAYQBuAAAAAAAAAE80V7D+ubJIqJixpbFnU3gHAAAA6wBskeSl
+Ekaf27SIviJ8fHMAdAByAGkAbgBnAF8AdwBpAHQAaABfAGQAZQBmAGEAdQBsAHQA
+AAAAAAAAM9BUtLmc7kuhScg6mkPBFwcAAADrAGyR5KUSRp/btIi+Inx8bgB1AG0A
+ZQByAGkAYwBfAHcAaQB0AGgAXwBjAG8AbgBkAGkAdABpAG8AbgAAAAAAAADAZBuB
+jGJlT6rXb7Sixgr5BwAAAOsAbJHkpRJGn9u0iL4ifHxuAG8AbgBuAHUAbABsAF8A
+ZABhAHQAZQAAAAAAAACV5jlIKpA0QKqJEP/H6ot2BwAAAOsAbJHkpRJGn9u0iL4i
+fHxpAG4AZABlAHgAZQBkAF8AaQBuAHQAZQBnAGUAcgBfAG4AbwBfAGQAZQBjAGkA
+bQBhAGwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAFAAAAAAAAAAAAAAAAAAAA
+AAA=
+"/>
+<od:tableProperty name="DefaultView" type="2" value="2"/>
+<od:tableProperty name="DisplayViewsOnSharePointSite" type="2" value="1"/>
+<od:tableProperty name="TotalsRow" type="1" value="0"/>
+<od:tableProperty name="FilterOnLoad" type="1" value="0"/>
+<od:tableProperty name="OrderByOnLoad" type="1" value="1"/>
+<od:tableProperty name="HideNewField" type="1" value="0"/>
+<od:tableProperty name="BackTint" type="6" value="100"/>
+<od:tableProperty name="BackShade" type="6" value="100"/>
+<od:tableProperty name="ThemeFontIndex" type="4" value="1"/>
+<od:tableProperty name="AlternateBackThemeColorIndex" type="4" value="1"/>
+<od:tableProperty name="AlternateBackTint" type="6" value="100"/>
+<od:tableProperty name="AlternateBackShade" type="6" value="95"/>
+<od:tableProperty name="ReadOnlyWhenDisconnected" type="1" value="0"/>
+<od:tableProperty name="DatasheetGridlinesThemeColorIndex" type="4" value="3"/>
+<od:tableProperty name="DatasheetForeThemeColorIndex" type="4" value="0"/>
+<od:tableProperty name="PublishToWeb" type="2" value="1"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:complexType>
+<xsd:sequence>
+<xsd:element name="auto_number" minOccurs="1" od:jetType="autonumber" od:sqlSType="int" od:autoUnique="yes" od:nonNullable="yes" type="xsd:int">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="LWKyLLY33Uy1PoeLKjltyw==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="-1"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+</xsd:element>
+<xsd:element name="string" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="vc9FRAO/wkuPBxqEyuH2+Q==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="-1"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="Required" type="1" value="0"/>
+<od:fieldProperty name="AllowZeroLength" type="1" value="1"/>
+<od:fieldProperty name="DisplayControl" type="3" value="109"/>
+<od:fieldProperty name="IMEMode" type="2" value="0"/>
+<od:fieldProperty name="IMESentenceMode" type="2" value="3"/>
+<od:fieldProperty name="UnicodeCompression" type="1" value="1"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:simpleType>
+<xsd:restriction base="xsd:string">
+<xsd:maxLength value="255"/>
+</xsd:restriction>
+</xsd:simpleType>
+</xsd:element>
+<xsd:element name="long_string" minOccurs="0" od:jetType="memo" od:sqlSType="ntext">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="kOeCymPHUka8rsDC8f7z6A==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="-1"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="Required" type="1" value="0"/>
+<od:fieldProperty name="AllowZeroLength" type="1" value="1"/>
+<od:fieldProperty name="IMEMode" type="2" value="0"/>
+<od:fieldProperty name="IMESentenceMode" type="2" value="3"/>
+<od:fieldProperty name="UnicodeCompression" type="1" value="1"/>
+<od:fieldProperty name="TextFormat" type="2" value="0"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AppendOnly" type="1" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:simpleType>
+<xsd:restriction base="xsd:string">
+<xsd:maxLength value="536870910"/>
+</xsd:restriction>
+</xsd:simpleType>
+</xsd:element>
+<xsd:element name="integer" minOccurs="0" od:jetType="integer" od:sqlSType="smallint" type="xsd:short">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="EDgxFd3PS0CJpHirrFO4zw==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="-1"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="DecimalPlaces" type="2" value="255"/>
+<od:fieldProperty name="Required" type="1" value="0"/>
+<od:fieldProperty name="DisplayControl" type="3" value="109"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+</xsd:element>
+<xsd:element name="long_int" minOccurs="0" od:jetType="longinteger" od:sqlSType="int" type="xsd:int">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="X7pUpgpvJkiOqdBr+K10Pg==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="-1"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="DecimalPlaces" type="2" value="255"/>
+<od:fieldProperty name="Required" type="1" value="0"/>
+<od:fieldProperty name="DisplayControl" type="3" value="109"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+</xsd:element>
+<xsd:element name="real" minOccurs="0" od:jetType="single" od:sqlSType="real" type="xsd:float">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="weCQ7aPEZESCZhOn2D+Z0g==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="-1"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="DecimalPlaces" type="2" value="255"/>
+<od:fieldProperty name="Required" type="1" value="0"/>
+<od:fieldProperty name="DisplayControl" type="3" value="109"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+</xsd:element>
+<xsd:element name="real_one_decimal" minOccurs="0" od:jetType="single" od:sqlSType="real" type="xsd:float">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="p6obbJvhp06ItdqBQPJsdQ==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="2010"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="DecimalPlaces" type="2" value="1"/>
+<od:fieldProperty name="Required" type="1" value="0"/>
+<od:fieldProperty name="DisplayControl" type="3" value="109"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+</xsd:element>
+<xsd:element name="real_double" minOccurs="0" od:jetType="double" od:sqlSType="float" type="xsd:double">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="4VxjeyBJ+UmvHZ55E8xkYA==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="2235"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="DecimalPlaces" type="2" value="255"/>
+<od:fieldProperty name="Required" type="1" value="0"/>
+<od:fieldProperty name="DisplayControl" type="3" value="109"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+</xsd:element>
+<xsd:element name="decimal" minOccurs="0" od:jetType="decimal" od:sqlSType="decimal">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="7uoa8FGxI0mN5xCeDJmayg==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="-1"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="DecimalPlaces" type="2" value="255"/>
+<od:fieldProperty name="DefaultValue" type="12" value="0"/>
+<od:fieldProperty name="Required" type="1" value="0"/>
+<od:fieldProperty name="DisplayControl" type="3" value="109"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:simpleType>
+<xsd:restriction base="xsd:decimal">
+<xsd:totalDigits value="18"/>
+<xsd:fractionDigits value="0"/>
+</xsd:restriction>
+</xsd:simpleType>
+</xsd:element>
+<xsd:element name="datetime" minOccurs="0" od:jetType="datetime" od:sqlSType="datetime" type="xsd:dateTime">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="fzTbfWBwOUShn3bYZT7UaQ==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="-1"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="Required" type="1" value="0"/>
+<od:fieldProperty name="IMEMode" type="2" value="0"/>
+<od:fieldProperty name="IMESentenceMode" type="2" value="3"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ShowDatePicker" type="3" value="1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+</xsd:element>
+<xsd:element name="boolean" minOccurs="1" od:jetType="yesno" od:sqlSType="bit" od:nonNullable="yes" type="xsd:boolean">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="WajzQPJDj0GYhtwFnd8joA==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="-1"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="Format" type="10" value="True/False"/>
+<od:fieldProperty name="DefaultValue" type="12" value="0"/>
+<od:fieldProperty name="DisplayControl" type="3" value="106"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+</xsd:element>
+<xsd:element name="string_with_default" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="TzRXsP65skiomLGlsWdTeA==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="-1"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="Required" type="1" value="0"/>
+<od:fieldProperty name="AllowZeroLength" type="1" value="1"/>
+<od:fieldProperty name="DisplayControl" type="3" value="109"/>
+<od:fieldProperty name="IMEMode" type="2" value="0"/>
+<od:fieldProperty name="IMESentenceMode" type="2" value="3"/>
+<od:fieldProperty name="UnicodeCompression" type="1" value="1"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+<od:fieldProperty name="DefaultValue" type="12" value="&quot;default value&quot;"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:simpleType>
+<xsd:restriction base="xsd:string">
+<xsd:maxLength value="255"/>
+</xsd:restriction>
+</xsd:simpleType>
+</xsd:element>
+<xsd:element name="numeric_with_condition" minOccurs="0" od:jetType="longinteger" od:sqlSType="int" type="xsd:int">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="M9BUtLmc7kuhScg6mkPBFw==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="2490"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="DecimalPlaces" type="2" value="255"/>
+<od:fieldProperty name="Required" type="1" value="0"/>
+<od:fieldProperty name="DisplayControl" type="3" value="109"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+<od:fieldProperty name="ValidationRule" type="12" value="&gt;0"/>
+</xsd:appinfo>
+</xsd:annotation>
+</xsd:element>
+<xsd:element name="nonnull_date" minOccurs="1" od:jetType="text" od:sqlSType="nvarchar" od:nonNullable="yes">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="wGQbgYxiZU+q12+0osYK+Q==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="-1"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="Required" type="1" value="1"/>
+<od:fieldProperty name="AllowZeroLength" type="1" value="1"/>
+<od:fieldProperty name="DisplayControl" type="3" value="109"/>
+<od:fieldProperty name="IMEMode" type="2" value="0"/>
+<od:fieldProperty name="IMESentenceMode" type="2" value="3"/>
+<od:fieldProperty name="UnicodeCompression" type="1" value="1"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:simpleType>
+<xsd:restriction base="xsd:string">
+<xsd:maxLength value="255"/>
+</xsd:restriction>
+</xsd:simpleType>
+</xsd:element>
+<xsd:element name="indexed_integer_no_decimal" minOccurs="0" od:jetType="integer" od:sqlSType="smallint" type="xsd:short">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="leY5SCqQNECqiRD/x+qLdg==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="3975"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="DecimalPlaces" type="2" value="0"/>
+<od:fieldProperty name="Required" type="1" value="0"/>
+<od:fieldProperty name="DisplayControl" type="3" value="109"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+</xsd:element>
+</xsd:sequence>
+</xsd:complexType>
+</xsd:element>
+</xsd:schema>
+<dataroot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" generated="2016-12-13T10:46:22">
+<TableTestBaseFields>
+<auto_number>1</auto_number>
+<string>foo</string>
+<long_string>foobar</long_string>
+<integer>1</integer>
+<long_int>1000000</long_int>
+<real>1.608201E+07</real>
+<real_one_decimal>1608.202</real_one_decimal>
+<real_double>1.23123123123123E+17</real_double>
+<datetime>2008-04-27T00:00:00</datetime>
+<boolean>1</boolean>
+<string_with_default>default value</string_with_default>
+<numeric_with_condition>1</numeric_with_condition>
+<nonnull_date>5/12/2011</nonnull_date>
+<indexed_integer_no_decimal>123</indexed_integer_no_decimal>
+</TableTestBaseFields>
+</dataroot>
+</root>

+ 111 - 0
tests/reference/source/tables/TableTestRelation1.xml

@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:od="urn:schemas-microsoft-com:officedata">
+<xsd:schema>
+<xsd:element name="dataroot">
+<xsd:complexType>
+<xsd:sequence>
+<xsd:element ref="TableTestRelation1" minOccurs="0" maxOccurs="unbounded"/>
+</xsd:sequence>
+<xsd:attribute name="generated" type="xsd:dateTime"/>
+</xsd:complexType>
+</xsd:element>
+<xsd:element name="TableTestRelation1">
+<xsd:annotation>
+<xsd:appinfo>
+<od:index index-name="PrimaryKey" index-key="Id " primary="yes" unique="yes" clustered="no" order="asc"/>
+<od:tableProperty name="GUID" type="9" value="J4CR28RJh0SFnvGvJkN9Ug==
+"/>
+<od:tableProperty name="Orientation" type="2" value="0"/>
+<od:tableProperty name="OrderByOn" type="1" value="0"/>
+<od:tableProperty name="NameMap" type="11" value="CswOVQAAAAAngJHbxEmHRIWe8a8mQ31SAAAAAM33yJUT2eRAAAAAAAAAAABUAGEA
+YgBsAGUAVABlAHMAdABSAGUAbABhAHQAaQBvAG4AMQAAAAAAAAASfx86CtdQTaaY
+NnzLfQjXBwAAACeAkdvESYdEhZ7xryZDfVJJAGQAAAAAAAAAGsKp+h/C1kitrYXG
+snoxUwcAAAAngJHbxEmHRIWe8a8mQ31SRABhAHQAYQAAAAAAAABp7AdUdYxLQZNT
+E4xYQbNGBwAAACeAkdvESYdEhZ7xryZDfVJGAEsAXwBUAFQAUgAxAF8AVABUAFIA
+MgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAUAAAAAAAAAAAAAAAAAAAAAAA==
+"/>
+<od:tableProperty name="DefaultView" type="2" value="2"/>
+<od:tableProperty name="DisplayViewsOnSharePointSite" type="2" value="1"/>
+<od:tableProperty name="TotalsRow" type="1" value="0"/>
+<od:tableProperty name="FilterOnLoad" type="1" value="0"/>
+<od:tableProperty name="OrderByOnLoad" type="1" value="1"/>
+<od:tableProperty name="HideNewField" type="1" value="0"/>
+<od:tableProperty name="BackTint" type="6" value="100"/>
+<od:tableProperty name="BackShade" type="6" value="100"/>
+<od:tableProperty name="ThemeFontIndex" type="4" value="1"/>
+<od:tableProperty name="AlternateBackThemeColorIndex" type="4" value="1"/>
+<od:tableProperty name="AlternateBackTint" type="6" value="100"/>
+<od:tableProperty name="AlternateBackShade" type="6" value="95"/>
+<od:tableProperty name="ReadOnlyWhenDisconnected" type="1" value="0"/>
+<od:tableProperty name="DatasheetGridlinesThemeColorIndex" type="4" value="3"/>
+<od:tableProperty name="DatasheetForeThemeColorIndex" type="4" value="0"/>
+<od:tableProperty name="PublishToWeb" type="2" value="1"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:complexType>
+<xsd:sequence>
+<xsd:element name="Id" minOccurs="1" od:jetType="autonumber" od:sqlSType="int" od:autoUnique="yes" od:nonNullable="yes" type="xsd:int">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="En8fOgrXUE2mmDZ8y30I1w==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="-1"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+</xsd:element>
+<xsd:element name="Data" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="GsKp+h/C1kitrYXGsnoxUw==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="-1"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="Required" type="1" value="0"/>
+<od:fieldProperty name="AllowZeroLength" type="1" value="1"/>
+<od:fieldProperty name="DisplayControl" type="3" value="109"/>
+<od:fieldProperty name="IMEMode" type="2" value="0"/>
+<od:fieldProperty name="IMESentenceMode" type="2" value="3"/>
+<od:fieldProperty name="UnicodeCompression" type="1" value="1"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:simpleType>
+<xsd:restriction base="xsd:string">
+<xsd:maxLength value="255"/>
+</xsd:restriction>
+</xsd:simpleType>
+</xsd:element>
+<xsd:element name="FK_TTR1_TTR2" minOccurs="0" od:jetType="longinteger" od:sqlSType="int" type="xsd:int">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="aewHVHWMS0GTUxOMWEGzRg==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="-1"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="DecimalPlaces" type="2" value="255"/>
+<od:fieldProperty name="Required" type="1" value="0"/>
+<od:fieldProperty name="DisplayControl" type="3" value="109"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+</xsd:element>
+</xsd:sequence>
+</xsd:complexType>
+</xsd:element>
+</xsd:schema>
+<dataroot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" generated="2016-12-13T10:46:23"/>
+</root>

+ 112 - 0
tests/reference/source/tables/TableTestRelation2.xml

@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:od="urn:schemas-microsoft-com:officedata">
+<xsd:schema>
+<xsd:element name="dataroot">
+<xsd:complexType>
+<xsd:sequence>
+<xsd:element ref="TableTestRelation2" minOccurs="0" maxOccurs="unbounded"/>
+</xsd:sequence>
+<xsd:attribute name="generated" type="xsd:dateTime"/>
+</xsd:complexType>
+</xsd:element>
+<xsd:element name="TableTestRelation2">
+<xsd:annotation>
+<xsd:appinfo>
+<od:index index-name="PrimaryKey" index-key="Id " primary="yes" unique="yes" clustered="no" order="asc"/>
+<od:index index-name="TableTestRelation3TableTestRelation2" index-key="FK_TTR2_TTR3 " primary="no" unique="no" clustered="no" order="asc"/>
+<od:tableProperty name="Orientation" type="2" value="0"/>
+<od:tableProperty name="OrderByOn" type="1" value="0"/>
+<od:tableProperty name="NameMap" type="11" value="CswOVQAAAADXllqWzXZBQrSPhm9gHRH5AAAAAKGM3v4t2eRAAAAAAAAAAABUAGEA
+YgBsAGUAVABlAHMAdABSAGUAbABhAHQAaQBvAG4AMgAAAAAAAADVC8nfVcopTprf
+UKeIOERxBwAAANeWWpbNdkFCtI+Gb2AdEflJAGQAAAAAAAAA8l03hXetFkGJPx3O
+U751nwcAAADXllqWzXZBQrSPhm9gHRH5RABhAHQAYQAAAAAAAAD/J2+jsBeTSqvC
+MmMqt5WvBwAAANeWWpbNdkFCtI+Gb2AdEflGAEsAXwBUAFQAUgAyAF8AVABUAFIA
+MwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAUAAAAAAAAAAAAAAAAAAAAAAA==
+"/>
+<od:tableProperty name="DefaultView" type="2" value="2"/>
+<od:tableProperty name="DisplayViewsOnSharePointSite" type="2" value="1"/>
+<od:tableProperty name="TotalsRow" type="1" value="0"/>
+<od:tableProperty name="FilterOnLoad" type="1" value="0"/>
+<od:tableProperty name="OrderByOnLoad" type="1" value="1"/>
+<od:tableProperty name="HideNewField" type="1" value="0"/>
+<od:tableProperty name="BackTint" type="6" value="100"/>
+<od:tableProperty name="BackShade" type="6" value="100"/>
+<od:tableProperty name="ThemeFontIndex" type="4" value="1"/>
+<od:tableProperty name="AlternateBackThemeColorIndex" type="4" value="1"/>
+<od:tableProperty name="AlternateBackTint" type="6" value="100"/>
+<od:tableProperty name="AlternateBackShade" type="6" value="95"/>
+<od:tableProperty name="ReadOnlyWhenDisconnected" type="1" value="0"/>
+<od:tableProperty name="DatasheetGridlinesThemeColorIndex" type="4" value="3"/>
+<od:tableProperty name="DatasheetForeThemeColorIndex" type="4" value="0"/>
+<od:tableProperty name="PublishToWeb" type="2" value="1"/>
+<od:tableProperty name="GUID" type="9" value="15Zals12QUK0j4ZvYB0R+Q==
+"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:complexType>
+<xsd:sequence>
+<xsd:element name="Id" minOccurs="1" od:jetType="autonumber" od:sqlSType="int" od:autoUnique="yes" od:nonNullable="yes" type="xsd:int">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="ColumnWidth" type="3" value="-1"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+<od:fieldProperty name="GUID" type="9" value="1QvJ31XKKU6a31CniDhEcQ==
+"/>
+</xsd:appinfo>
+</xsd:annotation>
+</xsd:element>
+<xsd:element name="Data" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="ColumnWidth" type="3" value="-1"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="Required" type="1" value="0"/>
+<od:fieldProperty name="AllowZeroLength" type="1" value="1"/>
+<od:fieldProperty name="DisplayControl" type="3" value="109"/>
+<od:fieldProperty name="IMEMode" type="2" value="0"/>
+<od:fieldProperty name="IMESentenceMode" type="2" value="3"/>
+<od:fieldProperty name="UnicodeCompression" type="1" value="1"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+<od:fieldProperty name="GUID" type="9" value="8l03hXetFkGJPx3OU751nw==
+"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:simpleType>
+<xsd:restriction base="xsd:string">
+<xsd:maxLength value="255"/>
+</xsd:restriction>
+</xsd:simpleType>
+</xsd:element>
+<xsd:element name="FK_TTR2_TTR3" minOccurs="0" od:jetType="longinteger" od:sqlSType="int" type="xsd:int">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="/ydvo7AXk0qrwjJjKreVrw==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="-1"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="DecimalPlaces" type="2" value="255"/>
+<od:fieldProperty name="Required" type="1" value="0"/>
+<od:fieldProperty name="DisplayControl" type="3" value="109"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+</xsd:element>
+</xsd:sequence>
+</xsd:complexType>
+</xsd:element>
+</xsd:schema>
+<dataroot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" generated="2016-12-13T10:46:23"/>
+</root>

+ 112 - 0
tests/reference/source/tables/TableTestRelation3.xml

@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:od="urn:schemas-microsoft-com:officedata">
+<xsd:schema>
+<xsd:element name="dataroot">
+<xsd:complexType>
+<xsd:sequence>
+<xsd:element ref="TableTestRelation3" minOccurs="0" maxOccurs="unbounded"/>
+</xsd:sequence>
+<xsd:attribute name="generated" type="xsd:dateTime"/>
+</xsd:complexType>
+</xsd:element>
+<xsd:element name="TableTestRelation3">
+<xsd:annotation>
+<xsd:appinfo>
+<od:index index-name="PrimaryKey" index-key="Id " primary="yes" unique="yes" clustered="no" order="asc"/>
+<od:index index-name="TableTestRelation4TableTestRelation3" index-key="FK_TTR3_TTR4 " primary="no" unique="no" clustered="no" order="asc"/>
+<od:tableProperty name="Orientation" type="2" value="0"/>
+<od:tableProperty name="OrderByOn" type="1" value="0"/>
+<od:tableProperty name="NameMap" type="11" value="CswOVQAAAACKrn9XVOK3RbPX5h19ItJoAAAAANiS3v4t2eRAAAAAAAAAAABUAGEA
+YgBsAGUAVABlAHMAdABSAGUAbABhAHQAaQBvAG4AMwAAAAAAAAAdiHlpuLFBR6Zg
+ZZIN5Z7HBwAAAIquf1dU4rdFs9fmHX0i0mhJAGQAAAAAAAAALYoj8+GXGU6hGAsI
+GCuv4QcAAACKrn9XVOK3RbPX5h19ItJoRABhAHQAYQAAAAAAAAAK3mU6KoF0TJ6G
+4qLinDBXBwAAAIquf1dU4rdFs9fmHX0i0mhGAEsAXwBUAFQAUgAzAF8AVABUAFIA
+NAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAUAAAAAAAAAAAAAAAAAAAAAAA==
+"/>
+<od:tableProperty name="DefaultView" type="2" value="2"/>
+<od:tableProperty name="DisplayViewsOnSharePointSite" type="2" value="1"/>
+<od:tableProperty name="TotalsRow" type="1" value="0"/>
+<od:tableProperty name="FilterOnLoad" type="1" value="0"/>
+<od:tableProperty name="OrderByOnLoad" type="1" value="1"/>
+<od:tableProperty name="HideNewField" type="1" value="0"/>
+<od:tableProperty name="BackTint" type="6" value="100"/>
+<od:tableProperty name="BackShade" type="6" value="100"/>
+<od:tableProperty name="ThemeFontIndex" type="4" value="1"/>
+<od:tableProperty name="AlternateBackThemeColorIndex" type="4" value="1"/>
+<od:tableProperty name="AlternateBackTint" type="6" value="100"/>
+<od:tableProperty name="AlternateBackShade" type="6" value="95"/>
+<od:tableProperty name="ReadOnlyWhenDisconnected" type="1" value="0"/>
+<od:tableProperty name="DatasheetGridlinesThemeColorIndex" type="4" value="3"/>
+<od:tableProperty name="DatasheetForeThemeColorIndex" type="4" value="0"/>
+<od:tableProperty name="PublishToWeb" type="2" value="1"/>
+<od:tableProperty name="GUID" type="9" value="iq5/V1Tit0Wz1+YdfSLSaA==
+"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:complexType>
+<xsd:sequence>
+<xsd:element name="Id" minOccurs="1" od:jetType="autonumber" od:sqlSType="int" od:autoUnique="yes" od:nonNullable="yes" type="xsd:int">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="ColumnWidth" type="3" value="-1"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+<od:fieldProperty name="GUID" type="9" value="HYh5abixQUemYGWSDeWexw==
+"/>
+</xsd:appinfo>
+</xsd:annotation>
+</xsd:element>
+<xsd:element name="Data" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="ColumnWidth" type="3" value="-1"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="Required" type="1" value="0"/>
+<od:fieldProperty name="AllowZeroLength" type="1" value="1"/>
+<od:fieldProperty name="DisplayControl" type="3" value="109"/>
+<od:fieldProperty name="IMEMode" type="2" value="0"/>
+<od:fieldProperty name="IMESentenceMode" type="2" value="3"/>
+<od:fieldProperty name="UnicodeCompression" type="1" value="1"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+<od:fieldProperty name="GUID" type="9" value="LYoj8+GXGU6hGAsIGCuv4Q==
+"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:simpleType>
+<xsd:restriction base="xsd:string">
+<xsd:maxLength value="255"/>
+</xsd:restriction>
+</xsd:simpleType>
+</xsd:element>
+<xsd:element name="FK_TTR3_TTR4" minOccurs="0" od:jetType="longinteger" od:sqlSType="int" type="xsd:int">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="Ct5lOiqBdEyehuKi4pwwVw==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="-1"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="DecimalPlaces" type="2" value="255"/>
+<od:fieldProperty name="Required" type="1" value="0"/>
+<od:fieldProperty name="DisplayControl" type="3" value="109"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+</xsd:element>
+</xsd:sequence>
+</xsd:complexType>
+</xsd:element>
+</xsd:schema>
+<dataroot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" generated="2016-12-13T10:46:23"/>
+</root>

+ 92 - 0
tests/reference/source/tables/TableTestRelation4.xml

@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:od="urn:schemas-microsoft-com:officedata">
+<xsd:schema>
+<xsd:element name="dataroot">
+<xsd:complexType>
+<xsd:sequence>
+<xsd:element ref="TableTestRelation4" minOccurs="0" maxOccurs="unbounded"/>
+</xsd:sequence>
+<xsd:attribute name="generated" type="xsd:dateTime"/>
+</xsd:complexType>
+</xsd:element>
+<xsd:element name="TableTestRelation4">
+<xsd:annotation>
+<xsd:appinfo>
+<od:index index-name="PrimaryKey" index-key="Id " primary="yes" unique="yes" clustered="no" order="asc"/>
+<od:tableProperty name="Orientation" type="2" value="0"/>
+<od:tableProperty name="OrderByOn" type="1" value="0"/>
+<od:tableProperty name="NameMap" type="11" value="CswOVQAAAAASiBCOtM0sT7+lkSWMm0iLAAAAANmS3v4t2eRAAAAAAAAAAABUAGEA
+YgBsAGUAVABlAHMAdABSAGUAbABhAHQAaQBvAG4ANAAAAAAAAADV2f+2f3wOSbSP
+LKH2ZOVOBwAAABKIEI60zSxPv6WRJYybSItJAGQAAAAAAAAA9b5nz6RtCU2ihiDB
+5GZNYgcAAAASiBCOtM0sT7+lkSWMm0iLRABhAHQAYQAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAADAAAAAUAAAAAAAAAAAAAAAAAAAAAAA==
+"/>
+<od:tableProperty name="DefaultView" type="2" value="2"/>
+<od:tableProperty name="DisplayViewsOnSharePointSite" type="2" value="1"/>
+<od:tableProperty name="TotalsRow" type="1" value="0"/>
+<od:tableProperty name="FilterOnLoad" type="1" value="0"/>
+<od:tableProperty name="OrderByOnLoad" type="1" value="1"/>
+<od:tableProperty name="HideNewField" type="1" value="0"/>
+<od:tableProperty name="BackTint" type="6" value="100"/>
+<od:tableProperty name="BackShade" type="6" value="100"/>
+<od:tableProperty name="ThemeFontIndex" type="4" value="1"/>
+<od:tableProperty name="AlternateBackThemeColorIndex" type="4" value="1"/>
+<od:tableProperty name="AlternateBackTint" type="6" value="100"/>
+<od:tableProperty name="AlternateBackShade" type="6" value="95"/>
+<od:tableProperty name="ReadOnlyWhenDisconnected" type="1" value="0"/>
+<od:tableProperty name="DatasheetGridlinesThemeColorIndex" type="4" value="3"/>
+<od:tableProperty name="DatasheetForeThemeColorIndex" type="4" value="0"/>
+<od:tableProperty name="PublishToWeb" type="2" value="1"/>
+<od:tableProperty name="GUID" type="9" value="EogQjrTNLE+/pZEljJtIiw==
+"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:complexType>
+<xsd:sequence>
+<xsd:element name="Id" minOccurs="1" od:jetType="autonumber" od:sqlSType="int" od:autoUnique="yes" od:nonNullable="yes" type="xsd:int">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="ColumnWidth" type="3" value="-1"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+<od:fieldProperty name="GUID" type="9" value="1dn/tn98Dkm0jyyh9mTlTg==
+"/>
+</xsd:appinfo>
+</xsd:annotation>
+</xsd:element>
+<xsd:element name="Data" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="ColumnWidth" type="3" value="-1"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="Required" type="1" value="0"/>
+<od:fieldProperty name="AllowZeroLength" type="1" value="1"/>
+<od:fieldProperty name="DisplayControl" type="3" value="109"/>
+<od:fieldProperty name="IMEMode" type="2" value="0"/>
+<od:fieldProperty name="IMESentenceMode" type="2" value="3"/>
+<od:fieldProperty name="UnicodeCompression" type="1" value="1"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+<od:fieldProperty name="GUID" type="9" value="9b5nz6RtCU2ihiDB5GZNYg==
+"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:simpleType>
+<xsd:restriction base="xsd:string">
+<xsd:maxLength value="255"/>
+</xsd:restriction>
+</xsd:simpleType>
+</xsd:element>
+</xsd:sequence>
+</xsd:complexType>
+</xsd:element>
+</xsd:schema>
+<dataroot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" generated="2016-12-13T10:46:23"/>
+</root>

+ 76 - 0
tests/reference/source/tables/TableTestSpecialChars_éèà@~êëç_[92]_[47]_[58]_[42]_[63]_[60]_[62]_[124].xml

@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:od="urn:schemas-microsoft-com:officedata">
+<xsd:schema>
+<xsd:element name="dataroot">
+<xsd:complexType>
+<xsd:sequence>
+<xsd:element ref="TableTestSpecialChars_éèà_x0040__x007E_êëç__x005C___x002F___x003A___x002A___x003F___x003C___x003E___x007C_" minOccurs="0" maxOccurs="unbounded"/>
+</xsd:sequence>
+<xsd:attribute name="generated" type="xsd:dateTime"/>
+</xsd:complexType>
+</xsd:element>
+<xsd:element name="TableTestSpecialChars_éèà_x0040__x007E_êëç__x005C___x002F___x003A___x002A___x003F___x003C___x003E___x007C_">
+<xsd:annotation>
+<xsd:appinfo>
+<od:tableProperty name="GUID" type="9" value="S0ZiIgf1X0Wvhob2ywrRCg==
+"/>
+<od:tableProperty name="Orientation" type="2" value="0"/>
+<od:tableProperty name="OrderByOn" type="1" value="0"/>
+<od:tableProperty name="NameMap" type="11" value="CswOVQAAAABLRmIiB/VfRa+GhvbLCtEKAAAAAMSu2UoV2eRAAAAAAAAAAABUAGEA
+YgBsAGUAVABlAHMAdABTAHAAZQBjAGkAYQBsAEMAaABhAHIAcwBfAOkA6ADgAEAA
+fgDqAOsA5wBfAFwAXwAvAF8AOgBfACoAXwA/AF8APABfAD4AXwB8AAAAAAAAANxy
+j1RNXPJDiWnLaO4s3gsHAAAAS0ZiIgf1X0Wvhob2ywrRCukA6ADgAEAAfgDqAOsA
+5wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAUAAAAAAAAAAAAAAAAAAAAAAA==
+"/>
+<od:tableProperty name="DefaultView" type="2" value="2"/>
+<od:tableProperty name="DisplayViewsOnSharePointSite" type="2" value="1"/>
+<od:tableProperty name="TotalsRow" type="1" value="0"/>
+<od:tableProperty name="FilterOnLoad" type="1" value="0"/>
+<od:tableProperty name="OrderByOnLoad" type="1" value="1"/>
+<od:tableProperty name="HideNewField" type="1" value="0"/>
+<od:tableProperty name="BackTint" type="6" value="100"/>
+<od:tableProperty name="BackShade" type="6" value="100"/>
+<od:tableProperty name="ThemeFontIndex" type="4" value="1"/>
+<od:tableProperty name="AlternateBackThemeColorIndex" type="4" value="1"/>
+<od:tableProperty name="AlternateBackTint" type="6" value="100"/>
+<od:tableProperty name="AlternateBackShade" type="6" value="95"/>
+<od:tableProperty name="ReadOnlyWhenDisconnected" type="1" value="0"/>
+<od:tableProperty name="DatasheetGridlinesThemeColorIndex" type="4" value="3"/>
+<od:tableProperty name="DatasheetForeThemeColorIndex" type="4" value="0"/>
+<od:tableProperty name="PublishToWeb" type="2" value="1"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:complexType>
+<xsd:sequence>
+<xsd:element name="éèà_x0040__x007E_êëç" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="3HKPVE1c8kOJacto7izeCw==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="-1"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="Required" type="1" value="0"/>
+<od:fieldProperty name="AllowZeroLength" type="1" value="1"/>
+<od:fieldProperty name="DisplayControl" type="3" value="109"/>
+<od:fieldProperty name="IMEMode" type="2" value="0"/>
+<od:fieldProperty name="IMESentenceMode" type="2" value="3"/>
+<od:fieldProperty name="UnicodeCompression" type="1" value="1"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:simpleType>
+<xsd:restriction base="xsd:string">
+<xsd:maxLength value="255"/>
+</xsd:restriction>
+</xsd:simpleType>
+</xsd:element>
+</xsd:sequence>
+</xsd:complexType>
+</xsd:element>
+</xsd:schema>
+<dataroot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" generated="2016-12-13T10:47:48"/>
+</root>

+ 0 - 5
tests/reference/source/tables/TableWithData.txt

@@ -1,5 +0,0 @@
-param	key
-param1	key1
-param2	key2
-param3	key3
-with_special_chars	éèà@~êëç

+ 121 - 0
tests/reference/source/tables/TableWithData.xml

@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:od="urn:schemas-microsoft-com:officedata">
+<xsd:schema>
+<xsd:element name="dataroot">
+<xsd:complexType>
+<xsd:sequence>
+<xsd:element ref="TableWithData" minOccurs="0" maxOccurs="unbounded"/>
+</xsd:sequence>
+<xsd:attribute name="generated" type="xsd:dateTime"/>
+</xsd:complexType>
+</xsd:element>
+<xsd:element name="TableWithData">
+<xsd:annotation>
+<xsd:appinfo>
+<od:index index-name="PrimaryKey" index-key="param " primary="yes" unique="yes" clustered="no" order="asc"/>
+<od:tableProperty name="GUID" type="9" value="nmxRor4VkUunR1wQPnOJcQ==
+"/>
+<od:tableProperty name="Orientation" type="2" value="0"/>
+<od:tableProperty name="OrderByOn" type="1" value="0"/>
+<od:tableProperty name="NameMap" type="11" value="CswOVQAAAACebFGivhWRS6dHXBA+c4lxAAAAALyLz5UT2eRAAAAAAAAAAABUAGEA
+YgBsAGUAVwBpAHQAaABEAGEAdABhAAAAAAAAAJYrodLpf+ZHtv3h3thTH1sHAAAA
+nmxRor4VkUunR1wQPnOJcXAAYQByAGEAbQAAAAAAAADZltRoeYk3QI7Jpl7/iKZX
+BwAAAJ5sUaK+FZFLp0dcED5ziXFrAGUAeQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+DAAAAAUAAAAAAAAAAAAAAAAAAAAAAA==
+"/>
+<od:tableProperty name="DefaultView" type="2" value="2"/>
+<od:tableProperty name="DisplayViewsOnSharePointSite" type="2" value="1"/>
+<od:tableProperty name="TotalsRow" type="1" value="0"/>
+<od:tableProperty name="FilterOnLoad" type="1" value="0"/>
+<od:tableProperty name="OrderByOnLoad" type="1" value="1"/>
+<od:tableProperty name="HideNewField" type="1" value="0"/>
+<od:tableProperty name="BackTint" type="6" value="100"/>
+<od:tableProperty name="BackShade" type="6" value="100"/>
+<od:tableProperty name="ThemeFontIndex" type="4" value="1"/>
+<od:tableProperty name="AlternateBackThemeColorIndex" type="4" value="1"/>
+<od:tableProperty name="AlternateBackTint" type="6" value="100"/>
+<od:tableProperty name="AlternateBackShade" type="6" value="95"/>
+<od:tableProperty name="ReadOnlyWhenDisconnected" type="1" value="0"/>
+<od:tableProperty name="DatasheetGridlinesThemeColorIndex" type="4" value="3"/>
+<od:tableProperty name="DatasheetForeThemeColorIndex" type="4" value="0"/>
+<od:tableProperty name="PublishToWeb" type="2" value="1"/>
+<od:tableProperty name="Description" type="10" value="used to test queries / reports / forms..."/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:complexType>
+<xsd:sequence>
+<xsd:element name="param" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="liuh0ul/5ke2/eHe2FMfWw==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="1935"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="Required" type="1" value="0"/>
+<od:fieldProperty name="AllowZeroLength" type="1" value="1"/>
+<od:fieldProperty name="DisplayControl" type="3" value="109"/>
+<od:fieldProperty name="IMEMode" type="2" value="0"/>
+<od:fieldProperty name="IMESentenceMode" type="2" value="3"/>
+<od:fieldProperty name="UnicodeCompression" type="1" value="1"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:simpleType>
+<xsd:restriction base="xsd:string">
+<xsd:maxLength value="255"/>
+</xsd:restriction>
+</xsd:simpleType>
+</xsd:element>
+<xsd:element name="key" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="2ZbUaHmJN0COyaZe/4imVw==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="2835"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="Required" type="1" value="0"/>
+<od:fieldProperty name="AllowZeroLength" type="1" value="1"/>
+<od:fieldProperty name="DisplayControl" type="3" value="109"/>
+<od:fieldProperty name="IMEMode" type="2" value="0"/>
+<od:fieldProperty name="IMESentenceMode" type="2" value="3"/>
+<od:fieldProperty name="UnicodeCompression" type="1" value="1"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:simpleType>
+<xsd:restriction base="xsd:string">
+<xsd:maxLength value="255"/>
+</xsd:restriction>
+</xsd:simpleType>
+</xsd:element>
+</xsd:sequence>
+</xsd:complexType>
+</xsd:element>
+</xsd:schema>
+<dataroot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" generated="2016-12-13T10:47:48">
+<TableWithData>
+<param>param1</param>
+<key>key1</key>
+</TableWithData>
+<TableWithData>
+<param>param2</param>
+<key>key2</key>
+</TableWithData>
+<TableWithData>
+<param>param3</param>
+<key>key3</key>
+</TableWithData>
+<TableWithData>
+<param>with_special_chars</param>
+<key>éèà@~êëç</key>
+</TableWithData>
+</dataroot>
+</root>

+ 94 - 0
tests/reference/source/tables/TableWithProperties.xml

@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:od="urn:schemas-microsoft-com:officedata">
+<xsd:schema>
+<xsd:element name="dataroot">
+<xsd:complexType>
+<xsd:sequence>
+<xsd:element ref="TableWithProperties" minOccurs="0" maxOccurs="unbounded"/>
+</xsd:sequence>
+<xsd:attribute name="generated" type="xsd:dateTime"/>
+</xsd:complexType>
+</xsd:element>
+<xsd:element name="TableWithProperties">
+<xsd:annotation>
+<xsd:appinfo>
+<od:index index-name="PrimaryKey" index-key="Id " primary="yes" unique="yes" clustered="no" order="asc"/>
+<od:tableProperty name="GUID" type="9" value="lM/arGmJcUa7D9hmB4zu+Q==
+"/>
+<od:tableProperty name="Orientation" type="2" value="0"/>
+<od:tableProperty name="OrderByOn" type="1" value="0"/>
+<od:tableProperty name="NameMap" type="11" value="CswOVQAAAACUz9qsaYlxRrsP2GYHjO75AAAAANrO0JUT2eRAAAAAAAAAAABUAGEA
+YgBsAGUAVwBpAHQAaABQAHIAbwBwAGUAcgB0AGkAZQBzAAAAAAAAADyyL7/t2UFF
+pLHEPqlDTb8HAAAAlM/arGmJcUa7D9hmB4zu+UkAZAAAAAAAAABjjh+FZbGAT7KN
+Fy7l/WxkBwAAAJTP2qxpiXFGuw/YZgeM7vlEAGEAdABhAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAMAAAABQAAAAAAAAAAAAAAAAAAAAAA
+"/>
+<od:tableProperty name="DefaultView" type="2" value="2"/>
+<od:tableProperty name="DisplayViewsOnSharePointSite" type="2" value="1"/>
+<od:tableProperty name="TotalsRow" type="1" value="0"/>
+<od:tableProperty name="FilterOnLoad" type="1" value="0"/>
+<od:tableProperty name="OrderByOnLoad" type="1" value="1"/>
+<od:tableProperty name="HideNewField" type="1" value="0"/>
+<od:tableProperty name="BackTint" type="6" value="100"/>
+<od:tableProperty name="BackShade" type="6" value="100"/>
+<od:tableProperty name="ThemeFontIndex" type="4" value="1"/>
+<od:tableProperty name="AlternateBackThemeColorIndex" type="4" value="1"/>
+<od:tableProperty name="AlternateBackTint" type="6" value="100"/>
+<od:tableProperty name="AlternateBackShade" type="6" value="95"/>
+<od:tableProperty name="ReadOnlyWhenDisconnected" type="1" value="0"/>
+<od:tableProperty name="DatasheetGridlinesThemeColorIndex" type="4" value="3"/>
+<od:tableProperty name="DatasheetForeThemeColorIndex" type="4" value="0"/>
+<od:tableProperty name="PublishToWeb" type="2" value="1"/>
+<od:tableProperty name="Description" type="10" value="this is a description"/>
+<od:tableProperty name="ValidationText" type="10" value="&quot;error&quot;"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:complexType>
+<xsd:sequence>
+<xsd:element name="Id" minOccurs="1" od:jetType="autonumber" od:sqlSType="int" od:autoUnique="yes" od:nonNullable="yes" type="xsd:int">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="PLIvv+3ZQUWkscQ+qUNNvw==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="-1"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+</xsd:element>
+<xsd:element name="Data" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="Y44fhWWxgE+yjRcu5f1sZA==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="-1"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="Required" type="1" value="0"/>
+<od:fieldProperty name="AllowZeroLength" type="1" value="1"/>
+<od:fieldProperty name="DisplayControl" type="3" value="109"/>
+<od:fieldProperty name="IMEMode" type="2" value="0"/>
+<od:fieldProperty name="IMESentenceMode" type="2" value="3"/>
+<od:fieldProperty name="UnicodeCompression" type="1" value="1"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:simpleType>
+<xsd:restriction base="xsd:string">
+<xsd:maxLength value="255"/>
+</xsd:restriction>
+</xsd:simpleType>
+</xsd:element>
+</xsd:sequence>
+</xsd:complexType>
+</xsd:element>
+</xsd:schema>
+<dataroot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" generated="2016-12-13T10:47:48"/>
+</root>

+ 0 - 3
tests/reference/source/tables/USysOpenAccess.txt

@@ -1,3 +0,0 @@
-key	val
-include_tables	USysOpenAccess,TableWithData,TableTestBaseFields,TableTestAdvancedFields
-sources_date	

+ 111 - 0
tests/reference/source/tables/USysOpenAccess.xml

@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:od="urn:schemas-microsoft-com:officedata">
+<xsd:schema>
+<xsd:element name="dataroot">
+<xsd:complexType>
+<xsd:sequence>
+<xsd:element ref="USysOpenAccess" minOccurs="0" maxOccurs="unbounded"/>
+</xsd:sequence>
+<xsd:attribute name="generated" type="xsd:dateTime"/>
+</xsd:complexType>
+</xsd:element>
+<xsd:element name="USysOpenAccess">
+<xsd:annotation>
+<xsd:appinfo>
+<od:tableProperty name="GUID" type="9" value="Uklw8DLur0mJF24qFQ0O3w==
+"/>
+<od:tableProperty name="Orientation" type="2" value="0"/>
+<od:tableProperty name="OrderByOn" type="1" value="0"/>
+<od:tableProperty name="NameMap" type="11" value="CswOVQAAAABSSXDwMu6vSYkXbioVDQ7fAAAAALRK/tQT2eRAAAAAAAAAAABVAFMA
+eQBzAE8AcABlAG4AQQBjAGMAZQBzAHMAAAAAAAAAup86upM1KU+49oyfKMnpIgcA
+AABSSXDwMu6vSYkXbioVDQ7fawBlAHkAAAAAAAAAQYuCP06DWkKfOO0zI91DqwcA
+AABSSXDwMu6vSYkXbioVDQ7fdgBhAGwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwA
+AAAFAAAAAAAAAAAAAAAAAAAAAAA=
+"/>
+<od:tableProperty name="DefaultView" type="2" value="2"/>
+<od:tableProperty name="DisplayViewsOnSharePointSite" type="2" value="1"/>
+<od:tableProperty name="TotalsRow" type="1" value="0"/>
+<od:tableProperty name="FilterOnLoad" type="1" value="0"/>
+<od:tableProperty name="OrderByOnLoad" type="1" value="1"/>
+<od:tableProperty name="HideNewField" type="1" value="0"/>
+<od:tableProperty name="BackTint" type="6" value="100"/>
+<od:tableProperty name="BackShade" type="6" value="100"/>
+<od:tableProperty name="ThemeFontIndex" type="4" value="-1"/>
+<od:tableProperty name="AlternateBackThemeColorIndex" type="4" value="-1"/>
+<od:tableProperty name="AlternateBackTint" type="6" value="100"/>
+<od:tableProperty name="AlternateBackShade" type="6" value="100"/>
+<od:tableProperty name="ReadOnlyWhenDisconnected" type="1" value="0"/>
+<od:tableProperty name="DatasheetGridlinesThemeColorIndex" type="4" value="-1"/>
+<od:tableProperty name="DatasheetForeThemeColorIndex" type="4" value="-1"/>
+<od:tableProperty name="PublishToWeb" type="2" value="1"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:complexType>
+<xsd:sequence>
+<xsd:element name="key" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="up86upM1KU+49oyfKMnpIg==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="2070"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+<od:fieldProperty name="Required" type="1" value="0"/>
+<od:fieldProperty name="AllowZeroLength" type="1" value="1"/>
+<od:fieldProperty name="DisplayControl" type="3" value="109"/>
+<od:fieldProperty name="IMEMode" type="2" value="0"/>
+<od:fieldProperty name="IMESentenceMode" type="2" value="3"/>
+<od:fieldProperty name="UnicodeCompression" type="1" value="0"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:simpleType>
+<xsd:restriction base="xsd:string">
+<xsd:maxLength value="255"/>
+</xsd:restriction>
+</xsd:simpleType>
+</xsd:element>
+<xsd:element name="val" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
+<xsd:annotation>
+<xsd:appinfo>
+<od:fieldProperty name="GUID" type="9" value="QYuCP06DWkKfOO0zI91Dqw==
+"/>
+<od:fieldProperty name="ColumnWidth" type="3" value="9060"/>
+<od:fieldProperty name="ColumnOrder" type="3" value="0"/>
+<od:fieldProperty name="ColumnHidden" type="1" value="0"/>
+<od:fieldProperty name="TextAlign" type="2" value="0"/>
+<od:fieldProperty name="AggregateType" type="4" value="-1"/>
+<od:fieldProperty name="CurrencyLCID" type="4" value="0"/>
+<od:fieldProperty name="Required" type="1" value="0"/>
+<od:fieldProperty name="AllowZeroLength" type="1" value="1"/>
+<od:fieldProperty name="DisplayControl" type="3" value="109"/>
+<od:fieldProperty name="IMEMode" type="2" value="0"/>
+<od:fieldProperty name="IMESentenceMode" type="2" value="3"/>
+<od:fieldProperty name="UnicodeCompression" type="1" value="0"/>
+<od:fieldProperty name="ResultType" type="2" value="0"/>
+</xsd:appinfo>
+</xsd:annotation>
+<xsd:simpleType>
+<xsd:restriction base="xsd:string">
+<xsd:maxLength value="255"/>
+</xsd:restriction>
+</xsd:simpleType>
+</xsd:element>
+</xsd:sequence>
+</xsd:complexType>
+</xsd:element>
+</xsd:schema>
+<dataroot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" generated="2016-12-13T10:47:48">
+<USysOpenAccess>
+<key>include_tables</key>
+<val>USysOpenAccess,TableWithData,TableTestBaseFields,TableTestAdvancedFields</val>
+</USysOpenAccess>
+<USysOpenAccess>
+<key>sources_date</key>
+<val></val>
+</USysOpenAccess>
+</dataroot>
+</root>

+ 0 - 0
tests/reference/source/tbldefs/linked_table.LNKD → tests/reference/source/tables/linked_table.LNKD


+ 0 - 7
tests/reference/source/tbldefs/TableTestAdvancedFields.sql

@@ -1,7 +0,0 @@
-CREATE TABLE [TableTestAdvancedFields] (
-  [monetary] CURRENCY ,
-  [hypertext] LONGTEXT ,
-  [calculated] SHORT ,
-  [combobox] VARCHAR (255),
-  [combobox_multichoice] VARCHAR 
-)

+ 0 - 17
tests/reference/source/tbldefs/TableTestBaseFields.sql

@@ -1,17 +0,0 @@
-CREATE TABLE [TableTestBaseFields] (
-  [auto_number] AUTOINCREMENT CONSTRAINT [PrimaryKey] PRIMARY KEY  UNIQUE  NOT NULL ,
-  [string] VARCHAR (255),
-  [long_string] LONGTEXT ,
-  [integer] SHORT ,
-  [long_int] LONG ,
-  [real] SINGLE ,
-  [real_one_decimal] SINGLE ,
-  [real_double] DOUBLE ,
-  [decimal] DECIMAL (18, 0),
-  [datetime] DATETIME ,
-  [boolean] BIT ,
-  [string_with_default] VARCHAR (255),
-  [numeric_with_condition] LONG ,
-  [nonnull_date] VARCHAR (255),
-  [indexed_integer_no_decimal] SHORT 
-)

+ 0 - 5
tests/reference/source/tbldefs/TableTestRelation1.sql

@@ -1,5 +0,0 @@
-CREATE TABLE [TableTestRelation1] (
-  [Id] AUTOINCREMENT CONSTRAINT [PrimaryKey] PRIMARY KEY  UNIQUE  NOT NULL ,
-  [Data] VARCHAR (255),
-  [FK_TTR1_TTR2] LONG 
-)

+ 0 - 5
tests/reference/source/tbldefs/TableTestRelation2.sql

@@ -1,5 +0,0 @@
-CREATE TABLE [TableTestRelation2] (
-  [Id] AUTOINCREMENT CONSTRAINT [PrimaryKey] PRIMARY KEY  UNIQUE  NOT NULL ,
-  [Data] VARCHAR (255),
-  [FK_TTR2_TTR3] LONG 
-)

+ 0 - 5
tests/reference/source/tbldefs/TableTestRelation3.sql

@@ -1,5 +0,0 @@
-CREATE TABLE [TableTestRelation3] (
-  [Id] AUTOINCREMENT CONSTRAINT [PrimaryKey] PRIMARY KEY  UNIQUE  NOT NULL ,
-  [Data] VARCHAR (255),
-  [FK_TTR3_TTR4] LONG 
-)

+ 0 - 4
tests/reference/source/tbldefs/TableTestRelation4.sql

@@ -1,4 +0,0 @@
-CREATE TABLE [TableTestRelation4] (
-  [Id] AUTOINCREMENT CONSTRAINT [PrimaryKey] PRIMARY KEY  UNIQUE  NOT NULL ,
-  [Data] VARCHAR (255)
-)

+ 0 - 3
tests/reference/source/tbldefs/TableTestSpecialChars_éèà@~êëç_[92]_[47]_[58]_[42]_[63]_[60]_[62]_[124].sql

@@ -1,3 +0,0 @@
-CREATE TABLE [TableTestSpecialChars_éčŕ@~ęëç_\_/_:_*_?_<_>_|] (
-  [éčŕ@~ęëç] VARCHAR (255)
-)

+ 0 - 4
tests/reference/source/tbldefs/TableWithData.sql

@@ -1,4 +0,0 @@
-CREATE TABLE [TableWithData] (
-  [param] VARCHAR (255) CONSTRAINT [PrimaryKey] PRIMARY KEY  UNIQUE  NOT NULL ,
-  [key] VARCHAR (255)
-)

+ 0 - 4
tests/reference/source/tbldefs/TableWithProperties.sql

@@ -1,4 +0,0 @@
-CREATE TABLE [TableWithProperties] (
-  [Id] AUTOINCREMENT CONSTRAINT [PrimaryKey] PRIMARY KEY  UNIQUE  NOT NULL ,
-  [Data] VARCHAR (255)
-)

+ 0 - 4
tests/reference/source/tbldefs/USysOpenAccess.sql

@@ -1,4 +0,0 @@
-CREATE TABLE [USysOpenAccess] (
-  [key] VARCHAR (255),
-  [val] VARCHAR (255)
-)

+ 3 - 3
tests/test.py

@@ -18,9 +18,9 @@ for subdir in (".\\work", ".\\results"):
     if file.fexists(subdir):
         _print_("clean "+subdir)
         file.frmdir(os.path.abspath(subdir))
-    else:
-        _print_("make dir "+subdir)
-        file.fmkdir(os.path.abspath(subdir))
+  
+    _print_("make dir "+subdir)
+    file.fmkdir(os.path.abspath(subdir))
 
 _print_("unzip OpenAccess.zip in .\\work\\")
 os.system("unzip -q ..\\OpenAccess.zip -d .\\work\\")

+ 16 - 5
tests/utilities.py

@@ -6,7 +6,10 @@ Created on 22 nov. 2016
 import os
 
 import file
+import re
 
+# regex for ignoring lines in file comparison
+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}\"/?>"]
 
 def compare_dirs(source_dir, reference_dir):
     print("** Compare {} to {} **".format(source_dir, reference_dir))
@@ -31,18 +34,26 @@ def compare_dirs(source_dir, reference_dir):
     
     for source_path in list_source_dir:
         linecount = 0
-        with open(source_path, "rb") as source_file:
+        with open(source_path, "r") as source_file:
             
             ref_path = source_path.replace(source_dir, reference_dir)
-            with open(ref_path, "rb") as ref_file:
+            with open(ref_path, "r") as ref_file:
                 
                 for line in source_file:
                     linecount += 1
                     
                     if line != ref_file.readline():
-                        print("> {} : source and ref differ at line {}".format(source_path, linecount))
-                        err_code += 1
-                        continue
+                        ignore = False
+                        try:
+                            for ignore_regex in CMP_IGNORE_LINES:
+                                if re.match(ignore_regex, line) != None:
+                                    ignore = True
+                        except:
+                            pass
+                        if not ignore:        
+                            print("> {} : source and ref differ at line {}".format(source_path, linecount))
+                            err_code += 1
+                            continue
                 
     return err_code