/***************************************************************************/
/* ISAM.H                                                                  */
/* Copyright (C) 1995-98 SYWARE Inc., All rights reserved                  */
/***************************************************************************/

#include "dbase.h"

/* Error codes */
#define NO_ISAM_ERR        0
#define ISAM_EOF           1
#define ISAM_TRUNCATION    2
#define ISAM_NOTSUPPORTED  3
#define ISAM_ERROR         4
#define ISAM_NETERROR      5
#define ISAM_NETVERSION    6
#define ISAM_NETISAM       7

    /*  To create additional error codes that your implementation of the   */
    /*  ISAM functions can return, #define them here (no greater than      */
    /*  LAST_ISAM_ERROR_CODE).                                             */

#define LAST_ISAM_ERROR_CODE 1000

/* Maximum sizes */

#define MAX_CHAR_LITERAL_LENGTH 255
#define MAX_BINARY_LITERAL_LENGTH 255
#define MAX_COLUMN_NAME_LENGTH 63
#define MAX_TABLE_NAME_LENGTH 63
#define MAX_DATABASE_NAME_LENGTH 127
#define MAX_USER_NAME_LENGTH 63
#define MAX_PASSWORD_LENGTH 63
#define MAX_COLUMNS_IN_ORDER_BY 20
#define MAX_ISAM_NAME_LENGTH 31
#define MAX_VERSION_NAME_LENGTH 15
#define MAX_DRIVER_NAME_LENGTH 31
#define MAX_HOST_NAME_LENGTH 63
#define MAX_PORT_NUMBER_LENGTH 15
#define MAX_COLUMNS_IN_KEY 15
#define MAX_KEY_NAME_LENGTH 63
#define MAX_INDEX_NAME_LENGTH 63
#define MAX_COLUMNS_IN_INDEX MAX_COLUMNS_IN_KEY
#define MAX_DEFAULT_LENGTH 255

/*  ******* Note: do not change MAX_TABLE_NAME_LENGTH.  If the ISAM's table */
/*  *******       name length is smaller than these values,                 */
/*  *******       ISAMMaxTableNameLength() should return the correct value. */

/*  ******* Note: do not change MAX_COLUMN_NAME_LENGTH.  If the ISAM's      */
/*  *******       table name length is smaller than these values,           */
/*  *******       ISAMMaxColumnNameLength() should return the correct value.*/

/* Comparison operators */

#define ISAM_OP_NONE       0
#define ISAM_OP_EQ         1
#define ISAM_OP_NE         2
#define ISAM_OP_LE         3
#define ISAM_OP_LT         4
#define ISAM_OP_GE         5
#define ISAM_OP_GT         6
/* Note: If you add to this list, you will probably have to add to OP_* in */
/*       PARSE.H                                                           */

/* Network stuff */
#define NET_OPAQUE                      UWORD
#define NET_OPAQUE_INVALID      ((NET_OPAQUE)-1)

/***************************************************************************/

/* ISAM provides low level data access. */

typedef struct  tagISAM {

    /* These values must be here.  They are used by the driver */

    UWORD      cSQLTypes;
    LPSQLTYPE  SQLTypes;
    SWORD      fTxnCapable;         /* See the discussion of transactions  */
                                    /* (below) for a description of this   */
                                    /* value.                              */
    BOOL       fSchemaInfoTransactioned;
                                    /* See the discussion of transactions  */ 
                                    /* (below) for a description of this   */
                                    /* value.                              */
    BOOL       fMultipleActiveTxn;  /* See the discussion of transactions  */
                                    /* (below) for a description of this   */
                                    /* value.                              */
    SDWORD     fTxnIsolationOption; /* See the discussion of transactions  */
                                    /* (below) for a description of this   */
                                    /* value.                              */
    SDWORD     fDefaultTxnIsolation;/* See the discussion of transactions  */
                                    /* (below) for a description of this   */
                                    /* value.                              */

    /* The following values are only used by Network Edition */
    UDWORD     udwNetISAMVersion;

    /* The following values are only used by Network Edition client */
    NET_OPAQUE netISAM;
    LPVOID     netConnection;
    BOOL       fCaseSensitive;
    UCHAR      szName[MAX_ISAM_NAME_LENGTH+1];
    UCHAR      szVersion[MAX_VERSION_NAME_LENGTH+1];
    UCHAR      szDriver[MAX_DRIVER_NAME_LENGTH+1];
    SWORD      cbMaxTableNameLength;
    SWORD      cbMaxColumnNameLength;
    UCHAR      szUser[MAX_USER_NAME_LENGTH+1];

    /* The following values are only used within ISAM.C */
    UCHAR      szDatabase[MAX_DATABASE_NAME_LENGTH+1];
    SWORD      errcode;
}       ISAM,
        FAR * LPISAM;

/***************************************************************************/

/* ISAM provides a mechanism for the driver to retrieve a list of          */
/* table names.  First ISAMGetTableList() is called to get a               */
/* LPISAMTABLELIST.  Then ISAMGetNextTableName() is called zero or more    */
/* times to get the names off the list.  Finally, ISAMFreeTableList() is   */
/* called to deallocate the list.                                          */

typedef struct  tagISAMTABLELIST {
    /* The following values are only used by ISAM.C and the Network Edition */
    LPISAM     lpISAM;

    /* The following values are only used by Network Edition client */
    NET_OPAQUE      netISAMTableList;

    /* The following values are only used within ISAM.C */
    UCHAR           lpPattern[MAX_TABLE_NAME_LENGTH];
    SWORD           cbPattern;
    BOOL            fFirstTime;
#ifdef WIN32
    HANDLE          hFile;
#else
    struct _find_t  sFile;   
#endif
}       ISAMTABLELIST,
        FAR * LPISAMTABLELIST;

/***************************************************************************/

/* ISAM provides a mechanism for the driver to retrieve the foreign key    */ 
/* between two tabled.                                                     */

typedef UCHAR ISAMKEYCOLUMNNAME[MAX_COLUMN_NAME_LENGTH+1];
typedef ISAMKEYCOLUMNNAME FAR *LPISAMKEYCOLUMNNAME;

/***************************************************************************/

/* ISAM provides a bookmarking facility.  It allows the ISAM user to get   */
/* get a bookmark for the current record in the table and then later       */
/* reposition to that record.                                              */

typedef UDWORD ISAMBOOKMARK;
#define NULL_BOOKMARK 0xFFFFFFFF

