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 xbString& GetTempDirectory () const;
68
69 void GetHomeDir ( xbString &sHomeDirOut );
70
71
72 xbInt16 GetEndianType () const;
73 const char *GetErrorMessage ( xbInt16 ErrorCode ) const;
74 char GetPathSeparator () const;
75
76 void SetDataDirectory ( const xbString &sDataDirectory );
77 void SetDefaultDateFormat ( const xbString &sDefaultDateFormat );
78 void SetTempDirectory ( const xbString &sTempDirectory );
79
80
81 xbBool BitSet ( unsigned char c, xbInt16 iBitNo ) const;
82 void BitDump ( unsigned char c ) const;
83 void BitDump ( char c ) const;
84
85 xbBool GetDefaultAutoCommit () const;
86 void SetDefaultAutoCommit ( xbBool bDefaultAutoCommit );
87
88 xbString& GetLogDirectory () const;
89 xbString& GetLogFileName () const;
90 void SetLogDirectory ( const xbString &sLogDirectory );
91 void SetLogFileName ( const xbString &sLogFileName );
92
93
94 xbBool GetMultiUser () const;
95 void SetMultiUser ( xbBool bMultiUser );
96
97 #if defined (XB_NDX_SUPPORT) || defined (XB_MDX_SUPPORT)
98 xbInt16 GetUniqueKeyOpt () const;
99 xbInt16 SetUniqueKeyOpt ( xbInt16 iUniqueKeyOpt );
100 #endif // (XB_NDX_SUPPORT) || defined (XB_MDX_SUPPORT)
101
102 #ifdef XB_LOCKING_SUPPORT
103 xbInt16 GetDefaultLockRetries () const;
104 void SetDefaultLockRetries ( xbInt16 iRetryCount );
105 xbInt32 GetDefaultLockWait () const;
106 void SetDefaultLockWait ( xbInt32 lRetryWait );
107 xbInt16 GetDefaultLockFlavor () const;
108 void SetDefaultLockFlavor ( xbInt16 iLockFlavor );
109 xbBool GetDefaultAutoLock () const;
110 void SetDefaultAutoLock ( xbBool bAutoLock );
111 void EnableDefaultAutoLock ();
112 void DisableDefaultAutoLock ();
113 #endif // XB_LOCKING_SUPPORT
114
115 #ifdef XB_MDX_SUPPORT
116 xbInt16 GetCreateMdxBlockSize() const;
117 xbInt16 SetCreateMdxBlockSize( xbInt16 ulBlockSize );
118 #endif // XB_MDX_SUPPORT
119
120 #ifdef XB_BLOCKREAD_SUPPORT
121 xbUInt32 GetDefaultBlockReadSize() const;
122 void SetDefaultBlockReadSize( xbUInt32 ulDfltBlockReadSize );
123 #endif // XB_BLOCKREAD_SUPPORT
124
125
126 protected:
127
128 void SetEndianType ();
129
130 static xbInt16 iEndianType; // B=Big Endian L=Little Endian
131 static xbString sNullString; // Null String
132
133
134 private:
135
136 static xbString sDefaultDateFormat;
137 static xbString sDataDirectory; //Data file directory
138 static xbString sTempDirectory; //Temp file directory
139
140 #ifdef XB_LOGGING_SUPPORT
141 static xbString sLogDirectory; //Default location to store log files
142 static xbString sLogFileName; //Default LogFileName
143 #endif
144
145 static xbInt16 iDefaultFileVersion; // 3 = DBase 3
146 // 4 = DBase 4
147 // default version used in CreateTable command
148 // can be over ridden at the Xbase level, or table level
149 // Different versions can be open simultaneously
150
151 static xbBool bDefaultAutoCommit; // Default dbf auto commit switch
152
153 static xbBool bMultiUser; // True if multi user mode is turned on
154 // Turn this off for better performance in single user mode
155 // This needs to be turned on or off before any data tables are opened
156 // turning this on after tables are opened, can result in out of date
157 // file buffers if multiple users are sharing the files
158
159#ifdef XB_LOCKING_SUPPORT
160 static xbInt32 lDefaultLockWait; // Number of milliseconds between lock retries
161 static xbInt16 iDefaultLockRetries; // Number of times to retry a lock before conceding
162 static xbInt16 bDefaultAutoLock; // Autolocking enabled?
163 static xbInt16 iDefaultLockFlavor; // 1 = DBase
164 // 2 = Clipper - not developed yet
165 // 3 = FoxPro - not developed yet
166 // 9 = Xbase64 - not developed yet
167#endif
168
169
170#if defined (XB_NDX_SUPPORT) || defined (XB_MDX_SUPPORT)
171
172 static xbInt16 iUniqueKeyOpt;
173
174 // is one of:
175 // XB_HALT_ON_DUPKEY
176 // XB_EMULATE_DBASE
177
178#endif
179
180
181#ifdef XB_MDX_SUPPORT
182 static xbInt16 iCreateMdxBlockSize; // System level Mdx Block Size
183#endif // XB_MDX_SUPPORT
184
185
186#ifdef XB_BLOCKREAD_SUPPORT
187 static xbUInt32 ulDefaultBlockReadSize;
188#endif // XB_BLOCKREAD_SUPPORT
189
190
191};
192
193} /* namespace xb */
194#endif /* __XB_XBSSV_H__ */
Class for handling shared system variables.
Definition: xbssv.h:59
static xbInt16 iEndianType
Definition: xbssv.h:130
static xbString sNullString
Definition: xbssv.h:131
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