Permalink
Browse files

Merge branch 'master' of https://github.com/bkidwell/msaccess-vcs-int…

…egration

* Added AggressiveSanitize constant, it's a number to allow for different levels in the future. Default 0 (off)
* Added Skipping for GUID & Namemap in aggressive sanitize mode.
* If AggressiveSanitize is on, also sanitize query exports (needed for exclude DOL to work in my project).
* Append [Number] of objects exported to information lines in immediate window.
* Updated readme (removed references to terminal window).
* Removed CHANGELOG.txt
  • Loading branch information...
2 parents 3f19493 + 6cfa2c0 commit 4c8a3fb82499904e0b6446ed8fd9d37f429c6b00 @matonb matonb committed Apr 5, 2013
Showing with 57 additions and 17 deletions.
  1. +21 −9 AppCodeImportExport.bas
  2. +30 −0 CHANGELOG.md
  3. +0 −6 CHANGELOG.txt
  4. +2 −2 README.md
  5. +4 −0 demo/README.md
  6. BIN demo/demo.accdb
@@ -61,6 +61,7 @@ End Type
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Const TristateTrue = -1, TristateFalse = 0, TristateUseDefault = -2
+Const AggressiveSanitize = 0
' --------------------------------
' Module variables
@@ -254,7 +255,7 @@ Private Function UsingUcs2() As Boolean
Exit Function
End If
- If CurrentDb.QueryDefs.Count > 0 Then
+ If CurrentDb.QueryDefs.count > 0 Then
obj_type_num = acQuery
obj_name = CurrentDb.QueryDefs(1).Name
Else
@@ -267,7 +268,7 @@ Private Function UsingUcs2() As Boolean
obj_type_split = Split(obj_type, "|")
obj_type_name = obj_type_split(0)
obj_type_num = Val(obj_type_split(1))
- If CurrentDb.Containers(obj_type_name).Documents.Count > 0 Then
+ If CurrentDb.Containers(obj_type_name).Documents.count > 0 Then
obj_name = CurrentDb.Containers(obj_type_name).Documents(1).Name
Exit For
End If
@@ -360,7 +361,12 @@ Private Sub SanitizeTextFiles(Path As String, Ext As String)
InStr(txt, "PrtDevNamesW = Begin") > 0 Or _
InStr(txt, "PrtDevModeW = Begin") > 0 Or _
InStr(txt, "PrtDevMode = Begin") > 0 Or _
- InStr(txt, "dbLongBinary ""DOL"" = Begin") > 0 Then
+ InStr(txt, "dbLongBinary ""DOL"" = Begin") > 0 Or _
+ (AggressiveSanitize > 0 And _
+ InStr(txt, "dbLongBinary ""DOL"" = Begin") > 0 Or _
+ InStr(txt, "NameMap") > 0 Or _
+ InStr(txt, "GUID") _
+ ) Then
' skip this block of code
Do Until InFile.AtEndOfStream
@@ -412,22 +418,28 @@ Public Sub ExportAllSource()
obj_path = source_path & "queries\"
ClearTextFilesFromDir obj_path, "bas"
- If (db.QueryDefs.Count > 0) Then
- Debug.Print "Exporting queries..."
+ If (db.QueryDefs.count > 0) Then
+ Debug.Print "Exporting queries "; Tab(20);
For Each qry In db.QueryDefs
If Left(qry.Name, 1) <> "~" Then
ExportObject acQuery, qry.Name, obj_path & qry.Name & ".bas", UsingUcs2()
+ If (AggressiveSanitize > 0) Then: SanitizeTextFiles obj_path, "bas"
End If
Next
+ Debug.Print "[" & db.QueryDefs.count & "]"
End If
obj_path = source_path & "tables\"
ClearTextFilesFromDir obj_path, "txt"
If (Len(Replace(INCLUDE_TABLES, " ", "")) > 0) Then
- Debug.Print "Exporting tables..."
+ Dim count As Integer
+ count = 0
+ Debug.Print "Exporting tables"; Tab(20);
For Each tblName In Split(INCLUDE_TABLES, ",")
ExportTable CStr(tblName), obj_path
+ count = count + 1
Next
+ Debug.Print "[" & count & "]"
End If
For Each obj_type In Split( _
@@ -445,8 +457,8 @@ Public Sub ExportAllSource()
ClearTextFilesFromDir obj_path, "bas"
'
' Export objects (if there are any).
- If (db.Containers(obj_type_name).Documents.Count > 0) Then
- Debug.Print "Exporting " & obj_type_label & "..."
+ If (db.Containers(obj_type_name).Documents.count > 0) Then
+ Debug.Print "Exporting " & obj_type_label; Tab(20);
For Each doc In db.Containers(obj_type_name).Documents
If Left(doc.Name, 1) <> "~" Then
If obj_type_label = "modules" Then
@@ -457,7 +469,7 @@ Public Sub ExportAllSource()
ExportObject obj_type_num, doc.Name, obj_path & doc.Name & ".bas", ucs2
End If
Next
-
+ Debug.Print "[" & db.Containers(obj_type_name).Documents.count & "]"
If obj_type_label <> "modules" Then
SanitizeTextFiles obj_path, "bas"
End If
View
@@ -0,0 +1,30 @@
+Change log
+==========
+version 0.3 - 5 Apr 2013
+
+matonb:
+* Added AggressiveSanitize constant, it's a number to allow for different
+ levels in the future. Default 0 (off)
+* Added Skipping for GUID & Namemap in aggressive sanitize mode.
+* If AggressiveSanitize is on, also sanitize query exports.
+* Append [Number] of objects exported to information lines in immediate window.
+* Updated readme (removed references to terminal window).
+
+version 0.2 - 4 Apr 2013
+------------------------
+
+matonb:
+* Added dbLongBinary "DOL" to SkipList in SanitizeTextFiles, default 0 (off).
+* Added Source directory check to ImportAllSource, pops up a message box if missing.
+* Only create source directories if there is something to export.
+
+bkidwell:
+* Removed external executable for converting UCS-2-little-endian to and from UTF-8; replaced with VB6 methods.
+* Added demo database to the repository.
+* Removed the need for a special "export_[name]" query to export and import a lookup table.
+* Added check to determine if Queries, Forms, etc. are exported from THIS database (depending on which version of Access created it) uses UCS-2-little-endian, or a legacy 8-bit Windows character set. Skip converting to/from UTF-8 if not using UCS-2, because the point of the conversion was to avoid writing 0x00 bytes in the text files and confuse diff/merge tools.
+
+version 0.1 - 22 Oct 2012
+-------------------------
+
+Initial release
View
@@ -1,6 +0,0 @@
-2013-Apr-04 BM Added dbLongBinary "DOL" to SkipList in SanitizeTextFiles
- Added Source directory check to ImportAllSource, pops up a message box
- if source path isn't found.
- Only create source directories if there is something to export.
- Only display importing / exporting <object> in immediate window
- if we are actually doing something.
View
@@ -46,11 +46,11 @@ First Commit to Your Source Control System
Committing New Progress and Pulling Changes from Other Developers
-----------------------------------------------------------------
-1. Open the application, hit CTRL-G, and run the following VB code in the Immediate window: "`ExportAllSource`". Dismiss the popup command prompt window when it's done, and wait for the Immediate window to say the export job is "Done."
+1. Open the application, hit CTRL-G, and run the following VB code in the Immediate window: "`ExportAllSource`". Wait for the Immediate window to say the export job is "Done."
2. Using your repository's tools, commit all the new files that were created in the source folder under `~/MyProject` . Use an appropriate commit message to describe your changes.
3. Pull new upstream changes (if any exist) from your central sharing location used by all developers. If necessary address any merge conflicts using your repository's merge and conflict resolution tools. If any work was done in this step, commit these changes to your local repository as well.
4. Push all local and merged changes back to the central sharing location.
-5. Go back into the Access Immediate window (CTRL-G) and run the following VB code: "`ImportAllSource`". Dismiss the popup command prompt window when it's done, and wait for the Immediate window to say the export job is "Done."
+5. Go back into the Access Immediate window (CTRL-G) and run the following VB code: "`ImportAllSource`". Wait for the Immediate window to say the export job is "Done."
Committing a New "Release" of Your Project
------------------------------------------
View
@@ -0,0 +1,4 @@
+demo.accdb
+==========
+
+Use this Microsoft Access 2010 database to test `AppCodeImportExport.bas`. You need to actually import that module into this database to try it.
View
Binary file not shown.

0 comments on commit 4c8a3fb

Please sign in to comment.