/***************************************************************************/

/* ISAM allows the driver to open and access a table.  To open the         */ 
/* table, ISAMOpenTable() is called.  To close the table ISAMCloseTable()  */
/* is called.                                                              */

typedef struct  tagISAMCOLUMNDEF {             /* A column of the table */

    /* These values must be here.  They are used by the driver */

    UCHAR       szColumnName[MAX_COLUMN_NAME_LENGTH+1];
                                    /* The name of the column              */
    SWORD       fSqlType;           /* The type of the column (SQL_*)      */
                                    /* *********************************** */
                                    /* ***                             *** */
                                    /* ***   THIS MUST BE ONE OF THE   *** */
                                    /* *** TYPES SPECIFIED IN SQLTypes *** */
                                    /* *** IN SQLTYPE.C WHICH HAS THE  *** */
                                    /* ***  supported FLAG SET TO TRUE *** */
                                    /* ***                             *** */
                                    /* *********************************** */
    UDWORD      cbPrecision;        /* The precision of the column (see    */
                                    /*     appendix D of the ODBC Spec).   */
    SWORD       ibScale;            /* The scale of the column (see        */
                                    /*     appendix D of the ODBC Spec).   */
    SWORD       fNullable;          /* See SQLColumns(NULLABLE) in the     */
                                    /*     ODBC spec.                      */
    UWORD       fSelectivity;       /* A measure of how unique values of   */
                                    /*     this column are.  The higher    */
                                    /*     the number, the more values     */
                                    /*     there are.  For example, a      */
                                    /*     GENDER column would have low    */
                                    /*     selectivity value, but a SSN    */
                                    /*     column would have high value.   */
                                    /*     This value is used to determine */
                                    /*     the restrictive conditions to   */
                                    /*     send to ISAMRestrict().  If you */
                                    /*     don't know the selectivity or   */
                                    /*     don't want this column to be    */
                                    /*     sent to ISAMRestrict(), set     */
                                    /*     this value to 0.                */
    UWORD       fKeyComponent;      /* Non-zero if this column is a        */
                                    /*     component of the primary key    */
                                    /*     for the table.                  */
                                    /*                                     */
                                    /*     If the table has a primary key  */
                                    /*     that has multiple components    */
                                    /*     (for example, the combination   */ 
                                    /*     of LAST_NAME and FIRST_NAME     */
                                    /*     is unique but neither           */
                                    /*     FIRST_NAME nor LAST_NAME alone  */
                                    /*     is unique), fKeyComponent has   */
                                    /*     the value 1 for the first key   */ 
                                    /*     component, 2 for the second     */
                                    /*     key component, etc.             */
                                    /*                                     */
                                    /*     If table has multiple primary   */
                                    /*     keys (for example, RECORD_ID    */
                                    /*     alone is unique and NAME alone  */
                                    /*     is unique), fKeyComponent is    */
                                    /*     set for only one of them, not   */
                                    /*     both.                           */
                                    /*                                     */
                                    /*     If the table has no primary     */
                                    /*     keys, fKeyComponent is zero for */
                                    /*     all the columns in the table.   */
                                    /*     Note: If the table has no       */
                                    /*     primary keys, some applications */
                                    /*     such as Microsoft Access or     */ 
                                    /*     PowerBuilder may not be able to */
                                    /*     update the table.               */
    UCHAR       szDefault[MAX_DEFAULT_LENGTH+1];
                                    /*     The default value of the column */
                                    /*     (i.e., the value used for the   */
                                    /*     column if an ISAMInsertRecord() */
                                    /*     is followed by                  */
                                    /*     ISAMUpdateRecord() with no      */
                                    /*     intervening ISAMPutData() for   */
                                    /*     the column).  If the default is */
                                    /*     always expressed as a characted */
                                    /*     string.  If the value is for a  */
                                    /*     charcter column, the value must */
                                    /*     be enclosed by single quotes.   */
                                    /*     If the default is NULL, set     */
                                    /*     this value to "NULL" (without   */
                                    /*     any enclosing quotation marks). */
                                    /*     If the value is greater than    */
                                    /*     MAX_DEFAULT_LENGTH characters,  */
                                    /*     set this value to TRUNCATED     */
                                    /*     (without any enclosing          */ 
                                    /*     quotation marks). */

    /* The following values are only used by Network Edition client */
    SWORD      iSqlType;
    SDWORD     cbValue;
    PTR        rgbValue;

    /* The following values are only used within ISAM.C */

}       ISAMCOLUMNDEF,
        FAR * LPISAMCOLUMNDEF;

#define REFETCH_DATA SQL_DATA_AT_EXEC

typedef struct  tagISAMTABLEDEF {
    
    /* These values must be here.  They are used by the driver */

    UCHAR       szTableName[MAX_TABLE_NAME_LENGTH+1];
                                    /* The name of the table      */
    UWORD       cColumnDefs;        /* The number of columns      */
    LPISAMCOLUMNDEF lpColumnDef;    /* Pointer to array column of */
                                    /* descriptors                */
    UCHAR       szPrimaryKeyName[MAX_KEY_NAME_LENGTH+1];
                                    /* If there is a primary key  */
                                    /* on the table, the name of  */
                                    /* the primary key.  If there */
                                    /* is not name or no primary  */
                                    /* key, a zero length string  */

    /* The following values are only used by ISAM.C and the Network Edition */
    LPISAM     lpISAM;

    /* The following values are only used by Network Edition client */
    NET_OPAQUE  netISAMTableDef;
    HGLOBAL     hPreFetchedValues;
    SDWORD      cbBookmark;
    ISAMBOOKMARK bookmark;

    /* The following values are only used within ISAM.C */
    LPDBASEFILE lpFile;
    BOOL        fFirstRead;
    SDWORD      iRecord;
}       ISAMTABLEDEF,
        FAR * LPISAMTABLEDEF;

/***************************************************************************/

/* ISAM allows for an SQL statement to be passed to it (for use with       */
/* backend databases that suport SQL).  An ISAMSQL handle is used to       */
/* identify an SQL statement passed.  See ISAMPrepare() and ISAMExecute(). */

typedef struct  tagISAMSTATEMENT {
    /* The following values are only used by ISAM.C and the Network Edition */
    LPISAM     lpISAM;

    /* The following values are only used by Network Edition client */
    NET_OPAQUE netISAMStatement;

    /* The following values are only used within ISAM.C */
    BOOL       resultSet;
    LPSTR      lpszParam1;
    SDWORD     cbParam1;
    LPSTR      lpszParam2;
    SDWORD     cbParam2;
}       ISAMSTATEMENT,
        FAR * LPISAMSTATEMENT;

