-
Notifications
You must be signed in to change notification settings - Fork 40
/
clsDbTableData.cls
750 lines (640 loc) · 28 KB
/
clsDbTableData.cls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "clsDbTableData"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
'---------------------------------------------------------------------------------------
' Author : Adam Waller
' Date : 4/23/2020
' Purpose : This class extends the IDbComponent class to perform the specific
' : operations required by this particular object type.
' : (I.e. The specific way you export or import this component.)
'---------------------------------------------------------------------------------------
Option Compare Database
Option Explicit
Public Format As eTableDataExportFormat
Const UNSUPPORTED_DATA_TYPE As String = "UNSUPPORTED DATA TYPE"
Private m_Table As AccessObject
Private m_Items(True To False) As Dictionary
Private m_FileList As Dictionary
' This requires us to use all the public methods and properties of the implemented class
' which keeps all the component classes consistent in how they are used in the export
' and import process. The implemented functions should be kept private as they are called
' from the implementing class, not this class.
Implements IDbComponent
'---------------------------------------------------------------------------------------
' Procedure : Export
' Author : Adam Waller
' Date : 4/23/2020
' Purpose : Export the individual database component (table, form, query, etc...)
'---------------------------------------------------------------------------------------
'
Private Sub IDbComponent_Export(Optional strAlternatePath As String)
Dim strFile As String
Dim intFormat As eTableDataExportFormat
' Save as selected format, and remove other formats if they exist.
For intFormat = 1 To eTableDataExportFormat.[_Last]
' Build file name for this format
strFile = Nz2(strAlternatePath, IDbComponent_BaseFolder & GetSafeFileName(m_Table.Name) & "." & GetExtByFormat(intFormat))
If FSO.FileExists(strFile) Then DeleteFile strFile, True
If intFormat = Me.Format Then
' Export the table using this format.
Select Case intFormat
Case etdTabDelimited
' Export in tab delimited text file
ExportTableDataAsTDF m_Table.Name, strFile
Case etdXML
' Export data rows as XML (encoding default is UTF-8)
VerifyPath strFile
Perf.OperationStart "App.ExportXML()"
If IsLocalTable(m_Table.Name) Then
' Embedded schema for local tables to support calculated fields
Application.ExportXML acExportTable, m_Table.Name, strFile, , , , , acEmbedSchema
Else
' Export data only for linked tables
Application.ExportXML acExportTable, m_Table.Name, strFile
End If
Perf.OperationEnd
SanitizeXML strFile, False
End Select
End If
Next intFormat
End Sub
'---------------------------------------------------------------------------------------
' Procedure : ExportTableData
' Author : Adam Waller
' Date : 1/18/2019
' Purpose : Export the data from the table.
'---------------------------------------------------------------------------------------
'
Private Sub ExportTableDataAsTDF(strTable As String, strFile As String)
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim fld As DAO.Field
Dim cData As New clsConcat
Dim intFields As Integer
Dim intCnt As Integer
Dim strText As String
Dim lngProgMax As Long
Dim lngProgValue As Long
Perf.OperationStart "Export Table Data as TDF"
' Open table in fast read-only view
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(GetTableExportSql(strTable), dbOpenSnapshot, dbReadOnly)
intFields = rst.Fields.Count
' Add header row
For Each fld In rst.Fields
cData.Add fld.Name
intCnt = intCnt + 1
If intCnt < intFields Then cData.Add vbTab
Next fld
cData.Add vbCrLf
' Make sure we actually have records
If Not rst.EOF Then
' Stash current progress bar values so we can reuse the
' progress bar to show the progress through the rows.
With Log.ProgressBar
lngProgMax = .Max
lngProgValue = .Value
' Set to recordset after accessing all records
rst.MoveLast
.Max = rst.RecordCount
.Value = 1
rst.MoveFirst
End With
' Add data rows
Do While Not rst.EOF
intCnt = 0
For Each fld In rst.Fields
If IsBinaryType(fld) Then
' Binary data not supported
cData.Add UNSUPPORTED_DATA_TYPE
Else
' Format for TDF format without line breaks
cData.Add FormatStringForTDF(Nz(fld.Value))
End If
intCnt = intCnt + 1
If intCnt < intFields Then cData.Add vbTab
Next fld
cData.Add vbCrLf
rst.MoveNext
Log.Increment ' Increment log, in case this takes a while
Loop
' Restore progress bar values for object iteration
With Log.ProgressBar
.Max = lngProgMax
.Value = lngProgValue
End With
End If
' Close database objects
rst.Close
Set rst = Nothing
Perf.OperationEnd
' Save output file
WriteFile cData.GetStr, strFile
End Sub
'---------------------------------------------------------------------------------------
' Procedure : ImportTableDataTDF
' Author : Adam Waller
' Date : 5/7/2020
' Purpose : Imports the data from a TDF file, loading it into the table
'---------------------------------------------------------------------------------------
'
Private Sub ImportTableDataTDF(strFile As String)
Dim strTable As String
Dim dCols As Dictionary
Dim fld As DAO.Field
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim stm As ADODB.Stream
Dim strLine As String
Dim varLine As Variant
Dim varHeader As Variant
Dim intCol As Integer
Dim strValue As String
Perf.OperationStart "Import TDF Data"
' Build a dictionary of column names so we can load the data
' into the matching columns.
strTable = GetObjectNameFromFileName(strFile)
Set dbs = CurrentDb
Set dCols = New Dictionary
For Each fld In dbs.TableDefs(strTable).Fields
dCols.Add fld.Name, fld.Name
Next fld
' Clear any existing records before importing this data.
dbs.Execute "delete from [" & strTable & "]", dbFailOnError
Set rst = dbs.OpenRecordset(strTable)
' Read file line by line
Set stm = New ADODB.Stream
With stm
.Charset = "utf-8"
.Open
.LoadFromFile strFile
End With
' Loop through lines in file
Do While Not stm.EOS
strLine = stm.ReadText(adReadLine)
' See if the header has already been parsed.
If Not IsArray(varHeader) Then
' Skip past any UTF-8 BOM header
If Left$(strLine, 3) = UTF8_BOM Then strLine = Mid$(strLine, 4)
' Read header line
varHeader = Split(strLine, vbTab)
Else
' Data line
varLine = Split(strLine, vbTab)
rst.AddNew
' Loop through fields
For intCol = 0 To UBound(varHeader)
' Check to see if field exists in the table
If dCols.Exists(varHeader(intCol)) Then
' Check for empty string or null.
If varLine(intCol) = vbNullString Then
' The field could have a default value, but the imported
' data may still be a null value.
If Not IsNull(rst.Fields(varHeader(intCol)).Value) Then
' Could possibly hit a problem with the storage of
' zero length strings instead of nulls. Since we can't
' really differentiate between these in a TDF file,
' we will go with NULL for now.
'rst.Fields(varHeader(intCol)).AllowZeroLength
rst.Fields(varHeader(intCol)).Value = Null
End If
Else
' Perform any needed replacements
strValue = FormatStringFromTDF(CStr(varLine(intCol)))
If strValue <> CStr(varLine(intCol)) Then
' Use replaced string value
rst.Fields(varHeader(intCol)).Value = strValue
Else
If strValue <> UNSUPPORTED_DATA_TYPE Then
' Use variant value without the string conversion
rst.Fields(varHeader(intCol)).Value = varLine(intCol)
End If
End If
End If
End If
Next intCol
rst.Update
End If
' Increment log, just in case this takes a while.
Log.Increment
Loop
stm.Close
Set stm = Nothing
rst.Close
Set rst = Nothing
Perf.OperationEnd
End Sub
'---------------------------------------------------------------------------------------
' Procedure : FormatStringForTDF
' Author : Adam Waller
' Date : 7/16/2021
' Purpose : Replace line feeds and similar characters with escaped codes for
' : representation in tab-delimited format.
' : (Using Chr(26) as interim placeholder) See #251
'---------------------------------------------------------------------------------------
'
Private Function FormatStringForTDF(strValue As String) As String
FormatStringForTDF = MultiReplace(strValue, _
"\", Chr$(26), _
vbCrLf, "\r\n", _
vbCr, "\r", _
vbLf, "\n", _
vbTab, "\t", _
Chr$(26), "\\")
End Function
'---------------------------------------------------------------------------------------
' Procedure : FormatStringFromTDF
' Author : Adam Waller
' Date : 7/16/2021
' Purpose : Restore original characters from escaped codes.
'---------------------------------------------------------------------------------------
'
Private Function FormatStringFromTDF(strTDFValue) As String
FormatStringFromTDF = MultiReplace(strTDFValue, _
"\\", Chr$(26), _
"\r\n", vbCrLf, _
"\r", vbCr, _
"\n", vbLf, _
"\t", vbTab, _
Chr$(26), "\")
End Function
'---------------------------------------------------------------------------------------
' Procedure : GetTableExportSql
' Author : Adam Waller
' Date : 1/18/2019
' Purpose : Build SQL to export `tbl_name` sorted by each field from first to last
'---------------------------------------------------------------------------------------
'
Private Function GetTableExportSql(strTable As String) As String
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
Dim intCnt As Integer
Dim intFields As Integer
Dim cText As New clsConcat
Dim cFieldList As New clsConcat
Dim cSortList As New clsConcat
Dim dbs As Database
Set dbs = CurrentDb
Set tdf = dbs.TableDefs(strTable)
intFields = tdf.Fields.Count
' Build list of fields
With cFieldList
For Each fld In tdf.Fields
.Add "[", fld.Name, "], "
If Not IsBinaryType(fld) Then cSortList.Add "[", fld.Name, "], "
Next fld
End With
' Remove any trailing commas
cFieldList.Remove 2
cSortList.Remove 2
' Build select statement
With cText
.Add "SELECT ", cFieldList.GetStr
.Add " FROM [", strTable, "] ORDER BY "
.Add cSortList.GetStr
End With
GetTableExportSql = cText.GetStr
End Function
'---------------------------------------------------------------------------------------
' Procedure : Import
' Author : Adam Waller, Florian Jenn
' Date : 4/23/2020, 2020-10-26
' Purpose : Import the table data from a file.
'---------------------------------------------------------------------------------------
'
Private Sub IDbComponent_Import(strFile As String)
Dim blnUseTemp As Boolean
Dim strTempFile As String
Dim strTable As String
' Make sure table exists before importing data to it.
strTable = GetObjectNameFromFileName(strFile)
' Only allow import into local tables (not linked tables)
If IsLocalTable(strTable) Then
' Import from different formats (XML is preferred for data integrity)
Select Case GetFormatByExt(strFile)
Case etdXML
' The ImportXML function does not properly handle UrlEncoded paths
blnUseTemp = (InStr(1, strFile, "%") > 0)
If blnUseTemp Then
' Import from (safe) temporary file name.
strTempFile = GetTempFile
FSO.CopyFile strFile, strTempFile
Application.ImportXML strTempFile, acAppendData
DeleteFile strTempFile
Else
Application.ImportXML strFile, acAppendData
End If
Case etdTabDelimited
ImportTableDataTDF strFile
End Select
Else
' Either not a local table, or it doesn't exist
If TableExists(strTable) Then
Log.Error eelWarning, "Table data may only be imported into local tables", "clsDbTableData.Import"
Else
' Warn user that table does not exist.
Log.Error eelError, "Table structure not found for '" & strTable & "'.", "clsDbTableData.Import"
Log.Add "Table definition does not exist for '" & strTable & _
"'. This must be created before importing table data.", False
End If
Log.Add "Table data from '" & strTable & "' was not imported.", False
End If
End Sub
'---------------------------------------------------------------------------------------
' Procedure : Merge
' Author : Adam Waller
' Date : 11/21/2020
' Purpose : Merge the source file into the existing database, updating or replacing
' : any existing object.
'---------------------------------------------------------------------------------------
'
Private Sub IDbComponent_Merge(strFile As String)
Log.Error eelWarning, "Merge not supported for table data. (" & _
GetObjectNameFromFileName(strFile) & ")", "clsDbTableData.Merge"
End Sub
'---------------------------------------------------------------------------------------
' Procedure : IDbComponent_MoveSource
' Author : Adam Waller
' Date : 9/10/2022
' Purpose : Move the component's source file(s) from one folder to another
'---------------------------------------------------------------------------------------
'
Private Sub IDbComponent_MoveSource(strFromFolder As String, strToFolder As String)
MoveFileIfExists strFromFolder & FSO.GetFileName(IDbComponent_SourceFile), strToFolder
End Sub
'---------------------------------------------------------------------------------------
' Procedure : GetAllFromDB
' Author : Adam Waller
' Date : 4/23/2020
' Purpose : Return a collection of class objects represented by this component type.
'---------------------------------------------------------------------------------------
'
Private Function IDbComponent_GetAllFromDB(Optional blnModifiedOnly As Boolean = False) As Dictionary
Dim tbl As AccessObject
Dim cTable As clsDbTableData
Dim blnAdd As Boolean
' Build collection if not already cached
If m_Items(blnModifiedOnly) Is Nothing Then
Set m_Items(blnModifiedOnly) = New Dictionary
' No need to go any further if we don't have any saved tables defined
If Options.TablesToExportData.Count > 0 Then
' We have at least one table defined. Loop through the tables looking
' for a matching name.
With Options
For Each tbl In CurrentData.AllTables
If .TablesToExportData.Exists(tbl.Name) Then
Set cTable = New clsDbTableData
cTable.Format = .GetTableExportFormat(CStr(.TablesToExportData(tbl.Name)("Format")))
Set cTable.Parent.DbObject = tbl
blnAdd = True
If blnModifiedOnly Then blnAdd = cTable.IDbComponent_IsModified
If blnAdd Then m_Items(blnModifiedOnly).Add cTable.Parent.SourceFile, cTable
End If
Next tbl
End With
End If
End If
' Return cached collection
Set IDbComponent_GetAllFromDB = m_Items(blnModifiedOnly)
End Function
'---------------------------------------------------------------------------------------
' Procedure : GetFileList
' Author : Adam Waller
' Date : 4/23/2020
' Purpose : Return a list of file names to import for this component type. (Could be
' : a couple different file extensions involved.
'---------------------------------------------------------------------------------------
'
Private Function IDbComponent_GetFileList() As Dictionary
If m_FileList Is Nothing Then
Set m_FileList = GetFilePathsInFolder(IDbComponent_BaseFolder, "*." & GetExtByFormat(etdTabDelimited))
MergeDictionary m_FileList, GetFilePathsInFolder(IDbComponent_BaseFolder, "*." & GetExtByFormat(etdXML))
End If
Set IDbComponent_GetFileList = m_FileList
End Function
'---------------------------------------------------------------------------------------
' Procedure : IsBinaryType
' Author : Adam Waller
' Date : 9/10/2022
' Purpose : Returns true if the field type uses binary content. (Export/import on
' : binary data through XML or text is not well supported.)
'---------------------------------------------------------------------------------------
'
Private Function IsBinaryType(fld As DAO.Field) As Boolean
Select Case fld.Type
Case dbLongBinary, dbVarBinary, dbAttachment: IsBinaryType = True
Case Else: IsBinaryType = False
End Select
End Function
'---------------------------------------------------------------------------------------
' Procedure : GetExtByFormat
' Author : Adam Waller
' Date : 4/23/2020
' Purpose : Return the expected file extension by format.
'---------------------------------------------------------------------------------------
'
Private Function GetExtByFormat(intFormat As eTableDataExportFormat) As String
Select Case intFormat
Case etdTabDelimited: GetExtByFormat = "txt"
Case etdXML: GetExtByFormat = "xml"
End Select
End Function
'---------------------------------------------------------------------------------------
' Procedure : GetFormatByExt
' Author : Adam Waller
' Date : 5/7/2020
' Purpose : Look up the format from the extension name
'---------------------------------------------------------------------------------------
'
Private Function GetFormatByExt(strFile As String) As eTableDataExportFormat
Select Case FSO.GetExtensionName(strFile)
Case "txt": GetFormatByExt = etdTabDelimited
Case "xml": GetFormatByExt = etdXML
End Select
End Function
'---------------------------------------------------------------------------------------
' Procedure : ClearOrphanedSourceFiles
' Author : Adam Waller
' Date : 4/23/2020
' Purpose : Remove any source files for objects not in the current database.
' : Note that alternate formats may stay here till the next export.
'---------------------------------------------------------------------------------------
'
Private Sub IDbComponent_ClearOrphanedSourceFiles()
ClearOrphanedSourceFiles Me, "xml", "txt"
End Sub
'---------------------------------------------------------------------------------------
' Procedure : ClearOrphanedDatabaseObjects
' Author : Adam Waller
' Date : 11/3/2021
' Purpose : Remove database objects that are not represented by existing source files.
'---------------------------------------------------------------------------------------
'
Public Sub IDbComponent_ClearOrphanedDatabaseObjects()
End Sub
'---------------------------------------------------------------------------------------
' Procedure : IsModified
' Author : Adam Waller
' Date : 11/21/2020
' Purpose : Returns true if the object in the database has been modified since
' : the last export of the object.
'---------------------------------------------------------------------------------------
'
Public Function IDbComponent_IsModified() As Boolean
' It's not really worth it to try to determine if the table data has been changed.
' We would have to fully export anyway just to check, so let's always export for
' table data. (This is handled different from just about every other object type.)
IDbComponent_IsModified = True
End Function
'---------------------------------------------------------------------------------------
' Procedure : DateModified
' Author : Adam Waller
' Date : 4/23/2020
' Purpose : The date/time the object was modified. (If possible to retrieve)
' : If the modified date cannot be determined (such as application
' : properties) then this function will return 0.
'---------------------------------------------------------------------------------------
'
Private Function IDbComponent_DateModified() As Date
' We cannot determine when *records* were modified in a table.
IDbComponent_DateModified = 0
End Function
'---------------------------------------------------------------------------------------
' Procedure : SourceModified
' Author : Adam Waller
' Date : 4/27/2020
' Purpose : The date/time the source object was modified. In most cases, this would
' : be the date/time of the source file, but it some cases like SQL objects
' : the date can be determined through other means, so this function
' : allows either approach to be taken.
'---------------------------------------------------------------------------------------
'
Private Function IDbComponent_SourceModified() As Date
If FSO.FileExists(IDbComponent_SourceFile) Then IDbComponent_SourceModified = GetLastModifiedDate(IDbComponent_SourceFile)
End Function
'---------------------------------------------------------------------------------------
' Procedure : Category
' Author : Adam Waller
' Date : 4/23/2020
' Purpose : Return a category name for this type. (I.e. forms, queries, macros)
'---------------------------------------------------------------------------------------
'
Private Property Get IDbComponent_Category() As String
IDbComponent_Category = "Table Data"
End Property
'---------------------------------------------------------------------------------------
' Procedure : BaseFolder
' Author : Adam Waller
' Date : 4/23/2020
' Purpose : Return the base folder for import/export of this component.
'---------------------------------------------------------------------------------------
Private Property Get IDbComponent_BaseFolder() As String
IDbComponent_BaseFolder = Options.GetExportFolder & "tables" & PathSep
End Property
'---------------------------------------------------------------------------------------
' Procedure : Name
' Author : Adam Waller
' Date : 4/23/2020
' Purpose : Return a name to reference the object for use in logs and screen output.
'---------------------------------------------------------------------------------------
'
Private Property Get IDbComponent_Name() As String
If m_Table Is Nothing Then Exit Property
IDbComponent_Name = m_Table.Name
End Property
'---------------------------------------------------------------------------------------
' Procedure : SourceFile
' Author : Adam Waller
' Date : 4/23/2020
' Purpose : Return the full path of the source file for the current object.
'---------------------------------------------------------------------------------------
'
Private Property Get IDbComponent_SourceFile() As String
If m_Table Is Nothing Then Exit Property
IDbComponent_SourceFile = IDbComponent_BaseFolder & GetSafeFileName(m_Table.Name) & "." & GetExtByFormat(Me.Format)
End Property
'---------------------------------------------------------------------------------------
' Procedure : Count
' Author : Adam Waller
' Date : 4/23/2020
' Purpose : Return a count of how many items are in this category.
'---------------------------------------------------------------------------------------
'
Private Property Get IDbComponent_Count(Optional blnModifiedOnly As Boolean = False) As Long
IDbComponent_Count = IDbComponent_GetAllFromDB(blnModifiedOnly).Count
End Property
'---------------------------------------------------------------------------------------
' Procedure : QuickCount
' Author : Adam Waller
' Date : 6/14/2022
' Purpose : Return a cached, non-iterative approximate count of database objects
' : for use with progress indicators when scanning for changes. Single file
' : objects like database properties can simply return 1.
'---------------------------------------------------------------------------------------
'
Private Property Get IDbComponent_QuickCount() As Long
' In most cases very few tables will be involved here
IDbComponent_QuickCount = 1
End Property
'---------------------------------------------------------------------------------------
' Procedure : ComponentType
' Author : Adam Waller
' Date : 4/23/2020
' Purpose : The type of component represented by this class.
'---------------------------------------------------------------------------------------
'
Private Property Get IDbComponent_ComponentType() As eDatabaseComponentType
IDbComponent_ComponentType = edbTableData
End Property
'---------------------------------------------------------------------------------------
' Procedure : Upgrade
' Author : Adam Waller
' Date : 4/23/2020
' Purpose : Run any version specific upgrade processes before importing.
'---------------------------------------------------------------------------------------
'
Private Sub IDbComponent_Upgrade()
' No upgrade needed.
End Sub
'---------------------------------------------------------------------------------------
' Procedure : SingleFile
' Author : Adam Waller
' Date : 4/24/2020
' Purpose : Returns true if the export of all items is done as a single file instead
' : of individual files for each component. (I.e. properties, references)
'---------------------------------------------------------------------------------------
'
Private Property Get IDbComponent_SingleFile() As Boolean
IDbComponent_SingleFile = False
End Property
'---------------------------------------------------------------------------------------
' Procedure : DbObject
' Author : Adam Waller
' Date : 4/23/2020
' Purpose : This represents the database object we are dealing with.
'---------------------------------------------------------------------------------------
'
Private Property Get IDbComponent_DbObject() As Object
Set IDbComponent_DbObject = m_Table
End Property
Private Property Set IDbComponent_DbObject(ByVal RHS As Object)
Set m_Table = RHS
End Property
'---------------------------------------------------------------------------------------
' Procedure : Parent
' Author : Adam Waller
' Date : 4/24/2020
' Purpose : Return a reference to this class as an IDbComponent. This allows you
' : to reference the public methods of the parent class without needing
' : to create a new class object.
'---------------------------------------------------------------------------------------
'
Public Property Get Parent() As IDbComponent
Set Parent = Me
End Property