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