/***************************************************************************/
/* If the ISAM layer reports that it supports transactions, the driver     */
/* be transaction enabled.  When ISAMOpen() is called, it reports back the */
/* transaction capabilites supported in the LPISAM structure:              */
/*                                                                         */
/*      fTxnCapable                                                        */
/*                                                                         */
/*            SQL_TC_NONE: Transactions are not suported                   */
/*                                                                         */
/*            SQL_TC_DML: Transactions can only contain Data Manipulation  */
/*                Language (DML) statements (SELECT, INSERT, UPDATE,       */
/*                DELETE).  Data Definition Language (DDL) statements      */
/*                encountered in a transation cause an error               */ 
/*                                                                         */
/*            SQL_TC_DDL_COMMIT:  Transactions can only contain DML        */
/*                statements.  DDL statements (CREATE TABLE, DROP INDEX,   */
/*                and so on) encountered in a transaction cause the        */
/*                transaction to be committed.                             */
/*                                                                         */
/*            SQL_TC_DDL_IGNORE: Transactions can only contain DML         */
/*                statements.  DDL statements encountered  in a            */
/*                transaction are ignored.                                 */
/*                                                                         */
/*            SQL_TC_ALL: Transactions can contain DDL statements and DML  */
/*                statements in any order.                                 */
/*                                                                         */
/*      fSchemaInfoTransactioned                                           */
/*                                                                         */
/*            There is no explicit "start transaction" ISAM entry point    */
/*            A transaction is started (if there isn't one started         */
/*            already) when certain ISAM calls are made.  This flag        */
/*            specifies if calls that only pertain to the schema of the    */
/*            database (as opposed to calls the pertain to the data in the */
/*            database) will start a transaction or not.                   */
/*                                                                         */
/*            The following functions are only used to process DML         */
/*            statements.  They are not used to process DDL statements.    */
/*            Each of the following functions will start a transaction if  */
/*            one is not already started, regardless of the value of       */ 
/*            fSchemaInfoTransactioned (Note: a transaction will only be   */
/*            started if the function returns ISAM_NO_ERROR, ISAM_EOF, or  */
/*            ISAM_TRUNCATION):                                            */
/*                                                                         */
/*                    ISAMRewind                                           */
/*                    ISAMSort                                             */
/*                    ISAMRestrict                                         */
/*                    ISAMNextRecord                                       */
/*                    ISAMGetData                                          */
/*                    ISAMPutData                                          */
/*                    ISAMInsertRecord                                     */
/*                    ISAMUpdateRecord                                     */
/*                    ISAMDeleteRecord                                     */
/*                    ISAMGetBookmark                                      */
/*                    ISAMPosition                                         */
/*                    ISAMPrepare                                          */
/*                    ISAMParameter                                        */
/*                    ISAMExecute                                          */
/*                                                                         */
/*            The following functions are used to process DML and/or DDL   */
/*            statements.  Each of the following functions will start a    */
/*            transaction if one is not already started only if the value  */
/*            of fSchemaInfoTransactioned is TRUE (Note: a transaction     */
/*            will only be started if the function returns ISAM_NO_ERROR,  */
/*            ISAM_EOF, or ISAM_TRUNCATION):                               */
/*                                                                         */
/*                    ISAMCreateTable                                      */
/*                    ISAMAddColumn                                        */
/*                    ISAMCreateIndex                                      */
/*                    ISAMDeleteIndex                                      */
/*                    ISAMOpenTable                                        */
/*                    ISAMGetTableList                                     */
/*                    ISAMGetNextTableName                                 */
/*                    ISAMForeignKey                                       */
/*                    ISAMDeleteTable                                      */
/*                                                                         */
/*      fMultipleActiveTxn                                                 */
/*                                                                         */
/*            A single user of ISAM may call ISAMOpen() multiple times.    */
/*            If fMultipleActiveTxn is TRUE, separate transactions on each */
/*            of these connections can occur at the same time.  Otherwise, */
/*            only one connection at can have a transaction open at any    */
/*            given time.                                                  */
/*                                                                         */
/*      fTxnIsolationOption                                                */
/*                                                                         */
/*            A 32-bit bitmask enumerating the transaction isolation       */
/*            levels available.  The following bitmasks are used in        */
/*            conjuction with the flag to determine which options are      */
/*            supported:                                                   */
/*                                                                         */
/*                    SQL_TXN_READ_UNCOMMITTED                             */
/*                    SQL_TXN_READ_COMMITTED                               */
/*                    SQL_TXN_REPEATABLE_READ                              */
/*                    SQL_TXN_SERIALIZABLE                                 */
#if (ODBCVER >= 0x0300)
#define               SQL_TXN_VERSIONING        0x00000010L
#endif
/*            Note: SQL_TXN_VERSIONING was deprerecated in ODBC 3.0.       */
/*                                                                         */
/*            These values are described in the ODBC SDK Programmer's      */
/*            reference (under SQLGetInfo(SQL_DEFAULT_TXN_ISOLATION))      */
/*                                                                         */
/*      fDefaultTxnIsolation                                               */
/*            This value specifies which of the above SQL_TXN_* isolation  */
/*            levels is used by default.                                   */
/*                                                                         */
/* Note: ODBC defines an "autocommit" mode which, if enabled, causes       */
/* statements to committed automatically after they are executed. The ISAM */
/* layer does not implement this capability.  The upper levels of the      */
/* system implement autocommit mode.  If the underlying database has an    */                                       
/* autocommit mode, it should be turned off.                               */
/*                                                                         */
/* In addition to reporting this information when ISAMOpen() is called,    */
/* there are three transaction related functions which are used (these are */
/* only called if fTxnCapable is not SQL_TC_NONE):                         */
/*                                                                         */
/*                    ISAMCommitTxn()                                      */
/*                    ISAMRollbackTxn()                                    */
/*                    ISAMSetTxnIsolation()                                */
/*                                                                         */
/***************************************************************************/
/***************************************************************************/

