Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified access-add-in/AccUnitLoader.accda
Binary file not shown.
10 changes: 10 additions & 0 deletions access-add-in/New Text Document.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Public Sub {MethodUnderTest}_{StateUnderTest}_{ExpectedBehaviour}({Params})
' Arrange
Err.Raise vbObjectError, "{MethodUnderTest}_{StateUnderTest}_{ExpectedBehaviour}", "Test not implemented"
Const Expected As Variant = "expected value"
Dim Actual As Variant
' Act
Actual = "actual value"
' Assert
Assert.That Actual, Iz.EqualTo(Expected)
End Sub
206 changes: 14 additions & 192 deletions access-add-in/source/AccUnitConfiguration.cls
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,9 @@ Private Const EXTENSION_KEY As String = "AccUnitConfiguration"
#Const ADODB_EARLYBINDING = 0
'ADODB wird hier �ber Late binding eingesetzt, da es nur zum Erstellen der Tabelle genutzt wird

Private m_ACLibConfig As ACLibConfiguration

' Grundeinstellungen
Private Const ACLIB_CONFIG_ROOTFOLDERNAME As String = "AccessCodeLibrary"
Private Const ACLIB_CONFIG_DATABASENAME As String = "ACLib_Config"
Private Const ACLIB_CONFIG_TABLEDEFNAME As String = "ACLib_ConfigTable"

Private Const SQL_CONFIG_TABLE_FIELD_PROPNAME As String = "PropName"
Private Const SQL_CONFIG_TABLE_FIELD_PROPVALUE As String = "PropValue"
Private Const SQL_SELECT_PROPERTYVALUE As String = _
"select " & SQL_CONFIG_TABLE_FIELD_PROPNAME & ", " & SQL_CONFIG_TABLE_FIELD_PROPVALUE & _
" From " & ACLIB_CONFIG_TABLEDEFNAME & " where " & SQL_CONFIG_TABLE_FIELD_PROPNAME & " = [?]"

Private Const SQL_CREATETABLE_CONFIGTABLE As String = _
"CREATE TABLE " & ACLIB_CONFIG_TABLEDEFNAME & _
"([PropName] varchar(255) WITH COMPRESSION NOT NULL," & _
" [PropValue] varchar(255) WITH COMPRESSION," & _
" [PropRemarks] text WITH COMPRESSION," & _
" CONSTRAINT PK_" & ACLIB_CONFIG_TABLEDEFNAME & " PRIMARY KEY ([PropName]))"

' Base config
Private Const PROPNAME_ACCUNITDLLPATH As String = "AccUnitDllPath"

' Hilfsvariablen
Expand Down Expand Up @@ -115,9 +99,17 @@ End Sub


'---------------------------------------------------------------------------------------
' Erg�nzungen f�r Ereiterung: AccUnitConfiguration
' Erg�nzungen f�r Erweiterung: AccUnitConfiguration
'---------------------------------------------------------------------------------------


Public Property Get ACLibConfig() As ACLibConfiguration
If m_ACLibConfig Is Nothing Then
Set m_ACLibConfig = New ACLibConfiguration
End If
Set ACLibConfig = m_ACLibConfig
End Property

Private Sub GetExtensionPropertyLookup(ByVal PropertyName As String, ByRef ResumeMode As ApplicationHandlerResumeModes, ByRef ResumeMessage As Variant)

ResumeMode = AppResumeMode_Completed
Expand All @@ -140,15 +132,15 @@ End Property
Public Property Get AccUnitDllPath() As String

If Len(m_AccUnitDllPath) = 0 Then
m_AccUnitDllPath = GetACLibGlobalProperty(PROPNAME_ACCUNITDLLPATH)
m_AccUnitDllPath = ACLibConfig.GetACLibGlobalProperty(PROPNAME_ACCUNITDLLPATH)
If Len(m_AccUnitDllPath) > 0 Then
If Not DirExists(m_AccUnitDllPath) Then
Err.Raise vbObjectError, "AccUnitConfiguration.AccUnitDllPath", "Das Verzeichnis '" & m_AccUnitDllPath & "' ist nicht vorhanden!"
m_AccUnitDllPath = vbNullString
End If
If VBA.Right$(m_AccUnitDllPath, 1) <> "\" Then
m_AccUnitDllPath = m_AccUnitDllPath & "\"
SetACLibGlobalProperty PROPNAME_ACCUNITDLLPATH, m_AccUnitDllPath
ACLibConfig.SetACLibGlobalProperty PROPNAME_ACCUNITDLLPATH, m_AccUnitDllPath
End If
End If
End If
Expand All @@ -169,180 +161,10 @@ Public Property Let AccUnitDllPath(ByVal NewPath As String)
End If
End If
m_AccUnitDllPath = NewPath
SetACLibGlobalProperty PROPNAME_ACCUNITDLLPATH, m_AccUnitDllPath
ACLibConfig.SetACLibGlobalProperty PROPNAME_ACCUNITDLLPATH, m_AccUnitDllPath

