Alpes Software Homepage Real Isam Home Page


Summary Main WordsA B C D E F G H I J K L M N O P Q R S T U V W X Y Z Other


REAL ISAM Version 2.3

OVERVIEW

Real Isam is a tool used to manage files using the well known ISAM method (Indexed Sequential Access Method). This method is still very convenient for applications such as Internet, Intranet, Text database retrieval, when you need to store and get variable length documents at very high speed.
RealIsam is a 32-bits DLL and can be interfaced to any 32 bits application developped under Win95,Win98, NT,XP.
RealIsam uses the object-oriented technology for a faster and easier development and to simplify the source code.
Real Isam, at contrary to other relational databases, ignores the field notion, and does not try to classify data in numeric, date or text fields : it writes binary or text data according the length specified, and returns all these bytes when a reading operation is required. It is the responsability of the developer to organize records and to know how to extract the fields. Realisam is better adapted to store variable length text data like XML strings.
This software is in operation since 1996 in different kind of application : Text Retrieval, CGI Internet, databases to store HTML pages, scripts and HTML macros, XML records, with a very fast access time. Tests were conducted to store million of keys and records associated.
Companion tools as words indexation and desindexation, local search engines, SQL interface are existing, but they are not integrated in the DLL
realisam Features :
Variable length Keys, for any index.
Up to 64 indexes
Unique or duplicate keys
Any ascii value in the key (null terminated)
Maximum key length : 250 characters
Variable length for Data records
Environment : Windows 95,98,NT,2000,XP.
DLL module size, less than 90 KB
Object oriented
Fast access to data


RealIsam ZIP file to download

The DLL file name is "realisam.dll". Another files are needed for development purpose :
"realisam.h" is the header file to include in an application
"realisam.lib" is the library to link to the application
The Zip file countains the following files :
- realisam.dll
- realisam.h
- realisam.lib
Download realisam.zip File (35 KB)




REAL ISAM API



API Function Syntax / Example Operation
Constructor realisam db = new realisam(); build an instance of the isam files
OpenEngine rc =db->OpenEngine("example",248,"ndx","dat"); Create or Open Isam Files
CloseEngine rc=db->CloseEngine(); Close Index and Record Files
SetIndexMode rc=db->SetIndex(short Index,short Value) Set Index to be Unique or Multi-Key
WriteKey rc = db->Writekey(short Index,char *Key,int RecNumber) Insert a Key in the index
GetNewRecordNumber rc = db->GetNewRecordNumber Get a pointer where to Write the data Record
WriteRecord rc = db->WriteRecord(char pdata,int len) Write Record
ReadDirectKey rc = db->ReadDirectKey(short Index,char *Key,char *RetKey,int *RecNumber) Get pointer on a data record with key = Key
ReadFirstKey rc = db->ReadFirstKey(short Index,char *RetKey,int *RecNumber) Pointer on First Record
ReadLastkey rc = db->ReadLastKey(short Index,char *RetKey,int *RecNumber) Ponter on last record
ReadNextKey rc = db->ReadNextKey(char *RetKey,int *RecNumber) Pointer on next record
ReadPrevKey rc = db->ReadPrevKey(char *RetKey,int *RecNumber) Pointer on previous record
DeleteKey rc = db->DeleteKey(short Index, char *Key,int *RecNumber) Delete Key in the index
ReadRecord rc = db->ReadRecord(char *pdata,int RecNumber) Read Data Record
DeleteRecord rc = db->DeleteRecord(int RecNumber) Delete Data Record
RewriteRecord rc = db->RewriteRecord(char *pdata,int len,int RecNumber) Rewrite Data Record
NumberOfKeys nbkeys = db->NumberOfKeys(short Index) Number of keys in an Index
RecordLength len = db->Recordlength(int RecNumber) Returns Record length
Version rc = db->Version(char *ver) Returns Version Number
GetIndexMode mode = db->GetIndexMode(int Index) Get Index Mode : unique or multi
DeleteIsam rc = db->DeleteIsam(char *indexname,char *dataname); Delete Index and Record Files
CloseReopen rc = db->CloseReopen(char *Filename,short BlockSize, char *ndx, char *dat) Close and Reopen Isam Files