SWORD INTFUNC ISAMOpen(
                    LPUSTR     lpszDatabase,
                        /* INPUT: The name of database.  This is specified */
                        /*   by DBQ in the ODBC.INI file or the connect */
                        /*   string. */
                    LPUSTR     lpszDSN,
                        /* INPUT: The name of datasource that is being */
                        /*   connected to. */
                    LPUSTR     lpszUsername,
                        /* INPUT: The user name, as specified at connect */
                        /*   time. */
                    LPUSTR     lpszPassword,
                        /* INPUT: The password, as specified at connect */
                        /*   time. */
                    LPISAM FAR *lplpISAM,
                        /* OUTPUT: Handle to the ISAM */
                    LPUSTR     lpszErrorMessage);
                        /* OUTPUT: If ISAMOpen() is unsuccessful, an error */
                        /*   message is returned here. */

/* Opens and initializes the ISAM.  lpszDatabase points to the name of     */
/* the database.                                                           */

/***************************************************************************/

SWORD INTFUNC ISAMGetTableList(
                    LPISAM lpISAM,
                        /* INPUT: Handle returned by ISAMOpen() */
                    LPUSTR lpPattern,
                        /* INPUT: The pattern to match */
                    SWORD cbPattern,
                        /* INPUT: Number of characters in the pattern */
                    LPISAMTABLELIST FAR *lplpISAMTableList);
                        /* OUTPUT: Handle to table list */

/* Creates a table list of all that tables that match lpPattern.           */
/* The PatternMatch() function can be used to see if a table               */
/* matches.  cbPattern is always a non-negative number no larger           */
/* the MAX_TABLE_NAME_LENGTH.                                              */
/*                                                                         */
/* This call works outside ISAM's transaction mechanism.  It will not      */
/* start a transaction and the LPISAMTABLELIST handle returned always      */
/* survives a commit or rollback.  The implementation of this function may */
/* have to internally cache the information to return for subsequent calls */
/* to ISAMGetNextTableName().                                              */
/*                                                                         */
/* NULL is returned if the tablelist could not be created.                 */

/***************************************************************************/

SWORD INTFUNC ISAMGetNextTableName(
                    LPISAMTABLELIST lpISAMTableList,
                        /* INPUT: Handle returned by ISAMGetTableList() */
                    LPUSTR lpTableName);
                        /* OUTPUT: Buffer where next table name is returned */

/* Gets the next name from the list.  lpTableName points to a buffer (that */
/* is MAX_TABLE_NAME_LENGTH+1 characters long) that this routine fills in  */
/* with the next table name.  Returns ISAM_EOF if no more tables.          */

/***************************************************************************/

SWORD INTFUNC ISAMFreeTableList(
                    LPISAMTABLELIST lpISAMTableList);
                        /* INPUT: Handle returned by ISAMGetTableList() */

/* Deallocates a table list. */

/***************************************************************************/

SWORD INTFUNC ISAMForeignKey(
                    LPISAM lpISAM,
                        /* INPUT: Handle returned by ISAMOpen() */
                    LPUSTR lpszPrimaryKeyTableName,
                        /* INPUT: Name of primary key table */
                    LPUSTR lpszForeignKeyTableName,
                        /* INPUT: Name of foreign key table */
                    LPUSTR lpPrimaryKeyName,
                        /* OUTPUT: Buffer where name of primary key is */
                        /*   returned (zero-length string if no name) */
                    LPUSTR lpForeignKeyName,
                        /* OUTPUT: Buffer where name of primary key is */
                        /*   returned (zero-length string if no name) */
                    SWORD FAR *lpfUpdateRule,
                        /* OUTPUT: Update rule for the foreign key */
                        /*   (SQL_CASCASE, SQL_RESTRICT, SQL_SET_NULL, */
                        /*   SQL_NO_ACTION, SQL_SET_DEFAULT, or -1 if not */
                        /*   applicable) */
                    SWORD FAR *lpfDeleteRule,
                        /* OUTPUT: Delete rule for the foreign key */
                        /*   (SQL_CASCASE, SQL_RESTRICT, SQL_SET_NULL, */
                        /*   SQL_NO_ACTION, SQL_SET_DEFAULT, or -1 if not */
                        /*   applicable) */
                    UWORD FAR *lpcISAMKeyColumnList,
                        /* OUTPUT: Number of column in the forien key */
                    LPISAMKEYCOLUMNNAME ISAMPrimaryKeyColumnList,
                        /* OUTPUT: Buffer where name of names of the */
                        /*   primary key columns is returned */
                    LPISAMKEYCOLUMNNAME ISAMForeignKeyColumnList,
                        /* OUTPUT: Buffer where name of names of the */
                        /*   foriegn key columns is returned */
                    SWORD FAR *lpfDeferrability);
                        /* OUTPUT: Deferrability for the foreign key */
                        /*   (SQL_INITIALLY_DEFERRED, */ 
                        /*   SQL_INITIALLY_IMMEDIATE, SQL_NOT_DEFERRABLE, */
                        /*   or -1 if not applicable) */

/* Gets a foreign key definition.  lpPrimaryKeyName points to a buffer     */
/* (that is MAX_KEY_NAME_LENGTH+1 characters long) that contains the name  */
/* of the primary key (if any).  lpForeignKeyName points to a buffer (that */
/* is MAX_KEY_NAME_LENGTH+1 characters long) that contains the name of the */
/* foreign key (if any).  lpfUpdateRule specifies the update rule (-1 if   */
/* not applicable.  lpfDeleteRule specifies the update rule (-1 if not     */ 
/* applicable.  ISAMPrimaryKeyColumnList points to an array of buffers     */
/* (each of which is MAX_COLUMN_NAME_LENGTH+1 characters long) that        */ 
/* contains the name of the columns of the primary key.                    */
/* ISAMForeignKeyColumnList points to an array of buffers (each of which   */
/* is MAX_COLUMN_NAME_LENGTH+1 characters long) that contains the name of  */
/* the columns of the foreign key.  The number of key components in        */
/* ISAMPrimaryKeyColumnList and ISAMForeignKeyColumnList is returned       */
/* in lpcISAMKeyColumnList.  Returns ISAM_EOF if no foreign key.           */

/***************************************************************************/

SWORD INTFUNC ISAMCreateTable(
                    LPISAM lpISAM,
                        /* INPUT: Handle returned by ISAMOpen() */
                    LPUSTR lpszTableName,
                        /* INPUT: Name of table to create */
                    LPISAMTABLEDEF FAR *lplpISAMTableDef);
                        /* Output: Handle to the table created */