End Property

Private Property Get DefaultAccUnitDllPath() As String
DefaultAccUnitDllPath = DefaultAccUnitLibFolder & "\"
End Property

Private Function GetACLibGlobalProperty(ByRef PropertyName As String) As String

Dim rst As DAO.Recordset
Dim SelectSql As String

SelectSql = Replace(SQL_SELECT_PROPERTYVALUE, "[?]", DaoSqlTool.TextToSqlText(PropertyName))
Set rst = ACLibPropertyDb.OpenRecordset(SelectSql)
If Not rst.EOF Then
GetACLibGlobalProperty = Nz(rst.Fields(SQL_CONFIG_TABLE_FIELD_PROPVALUE), vbNullString)
Else
GetACLibGlobalProperty = vbNullString
End If
rst.Close

End Function

Private Function SetACLibGlobalProperty(ByRef PropertyName As String, ByRef NewValue As String) As String

Dim rst As DAO.Recordset
Dim SelectSql As String

SelectSql = Replace(SQL_SELECT_PROPERTYVALUE, "[?]", DaoSqlTool.TextToSqlText(PropertyName))
Set rst = ACLibPropertyDb.OpenRecordset(SelectSql)
If rst.EOF Then
rst.AddNew
rst.Fields(SQL_CONFIG_TABLE_FIELD_PROPNAME).Value = PropertyName
Else
rst.Edit
End If
rst.Fields(SQL_CONFIG_TABLE_FIELD_PROPVALUE).Value = NewValue
rst.Update
rst.Close

End Function

Private Property Get ACLibPropertyDb() As DAO.Database

If m_ACLibPropertyDb Is Nothing Then
If CheckConfigTableDef Then
Set m_ACLibPropertyDb = CodeDb
End If
End If
Set ACLibPropertyDb = m_ACLibPropertyDb

End Property

#If ADODB_EARLYBINDING Then
Private Function CreateConfigTable(ByRef TargetConnection As ADODB.Connection) As Boolean
#Else
Private Function CreateConfigTable(ByRef TargetConnection As Object) As Boolean
#End If

TargetConnection.Execute SQL_CREATETABLE_CONFIGTABLE
CreateConfigTable = True

End Function


Private Function CheckConfigTableDef() As Boolean

Dim db As DAO.Database
Dim tdf As DAO.TableDef

Set db = CodeDb

If Not TableDefExists(ACLIB_CONFIG_TABLEDEFNAME, db) Then

Set tdf = db.CreateTableDef(ACLIB_CONFIG_TABLEDEFNAME)
tdf.Connect = ";Database=" & ACLibConfigDatabaseFile
tdf.SourceTableName = ACLIB_CONFIG_TABLEDEFNAME
db.TableDefs.Append tdf

ElseIf Len(VBA.Dir$(VBA.Mid$(db.TableDefs(ACLIB_CONFIG_TABLEDEFNAME).Connect, VBA.Len(";Database=") + 1))) = 0 Then

With db.TableDefs(ACLIB_CONFIG_TABLEDEFNAME)
.Connect = ";Database=" & ACLibConfigDatabaseFile
.RefreshLink
End With

End If

Set db = Nothing

CheckConfigTableDef = True

End Function

Public Property Get ACLibConfigDirectory() As String

Dim strPath As String

strPath = VBA.Environ("Appdata") & "\" & ACLIB_CONFIG_ROOTFOLDERNAME & "\"
If Len(VBA.Dir$(strPath, vbDirectory)) = 0 Then
VBA.MkDir strPath
End If

ACLibConfigDirectory = strPath

End Property

Private Property Get ACLibConfigDatabaseFile() As String

Dim db As DAO.Database
Dim strDbFile As String
Dim bolCreateConfigTable As Boolean

#If ADODB_EARLYBINDING = 1 Then
Dim cnn As ADODB.Connection
#Else
Dim cnn As Object
#End If

strDbFile = CodeDb.Name
strDbFile = VBA.Mid$(strDbFile, VBA.InStrRev(strDbFile, "."))
If VBA.Left$(strDbFile, 5) = ".accd" Then
strDbFile = ".accdu"
Else
strDbFile = ".mdt"
End If
strDbFile = ACLibConfigDirectory & ACLIB_CONFIG_DATABASENAME & strDbFile

