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_client_isam_file.h /main/3 1995/10/23 09:59:20 rswiston $ */
29 * tt_client_isam_file.h - Defines the TT ISAM file class. This class
30 * simplifies opening, closing, reading and writing an ISAM file.
32 * Copyright (c) 1992 by Sun Microsystems, Inc.
35 #ifndef _TT_CLIENT_ISAM_FILE_H
36 #define _TT_CLIENT_ISAM_FILE_H
38 #include "util/tt_object.h"
39 #include "db/tt_db_client_utils.h"
40 #include "db/tt_client_isam_key_descriptor_utils.h"
41 #include "db/tt_client_isam_record_utils.h"
42 #include <sys/param.h>
44 class _Tt_client_isam_file : public _Tt_object {
46 // Dummy constructor needed to make _tt_client_isam_file_utils.cc happy
47 _Tt_client_isam_file () {}
50 _Tt_client_isam_file (const _Tt_string &file,
52 const _Tt_db_client_ptr &db_connection);
53 _Tt_client_isam_file (const _Tt_string &file,
54 int max_record_length,
55 int min_record_length,
56 _Tt_client_isam_key_descriptor_ptr primary_key_descriptor,
58 const _Tt_db_client_ptr &db_connection);
59 ~_Tt_client_isam_file ();
61 void setErase (bool_t);
63 int addIndex (_Tt_client_isam_key_descriptor_ptr);
64 _Tt_client_isam_record_ptr getEmptyRecord ();
66 int findStartRecord (const _Tt_client_isam_key_descriptor_ptr &key_descriptor,
68 const _Tt_client_isam_record_ptr &record,
71 _Tt_client_isam_record_ptr readRecord (int mode);
72 int readRecord (int mode, const _Tt_client_isam_record_ptr&);
73 int updateRecord (long recnum, const _Tt_client_isam_record_ptr&);
74 int writeRecord (const _Tt_client_isam_record_ptr&);
75 int deleteRecord (long recnum,
76 const _Tt_client_isam_record_ptr &record);
78 int writeMagicString (const _Tt_string&);
79 _Tt_string readMagicString ();
81 long getLastRecordNumber () const
83 return currentRecordNumber;
86 int getFileDescriptor () const
88 return fileDescriptor;
91 const _Tt_string &getName () const
96 int getErrorStatus () const
101 bool_t isNew () const
107 int currentRecordLength;
108 long currentRecordNumber;
109 _Tt_db_client_ptr dbConnection;
115 _Tt_client_isam_key_descriptor_list_ptr keyDescriptorList;
120 void setTtISAMFileDefaults ();
121 _Tt_client_isam_record_ptr getFullRecord (const _Tt_string&);
122 void getISAMFileInfo ();
124 void getStatusInfo ()
126 currentRecordLength = dbConnection->isreclen;
127 currentRecordNumber = dbConnection->isrecnum;
128 errorStatus = dbConnection->iserrno;
132 #endif /* _TT_CLIENT_ISAM_FILE_H */