/* Creates a new table with the given name.  This call be followed by a    */
/* series of ISAMAddColumn() calls and a ISAMCloseTable() call.  No other  */
/* ISAM calls will be made with the LPISAMTABLEDEF returned.               */
/*                                                                         */
/* NULL is returned if the table could not be created.                     */

/***************************************************************************/

SWORD INTFUNC ISAMAddColumn(
                    LPISAMTABLEDEF lpISAMTableDef,
                        /* INPUT: Handle returned by ISAMCreateTable() */
                    LPUSTR lpszColumnName,
                        /* INPUT: The name of the column to create */
                    UWORD iSqlType,
                        /* INPUT: The index into the SQLTypes[] array that */
                        /*   describes the type of the column */
                    UDWORD udParam1,
                        /* INPUT: First create parameter (if any) */
                    UDWORD udParam2);
                        /* INPUT: Second create parameter (if any) */

/* Adds a column to a new table.  lpszColumnName specifies the column      */
/* name.  iSqlType specifies the datatype of the column (it will always be */
/* an index to an element of SQLTypes[] whose 'supported' component is     */ 
/* TRUE).  If the 'params' component designates that there are create      */
/* parameters for the type, udParam1 and udParam2 contain these values.    */
/*                                                                         */
/* This call will only be made on table handles returned by                */
/* ISAMCreateTable().                                                      */ 
/*                                                                         */
/* ISAM_NO_ERROR is returned if successful, ISAM_ERROR for failure.        */

/***************************************************************************/

SWORD INTFUNC ISAMCreateIndex(
                    LPISAMTABLEDEF lpISAMTableDef,
                        /* INPUT: Handle returned by ISAMOpenTable() */
                    LPUSTR lpszIndexName,
                        /* INPUT: The name of the index to create/delete */
                    BOOL fUnique,
                        /* INPUT: Unique index? */
                    UWORD          count,
                        /* INPUT: The number of columns in the key */
                    UWORD FAR *    icol,
                        /* INPUT: An array of column ids */
                    BOOL FAR *     fDescending);
                        /* INPUT: An array of ascending/descending flags */

/* Creates an index for this table.  The number of key fields is specified */
/* by count, which must be between 1 and MAX_COLUMNS_IN_INDEX (inclusive). */  
/* icol and fDescending are arrays (count elements long) specifying the    */ 
/* key columns and direction.                                              */
/*                                                                         */
/* ISAM_NO_ERROR is returned if successful, ISAM_ERROR for failure.        */
/***************************************************************************/

SWORD INTFUNC ISAMDeleteIndex(
                    LPISAM lpISAM,
                        /* INPUT: Handle returned by ISAMOpen() */
                    LPUSTR lpszIndexName);
                        /* INPUT: The name of the index to create/delete */

/* Deletes an index.                                                       */
/*                                                                         */
/* ISAM_NO_ERROR is returned if successful, ISAM_ERROR for failure.        */
/***************************************************************************/

SWORD INTFUNC ISAMOpenTable(
                    LPISAM lpISAM,
                        /* INPUT: Handle returned by ISAMOpen() */
                    LPUSTR lpszTableName,
                        /* INPUT: The name of the table to open */
                    BOOL fReadOnly,
                        /* INPUT: Flag to indicate whether or not write */
                        /*   access is needed */
                    LPISAMTABLEDEF FAR *lplpISAMTableDef);
                        /* OUTPUT: Handle to the table opened */

/* Opens the specified table.                                              */

/***************************************************************************/

SWORD INTFUNC ISAMRewind(
                    LPISAMTABLEDEF lpISAMTableDef);
                        /* INPUT: Handle returned by ISAMOpenTable() */

/* Move before the first record in the table.                              */
/*                                                                         */
/* ISAM_NO_ERROR is returned if successful, ISAM_ERROR for failure.        */


/***************************************************************************/

SWORD INTFUNC ISAMSort(
                    LPISAMTABLEDEF lpISAMTableDef,
                        /* INPUT: Handle returned by ISAMOpenTable() */
                    UWORD          count,
                        /* INPUT: The number of columns to sort on */
                    UWORD FAR *    icol,
                        /* INPUT: An array of column ids */
                    BOOL FAR *     fDescending);
                        /* INPUT: An array of ascending/descending flags */

/* Sorts the records such that ISAMNextRecord() returns the records in     */
/* sorted order.  This may do (but does not have to) a ISAMRewind() before */
/* returning.  After this call is made, ISAMNextRecord() will not be       */ 
/* called until after an ISAMRewind() is called.  The number of sort       */
/* fields is specified by count.  icol and fDescending are arrays (count   */
/* elements long) specifying the sort column and direction.  If count is   */
/* zero, then turn sorting off for this table.                             */
/*                                                                         */
/* ISAM_NO_ERROR is returned if successful.  If the ISAM layer cannot      */
/* perform sort, ISAM_NOTSUPPORTED is returned.  Otherwise, ISAM_ERROR     */ 
/* is returned.                                                            */

/***************************************************************************/

SWORD INTFUNC ISAMRestrict(
                    LPISAMTABLEDEF    lpISAMTableDef,
                        /* INPUT: Handle returned by ISAMOpenTable() */
                    UWORD          count,
                        /* INPUT: The number of restrictions */
                    UWORD FAR *       icol,
                        /* INPUT: An array of column ids */
                    UWORD FAR *       fOperator,
                        /* INPUT: An array of ISAM_OP_* value */
                    SWORD FAR *       fCType,
                        /* INPUT: An array of SQL_C_* types of the test */
                        /*        value */
                    PTR FAR *         rgbValue, 
                        /* INPUT: An array of buffers holding the test */
                        /*        value */
                    SDWORD FAR *      cbValue);
                        /* INPUT: An array of lengths of the value in */
                        /*        rgbValue */

/* Specifies that ISAMNextRecord() only needs to return records that       */
/* satisfy:                                                                */
/*                                                                         */
/*                  (<column-1> <operator-1> <value-1>) AND                */
/*                  (<column-2> <operator-2> <value-2>) AND                */
/*                                   ...                                   */
/*                  (<column-n> <operator-n> <value-n>)                    */
/*                                                                         */
/* The columns specified by icol will never have a fSelectivity of 0.      */
/* This may do (but does not have to) a ISAMRewind() before returning.     */
/* After this call is made, ISAMNextRecord() will not be called until      */ 
/* after an ISAMRewind() is called.                                        */
/*                                                                         */
/* ISAM_NO_ERROR is returned if successful.  If the ISAM layer cannot      */
/* perform the restriction, ISAM_NOTSUPPORTED is returned.  Otherwise,     */
/* ISAM_ERROR is returned.                                                 */