If Len(VBA.Dir$(strDbFile)) = 0 Then

'Datenbank anlegen
If CodeDb.Version = "4.0" Then
Set db = DBEngine.CreateDatabase(strDbFile, dbLangGeneral, dbVersion40)
Else
Set db = DBEngine.CreateDatabase(strDbFile, dbLangGeneral)
End If
db.Close

bolCreateConfigTable = True

Else 'Pr�fen ob Config-Tabelle vorhanden ist

Set db = DBEngine.OpenDatabase(strDbFile)
bolCreateConfigTable = Not TableDefExists(ACLIB_CONFIG_TABLEDEFNAME, db)
db.Close

End If

If bolCreateConfigTable Then
'Tabelle erstellen
#If ADODB_EARLYBINDING = 1 Then
Set cnn = New ADODB.Connection
#Else
Set cnn = CreateObject("ADODB.Connection")
#End If
cnn.ConnectionString = VBA.Replace(CodeProject.Connection.ConnectionString, CodeDb.Name, strDbFile)
cnn.Open
CreateConfigTable cnn
cnn.Close
Set cnn = Nothing
End If

ACLibConfigDatabaseFile = strDbFile

End Property

Private Property Get DaoSqlTool()
If m_DaoSqlTools Is Nothing Then
Set m_DaoSqlTools = SqlTools.Clone("\#yyyy-mm-dd\#", "True", "*")
End If
Set DaoSqlTool = m_DaoSqlTools
End Property

Private Sub Class_Terminate()
Set m_DaoSqlTools = Nothing
End Sub
17 changes: 17 additions & 0 deletions access-add-in/source/AccUnitLoaderFactoryCall.bas
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Attribute VB_Name = "AccUnitLoaderFactoryCall"
'---------------------------------------------------------------------------------------
' Modul: AccUnitLoaderFactoryCall
'---------------------------------------------------------------------------------------
'<codelib>
' <file>%AppFolder%/source/GetAccUnitFactory.bas</file>
' <license>_codelib/license.bas</license>
' <use>%AppFolder%/source/AccUnitLoaderFactory.cls</use>
'</codelib>
'---
Option Compare Database
Option Explicit

Public Function GetAccUnitFactory() As AccUnitLoaderFactory
CheckAccUnitTypeLibFile
Set GetAccUnitFactory = New AccUnitLoaderFactory
End Function
Binary file modified access-add-in/source/AccUnitLoaderForm.frm
Binary file not shown.
Binary file added access-add-in/source/AccUnitUserSettings.frm
Binary file not shown.
8 changes: 4 additions & 4 deletions access-add-in/source/DebugPrintTestSuite.cls
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ Private Function IAccessTestSuite_Add(ByVal testToAdd As Object) As AccUnit.IAcc
Set IAccessTestSuite_Add = Add(testToAdd)
End Function

Public Function AddByClassName(ByVal className As String) As DebugPrintTestSuite
m_TestSuite.AddByClassName className
Public Function AddByClassName(ByVal ClassName As String) As DebugPrintTestSuite
m_TestSuite.AddByClassName ClassName
Set AddByClassName = Me
End Function

Private Function IAccessTestSuite_AddByClassName(ByVal className As String) As AccUnit.IAccessTestSuite
Set IAccessTestSuite_AddByClassName = AddByClassName(className)
Private Function IAccessTestSuite_AddByClassName(ByVal ClassName As String) As AccUnit.IAccessTestSuite
Set IAccessTestSuite_AddByClassName = AddByClassName(ClassName)
End Function

Public Function AddFromVBProject() As DebugPrintTestSuite
Expand Down
4 changes: 1 addition & 3 deletions access-add-in/source/_config_Application.bas
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ Attribute VB_Name = "_config_Application"
'---------------------------------------------------------------------------------------
'---------------------------------------------------------------------------------------
'<codelib>
' <file>%AppFolder%/source/_config_Application.bas</file>
' <replace>base/_config_Application.bas</replace>
' <license>_codelib/license.bas</license>
' <use>%AppFolder%/source/defGlobal_AccUnitLoader.bas</use>
' <use>base/modApplication.bas</use>
Expand All @@ -20,7 +18,7 @@ Option Compare Database
Option Explicit

'Version nummer
Private Const APPLICATION_VERSION As String = "0.9.17.230817"
Private Const APPLICATION_VERSION As String = "0.9.18.231106"

Private Const APPLICATION_NAME As String = "ACLib AccUnit Loader"
Private Const APPLICATION_FULLNAME As String = "Access Code Library - AccUnit Loader"
Expand Down
Loading