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