Xbase64 4.0.1
C++ Library for handling Xbase (DBF) format type files
xbssv.h
Go to the documentation of this file.
1/* xbssv.h
2
3XBase64 Software Library
4
5Copyright (c) 1997,2003,2014,2022,2023 Gary A Kunkel
6
7The xb64 software library is covered under the terms of the GPL Version 3, 2007 license.
8
9Email Contact:
10
11 XDB-devel@lists.sourceforge.net
12 XDB-users@lists.sourceforge.net
13
14*/
15
16
17#ifndef __XB_XBSSV_H__
18#define __XB_XBSSV_H__
19
20#ifdef CMAKE_COMPILER_IS_GNUCC
21#pragma interface
22#endif
23
24
25namespace xb{
26
27class XBDLLEXPORT xbXBase;
28
30struct XBDLLEXPORT xbErrorMessage{
31 xbInt16 iErrorNo;
32 const char *sErrorText;
33};
35
36
38
49// By design, DBase allows mutliple records in a table all having the same key, but only one entry in a unique index
50// XB_HALT_ON_DUP_KEY tells the library to not allow appending records which generate duplicate keys in a unique index
51//
52#if defined (XB_NDX_SUPPORT) || defined (XB_MDX_SUPPORT)
53#define XB_HALT_ON_DUPKEY 0
54#define XB_EMULATE_DBASE 1
55#endif
56
57
58
59class XBDLLEXPORT xbSsv{
60 public:
61 xbSsv();
62 const static char *ErrorCodeText[];
63
64 void DisplayError ( xbInt16 ErrorCode ) const;
65 xbString& GetDefaultDateFormat () const;
66 xbString& GetDataDirectory () const;
67 xbInt16 GetEndianType () const;
68
69 const char *GetErrorMessage ( xbInt16 ErrorCode ) const;
70 void SetDataDirectory ( const xbString &sDataDirectory );
71 void SetDefaultDateFormat ( const xbString &sDefaultDateFormat );
72
73 xbBool BitSet ( unsigned char c, xbInt16 iBitNo ) const;
74 void BitDump ( unsigned char c ) const;
75 void BitDump ( char c ) const;
76
77 xbBool GetDefaultAutoCommit () const;
78 void SetDefaultAutoCommit ( xbBool bDefaultAutoCommit );
79
80 void GetHomeDir ( xbString &sHomeDirOut );
81
82 xbString& GetLogDirectory () const;
83 xbString& GetLogFileName () const;
84 void SetLogDirectory ( const xbString &sLogDirectory );
85
86 xbBool GetMultiUser () const;
87 void SetMultiUser ( xbBool bMultiUser );
88
89 #if defined (XB_NDX_SUPPORT) || defined (XB_MDX_SUPPORT)
90 xbInt16 GetUniqueKeyOpt () const;
91 xbInt16 SetUniqueKeyOpt ( xbInt16 iUniqueKeyOpt );
92 #endif // (XB_NDX_SUPPORT) || defined (XB_MDX_SUPPORT)
93
94 #ifdef XB_LOCKING_SUPPORT
95 xbInt16 GetDefaultLockRetries () const;
96 void SetDefaultLockRetries ( xbInt16 iRetryCount );
97 xbInt32 GetDefaultLockWait () const;
98 void SetDefaultLockWait ( xbInt32 lRetryWait );
99 xbInt16 GetDefaultLockFlavor () const;
100 void SetDefaultLockFlavor ( xbInt16 iLockFlavor );
101 xbBool GetDefaultAutoLock () const;
102 void SetDefaultAutoLock ( xbBool bAutoLock );
103 void EnableDefaultAutoLock ();
104 void DisableDefaultAutoLock ();
105 #endif // XB_LOCKING_SUPPORT
106
107 #ifdef XB_MDX_SUPPORT
108 xbInt16 GetCreateMdxBlockSize() const;
109 xbInt16 SetCreateMdxBlockSize( xbInt16 ulBlockSize );
110 #endif // XB_MDX_SUPPORT
111
112 #ifdef XB_BLOCKREAD_SUPPORT
113 xbUInt32 GetDefaultBlockReadSize() const;
114 void SetDefaultBlockReadSize( xbUInt32 ulDfltBlockReadSize );
115 #endif // XB_BLOCKREAD_SUPPORT
116
117
118 protected:
119
120 void SetEndianType ();
121
122 static xbInt16 iEndianType; // B=Big Endian L=Little Endian
123 static xbString sNullString; // Null String
124
125
126 private:
127
128 static xbString sDefaultDateFormat;
129 static xbString sDataDirectory; //Data file directory
130
131 #ifdef XB_LOGGING_SUPPORT
132 static xbString sLogDirectory; //Default location to store log files
133 static xbString sLogFileName; //Default LogFileName
134 #endif
135
136 static xbInt16 iDefaultFileVersion; // 3 = DBase 3
137 // 4 = DBase 4
138 // default version used in CreateTable command
139 // can be over ridden at the Xbase level, or table level
140 // Different versions can be open simultaneously
141
142 static xbBool bDefaultAutoCommit; // Default dbf auto commit switch
143
144 static xbBool bMultiUser; // True if multi user mode is turned on
145 // Turn this off for better performance in single user mode
146 // This needs to be turned on or off before any data tables are opened
147 // turning this on after tables are opened, can result in out of date
148 // file buffers if multiple users are sharing the files
149
150#ifdef XB_LOCKING_SUPPORT
151 static xbInt32 lDefaultLockWait; // Number of milliseconds between lock retries
152 static xbInt16 iDefaultLockRetries; // Number of times to retry a lock before conceding
153 static xbInt16 bDefaultAutoLock; // Autolocking enabled?
154 static xbInt16 iDefaultLockFlavor; // 1 = DBase
155 // 2 = Clipper - not developed yet
156 // 3 = FoxPro - not developed yet
157 // 9 = Xbase64 - not developed yet
158#endif
159
160
161#if defined (XB_NDX_SUPPORT) || defined (XB_MDX_SUPPORT)
162
163 static xbInt16 iUniqueKeyOpt;
164
165 // is one of:
166 // XB_HALT_ON_DUPKEY
167 // XB_EMULATE_DBASE
168
169#endif
170
171
172#ifdef XB_MDX_SUPPORT
173 static xbInt16 iCreateMdxBlockSize; // System level Mdx Block Size
174#endif // XB_MDX_SUPPORT
175
176
177#ifdef XB_BLOCKREAD_SUPPORT
178 static xbUInt32 ulDefaultBlockReadSize;
179#endif // XB_BLOCKREAD_SUPPORT
180
181
182};
183
184} /* namespace xb */
185#endif /* __XB_XBSSV_H__ */
Class for handling shared system variables.
Definition: xbssv.h:59
static xbInt16 iEndianType
Definition: xbssv.h:122
static xbString sNullString
Definition: xbssv.h:123
Class for handling string data.
Definition: xbstring.h:50
xbXbase class.
Definition: xbxbase.h:123
Definition: xbdate.cpp:19
short int xbBool
Definition: xbtypes.h:24