Include File REALISAM.H

#ifndef __REALISAM_H
#define __REALISAM_H

#ifdef __cplusplus
extern "C" {
#endif

class _export realisam
{

 public:

  realisam(void);
 ~realisam(void);
 int  OpenEngine(char *FileName,short BlockSize,char *ndx, char*dat);
 int  CloseEngine(void);
 int  SetIndexMode(short Index, short Value);
 int  WriteRecord(char *pdata,int len);
 int  RewriteRecord(char *pdata,int len, int RecNumber);
 int  DeleteRecord(int RecNumber);
 int  ReadRecord(char *pdata,int RecNumber);
 int  GetNewRecordNumber();
 int  WriteKey(short Index,char *Key,int RecNumber);
 int  DeleteKey(short Index,char *Key,int RecNumber);
 int  ReadFirstKey(short Index,char *ReturnKey,int *RecNumber);
 int  ReadNextKey(char *ReturnKey ,int *RecNumber);
 int  ReadLastKey(short Index,char *ReturnKey,int *RecNumber);
 int  ReadPrevKey(char *ReturnKey ,int *RecNumber);
 int  ReadDirectKey(short Index,char *Key, char *ReturnKey, int *RecNumber);
 int  NumberOfKeys(short Index);
 int  RecordLength(int RecNumber);
 int  Version(char *p);
 int  GetIndexMode(int ndx);
 int  DeleteIsam(char *indexname,char *dataname);
 int  CloseReopen(char *FileName,short BlockSize,char *ndx, char *dat);

};

#ifdef __cplusplus
}
#endif
#endif


constructor : new realisam


Fonction : Define an instance of the object realisam. There is an instance of a realisam object for each database you need in the same program.
Syntaxe : db = new realisam()
Parameters :None
Code retour :Return a pointer to the instance. This pointer has to be used for any call to realisam functions.
Example :

//APPLIC.H

#include "realisam.h"
...................
realisam  *db1;
realisam  *db2;
..................

//APPLIC.CPP
// in constructor or setup
................
db1 = new realisam();
db2 = new realisam();

................


OpenEngine


Function :
Open the index file and the data file associated to the database. The index file, will have the extension specified in the indx parameter,and the data file have the extension specified in the dat parameter. Realisam creates these files if they don't exist. Notice : always open / reopen the database with the same physical block size.
Syntax : db->OpenEngine(char *filename,int datalen, char *indx,char *dat); db is a pointer on the database
Parameters : filename = filename, with no extension (this function opens or creates the Isam files , according the extension required) datalen = Data physical block length . This value is not the real data length, but an average size. realisam will write data in consecutive blocks of datalen + 8 bytes. If real length is less than datalen, a physical block of datalen+8 bytes will be allocated and written. If data length is bigger than datalen, a second block is allocated, and so on... The Windows file management system works with multiples of 1024 bytes, and we recommand to work with datalen+8 such as 120 , 248, 504, 1016,2040 ... bytes in order to improve the access time.
Return code :
0 = Error at opening files
1= Correct.
Example :

//APPLIC.H

#include "realisam.h"
...................
realisam  *db1;
realisam  *db2;
..................


//APPLIC.CPP
// constructor or setup
................
db1 = new realisam();
db2 = new realisam();
................


// your routine ....
int rc;

rc = db1->OpenEngine("htmlfile",248,"ndx","dat");    // 248 + 8 => 256 !
if (!rc)  { error db1 .... }

rc = db2->OpenEngine("scripts",504,"ndx","dat");    // 504 + 8 ==> 512 !!
if (!rc)  { error db2 ... }



CloseEngine


Function : Close the .NDX index file and the .DAT file
Syntax : rc=db->CloseEngine(); db is the database pointer.
Parameters :None
Return code :
0 = Closing error
1= Correct.
Example :

//APPLIC.H

