2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
24 /*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
25 /*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
26 /*%% (c) Copyright 1993, 1994 Novell, Inc. */
27 /*%% $XConsortium: tt_isam_file.h /main/3 1995/10/20 16:43:47 rswiston $ */
29 * tt_isam_file.h - Defines the TT ISAM file class. This class simplifies
30 * opening, closing, reading and writing an ISAM file.
32 * Copyright (c) 1992 by Sun Microsystems, Inc.
35 #ifndef _TT_ISAM_FILE_H
36 #define _TT_ISAM_FILE_H
38 #include "util/tt_object.h"
40 #include "tt_isam_key_descriptor_utils.h"
41 #include "tt_isam_record_utils.h"
43 typedef int (*FatalErrorHandlerFunction) (char *);
45 class _Tt_isam_file : public _Tt_object {
47 // Dummy constructor needed to make _tt_isam_file_utils.cc happy
51 _Tt_isam_file (const _Tt_string &file, int mode);
52 _Tt_isam_file (const _Tt_string &file,
53 int max_record_length,
54 int min_record_length,
55 _Tt_isam_key_descriptor_ptr primary_key_descriptor,
59 void setErase (bool_t);
63 // islock and isunlock are not supported by mini-isam
68 int rename (const _Tt_string&);
70 int addIndex (_Tt_isam_key_descriptor_ptr);
71 _Tt_isam_record_ptr getEmptyRecord ();
73 int findStartRecord (const _Tt_isam_key_descriptor_ptr &key_descriptor,
75 const _Tt_isam_record_ptr &record,
78 _Tt_isam_record_ptr readRecord (int mode);
79 int readRecord (int mode, const _Tt_isam_record_ptr&);
80 int updateCurrentRecord (const _Tt_isam_record_ptr&);
81 int updateRecord (long recnum, const _Tt_isam_record_ptr&);
82 int writeRecord (const _Tt_isam_record_ptr&);
83 int deleteCurrentRecord ();
84 int deleteRecord (long recnum);
86 int writeMagicString (const _Tt_string&);
87 _Tt_string readMagicString ();
89 int setFatalErrorHandler (FatalErrorHandlerFunction);
91 long getLastRecordNumber () const
93 return currentRecordNumber;
96 int getFileDescriptor () const
98 return fileDescriptor;
101 const _Tt_string &getName () const
106 int getErrorStatus () const
111 bool_t isNew () const
117 int currentRecordLength;
118 long currentRecordNumber;
124 _Tt_isam_key_descriptor_list_ptr keyDescriptorList;
129 void setTtISAMFileDefaults ();
130 _Tt_isam_record_ptr getFullRecord (const _Tt_string&);
131 void getISAMFileInfo ();
133 void getStatusInfo ()
135 currentRecordLength = isreclen;
136 currentRecordNumber = isrecnum;
137 errorStatus = iserrno;
140 static bool_t isamFatalErrorHandlerSet;
141 static int isamFatalErrorHandler (char *message);
144 #endif /* _TT_ISAM_FILE_H */