Another dump question

Joakim Schramm joakim at astrocalc.com
Thu Dec 7 11:29:17 CST 2006


VCOM docs say about LoadDump,

Note: You must use a variable of type IVDatabase, but not your subclass of
IVDatabase!
After the loading is complete, you will need to close the IVDatabase and
open it again as
your subclass.

Does it mean I have to use another variable or can I safely reuse a global
(or private to module) variable like this:


Public Function InitChartDB() As Boolean

On Error GoTo ErrHandler

Set mChartDB = New VDatabase

With mChartDB
    .InitLocal kStorageDisk
    .DateFormat = EVDateFormat.kYMD
End With

DbPath = ChartDir + "AstCharts.vdb"

'If Database not exists we create it.
If Not FileExists(DbPath) Then

    With mChartDB
        .LoadDump DbSchemaDir & "Charts.xml", DbPath, kXML
        .Close
        Set mChartDB = New VDatabase
        .InitLocal kStorageDisk
        .DateFormat = EVDateFormat.kYMD
    End With

End If

mChartDB.Open DbPath
InitChartDB = CheckOpenChartDB ' check open and set Tbl & fld referenses

Exit Function

ErrHandler:
DisplayError "InitChartDB"
End Function

/Joakim



More information about the Valentina mailing list