VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "DBase"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

'Klasa DBase
'Ukrywa szczegóły tworzenia połączeń do konkretnej bazy danych
'Implementuje fabrykę tworzenia indeksów, dodawania tabel,
'Oraz dodawania indeksów do tabel
Private db As Database  'Połączenie do bazy danych
Private ws As Workspace 'Używane przez połączenie
Private fl As File      'Używane dla sprawdzenia istnienia pliku
Private tb As TableDef  'Używana do tworzenia tabel
'--------
Public Sub createDatabase(dbname As String)
  Set fl = New File
  Set ws = Workspaces(0)
  
  fl.setFilename dbname
  If fl.exists() Then
    fl.delete
  End If
  Set db = ws.createDatabase(dbname, dbLangGeneral)
End Sub

Public Sub openDatabase(dbname As String)
  Set ws = Workspaces(0)
  Set db = ws.openDatabase(dbname, dbLangGeneral)
End Sub
'--------
Public Function makeTable(nm As String) As Indexer
  Dim inx As New Indexer
  inx.makeTable db, nm
  Set makeTable = inx
End Function
'--------
Public Function openTable(tbName As String) As Recordset
  Set openTable = db.OpenRecordset(tbName, dbOpenTable)
End Function
'--------
Public Function openQuery(qry As String) As Recordset
  Set openQuery = db.OpenRecordset(qry, dbOpenDynaset)
End Function
'--------