/***************************************************************************/

SWORD INTFUNC ISAMNextRecord(
                    LPISAMTABLEDEF lpISAMTableDef);
                        /* INPUT: Handle returned by ISAMOpenTable() */

/* Move to the next record in the table.                                   */
/*                                                                         */
/* ISAM_EOF is returned if there are not more record, ISAM_NO_ERROR is     */
/* returned if successful, ISAM_ERROR for failure.                         */

/***************************************************************************/

SWORD INTFUNC ISAMGetData(
                    LPISAMTABLEDEF    lpISAMTableDef,
                        /* INPUT: Handle returned by ISAMOpenTable() */
                    UWORD             icol,
                        /* INPUT: The id of the column */
                    SDWORD            cbOffset, 
                        /* INPUT: When reading a character column the */
                        /*   starting offset to read at.  When reading a */ 
                        /*   binary column as SQL_C_BINARY, the starting */
                        /*   offset to read at.  When reading a binary */
                        /*   column as SQL_C_CHAR the starting character */
                        /*   to return (after the conversion). */
                    SWORD             fCType, 
                        /* INPUT: A SQL_C_* type which designates which */
                        /*   format the data should be returned in. */
                        /*   For character columns this is SQL_C_CHAR.  The */
                        /*       data is returned as a null terminated */
                        /*       character string (if the character string */ 
                        /*       to return is cbValueMax characters long or */
                        /*       longer, only the first (cbValueMax-1) */
                        /*       characters are returned in rgbValue and */
                        /*       ISAM_TRUNCATION returned by this function) */
                        /*   For numerical columns other than SQL_DECIMAL, */
                        /*       SQL_NUMERIC, and SQL_BIGINT; this is */
                        /*       SQL_C_DOUBLE.  The data is returned as */
                        /*       a double. */
                        /*   For numerical columns that are SQL_DECIMAL, */
                        /*       SQL_NUMERIC, or SQL_BIGINT; this is */
                        /*       SQL_C_CHAR.  The data is returned as a */
                        /*       null terminated character string.  For */
                        /*       values with a non-zero scale, 'scale' */
                        /*       digits to the right are returned.  If the */
                        /*       scale is zero, no decimal point is */
                        /*       returned.  The string has no leading or */
                        /*       trailing blanks. */
                        /*    For date columns, this is SQL_C_DATE */
                        /*       (not SQL_C_TYPE_DATE). The data is */
                        /*       returned in as a DATE_SRUCT. */
                        /*    For time columns, this is SQL_C_TIME */
                        /*       (not SQL_C_TYPE_TIME).  The data is */
                        /*       returned in as a TIME_SRUCT. */
                        /*    For timestamp columns, this is */
                        /*       SQL_C_TIMESTAMP (not SQL_C_TYPE_TIME). */ 
                        /*       The data is returned in as a */
                        /*       TIMESTAMP_SRUCT. */
                        /*    For binary columns this is either */  
                        /*       SQL_C_BINARY or SQL_C_CHAR.  If */
                        /*       SQL_C_BINARY, the data is returned in */
                        /*       binary form. If SQL_C_CHAR, the binary */
                        /*       value is converted to a null terminated */
                        /*       character string (if the character string */
                        /*       to return is cbValueMax characters long or */
                        /*       longer, only the first (cbValueMax-1) */
                        /*       characters are returned in rgbValue and */
                        /*       ISAM_TRUNCATION returned by this function) */
                    PTR               rgbValue, 
                        /* OUTPUT: Buffer to hold output value */
                    SDWORD            cbValueMax, 
                        /* INPUT: Size of buffer to hold output value */
                    SDWORD FAR        *pcbValue);
                        /* OUTPUT: Number of bytes returned (not including */
                        /*   null terminator for strings).  If the buffer */
                        /*   is not big enough to return the entire value */
                        /*   this is is set to the total numebe of bytes */
                        /*   for the value, minus cbOffset.  For null */
                        /*   values, this is set to SQL_NULL_DATA */

/* Retrieves a column value from the current record.                       */
/*                                                                         */
/* ISAM_TRUNCATION is returned if the data was too large to fit in the     */
/* buffer provided, ISAM_NO_ERROR is returned if successful, ISAM_ERROR    */
/* for failure.                                                            */

/***************************************************************************/

SWORD INTFUNC ISAMPutData(
                    LPISAMTABLEDEF    lpISAMTableDef,
                        /* INPUT: Handle returned by ISAMOpenTable() */
                    UWORD             icol,
                        /* INPUT: The id of the column */
                    SWORD             fCType, 
                        /* INPUT: A SQL_C_* type which designates which */
                        /*   format the data is sent in. */
                        /*   For character columns this is SQL_C_CHAR.  The */
                        /*       data is a null terminated character */
                        /*       string. */
                        /*   For numerical columns other than SQL_DECIMAL, */
                        /*       SQL_NUMERIC, and SQL_BIGINT); this is */
                        /*       SQL_C_DOUBLE.  The data is a double */
                        /*   For numerical columns that are SQL_DECIMAL, */
                        /*       SQL_NUMERIC, or SQL_BIGINT; this is */
                        /*       SQL_C_CHAR.  The data is a null terminated */ 
                        /*       character string.  For values with a */
                        /*       non-zero scale, the value has 'scale' */
                        /*       digits to the right are returned.  If the */
                        /*       scale is zero, the value has no decimal */
                        /*       point. The string has no leading or */
                        /*       trailing blanks. */
                        /*    For date columns, this is SQL_C_DATE */
                        /*       (not SQL_C_TYPE_DATE).  The data is */
                        /*       a DATE_SRUCT. */
                        /*    For time columns, this is SQL_C_TIME */
                        /*       (not SQL_C_TYPE_TIME).  The data is */
                        /*       a TIME_SRUCT. */
                        /*    For timestamp columns, this is */
                        /*       SQL_C_TIMESTAMP (not SQL_C_TYPE_TIME) */
                        /*       The data is a TIMESTAMP_SRUCT. */
                        /*   For binary columns this is SQL_C_BINARY.  The */
                        /*       data is in binary form */
                    PTR               rgbValue, 
                        /* INPUT: The buffer holding the value */ 
                    SDWORD            cbValue);
                        /* INPUT: The size of the buffer.  This is */
                        /*   SQL_NULL_DATA if the value is null. */