#include "realisam.h"
...................
realisam  *db1;
realisam  *db2;
..................

//APPLIC.CPP
// constructor or setup
................
db1 = new realisam();
db2 = new realisam();
................

// routine
int rc;

rc = db1->OpenEngine("htmlfile",248,"ndx","dat");    // 248 + 8 => 256 !
if (!rc)  { error db1 .... }

rc = db2->OpenEngine("scripts",504,,"ndx","dat");    // 504 + 8 ==> 512 !!
if (!rc)  { error db2 ... }


// end proceesing

rc = db1->CloseEngine();
rc = db2->CloseEngine();


SetIndexMode


Function : Define is keys are unique or duplicate for a specified index. realisam allows 64 index per database, from 00 to 63. If the index was declared with a unique type of key, it returns an error when trying to write again the same key. For indexes with duplicate keys, there is no limit to the number of duplicate keys. If this function is not called, the default value is 0 (no duplicate keys).
Syntax : rc=db->SetIndexMode(int Index, int Value); db is a database pointer.
Parameters : Index : index number (0 to 63) Value : 0 for non duplicate keys; 1 for duplicate keys
Return code :
1 = Correct
-1 Index number incorrect (<0 or > 63)
-2 Incorrect constant (0 or 1 only accepted)
Example :

//APPLIC.H

#include "realisam.h"
...................
realisam  *db1;
realisam  *db2;
..................


//APPLIC.CPP
// constructor or setup
................

#define UNIQUE_KEYS        0
#define DUPLICATE_KEYS     1

db1 = new realisam();
db2 = new realisam();
................


// Routine
int rc;

rc = db1->OpenEngine("htmlfile",248,"ndx","dat");    // 248 + 8 => 256 !
if (!rc)  { error db1 .... }
rc = db1->SetIndexMode(0,UNIQUE_KEYS);
rc = db1->SetIndexMode(1,DUPLICATE_KEYS);


rc = db2->OpenEngine("scripts",504,,"ndx","dat");    // 504 + 8 ==> 512 !!
rc = db2->SetIndexMode(0,UNIQUE_KEYS);
if (!rc)  { error db2 ... }


// End

rc = db1->CloseEngine();
rc = db2->CloseEngine();



WriteKey


