Category : Databases and related files
Archive   : MF-DB102.ZIP
Filename : MF.BAS

 
Output of file : MF.BAS contained in archive : MF-DB102.ZIP
Option Explicit
'************* MF DLL calls ***************

' Use this file with any program you create in VB
' It contains all the declarations needed for accessing
' the MF database.

' *** ADMIN ***
Declare Function mfInit% Lib "mf.dll" (extensionDLLs As Any)
Declare Function mfDeInit% Lib "mf.dll" (ByVal task%)
Declare Function mfOpen% Lib "mf.dll" (ByVal FileName$, ByVal task%)
Declare Function mfClose% Lib "mf.dll" (ByVal task%, ByVal dbHndl%)
Declare Function mfCreateDB% Lib "mf.dll" (ByVal FileName$, ByVal RecSize%, ByVal NumIndexs%, rSizeArray As Any, typeArray As Any)

' *** GENERAL ***
Declare Function mfInfoDB% Lib "mf.dll" (RecSize%, NumIndexs%, NumRecs&, LiveRecs&, ByVal task%, ByVal dbHndl%)
Declare Function mfInfoIndex% Lib "mf.dll" (ByVal task%, ByVal dbHndl%, ByVal indexNumber%)
Declare Function mfIsDeleted% Lib "mf.dll" (ByVal RecordNum&, ByVal task%, ByVal dbHndl%)
Declare Function mfReIndex% Lib "mf.dll" (ByVal anHwnd%, ByVal task%, ByVal dbHndl%)
Declare Function mfLock% Lib "mf.dll" (ByVal RecordNum&, ByVal task%, ByVal dbHndl%)
Declare Function mfUnLock% Lib "mf.dll" (ByVal RecordNum&, ByVal task%, ByVal dbHndl%)




' *** DATA I/O ***
Declare Function mfRead% Lib "mf.dll" (ByVal RecordNum&, record As Any, ByVal task%, ByVal dbHndl%, ByVal opt%)
Declare Function mfWrite% Lib "mf.dll" (ByVal RecordNum&, record As Any, ByVal task%, ByVal dbHndl%, ByVal opt%)
Declare Function mfDelete% Lib "mf.dll" (ByVal RecordNum&, ByVal task%, ByVal dbHndl%)
Declare Function mfAppendData& Lib "mf.dll" (record As Any, ByVal task%, ByVal dbHndl%)

' *** Movement ***
Declare Function mfTop& Lib "mf.dll" (ByVal task%, ByVal dbHndl%, ByVal indexNumber%)
Declare Function mfBottom& Lib "mf.dll" (ByVal task%, ByVal dbHndl%, ByVal indexNumber%)
Declare Function mfSkip& Lib "mf.dll" (ByVal FromRecord&, ByVal HowFarToSkip&, ByVal task%, ByVal dbHndl%, ByVal indexNumber%)
' Since VB doesn't support passing 'void' pointers -- we have to trick it to do the job
' SeekS is for STRINGS
' SeekO is for anything else...
Declare Function mfSeekS& Lib "mf.dll" Alias "mfSeek" (ByVal skStr$, retcode%, ByVal task%, ByVal dbHndl%, ByVal xNum%)
Declare Function mfSeekO& Lib "mf.dll" Alias "mfSeek" (skStr As Any, retcode%, ByVal task%, ByVal dbHndl%, ByVal xNum%)


' Severe-Performance functions
Declare Function mfReadListS& Lib "mf.dll" Alias "mfReadList" (ByVal record As Long, ByVal skStr$, ByVal FuzzyLength%, hitList As Any, ByVal maxHits&, ByVal task%, ByVal dbHndl%, ByVal xNum%)
Declare Function mfReadListO& Lib "mf.dll" Alias "mfReadList" (ByVal record As Long, skStr As Any, ByVal FuzzyLength%, hitList As Any, ByVal maxHits&, ByVal task%, ByVal dbHndl%, ByVal xNum%)
Declare Function mfReadListNull& Lib "mf.dll" Alias "mfReadList" (ByVal record As Long, ByVal skStr As Long, ByVal FuzzyLength%, hitList As Any, ByVal maxHits&, ByVal task%, ByVal dbHndl%, ByVal xNum%)



' Constants:
' READ and WRITE options
Global Const MFRW_ALL = -1
Global Const MFRW_DATA = -2
Global Const MFRW_KEY = -3

' Seek Top/Bottom
' Return codes when there's no higher/lower key
' or no data at all...
Global Const MFSEEK_BOF = -1
Global Const MFSEEK_EOF = -2
Global Const MFSEEK_NODATA = -3

' parameter set in iCode for an mfSeek
Global Const MFSEEK_EXACT_MATCH = 1
Global Const MFSEEK_PARTIAL_MATCH = 2

' SP constants
Global Const MF_SP_COUNT = -1

' index type information
Global Const MFCOMP_CHAR = 1
Global Const MFCOMP_INT = 2
Global Const MFCOMP_LONG = 3
Global Const MFCOMP_CHARIC = 4 ' Case insensitive strings
Global Const MFCOMP_UDK = 100 ' Or greater...

' used for an array on index sizes on createDB
Type tIntArray
i As Integer
End Type

' Used for getting a hit-list in the severe-performance functions
Type tLongArray
l As Long
End Type

' Required on mfInit when using extensions to MF
Type tExtDLL
type As Integer
DLLName As String * 128
End Type

' Need 1 task handle per application instance
Global TaskHndl As Integer ' Task handle # for this instance

Sub mfBeginRun ()
ReDim extDLLs(0 To 1) As tExtDLL

extDLLs(0).type = MFCOMP_UDK ' tells mf to use this dll for UDK's
extDLLs(0).DLLName = "mfUDK.dll"
extDLLs(1).type = -1 ' tells MF there are NO more extensions to load


' Add this line as the first line in your application
' (or, at least before you use the dbms)
' The TaskHndl is your unique handle to the database
' If the hndl is -1, then 10 apps are already accessing the
' database -- close some!
TaskHndl = mfInit(extDLLs(0))
If TaskHndl < 0 Then
MsgBox "No database handles available -- please close some active windows"
End
End If
End Sub

' Call when you are completely done with the database
' for the entire program...
Sub mfEndRun ()
junk = mfDeInit(TaskHndl)
End Sub

' Pad a string with 'char'
Function Pad$ (num%, char$)
Dim n%, r$
For n = 1 To num
r = r + char
Next n
Pad = r
End Function



  3 Responses to “Category : Databases and related files
Archive   : MF-DB102.ZIP
Filename : MF.BAS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/