Liberty Basic ISAM

© 2003, Richard Peeters

author email:

r.peeters@pandora.be

Home

Password Textbox API

Character Replacement

LB Isam Library

Beginning Games 2

Rubber Band Objects

WMLiberty Primer

LB Browser

Beginning Programming 5

INPUTTO Demo

Chase Button

Questionaire Wizard

MIDI Output Thoughts

MIDI-Tunes

Play MIDI DLL

Directory Search Function

Newsletter help

Index

Inroduction

Richard Peeters (r.peeters@pandora.be) has been working on a very interesting project to bring ISAM indexing to Liberty Basic using native LB code. His project is still in develpment, but really is promising.

I personally have been using this in some home grown projects and I am excited about where this is going. Richard may be submitting a proper newsletter article in the future (I hope) which details more about the project and its development. Until then I am offering the work in progress (with Richards permission). The function library is on page two. A sample test program using the function library is on page three.

All the functions depend on a global string array called globalinf$. It has four elements defined as:

Here is a run down of the function library:


-------------------------------------------------------------------------------

function initfunclib

 use once in your program before using any of the functions in this library

 does some initialisations

-------------------------------------------------------------------------------



-------------------------------------------------------------------------------

function getcount

 used to get the number of records in the index

 parameters passed

 indexname$ = name of indexfile

 keylength = length of key

 returns nr of records in the index

 ------------------------------------------

 

 -------------------------------------------------------------------------------

function index

 used to create an index on a file with fixed recordlengths (random or binary)

 the max number of records = 99999

 parameters to be passed:

   filename$ = filename of file to be indexed

   reclen    = recordlength

   indexname$= name of the indexfile to be created

   keybegin  = the position in the record where the key begins

   keylength = length of the key

   unique    = 0 = duplicate records allowed / 1 = no duplicates allowed



the function returns the number of records indexed  

-------------------------------------------------------------------------------



-------------------------------------------------------------------------------

function getkey

 used to search a key in an index 

 parameters to be passed:

   

   indexname$= name of the indexfile to be searched

   keylength = length of the key

   key$      = key to search for



the function returns the recordnr in the masterfile of the found key or if not found

the negative recordnr after which it should have been if present

-------------------------------------------------------------------------------



-------------------------------------------------------------------------------

function lookup

 used to search part of a key in an index 

 parameters to be passed:

   

   indexname$= name of the indexfile to be searched

   keylength = length of the key

   key$      = key to search for



the function returns the recordnr in the referencefile of the 1st found key

 or if not found the negative recordnr after which it should have been if present



-------------------------------------------------------------------------------



-------------------------------------------------------------------------------

 function getfirst

searches For the first key in the index 

with Name=indexname and keylength=keylength

 returns recordnr of record in masterfile





-------------------------------------------------------------------------------

 function getlast

searches For the last key in the index 

with Name=indexname and keylength=keylength

 returns recordnr of record in masterfile





-------------------------------------------------------------------------------

 function getnext

searches For the next key in the index from present position in globalinf$(2)

with Name=indexname and keylength=keylength

 returns position in masterfile of next





-------------------------------------------------------------------------------

 function getprev

searches For the previous key in the index from present position in globalinf$(2)

with Name=indexname and keylength=keylength

 returns position in masterfile of previous


Home

Password Textbox API

Character Replacement

LB Isam Library

Beginning Games 2

Rubber Band Objects

WMLiberty Primer

LB Browser

Beginning Programming 5

INPUTTO Demo

Chase Button

Questionaire Wizard

MIDI Output Thoughts

MIDI-Tunes

Play MIDI DLL

Directory Search Function

Newsletter help

Index