Function :Write a key in an index of the database. A data record record address is associated with this key.
Syntax : rc=db->WriteKey(int Index, char *key, int recdata); db is a pointer on the database.
Parameters : Index : index number (0 to 63) Key : Key value recdata : pointer (address of the data record in the file .DAT. This value is provided when calling the function GetNewRecordNumber.
Return code :
1 = Correct
0 = Key already existing (if duplicate keys not allowed)
-1 = Key length > 99 characters
-2 = Index number incorrect (<0 or > 63)
Example :

//APPLIC.H

#include "realisam.h"
...................
realisam  *db1;
realisam  *db2;
..................


//APPLIC.CPP
// constructor or setup
................

#define UNIQUE      0
#define DUPLICATE   1

db1 = new realisam();
db2 = new realisam();
................


// Routine
int rc;
int recdata;
char key[30];

rc = db1->OpenEngine("htmlfile",248,"ndx","dat");    // 248 + 8 => 256 !
if (!rc)  { error db1 .... }
rc = db1->SetIndexMode(0,UNIQUE);
rc = db1->SetIndexMode(1,DUPLICATE);


rc = db2->OpenEngine("scripts",504,"ndx","dat");    // 504 + 8 ==> 512 !!
rc = db2->SetIndexMode(0,UNIQUE);
if (!rc)  { error db2 ... }

strcpy(key,"doc30134");
recdata = db1->GetNewRecordNumber();
rc = db1->WriteKey(0,key,recdata);  // index 0          
if (!rc) { error / duplicate key ... }

rc = db1->WriteKey(1,"politics",recdata); // on index 1 , duplicate keys allowed
.................

// End processing

rc = db1->CloseEngine();
rc = db2->CloseEngine();


GetNewRecordNumber


Function :Return the new physical position where to write data in the data file. Use a WriteRecord to write the data.
Syntax : recdata =db->GetNewRecordNumber(); db is the database pointer.
Parameters :None
Return Code :
0 = error.
32 bits integer countaining the next available position.
Example :

//APPLIC.H

#include "realisam.h"
...................
realisam  *db;
..................

//APPLIC.CPP
// constructor
................
db = new realisam();
................


// procedure
int rc;
int recdata;
char key[30];

rc = db1->OpenEngine("htmlfile",248,"ndx","dat");    // 248 + 8 => 256 !
if (!rc)  { error db1 .... }
rc = db1->SetIndexMode(0,UNIQUE_KEY);

strcpy(key,"doc30134");
recdata = db1->GetNewRecordNumber();
rc = db1->WriteKey(0,key,recdata);  // index 0          
if (!rc) { error / duplicate key... }
  else
    {
     // data are stored in buffer
     rc = db1->WriteRecord(buffer,strlen(buffer));      
     ..............

    } 

.................

// end

rc = db1->CloseEngine();
rc = db2->CloseEngine();


WriteRecord


Function :Write a data record at a position previously defined by a call to GetNewRecordNumber. Data can be text or binary. Length is a parameter to provide . For characters strings ended with 0x00, the developer can insert the last byte 0x00, or can insert it when the program read the data.
Syntax : ptr = db->WriteRecord(char *buffer,int lendata); db is the database pointer.
Parameters : buffer contains data to write. lendata is the length of data
Return Code :ptr is a pointer on the address of buffer.
Example :

//APPLIC.H

#include "realisam.h"
...................
realisam *db;
..................


//APPLIC.CPP
// constructor
................
db = new realisam();
...............
rc = db->OpenEngine("Applic",504,"ndx","dat");
................

db->CloseEngine();
.......................


// procedure
int rc;
char RetKey[100];
int  recdata;

// new key to insert  = "microsoft"
// buffer contains the data 
recdata=db->GetNewRecordNumber();
rc = db->WriteKey(0,"microsoft",recdata);
if (rc) // key insert ok
   {
    db->WriteRecord(buffer,strlen(buffer)+1);
    .......
   } 
 else .............


ReadDirectKey


Fonction :Direct search of a key in a specified index, and acquisition of the data pointer associated.
Syntax : rc=db->ReadDirectkey(int Index,char *Key,char *ReturnKey, int &recdata) db is the database pointer.
Parameters :
Index = from 0 to 63
Key = Key to find in the index
ReturnKey = Key found after searching the index.
recdata = data record pointer
Return Code : 0 : Key not found (Retkey contains a key that is the closest key, usually the key before the searched key (in the alphabetic order). 1 : Key found : ReturnKey contains also Key
Example :

//APPLIC.H

#include "realisam.h"
...................
realisam *db;
..................


//APPLIC.CPP
// constructor
................
db = new realisam();
...............
rc = db->OpenEngine("Applic",504,"ndx","dat");
................

db->CloseEngine();
.......................



// procedure
int rc;
char RetKey[100];
int  recdata;

rc = db->ReadDirectKey(0,"microsoft",RetKey,&recdata);
if (rc)  // ok : key found
  {
   rc = db->ReadRecord(buffer,recdata);
   buffer[rc]=0;   
   .............

  }
 else ............



ReadFirstKey


Function :read the first key on a specified. This function allows to start to read the first key of a specified index.
Syntax : rc = db->ReadFirstKey(int index,char *Key,int &recdata); db is a database pointer.
Parameters : index number (0-63) Key is a pointer on a character string, large enough to receive the key (max = 250 characters) recdata is a pointer on the data record related to the key.
Return Code :
1 if correct (index not empty)
0 if the index is empty
-1 if key length > 250 characters
-2 if index > 63 or < 0
Example :

//APPLIC.H

#include "realisam.h"
...................
realisam *db;
..................

//APPLIC.CPP
// constructor or setup
................
db = new realisam();
...............
rc = db->OpenEngine("Applic",504,"ndx","dat");
................
db->CloseEngine();
.......................



// procedure
int rc;
char RetKey[100];
int  recdata;

rc = db->ReadFirstKey(0,RetKey,&recdata);
if (rc)  // key found 
  {
   rc = db->ReadRecord(buffer,recdata);
   buffer[rc]=0;   
   .............

  }
 else ............



// another example : sequential reading of a file
rc = db->ReadFirstKey(0,RetKey,&recdata);
while (rc)
  {
   rc=db->ReadRecord(buffer,recdata);
   // processs the record
   .............................

   rc=db->ReadNextKey(RetKey,&recdata);
   // rc = 0 if end of file (last key of index)
  } 
 ...................


ReadLastKey


Function : Read the last key of a specified index.
Syntax : int rc = db->ReadLastkey(int Index,char *Key,int &recdata); db is a database pointer.
Parameters :
Index = index number
Key is a pointer on a character string, large enough to receive the value of the key (250 char . max)
recdata is a 32 bit integer pointing on a data record related to the key. Retour Code :
rc = 1 : correct (key found, index not empty)
rc = 0 : error or index empty
rc = -1 : key length > 99 characters
rc = -2 : index number > 63 or < 0 Example :

//APPLIC.H

#include "realisam.h"
...................
realisam *db;
..................

//APPLIC.CPP
// constructor
................
db = new realisam();
...............
rc = db->OpenEngine("Applic",504,"ndx","dat");
................

db->CloseEngine();
.......................



// procedure
int rc;
char RetKey[100];
int  recdata;

rc = db->ReadLastKey(0,RetKey,&recdata);
if (rc)  // ok : key is found
  {
   rc = db->ReadRecord(buffer,recdata);
   buffer[rc]=0;   
   .............

  }
 else ............


ReadNextKey


Function :Read the next key in the current index . This function is generally used after a call to ReadFirstKey or un ReadDirectKey. The index is not specified in the call.
Syntax : int rc = db->ReadNextKey(char *Key, int &recdata); db is a database pointer.
Parameters :
Key is a pointer on a character string that will receive the value of the key.
recdata is a 32 bit integer that points on the related data record. Return Code :
rc = 1 : correct
rc = 0 : error or empty index, or over end of the index
rc = -1 : key length incorrect (> 250 char)
Example :

//APPLIC.H

#include "realisam.h"
...................
realisam *db;
..................


//APPLIC.CPP
// constructor or setup
................
db = new realisam();
if (db) rc=db->OpenEngine("Applic",504,"ndx","dat");
  
................
// end of processing
db->CloseEngine();
.......................

.................
// procedure
int rc, recdata;
char ReturnKey[100];

// sequentiel reading of an index

rc = db->ReadFirstKey(0,ReturnKey,&recdata);
while (rc)
  {
   rc=db->ReadRecord(buffer,recdata); 
   // process buffer 
   ................

   rc =db->ReadNextKey(ReturnKey,&recdata);
  }
................. 


ReadPrevKey


Function :Read the previous key in the current index
Syntax : int rc = db->ReadPrevKey(char *Key,int &recdata); db is a database pointer.
Parameters :
Key is a pointer on a character string that will recieve the value of the key
recdata is a 32 bit integer related to the data record to read.
Return Code :
rc = 1 : correct
rc = 0 : error or empty index, or under first key
rc = -1 : key length incorrect (> 99 char)
Example :

//APPLIC.H

#include "realisam.h"
...................
realisam *db;
..................
//APPLIC.CPP
// constructor or setup
................
db = new realisam();
id (db) rc=db->OpenEngine("Applic",504,"ndx","dat");
  
................
// end of process
db->CloseEngine();
.......................

.................
// procedure
int rc, recdata;
char ReturnKey[100];

// example : read a file in the reverse order
// buffer is supposed to be allocated

rc = db->ReadLast(0,ReturnKey,&recdata);
while (rc)
  {
    rc = db->ReadRecord(buffer,recdata);
    // process data here
    ..................
 
   rc=db->ReadPrevKey(ReturnKey,recdata);
  }


DeleteKey


Function :Delete a key in a specified index. The key and its related record number have to be provided as parameters (for duplicate keys, the function needs to know this association).
Syntax : int rc = db->DeleteKey(int Index,char *Key,int recdata); db is a database pointer.
Parameters :
Index = index number
Key = pointer on a character string with the value of the key.
recdata = record number related to the key.
Return Code :
rc = 1 : Correct
rc = 0 : error : Key not found
rc = -1 : key length > 250 characters.
rc = -2 : index < 0 or > 63
Example :

//APPLIC.H

#include "realisam.h"
...................
realisam *db;
..................


//APPLIC.CPP
// constructor
................
db = new realisam();
id (db) rc=db->OpenEngine("Applic",504,"ndx","dat");
  
................
// end of procedure
db->CloseEngine();
.......................

.................
// procedure
int rc, recdata;
char ReturnKey[100];

rc = db->ReadDirectKey(1,"microsoft",ReturnKey,&recdata);
if (rc)
  {
   rc=db->DeleteKey(1,"microsoft"); 
   rc=db->DeleteRecord(recdata);
  }
 else ..............


ReadRecord


Function : Read a data record. A character string pointer un pointeur is provided as a receiving buffer. The memory allocated for this transfer must be large enough to receive the data. If the length is totally unknown, a call to RecordLength function allows to allocate the right amount of memory. ReadRecord restores the entire data written previously, including binary data. For character strings stored without a 0x00 terminator, it is recommended to terminate the string with a 0 after the ReadRecord.
Syntax : int len = db->ReadRecord(char *buffer,int recdata); db is a database pointer.
Parameters :
buffer : pointer on a character string
recdata : data record number to read
Return Code :
len : record length of the data record.
Example :

//APPLIC.H

#include "realisam.h"
...................
realisam *db;
..................


//APPLIC.CPP
// constructor or setup
................
db = new realisam();
................


// procedure
int rc;
int recdata;
char ReturnKey[100];
char *buffer;

buffer = mem_alloc(10000);
if (!buffer) return -1;

rc = db->ReadDirectKey(0,"microsoft",ReturnKey,&recdata);
if (rc)
  {
   rc=db->ReadRecord(buffer,&recdata);
   buffer[rc]=0; // to end with a 0x00
   ..........................
 
  }
 else
  ................ 


DeleteRecord


Function :Delete a data record (more precisely, rewrite the record with a null data length). The free space is not managed under realisam. It is recommended to write an utility to copy a old database in a new one if there is too many records deleted.
Syntax : int rc = db->DeleteRecord(int recnum); db is a database pointer.
Parameters :
recnum : data record number to delete
Return Code :
rc = 1 : Correct
rc = 0 : Error (data number incorrect or <0)
Example :

//APPLIC.H

#include "realisam.h"
...................
realisam *db;
..................


//APPLIC.CPP
// constructor
................
db = new realisam();
................


// procedure
int rc;
int recdata;
char RetKey[100];

rc = db->ReadDirectKey(0,"microsoft",RetKey,&recdata);
if (rc)
   rc = db->DeleteRecord(&recdata);
.................   


RewriteRecord


Function :Rewrite a data record to a previous location. If data length is bigger than the previous write, the function can create new physical blocks. Developer has to specifiy the new data length.
Syntax : int rc = db->RewriteRecord(char *buffer, int len, int recdata); db is a database pointer.
Parameters :
buffer : pointer on the data to write
len : data length
recdata : data record address
Return Code :
rc = 1 : correct
rc = 0 : error
Example :

//APPLIC.H

#include "realisam.h"
...................
realisam *db;
..................


//APPLIC.CPP
// constructor or setup
................
db = new realisam();
................


// procedure
int rc;
char buffer [500];
int recdata;
char RetKey[100];

// read data
rc = db->ReadDirectKey(0,"microbiology",RetKey,&recdata);
if (rc) //ok
  {
   rc = db->ReadRecord(buffer,recdata);
   // rc is the record length and supposed to be less than 500
   .... process data in buffer.....
   rc = db->RewriteRecord(buffer, strlen(buffer+1),recdata);
   }


NumberOfKeys


Function :This function provides the number of keys existing for a specified index.
Syntaxe : int nb = db->NumberOfKeys(int index) db is a database pointer.
Parameters :
Index = Index Number
Return Code :
nb = number of keys in this index (>=0)
-2 : index number incorrect (<0 or > 63)
Example :

//APPLIC.H

#include "realisam.h"
...................
realisam *db;
..................


//APPLIC.CPP
// constructor or setup
................
db = new realisam();
................


// procedure
int nb,rc,recdata;
char Key[10];
..........
nb = db->NumberOfKeys(0);   // for index 0
sprintf(Key,"%07d",nb+1000);
recdata =db->GetNewRecordNumber();
rc = db->WriteKey(0,Key,recdata);
if (rc) db->WriteRecord(buffer,strlen(buffer)+1);
..............


RecordLength


Function :return the length of a data record. This function allows to know the size of a record before reading it, and the developer can allocate memory depending on the size returned.
Syntax : int len = db->RecordLength(int recdata) db is a database pointer.
Parameters :
recdata : record number
Return Code :
len = data length
Example :

//APPLIC.H

#include "realisam.h"
...................
realisam *db;
..................


//APPLIC.CPP
// constructor or setup
................
db = new realisam();
................


// procedure
int rc,len;
int recdata;
char RetKey[100];

rc = db->ReadDirectKey(0,"microsoft",RetKey,&recdata);
if (rc)  // success
  {
   len = db->RecordLength(recdata);
   if (len)
     {  buffer = malloc(len+2);
        ....
     }   
    else { ... empty ...}
  }
..........


Version


Function : Return the version number of the realisam software. (210 for this version : 2.10)
Syntax : int ver = db->Version();
Parameters :None
Return Code :
Version Number, in a character string.
Example :

//APPLIC.H

#include "realisam.h"
...................
realisam *db;
..................


//APPLIC.CPP
// constructor
...............
db = new realisam();
................


// procedure
char ver[20];
...............
db->Version(ver);

// ver stores the string "Version x.y"   (actually Version 2.3)


int GetIndexMode(int ndx);


Function : Returns the value of the mode for a given index.
Syntax : int mode = db->GetIndexMode(int Index);
Parameters :Index Number (0 to 63)
Return Code :
Int mode = 0 if unique keys, 1 if duplicate keys.
Example :

//APPLIC.H

#include "realisam.h"
...................
realisam *db;
..................


//APPLIC.CPP
// constructor
...............
db = new realisam();
................


// procedure
int mode;
...............
mode = db->GetIndexMode(12);
.......................


int DeleteIsam(char *indexname,char *dataname);


Function : Delete the index file and the data file. The programmer should provide the right full name for the index and the data file. After deleting these file, It is recommended to create a new database, and not try to access function through the old db pointer.
Syntax : rc = db->DeleteIsam(char *indexname, char *dataname);
Parameters :Character string indexname, character string dataname;
1 OK :
Example :

//APPLIC.H

#include "realisam.h"
...................
realisam *db;
..................


// procedure

...............
db->DeleteIsam("c:\\samples.ndx","c:\\samples.dat");



int CloseReopen(char *FileName,short BlockSize,char *ndx, char *dat);


Function : This function is used to save data, closing the files, and open them again for further processing.
Syntax : rc = db->CloseReopen("c:\\Samples,248,"ndx","dat");
Parameters :
Database Name
Data Block Size
Index file extension
Data file extension
Return Code :
0 = Error opening files
1= Correct.
Example :

//APPLIC.H

#include "realisam.h"
...................
realisam *db;
..................


//APPLIC.CPP
// constructor
...............
db = new realisam();
................


// procedure
int rc;
...............
rc=db->CloseReopen("Samples",248,"ndx","dat");


Copyright Alpes Software - Documentation and HTML pages generated by Final Doc