/* Updates a column value in the current record.  Note that                */
/* ISAMUpdateRecord will also be called to save the changes.               */
/*                                                                         */
/* ISAM_NO_ERROR is returned if successful, ISAM_ERROR for failure.        */

/***************************************************************************/

SWORD INTFUNC ISAMInsertRecord(
                    LPISAMTABLEDEF    lpISAMTableDef);
                        /* INPUT: Handle returned by ISAMOpenTable() */

/* Add a new record to the table, and make it the current record.          */
/* All column values in the row are NULL.                                  */
/*                                                                         */
/* ISAM_NO_ERROR is returned if successful, ISAM_ERROR for failure.        */

/***************************************************************************/

SWORD INTFUNC ISAMUpdateRecord(
                    LPISAMTABLEDEF    lpISAMTableDef);
                        /* INPUT: Handle returned by ISAMOpenTable() */

/* Commit any changes to column values in the current row.                 */
/*                                                                         */
/* ISAM_NO_ERROR is returned if successful, ISAM_ERROR for failure.        */

/***************************************************************************/

SWORD INTFUNC ISAMDeleteRecord(
                    LPISAMTABLEDEF    lpISAMTableDef);
                        /* INPUT: Handle returned by ISAMOpenTable() */

/* Remove the current record from the table.  Call ISAMNextRecord          */
/* to move the next record before calling ISAMGetData or ISAMPutData.      */
/*                                                                         */
/* ISAM_NO_ERROR is returned if successful, ISAM_ERROR for failure.        */

/***************************************************************************/

SWORD INTFUNC ISAMGetBookmark(
                    LPISAMTABLEDEF    lpISAMTableDef,
                        /* INPUT: Handle returned by ISAMOpenTable() */
                    ISAMBOOKMARK FAR *lpISAMBookmark);
                        /* OUTPUT: The bookmark value */

/* Retrieves the bookmark for the current record.  The bookmark is valid   */
/* until the table is closed.  See ISAMPosition().                         */
/*                                                                         */
/* ISAM_NO_ERROR is returned if successful, ISAM_ERROR for failure.        */

/***************************************************************************/

SWORD INTFUNC ISAMPosition(
                    LPISAMTABLEDEF    lpISAMTableDef,
                        /* INPUT: Handle returned by ISAMOpenTable() */
                    ISAMBOOKMARK ISAMBookmark);
                        /* INPUT: The bookmark value */

/* Repositions the current record to the record identified by              */
/* ISAMBookmark.  Note: Once ISAMPosition is called, only ISAMGetData(),   */
/* ISAMPosition(), and ISAMCloseTable() will be called for this table.     */

/* ISAM_NO_ERROR is returned if successful.  ISAM_EOF is returned if the   */
/* record no longer exists.  ISAM_ERROR for failure.                       */

/***************************************************************************/

SWORD INTFUNC ISAMCloseTable(
                    LPISAMTABLEDEF    lpISAMTableDef);
                        /* INPUT: Handle returned by ISAMOpenTable() or */
                        /*   ISAMCreateTable() */

/* Closes the table (opened by ISAMOpenTable() or ISAMCreateTable()).      */
/* Note: lpISAMTableDef will be invalid after this call, even if this      */
/* call returns an error.                                                  */
/*                                                                         */
/* ISAM_NO_ERROR is returned if successful, ISAM_ERROR for failure.        */

/***************************************************************************/

SWORD INTFUNC ISAMDeleteTable(
                    LPISAM lpISAM,
                        /* INPUT: Handle returned by ISAMOpen() */
                    LPUSTR lpszTableName);
                        /* INPUT: The name of the table to delete. */

/* Deletes the table.                                                      */
/*                                                                         */
/* ISAM_NO_ERROR is returned if successful, ISAM_ERROR for failure.        */

/***************************************************************************/

SWORD INTFUNC ISAMClose(
                    LPISAM lpISAM);
                        /* INPUT: Handle returned by ISAMOpen() */

/* Closes the ISAM (opened by ISAMOpen()).                                 */
/*                                                                         */
/* ISAM_NO_ERROR is returned if successful, ISAM_ERROR for failure.        */

/***************************************************************************/

SWORD INTFUNC ISAMPrepare(
                    LPISAM lpISAM,
                        /* INPUT: Handle returned by ISAMOpen() */
                    UCHAR FAR *szSqlStr,
                        /* INPUT: SQL statement to prepare */
                    SDWORD cbSqlStr,
                        /* INPUT: Length of SQL statement to prepare */
                    LPISAMSTATEMENT FAR * lplpISAMStatement,
                        /* OUTPUT: Handle to prepared statement */
                    LPUSTR lpszTablename,
                        /* OUTPUT: If the statement has a result set, */
                        /*   the name of the virtual table that contains */
                        /*   the result set.  Otherwise a zero length */
                        /*   string. */
                    UWORD FAR *lpParameterCount);
                        /* OUTPUT: Number of parameters in the statement */

/* Prepares an ISAM statment for later execution by ISAMExecute().         */
/*                                                                         */
/* If the statement has a result set (such as a SELECT statement), the     */
/* name of a virtual table that contains the result set is returned.  This */ 
/* table will be opened by ISAMOpenTable() (before ISAMExecute() is        */
/* called).                                                                */  
/*                                                                         */
/* If the statement does not have a result set, a zero length table name   */
/* is returned.                                                            */
/*                                                                         */
/* ISAM_NO_ERROR is returned if successful.  If the ISAM layer cannot      */
/* prepare and execute statements, ISAM_NOTSUPPORTED is returned.          */
/* Otherwise, ISAM_ERROR is returned.                                      */

/***************************************************************************/

SWORD INTFUNC ISAMParameter(
                    LPISAMSTATEMENT lpISAMStatement,
                        /* INPUT: Handle returned by ISAMPrepare() */
                    UWORD             ipar,
                        /* INPUT: The id of the parameter (the first */
                        /*       parameter is 1, the second is 2, etc.) */
                    SWORD             fCType, 
                        /* INPUT: A SQL_C_* type which designates which */
                        /*   format the data is sent in. */
                    PTR               rgbValue, 
                        /* INPUT: The buffer holding the value */ 
                    SDWORD            cbValue);
                        /* INPUT: The size of the buffer.  This is */
                        /*   SQL_NULL_DATA if the value is null. */

