openbase 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +50 -0
- data/License.txt +20 -0
- data/Manifest.txt +53 -0
- data/README.txt +35 -0
- data/Rakefile +126 -0
- data/examples/example.rb +37 -0
- data/ext/CommAPI.c +643 -0
- data/ext/Headers/CommAPI.h +1 -0
- data/ext/Headers/NetClient.h +42 -0
- data/ext/Headers/NetClientLib.h +41 -0
- data/ext/Headers/OB_Memory.h +69 -0
- data/ext/Headers/OpenBaseAdmin.h +227 -0
- data/ext/Headers/OpenBaseConnection.h +337 -0
- data/ext/Headers/OpenBaseEncoding.h +302 -0
- data/ext/Headers/OpenBasePrepare.h +1 -0
- data/ext/Headers/OpenBaseSupport.h +1 -0
- data/ext/Headers/Platform_Carbon_Header.h +5 -0
- data/ext/Headers/Platform_Classic_Header.h +6 -0
- data/ext/Headers/Platform_Linux.h +4 -0
- data/ext/Headers/Platform_Mach_Header.h +4 -0
- data/ext/Headers/Platform_Windows.h +3 -0
- data/ext/Headers/conversion.h +1 -0
- data/ext/Headers/datetime.h +26 -0
- data/ext/Headers/longlong.h +46 -0
- data/ext/Headers/platform.h +67 -0
- data/ext/Headers/stringConversion.h +15 -0
- data/ext/NetClient.c +888 -0
- data/ext/OpenBaseAdmin.c +1884 -0
- data/ext/OpenBaseConnection.c +1841 -0
- data/ext/OpenBaseEncoding.c +993 -0
- data/ext/OpenBaseEncoding_DOS.c +1 -0
- data/ext/OpenBaseEncoding_ISO8859.c +1 -0
- data/ext/OpenBaseEncoding_MacOS.c +1 -0
- data/ext/OpenBaseEncoding_Windows.c +1150 -0
- data/ext/OpenBasePrepare.c +1 -0
- data/ext/OpenBaseSupport.c +1 -0
- data/ext/conversion.c +1 -0
- data/ext/datetime.c +816 -0
- data/ext/depend +1 -0
- data/ext/extconf.rb +10 -0
- data/ext/longlong.c +1 -0
- data/ext/openbase.c +980 -0
- data/ext/stringConversion.c +169 -0
- data/lib/ruby-openbase/version.rb +9 -0
- data/scripts/txt2html +67 -0
- data/setup.rb +1585 -0
- data/test/test_helper.rb +2 -0
- data/test/test_openbase.rb +241 -0
- data/website/index.html +114 -0
- data/website/index.txt +59 -0
- data/website/javascripts/rounded_corners_lite.inc.js +285 -0
- data/website/stylesheets/screen.css +133 -0
- data/website/template.rhtml +47 -0
- metadata +105 -0
@@ -0,0 +1 @@
|
|
1
|
+
// ------------------------------------------------------------------------------
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#include "platform.h"
|
2
|
+
|
3
|
+
#ifdef __cplusplus
|
4
|
+
extern "C" {
|
5
|
+
#endif
|
6
|
+
|
7
|
+
#define OMNI_ERRNO() errno
|
8
|
+
|
9
|
+
#if MACOSX_UNIX || WINNT || LINUX || SOLARIS || RHAPSODY
|
10
|
+
|
11
|
+
int netConnect(int port, const char *hostName);
|
12
|
+
void netClose(unsigned int socket);
|
13
|
+
int netSndRaw(unsigned char *rawdata, size_t len, int socket);
|
14
|
+
long netRcvToken(unsigned char **buffer, int *bufsize, int socket, unsigned char *decodemap, int *flag);
|
15
|
+
|
16
|
+
int ob_socketread(int socketFD, unsigned char *buffer, size_t byteCount, int *flag);
|
17
|
+
|
18
|
+
int copyAndFixString(unsigned char **tostring, int *tosize, int position, const unsigned char *str, int length, unsigned char *codedmap);
|
19
|
+
|
20
|
+
void ob_intToBytes(unsigned char *buffer, int number);
|
21
|
+
void ob_bytesToInt(int *number, unsigned char *buffer);
|
22
|
+
|
23
|
+
#endif
|
24
|
+
|
25
|
+
#if MACOS_CARBON
|
26
|
+
|
27
|
+
EndpointRef netConnect( int inServerPort, const char * inServerName, OTClientContextPtr outClientContext);
|
28
|
+
void netClose(EndpointRef inEndpoint);
|
29
|
+
int netSndRaw ( unsigned char* inRawdata, size_t inLength, EndpointRef inEndpoint);
|
30
|
+
long netRcvToken (UInt8 **buffer, int *bufsize, EndpointRef inEndpoint, UInt8 *decodemap, int *flag) ;
|
31
|
+
|
32
|
+
int ob_socketread(EndpointRef inEndpoint, void* ioBuffer, size_t inByteCount, int *flag);
|
33
|
+
|
34
|
+
void ob_intToBytes(unsigned char *buffer, int number) ;
|
35
|
+
void ob_bytesToInt(int *number, unsigned char *buffer) ;
|
36
|
+
|
37
|
+
#endif
|
38
|
+
|
39
|
+
#ifdef __cplusplus
|
40
|
+
}
|
41
|
+
#endif
|
42
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
// ------------------------------------------------------------------------------
|
2
|
+
//
|
3
|
+
// Copyright (c) 2004 OpenBase International Ltd.
|
4
|
+
// All rights reserved.
|
5
|
+
//
|
6
|
+
// ------------------------------------------------------------------------------
|
7
|
+
//
|
8
|
+
// FILE: NetClientLib.h
|
9
|
+
//
|
10
|
+
// CREATION DATE: 12 mars 1999
|
11
|
+
//
|
12
|
+
// ------------------------------------------------------------------------------
|
13
|
+
|
14
|
+
#ifndef __NETCLIENTLIB_H__
|
15
|
+
#define __NETCLIENTLIB_H__
|
16
|
+
|
17
|
+
#ifdef MACOS_CARBON
|
18
|
+
#include <size_t.h>
|
19
|
+
#endif
|
20
|
+
|
21
|
+
#include "OpenBaseConnection.h"
|
22
|
+
|
23
|
+
|
24
|
+
#ifdef __cplusplus
|
25
|
+
using namespace std;
|
26
|
+
extern "C" {
|
27
|
+
#endif
|
28
|
+
|
29
|
+
#ifdef MACOS_CARBON
|
30
|
+
#include <OpenTransport.h>
|
31
|
+
#include <OpenTptInternet.h>
|
32
|
+
|
33
|
+
#include "MacCarbon_NetClient.h"
|
34
|
+
#endif
|
35
|
+
|
36
|
+
#ifdef __cplusplus
|
37
|
+
}
|
38
|
+
#endif
|
39
|
+
|
40
|
+
|
41
|
+
#endif // __NETCLIENTLIB_H__
|
@@ -0,0 +1,69 @@
|
|
1
|
+
// OB_Memory.h
|
2
|
+
// Scott Keith
|
3
|
+
// �2002 OpenBase International, Ltd.
|
4
|
+
// All rights reserved.
|
5
|
+
|
6
|
+
|
7
|
+
#include "platform.h"
|
8
|
+
|
9
|
+
#ifndef _OB_MEMORY_H
|
10
|
+
#define _OB_MEMORY_H
|
11
|
+
|
12
|
+
/*
|
13
|
+
#ifndef _OB_MEMORY_H
|
14
|
+
#include "OB_Memory.h"
|
15
|
+
#endif
|
16
|
+
*/
|
17
|
+
|
18
|
+
#ifdef __cplusplus
|
19
|
+
extern "C" {
|
20
|
+
#endif
|
21
|
+
|
22
|
+
#ifdef TARGET_API_MAC_OS8
|
23
|
+
#define ob_malloc(x) malloc(x)
|
24
|
+
#define ob_calloc(s, x) calloc(s, x)
|
25
|
+
#define ob_realloc(m, x) realloc(m, x)
|
26
|
+
#define ob_free(x) free(x)
|
27
|
+
#endif
|
28
|
+
|
29
|
+
#ifdef TARGET_API_MAC_CARBON
|
30
|
+
#define ob_malloc(x) malloc(x)
|
31
|
+
#define ob_calloc(s, x) calloc(s, x)
|
32
|
+
#define ob_realloc(m, x) realloc(m, x)
|
33
|
+
#define ob_free(x) free(x)
|
34
|
+
#endif
|
35
|
+
|
36
|
+
|
37
|
+
#ifdef WINNT
|
38
|
+
|
39
|
+
#if 0
|
40
|
+
#define ob_malloc(x) HeapAlloc(GetProcessHeap(), 0, x)
|
41
|
+
#define ob_calloc(s, x) HeapAlloc(GetProcessHeap(), 0, s * x)
|
42
|
+
#define ob_realloc(m, x) HeapReAlloc(GetProcessHeap(), 0, m, x)
|
43
|
+
#define ob_free(x) HeapFree(GetProcessHeap(), 0, x)
|
44
|
+
#elif 0
|
45
|
+
#define ob_malloc(x) GlobalAlloc(0, x)
|
46
|
+
#define ob_calloc(s, x) GlobalAlloc(0, s * x)
|
47
|
+
#define ob_realloc(m, x) GlobalReAlloc(m, x, 0)
|
48
|
+
#define ob_free(x) GlobalFree(x)
|
49
|
+
#else
|
50
|
+
#define ob_malloc(x) malloc(x)
|
51
|
+
#define ob_calloc(s, x) calloc(s, x)
|
52
|
+
#define ob_realloc(m, x) realloc(m, x)
|
53
|
+
#define ob_free(x) free(x)
|
54
|
+
#endif
|
55
|
+
|
56
|
+
#endif
|
57
|
+
|
58
|
+
#ifdef MOSX_UNIX
|
59
|
+
#define ob_malloc(x) malloc(x)
|
60
|
+
#define ob_calloc(s, x) calloc(s, x)
|
61
|
+
#define ob_realloc(m, x) realloc(m, x)
|
62
|
+
#define ob_free(x) free(x)
|
63
|
+
#endif
|
64
|
+
|
65
|
+
#ifdef __cplusplus
|
66
|
+
}
|
67
|
+
#endif
|
68
|
+
|
69
|
+
#endif
|
@@ -0,0 +1,227 @@
|
|
1
|
+
/*
|
2
|
+
OpenBaseAdmin.h
|
3
|
+
OpenBase Unified Client
|
4
|
+
�1996-2002 OpenBase International, Ltd.
|
5
|
+
All rights reserved
|
6
|
+
|
7
|
+
Derived from OpenBaseAdmin.h by Scott Keith.
|
8
|
+
|
9
|
+
Disclaimer:
|
10
|
+
-----------
|
11
|
+
THIS SOFTWARE IS FURNISHED ON AN "AS-IS" BASIS. OPENBASE MAKES NO WARRANTIES OF
|
12
|
+
ANY KIND, EITHER EXPRESS OR IMPLIED, AS TO ANY MATTER WHATSOEVER, INCLUDING WITHOUT
|
13
|
+
LIMITATION THE CONDITION, MERCHANTABILITY, OR FITNESS FOR ANY PARTICULAR PURPOSE OF
|
14
|
+
THIS SOFTWARE. OPENBASE DOES NOT ASSUME ANY LIABILITY REGARDING USE OF, OR ANY
|
15
|
+
DEFECT IN, THIS SOFTWARE. IN NO EVENT SHALL OPENBASE BE LIABLE FOR ANY INDIRECT,
|
16
|
+
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, EVEN IF IT HAS BEEN ADVISED OF THE
|
17
|
+
POSSIBILITY OF SUCH DAMAGE.
|
18
|
+
|
19
|
+
WARNING: MODIFY THIS SOURCE CODE AT YOUR OWN RISK. IF YOU DON'T NEED TO MODIFY THE
|
20
|
+
OPENBASE API SOURCE, WE RECOMMEND THAT YOU USE THE COMPILED LIBRARIES.
|
21
|
+
*/
|
22
|
+
|
23
|
+
#ifndef _OPENBASE_ADMIN_H
|
24
|
+
#define _OPENBASE_ADMIN_H
|
25
|
+
|
26
|
+
#ifdef __cplusplus
|
27
|
+
extern "C" {
|
28
|
+
#endif
|
29
|
+
|
30
|
+
//================================================================================
|
31
|
+
// Includes
|
32
|
+
//================================================================================
|
33
|
+
|
34
|
+
//#ifndef _OB_API_HEADER_H
|
35
|
+
//#include "OB_API_Header.h"
|
36
|
+
//#endif
|
37
|
+
|
38
|
+
//#ifndef _OB_COMMUNICATIONS_H
|
39
|
+
//#include "OB_Communications.h"
|
40
|
+
//#endif
|
41
|
+
|
42
|
+
//================================================================================
|
43
|
+
// Structures
|
44
|
+
//================================================================================
|
45
|
+
|
46
|
+
//--------------------------------------------------------------------------------
|
47
|
+
// OpenBaseAdminConnection
|
48
|
+
//--------------------------------------------------------------------------------
|
49
|
+
|
50
|
+
typedef struct OpenBaseAdminConnectionStruct
|
51
|
+
{
|
52
|
+
NetConn *connection;
|
53
|
+
NetConn *info_connection;
|
54
|
+
double lastchanged;
|
55
|
+
char hostAddress[100];
|
56
|
+
} OpenBaseAdminConnection;
|
57
|
+
|
58
|
+
//--------------------------------------------------------------------------------
|
59
|
+
// OpenBaseDatabaseList
|
60
|
+
//--------------------------------------------------------------------------------
|
61
|
+
|
62
|
+
#define OB_MAX_DATABASES 500
|
63
|
+
|
64
|
+
typedef struct OpenBaseDatabaseListStruct
|
65
|
+
{
|
66
|
+
char* databases[OB_MAX_DATABASES];
|
67
|
+
char* hosts[OB_MAX_DATABASES];
|
68
|
+
char* keys[OB_MAX_DATABASES];
|
69
|
+
int databaseCount;
|
70
|
+
} OpenBaseDatabaseList;
|
71
|
+
|
72
|
+
//================================================================================
|
73
|
+
// Functions
|
74
|
+
//================================================================================
|
75
|
+
|
76
|
+
//--------------------------------------------------------------------------------
|
77
|
+
// Connecting and Disconnecting
|
78
|
+
//--------------------------------------------------------------------------------
|
79
|
+
|
80
|
+
// connecting to the openexec process
|
81
|
+
OpenBaseAdminConnection* oba_newAdminConnection(const char *hostName);
|
82
|
+
|
83
|
+
// destroying the connection to the openexec process
|
84
|
+
void oba_deallocAdminConnection(OpenBaseAdminConnection* admin_conn);
|
85
|
+
|
86
|
+
//--------------------------------------------------------------------------------
|
87
|
+
// performing admin functions with the openexec process
|
88
|
+
//--------------------------------------------------------------------------------
|
89
|
+
|
90
|
+
const char *oba_databaseHostInfoString(OpenBaseAdminConnection* admin_conn);
|
91
|
+
// returns "hostname|ethernetaddress|ipaddress|OpenBaseVersion|Platform"
|
92
|
+
|
93
|
+
int oba_checkStatesChanged(OpenBaseAdminConnection* admin_conn);
|
94
|
+
// returns 1 or 0 depending on whether any of the states have changed since the last call
|
95
|
+
|
96
|
+
int oba_databaseStateList(OpenBaseAdminConnection* admin_conn, const char **states, const char **alerts);
|
97
|
+
|
98
|
+
// The state string gives a list of databases that have state information and their corresponding state.
|
99
|
+
// Databases that are not running will not be listed.
|
100
|
+
//
|
101
|
+
// states = "databaseName:stateString|databaseName:stateString|databaseName:stateString"
|
102
|
+
// -- stateString can contain % done using the format: stateString = "cleanup%49"
|
103
|
+
// -- other stateStrings include: running, starting, stopping
|
104
|
+
//
|
105
|
+
// Alerts are used for alerting the user of an error condition in the log. Alerts are
|
106
|
+
// conveyed in the following format:
|
107
|
+
//
|
108
|
+
// alerts = "databaseName:alert%updateNumber|databaseName:alert%updateNumber|databaseName:alert%updateNumber"
|
109
|
+
// -- alert can be any of: none, warning, error, severe
|
110
|
+
// -- updateNumber is a timestamp which changes only when there is a new error in the log since the last time we checked.
|
111
|
+
//
|
112
|
+
|
113
|
+
|
114
|
+
OpenBaseDatabaseList* oba_getDatabaseList(OpenBaseAdminConnection* admin_conn, const char* read_password);
|
115
|
+
// get the database list
|
116
|
+
// caller must deallocate result with oba_deallocDatabaseList
|
117
|
+
|
118
|
+
void oba_deallocDatabaseList(OpenBaseDatabaseList* database_list);
|
119
|
+
// free the result
|
120
|
+
|
121
|
+
int oba_startDatabase(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *password);
|
122
|
+
int oba_stopDatabase(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *password);
|
123
|
+
|
124
|
+
int oba_newDatabase(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *password);
|
125
|
+
int oba_duplicateDatabase(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *duplicatedName, const char *password);
|
126
|
+
int oba_renameDatabase(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *newDatabaseName, const char *password);
|
127
|
+
int oba_moveDatabase(OpenBaseAdminConnection *adminConnection, const char *sourceDatabaseName, const char *sourcePassword, const char *targetHost, const char *targetHostPassword);
|
128
|
+
int oba_deleteDatabase(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *password);
|
129
|
+
|
130
|
+
int oba_checkHostPassword(OpenBaseAdminConnection *adminConnection, const char *password);
|
131
|
+
int oba_setHostPassword(OpenBaseAdminConnection *adminConnection, const char *oldpassword, const char *newpassword);
|
132
|
+
|
133
|
+
int oba_checkReadPassword(OpenBaseAdminConnection *adminConnection, const char *password);
|
134
|
+
int oba_setReadPassword(OpenBaseAdminConnection *adminConnection, const char *oldpassword, const char *newpassword);
|
135
|
+
|
136
|
+
int oba_encodingForDatabase(OpenBaseAdminConnection *adminConnection, const char *database, char **encoding, const char *password);
|
137
|
+
int oba_setEncodingForDatabase(OpenBaseAdminConnection *adminConnection, const char *database, const char *encoding, const char *password);
|
138
|
+
|
139
|
+
int oba_databaseDescription(OpenBaseAdminConnection *adminConnection, const char *databaseName, char **databaseDescription, char **bubbleColor, char **size);
|
140
|
+
int oba_setDatabaseDescription(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *password, const char *description, const char *bubbleColor);
|
141
|
+
|
142
|
+
const char *oba_autoStartDatabaseList(OpenBaseAdminConnection *adminConnection, const char *password);
|
143
|
+
int oba_setAutoStartDatabase(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *password, const char *yn);
|
144
|
+
|
145
|
+
const char *oba_getLogFile(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *password);
|
146
|
+
const char *oba_getServerMacAddress(OpenBaseAdminConnection *adminConnection);
|
147
|
+
|
148
|
+
int oba_getDatabasePreferences(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *password,
|
149
|
+
const char **sortChars,
|
150
|
+
const char **sortCharsCaps,
|
151
|
+
const char **moneyPostfix,
|
152
|
+
const char **moneyPrefix,
|
153
|
+
const char **date,
|
154
|
+
const char **time,
|
155
|
+
const char **logSQL,
|
156
|
+
const char **logSQLFile,
|
157
|
+
const char **compressedBackup,
|
158
|
+
const char **compressedBackupTime,
|
159
|
+
const char **compressedBackupDay,
|
160
|
+
const char **compressedBackupDirectory,
|
161
|
+
const char **asciiBackup,
|
162
|
+
const char **asciiBackupTime,
|
163
|
+
const char **asciiBackupDay,
|
164
|
+
const char **asciiBackupDirectory,
|
165
|
+
const char **createClientMirror,
|
166
|
+
const char **createMasterMirror,
|
167
|
+
const char **clientClusterName,
|
168
|
+
const char **masterClusterName);
|
169
|
+
|
170
|
+
int oba_setDatabasePreferences(OpenBaseAdminConnection *adminConnection, const char *databaseName,
|
171
|
+
const char *password,
|
172
|
+
const char *sortChars,
|
173
|
+
const char *sortCharsCaps,
|
174
|
+
const char *moneyPostfix,
|
175
|
+
const char *moneyPrefix,
|
176
|
+
const char *date,
|
177
|
+
const char *time,
|
178
|
+
const char *logSQL,
|
179
|
+
const char *logSQLFile,
|
180
|
+
const char *compressedBackup,
|
181
|
+
const char *compressedBackupTime,
|
182
|
+
const char *compressedBackupDay,
|
183
|
+
const char *compressedBackupDirectory,
|
184
|
+
const char *asciiBackup,
|
185
|
+
const char *asciiBackupTime,
|
186
|
+
const char *asciiBackupDay,
|
187
|
+
const char *asciiBackupDirectory,
|
188
|
+
const char *createClientMirror,
|
189
|
+
const char *createMasterMirror,
|
190
|
+
const char *clientClusterName,
|
191
|
+
const char *masterClusterName,
|
192
|
+
const char *dbSerialNumber,
|
193
|
+
const char *dbAuthorization);
|
194
|
+
|
195
|
+
int oba_getInitializationForCluster(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *clusterName, char **targetDatabase, char **targetHost,char **targetUser, char **targetPassword, int *frequency, const char *password);
|
196
|
+
int oba_setInitializationForCluster(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *clusterName, const char *targetDatabase, const char *targetHost, const char *targetUser, const char *targetPassword, int frequency, const char *password);
|
197
|
+
int oba_createClusterFile(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *clusterName, const char *password);
|
198
|
+
int oba_removeCluster(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *clusterName, const char *password);
|
199
|
+
int oba_clearCluster(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *clusterName, const char *password);
|
200
|
+
|
201
|
+
|
202
|
+
int oba_encryptionForDatabase(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *password);
|
203
|
+
int oba_setEncryptionForDatabase(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *password, int yn);
|
204
|
+
int oba_portNumberForDatabase(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *password);
|
205
|
+
int oba_setPortNumberForDatabase(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *password, int port);
|
206
|
+
int oba_notificationForDatabase(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *password);
|
207
|
+
int oba_setNotificationForDatabase(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *password, int notify);
|
208
|
+
int oba_distributedKeyForDatabase(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *password, int *databaseKey, int *multiplier);
|
209
|
+
int oba_setDistributedKeyForDatabase(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *password, int databaseKey, int multiplier);
|
210
|
+
int oba_transactionTimeout(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *password, int *trans_timeout, int *connect_timeout);
|
211
|
+
int oba_setTransactionTimeout(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *password, int trans_timeout, int connect_timeout);
|
212
|
+
int oba_isSimulationModeOnForDatabase(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *password) ;
|
213
|
+
int oba_setSimulationMode(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *password, int yn);
|
214
|
+
int oba_isNoDeleteModeOnForDatabase(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *password) ;
|
215
|
+
int oba_setNoDeleteMode(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *password, int yn);
|
216
|
+
int oba_isSafeSQLModeForDatabase(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *password) ;
|
217
|
+
int oba_setSafeSQLMode(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *password, int yn);
|
218
|
+
const char *oba_automaticTriggerFileForDatabase(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *password) ;
|
219
|
+
int oba_setAutomaticTriggerFileForDatabase(OpenBaseAdminConnection *adminConnection, const char *databaseName, const char *password, const char *filecontent);
|
220
|
+
int oba_restartProcesses(OpenBaseAdminConnection *adminConnection, const char *password);
|
221
|
+
|
222
|
+
|
223
|
+
#ifdef __cplusplus
|
224
|
+
}
|
225
|
+
#endif
|
226
|
+
|
227
|
+
#endif
|
@@ -0,0 +1,337 @@
|
|
1
|
+
// OpenBaseConnection.h
|
2
|
+
// ------------------------------------------------------------------------------
|
3
|
+
//
|
4
|
+
// Copyright (c) 2004 OpenBase International Ltd.
|
5
|
+
// All rights reserved.
|
6
|
+
//
|
7
|
+
// ------------------------------------------------------------------------------
|
8
|
+
//
|
9
|
+
// [jsh] 11/07/2003
|
10
|
+
// Moved ob_releaseBuffers here from OT_NetClient.cpp.
|
11
|
+
// Added missing prototypes and deleted extraneous ones.
|
12
|
+
// Added const keyword to bind functions.
|
13
|
+
// Added pointer typedefs.
|
14
|
+
// Added functions to access date and time formatting preferences.
|
15
|
+
//
|
16
|
+
// -----------------------------------------------------------------------------
|
17
|
+
|
18
|
+
/* Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001 OpenBase International */
|
19
|
+
/* All rights reserved. */
|
20
|
+
/* OpenBaseConnection.h created by Jerome Lebel on Wed 14-Jan-1998 */
|
21
|
+
|
22
|
+
#ifndef __OPENBASECONNECTION_H__
|
23
|
+
#define __OPENBASECONNECTION_H__
|
24
|
+
|
25
|
+
#include "OpenBaseEncoding.h"
|
26
|
+
|
27
|
+
#ifdef TARGET_API_MAC_CARBON
|
28
|
+
//#include <OpenTptInternet.h>
|
29
|
+
#endif
|
30
|
+
|
31
|
+
#ifdef __cplusplus
|
32
|
+
extern "C" {
|
33
|
+
#endif
|
34
|
+
|
35
|
+
enum
|
36
|
+
{
|
37
|
+
OBTYPE_CHAR = 1,
|
38
|
+
OBTYPE_INT = 2,
|
39
|
+
OBTYPE_FLOAT = 3,
|
40
|
+
OBTYPE_LONG = 4,
|
41
|
+
OBTYPE_MONEY = 5,
|
42
|
+
OBTYPE_DATE = 6,
|
43
|
+
OBTYPE_TIME = 7,
|
44
|
+
OBTYPE_OBJECT = 8,
|
45
|
+
OBTYPE_DATETIME = 9,
|
46
|
+
OBTYPE_LONGLONG = 10,
|
47
|
+
OBTYPE_BOOLEAN = 11, // Added by Brad 20-Feb-2002
|
48
|
+
OBTYPE_BINARY = 12, // Added by Brad 21-Feb-2002
|
49
|
+
OBTYPE_OBJECT_TEXT = 13,
|
50
|
+
OBTYPE_TIMESTAMP = 14
|
51
|
+
};
|
52
|
+
|
53
|
+
enum
|
54
|
+
{
|
55
|
+
ERR_SFTUSRLIM = 1,
|
56
|
+
ERR_DBSUSRLIM = 2,
|
57
|
+
ERR_DBSLIM = 3,
|
58
|
+
ERR_DBSDUP = 4,
|
59
|
+
ERR_NOSERVER = 5,
|
60
|
+
ERR_INCORRECT_LOGIN = 6,
|
61
|
+
ERR_SERVER_RESTARTING = 7,
|
62
|
+
ERR_WEBOBJECTS_VIOLATION = 8,
|
63
|
+
ERR_LITE_VIOLATION = 9
|
64
|
+
};
|
65
|
+
|
66
|
+
enum
|
67
|
+
{
|
68
|
+
OB_MAX_KEYS = 30,
|
69
|
+
OB_MAX_COLUMNS = 400
|
70
|
+
};
|
71
|
+
|
72
|
+
// -----------------------------------------------------------------------------
|
73
|
+
|
74
|
+
struct NetConnStruct
|
75
|
+
{
|
76
|
+
unsigned char* resultKeys[OB_MAX_KEYS];
|
77
|
+
unsigned char* resultValues[OB_MAX_KEYS];
|
78
|
+
int keyBufferSize[OB_MAX_KEYS];
|
79
|
+
int valueBufferSize[OB_MAX_KEYS];
|
80
|
+
int resultLength[OB_MAX_KEYS];
|
81
|
+
int numberOfKeys;
|
82
|
+
int didInit;
|
83
|
+
int connectionPort;
|
84
|
+
unsigned char* dictionaryBuffer;
|
85
|
+
int dictionaryBufferSize;
|
86
|
+
int dictionaryLength;
|
87
|
+
|
88
|
+
/* for buffered reading */
|
89
|
+
int readPosition;
|
90
|
+
|
91
|
+
/* for encryption */
|
92
|
+
int privateConnection;
|
93
|
+
unsigned char* privateEncriptionMap;
|
94
|
+
unsigned char* privateDecriptionMap;
|
95
|
+
|
96
|
+
// addresses of client and server
|
97
|
+
char clientAddress[256];
|
98
|
+
char serverAddress[256];
|
99
|
+
|
100
|
+
#ifdef MACOS_CARBON
|
101
|
+
OTClientContextPtr outClientContext;
|
102
|
+
EndpointRef socketConnection;
|
103
|
+
#else
|
104
|
+
int socketConnection;
|
105
|
+
#endif
|
106
|
+
|
107
|
+
};
|
108
|
+
|
109
|
+
typedef struct NetConnStruct NetConn;
|
110
|
+
typedef NetConn * NetConnPtr;
|
111
|
+
// -----------------------------------------------------------------------------
|
112
|
+
|
113
|
+
struct OpenBaseResultDataStruct
|
114
|
+
{
|
115
|
+
struct OpenBaseResultDataStruct *next;
|
116
|
+
|
117
|
+
// result data
|
118
|
+
char *resultData;
|
119
|
+
int resultDataLength;
|
120
|
+
int resultDataNeedsDealloc;
|
121
|
+
} ;
|
122
|
+
|
123
|
+
typedef struct OpenBaseResultDataStruct OpenBaseResultData;
|
124
|
+
typedef OpenBaseResultData * OpenBaseResultDataPtr;
|
125
|
+
|
126
|
+
// -----------------------------------------------------------------------------
|
127
|
+
|
128
|
+
struct OpenBaseCursorStruct
|
129
|
+
{
|
130
|
+
struct OpenBaseCursorStruct *pushedResult;
|
131
|
+
|
132
|
+
// result data
|
133
|
+
//char *resultData;
|
134
|
+
//int resultDataLength;
|
135
|
+
OpenBaseResultDataPtr resultPage;
|
136
|
+
|
137
|
+
// resultInformation
|
138
|
+
int maxInitializedTables;
|
139
|
+
int maxInitializedColumns;
|
140
|
+
char *tableNames[OB_MAX_COLUMNS];
|
141
|
+
char *columnNames[OB_MAX_COLUMNS];
|
142
|
+
char targetTypes[OB_MAX_COLUMNS];
|
143
|
+
unsigned char resultIsNull[OB_MAX_COLUMNS];
|
144
|
+
int columnsReturned;
|
145
|
+
int rowsAffected;
|
146
|
+
|
147
|
+
char *bindVariables[OB_MAX_COLUMNS];
|
148
|
+
char bindTargetTypes[OB_MAX_COLUMNS];
|
149
|
+
int maxVariablesBound;
|
150
|
+
|
151
|
+
// estimated column widths
|
152
|
+
int columnWidths[OB_MAX_COLUMNS];
|
153
|
+
|
154
|
+
// state information
|
155
|
+
int readMoreResult;
|
156
|
+
int readPosition;
|
157
|
+
const char *errorMessage;
|
158
|
+
int skipConvert;
|
159
|
+
|
160
|
+
};
|
161
|
+
|
162
|
+
typedef struct OpenBaseCursorStruct OpenBaseCursor;
|
163
|
+
typedef OpenBaseCursor * OpenBaseCursorPtr;
|
164
|
+
|
165
|
+
// -----------------------------------------------------------------------------
|
166
|
+
|
167
|
+
struct OpenBaseStruct
|
168
|
+
{
|
169
|
+
NetConnPtr connection;
|
170
|
+
NetConnPtr altConnection;
|
171
|
+
OpenBaseCursorPtr resultset;
|
172
|
+
|
173
|
+
/* login information */
|
174
|
+
char databaseName[100];
|
175
|
+
char databaseHost[100];
|
176
|
+
char databaseLogin[100];
|
177
|
+
char databasePassword[100];
|
178
|
+
char softwareId[100];
|
179
|
+
char clientName[100];
|
180
|
+
|
181
|
+
char tmp[100];
|
182
|
+
/* SQLBuffer */
|
183
|
+
char *sqlBuffer;
|
184
|
+
int sqlBufferSize;
|
185
|
+
int position;
|
186
|
+
|
187
|
+
|
188
|
+
// prepared SQL
|
189
|
+
char *preparedSQL[OB_MAX_COLUMNS];
|
190
|
+
int numberOfPreparedValues;
|
191
|
+
int prepareValuePosition;
|
192
|
+
|
193
|
+
char invalidate;
|
194
|
+
int databaseEncoding;
|
195
|
+
int clientEncoding;
|
196
|
+
char insertedRowidValue[30];
|
197
|
+
|
198
|
+
int autoReconnectFlag;
|
199
|
+
int transactionInProgress;
|
200
|
+
char secondaryHost[100];
|
201
|
+
char secondaryDatabase[100];
|
202
|
+
|
203
|
+
#ifdef MACOS_CARBON
|
204
|
+
OTClientContextPtr outClientContext;
|
205
|
+
#endif
|
206
|
+
|
207
|
+
};
|
208
|
+
|
209
|
+
typedef struct OpenBaseStruct OpenBase;
|
210
|
+
typedef OpenBase * OpenBasePtr;
|
211
|
+
|
212
|
+
// -----------------------------------------------------------------------------
|
213
|
+
|
214
|
+
#ifdef MACOS_CARBON
|
215
|
+
#if !defined(TARGET_API_MAC_CARBON) && !defined(TARGET_API_MAC_OS8)
|
216
|
+
#warning You need to define TARGET_API_MAC_CARBON or TARGET_API_MAC_OS8 according to the target plateform
|
217
|
+
#endif
|
218
|
+
#endif
|
219
|
+
|
220
|
+
// -----------------------------------------------------------------------------
|
221
|
+
|
222
|
+
#ifdef MACOS_CARBON
|
223
|
+
|
224
|
+
char *MapNameToAddress(char* domainName, char* ipAddress, OTClientContextPtr outClientContext);
|
225
|
+
|
226
|
+
#ifdef TARGET_API_MAC_CARBON
|
227
|
+
OpenBasePtr ob_newConnection(OTClientContextPtr newClientContext);
|
228
|
+
#else
|
229
|
+
OpenBasePtr ob_newConnection(void);
|
230
|
+
#endif
|
231
|
+
|
232
|
+
#else
|
233
|
+
OpenBasePtr ob_newConnection(void);
|
234
|
+
#endif
|
235
|
+
|
236
|
+
|
237
|
+
int ob_abortFetch(OpenBasePtr conn);
|
238
|
+
int ob_beginTransaction(OpenBasePtr conn);
|
239
|
+
int ob_beginPassiveTransaction(OpenBasePtr conn); //jsh] 10/17/2003
|
240
|
+
int ob_isTransactionInProgress(OpenBasePtr conn);
|
241
|
+
void ob_bindDouble(OpenBasePtr conn, const double* var);
|
242
|
+
void ob_bindBoolean(OpenBasePtr conn, const int *var);
|
243
|
+
void ob_bindInt(OpenBasePtr conn, const int* var);
|
244
|
+
void ob_bindLong(OpenBasePtr conn, const long* var);
|
245
|
+
void ob_bindLongLong(OpenBasePtr conn, const int* var);
|
246
|
+
void ob_bindString(OpenBasePtr conn, const char* var);
|
247
|
+
void ob_bindBinary(OpenBasePtr conn, const char *var);
|
248
|
+
int ob_bufferHasCommands(OpenBasePtr conn);
|
249
|
+
void ob_clearCommands(OpenBasePtr conn);
|
250
|
+
char* ob_commandBuffer(OpenBasePtr conn);
|
251
|
+
int ob_commitTransaction(OpenBasePtr conn);
|
252
|
+
const char* ob_connectErrorMessage(OpenBasePtr conn);
|
253
|
+
int ob_checkConnectionToDatabase(OpenBasePtr conn, const char *dbHostName); //jsh] 10/17/2003
|
254
|
+
int ob_connectToDatabase(OpenBasePtr connection,
|
255
|
+
const char* dbName,
|
256
|
+
const char* dbHostName,
|
257
|
+
const char* loginName,
|
258
|
+
const char* passwordString,
|
259
|
+
const char* softwareId,
|
260
|
+
const char* clientName,
|
261
|
+
int* returnCode);
|
262
|
+
|
263
|
+
char* ob_databaseName(OpenBasePtr conn);
|
264
|
+
|
265
|
+
// -----------------------------------------------------------------------------
|
266
|
+
// [jsh] 11/07/2003
|
267
|
+
// date and time formatting used in ob_nextCursorRow
|
268
|
+
// -----------------------------------------------------------------------------
|
269
|
+
int getDateFormatType();
|
270
|
+
void setDateFormatType(int dateFormat);
|
271
|
+
int getTimeFormatType();
|
272
|
+
void setTimeFormatType(int timeFormat);
|
273
|
+
|
274
|
+
// -----------------------------------------------------------------------------
|
275
|
+
// encoding conversion
|
276
|
+
// -----------------------------------------------------------------------------
|
277
|
+
int convertStringToDatabaseEncoding(OpenBasePtr conn, const char *source, char *target);
|
278
|
+
int convertStringFromDatabaseEncoding(OpenBasePtr conn, const char *source, char *target);
|
279
|
+
int convertStringToDatabaseEncodingLength(OpenBasePtr conn, const char *source, char *target, int len);
|
280
|
+
int convertStringFromDatabaseEncodingLength(OpenBasePtr conn, const char *source, char *target, int len);
|
281
|
+
|
282
|
+
// -----------------------------------------------------------------------------
|
283
|
+
|
284
|
+
int ob_databaseEncoding(OpenBasePtr conn);
|
285
|
+
int ob_clientEncoding(OpenBasePtr conn);
|
286
|
+
void ob_setClientEncoding(OpenBasePtr conn, int encoding);
|
287
|
+
void ob_deallocBinary(const char* blob);
|
288
|
+
void ob_deallocConnection(OpenBasePtr conn); // invalidate and free the connection
|
289
|
+
void ob_deallocNetConn(NetConnPtr conn);
|
290
|
+
void ob_deallocCursor(OpenBaseCursorPtr cursor);
|
291
|
+
void ob_deallocResultData(OpenBaseResultDataPtr resultData); // ��� LD September 4, 2001
|
292
|
+
void ob_deallocResultDataList(OpenBaseResultDataPtr resultData); // ��� LD September 4, 2001
|
293
|
+
int ob_executeCommand(OpenBasePtr conn);
|
294
|
+
const char *ob_insertedRowid(OpenBasePtr conn);
|
295
|
+
char* ob_hostName(OpenBasePtr conn);
|
296
|
+
const char* ob_insertBinary(OpenBasePtr conn, const char* data, int size);
|
297
|
+
void ob_invalidate(OpenBasePtr conn);
|
298
|
+
int ob_isColumnNULL(OpenBasePtr conn, int col);
|
299
|
+
int ob_isCursorColumnNULL(OpenBaseCursorPtr cursor, int col);
|
300
|
+
const char* ob_loginName(OpenBasePtr conn);
|
301
|
+
void ob_makeCommand(OpenBasePtr conn, const char* cmd);
|
302
|
+
void ob_makeCommandLength(OpenBasePtr conn, const char* cmd, int length);
|
303
|
+
void ob_makeCommandLengthAndEncode(OpenBasePtr conn, const char *cmd, int length);
|
304
|
+
void ob_makeCommandAndEncode(OpenBasePtr conn, const char *cmd);
|
305
|
+
int ob_markRow(OpenBasePtr conn, const char* anId, const char* tableName);
|
306
|
+
int ob_markRowAlreadyMarkedByUser(OpenBasePtr conn, const char* anId, const char* tableName, char* userName);
|
307
|
+
OpenBaseCursorPtr ob_retrieveCursor(OpenBasePtr conn); // return a result cursor
|
308
|
+
OpenBaseCursorPtr ob_newResult(); // ��� LD September 4, 2001
|
309
|
+
OpenBaseResultDataPtr ob_newResultData(); // ��� LD September 4, 2001
|
310
|
+
NetConnPtr ob_newNetConn(); //[jsh] 11/07/2003
|
311
|
+
int ob_nextCursorRow(OpenBaseCursorPtr cursor); // replacement for ob_nextRow
|
312
|
+
int ob_nextRow(OpenBasePtr conn); // the old routine
|
313
|
+
char* ob_password(OpenBasePtr conn);
|
314
|
+
void ob_releaseBuffers(OpenBasePtr conn); //[jsh] 11/07/2003
|
315
|
+
int ob_removeMarkOnRow(OpenBasePtr conn, const char* anId, const char* tableName);
|
316
|
+
int ob_resultColumnCount(OpenBasePtr conn);
|
317
|
+
char* ob_resultColumnName(OpenBasePtr conn, int col);
|
318
|
+
char* ob_cursorColumnName(OpenBaseCursorPtr cursor, int col);
|
319
|
+
int ob_resultColumnType(OpenBasePtr conn, int col);
|
320
|
+
int ob_resultReturned(OpenBasePtr conn);
|
321
|
+
char* ob_resultTableName(OpenBasePtr conn, int col);
|
322
|
+
const char* ob_retrieveBinary(OpenBasePtr conn, const char* blobIdentifier, int* returnSize);
|
323
|
+
int ob_rollbackTransaction(OpenBasePtr conn);
|
324
|
+
int ob_rowsAffected(OpenBasePtr conn);
|
325
|
+
const char* ob_serverMessage(OpenBasePtr conn);
|
326
|
+
const char* ob_uniqueRowIdForTable(OpenBasePtr conn, const char* tblname);
|
327
|
+
const char* ob_uniqueRowIdForTableColumn(OpenBasePtr conn, const char* tblname, const char* colname);
|
328
|
+
int _ob_widthForColumn(OpenBasePtr conn, int col);
|
329
|
+
void _ob_estimateColumnWidths(OpenBasePtr conn);
|
330
|
+
// -------------------------------------------------------------------------------
|
331
|
+
char* _getEncoding (OpenBase* conn, char* encoding);
|
332
|
+
const int ob_isConnected(OpenBase* conn);
|
333
|
+
#ifdef __cplusplus
|
334
|
+
}
|
335
|
+
#endif
|
336
|
+
|
337
|
+
#endif // __OPENBASECONNECTION_H__
|