/* If SQLPrepare() returns a non-zero parameter count this rouitne is      */
/* called once to specify the parameter value ISAMExecute() is to use.     */
/* This routine need not make a copy of the data 'rgbValue' points to,     */
/* it will not change until after SQLExecute() is called.                  */
/*                                                                         */
/* ISAM_NO_ERROR is returned if successful.  Otherwise, ISAM_ERROR is      */
/* returned.                                                               */

/***************************************************************************/

SWORD INTFUNC ISAMExecute(
                    LPISAMSTATEMENT lpISAMStatement,
                        /* INPUT: Handle returned by ISAMPrepare() */
                    SDWORD FAR *lpcRowCount,
                        /* OUTPUT: If the prepared statement was an INSERT */
                        /*   UPDATE, or DELETE statement, the number of */
                        /*   rows affected.  Otherwise some meaningful */
                        /*   number is possible (otherwise -1). */
                    SDWORD FAR *lpfFunctionCode);
                        /* The SQL_DIAG_* code for the operation.  If */
                        /* unknown, this is SQL_DIAG_UNKNOWN_STATEMENT */

/* Executes a statement previously prepared by ISAMPrepare().  This may    */
/* be called multiple times for one call to ISAMPrepare().                 */
/*                                                                         */
/* ISAM_NO_ERROR is returned if successful.  Otherwise, ISAM_ERROR is      */
/* returned.                                                               */

/***************************************************************************/

SWORD INTFUNC ISAMFreeStatement(
                    LPISAMSTATEMENT lpISAMStatement);
                        /* INPUT: Handle returned by ISAMPrepare() */

/* Frees a previously prepared statement.  ISAM_NO_ERROR is returned if    */
/* successful.  Otherwise, ISAM_ERROR is returned.                         */

/***************************************************************************/
SWORD INTFUNC ISAMSetTxnIsolation(
                    LPISAM lpISAM,
                        /* INPUT: Handle returned by ISAMOpen() */
                    UDWORD fTxnIsolationLevel);
                        /* INPUT: One of the following (see ODBC */
                        /*   documentation for details) : */
                        /*           SQL_TXN_READ_UNCOMMITTED */
                        /*           SQL_TXN_READ_COMMITTED */
                        /*           SQL_TXN_REPEATABLE_READ */
                        /*           SQL_TXN_SERIALIZABLE */
                        /*           SQL_TXN_VERSIONING */

/* Sets the transaction isolation level.  ISAM_NO_ERROR is returned if     */
/* successful.  Otherwise, ISAM_ERROR is returned.                         */

/***************************************************************************/
SWORD INTFUNC ISAMCommitTxn(
                    LPISAM lpISAM);
                        /* INPUT: Handle returned by ISAMOpen() */

/* Commits the current transaction if one is open. If no transaction       */
/* is open, returns successfully anyway.                                   */

/* ISAM_NO_ERROR is returned if successful.  Otherwise, ISAM_ERROR is      */
/* returned.                                                               */

/***************************************************************************/
SWORD INTFUNC ISAMRollbackTxn(
                    LPISAM lpISAM);
                        /* INPUT: Handle returned by ISAMOpen() */

/* Rolls back the current transaction if one is open. If no transaction    */
/* is open, returns successfully anyway.                                   */

/* ISAM_NO_ERROR is returned if successful.  Otherwise, ISAM_ERROR is      */
/* returned.                                                               */

/***************************************************************************/
/***************************************************************************/
/***************************************************************************/
/***************************************************************************/

void INTFUNC ISAMGetErrorMessage(
                    LPISAM lpISAM,
                        /* INPUT: Handle returned by ISAMOpen() */
                    LPUSTR  lpszErrorMessage);
                        /* OUTPUT: The error message associated with the */
                        /*   most recent call to an ISAM call */

/* Returns the error message associated with the most recent call to an    */
/* ISAM function.                                                          */

/***************************************************************************/

LPSQLTYPE INTFUNC ISAMGetColumnType(
                    LPISAMTABLEDEF lpISAMTableDef,
                        /* INPUT: Handle returned by ISAMOpenTable() */
                    UWORD icol);
                        /* INPUT: Id of column */

/* Returns a pointer to the description of the SQL_* type of the column. */

/***************************************************************************/

BOOL INTFUNC ISAMCaseSensitive(
                    LPISAM lpISAM);
                        /* INPUT: Handle returned by ISAMOpen() */

/* Are column and table names case-sensitive?                              */

/***************************************************************************/

LPCUSTR INTFUNC ISAMName(
                    LPISAM lpISAM);
                        /* INPUT: Handle returned by ISAMOpen() */

/* Returns pointer to a string containing the name of the DBMS or file     */
/* format                                                                  */

/***************************************************************************/

LPCUSTR INTFUNC ISAMVersion(
                    LPISAM lpISAM);
                        /* INPUT: Handle returned by ISAMOpen() */

/* Returns pointer to a string containing the version of the DBMS or file  */
/* format.                                                                 */

/***************************************************************************/

LPCUSTR INTFUNC ISAMDriver(
                    LPISAM lpISAM);
                        /* INPUT: Handle returned by ISAMOpen() */

/* Returns pointer to a string containing the name of driver DLL           */

/***************************************************************************/

SWORD INTFUNC ISAMMaxTableNameLength(
                    LPISAM lpISAM);
                        /* INPUT: Handle returned by ISAMOpen() */

/* Returns the maximum length of a table name.  Must not exceed            */
/* MAX_TABLE_NAME_LENGTH.                                                  */

/***************************************************************************/

SWORD INTFUNC ISAMMaxColumnNameLength(
                    LPISAM lpISAM);
                        /* INPUT: Handle returned by ISAMOpen() */

/* Returns the maximum length of a column name.  Must not exceed           */
/* MAX_COLUMN_NAME_LENGTH.                                                 */

/***************************************************************************/

LPUSTR INTFUNC ISAMUser(
                    LPISAM lpISAM);
                        /* INPUT: Handle returned by ISAMOpen() */

/* Returns the current username.  Must not exceed MAX_USER_NAME_LENGTH.    */

/***************************************************************************/

LPUSTR INTFUNC ISAMDatabase(
                    LPISAM lpISAM);
                        /* INPUT: Handle returned by ISAMOpen() */

/* Returns the current database.  Must not exceed MAX_DATABASE_NAME_LENGTH */

/***************************************************************************/
