sedna 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/{CHANGES → CHANGES.rdoc} +9 -0
- data/{README → README.rdoc} +23 -25
- data/Rakefile +32 -9
- data/ext/{extconf.rb → sedna/extconf.rb} +33 -21
- data/ext/{sedna.c → sedna/sedna.c} +48 -40
- data/test/sedna_test.rb +9 -9
- data/vendor/sedna/AUTHORS +18 -0
- data/vendor/sedna/COPYRIGHT +90 -0
- data/vendor/sedna/LICENSE +202 -0
- data/vendor/sedna/Makefile.include +423 -0
- data/vendor/sedna/Makefile.platform +31 -0
- data/vendor/sedna/depend.sed +48 -0
- data/vendor/sedna/driver/c/Makefile +98 -0
- data/vendor/sedna/driver/c/libsedna.c +1998 -0
- data/vendor/sedna/driver/c/libsedna.h +199 -0
- data/vendor/sedna/driver/c/sednamt.def +21 -0
- data/vendor/sedna/driver/c/sp_defs.h +186 -0
- data/vendor/sedna/kernel/common/FastXptrHash.cpp +101 -0
- data/vendor/sedna/kernel/common/IntHash.h +314 -0
- data/vendor/sedna/kernel/common/IntList.h +224 -0
- data/vendor/sedna/kernel/common/Makefile +30 -0
- data/vendor/sedna/kernel/common/SSMMsg.cpp +459 -0
- data/vendor/sedna/kernel/common/SSMMsg.h +142 -0
- data/vendor/sedna/kernel/common/XptrHash.h +435 -0
- data/vendor/sedna/kernel/common/argtable.c +972 -0
- data/vendor/sedna/kernel/common/argtable.h +896 -0
- data/vendor/sedna/kernel/common/base.cpp +339 -0
- data/vendor/sedna/kernel/common/base.h +226 -0
- data/vendor/sedna/kernel/common/bit_set.cpp +157 -0
- data/vendor/sedna/kernel/common/bit_set.h +55 -0
- data/vendor/sedna/kernel/common/commutil.h +67 -0
- data/vendor/sedna/kernel/common/config.h +62 -0
- data/vendor/sedna/kernel/common/counted_ptr.h +74 -0
- data/vendor/sedna/kernel/common/errdbg/ErrorCodes.java +1056 -0
- data/vendor/sedna/kernel/common/errdbg/Makefile +34 -0
- data/vendor/sedna/kernel/common/errdbg/assert.c +133 -0
- data/vendor/sedna/kernel/common/errdbg/d_printf.c +150 -0
- data/vendor/sedna/kernel/common/errdbg/d_printf.h +91 -0
- data/vendor/sedna/kernel/common/errdbg/error.codes +1743 -0
- data/vendor/sedna/kernel/common/errdbg/error_codes.c +531 -0
- data/vendor/sedna/kernel/common/errdbg/error_codes.h +549 -0
- data/vendor/sedna/kernel/common/errdbg/error_codes_scm.scm +527 -0
- data/vendor/sedna/kernel/common/errdbg/event_log.c +956 -0
- data/vendor/sedna/kernel/common/errdbg/event_log.h +226 -0
- data/vendor/sedna/kernel/common/errdbg/exceptions.cpp +155 -0
- data/vendor/sedna/kernel/common/errdbg/exceptions.h +559 -0
- data/vendor/sedna/kernel/common/errdbg/gen_error_codes +0 -0
- data/vendor/sedna/kernel/common/errdbg/gen_error_codes.c +345 -0
- data/vendor/sedna/kernel/common/gmm.cpp +192 -0
- data/vendor/sedna/kernel/common/gmm.h +29 -0
- data/vendor/sedna/kernel/common/ipc_ops.cpp +435 -0
- data/vendor/sedna/kernel/common/ipc_ops.h +51 -0
- data/vendor/sedna/kernel/common/lfsGlobals.h +12 -0
- data/vendor/sedna/kernel/common/lm_base.h +90 -0
- data/vendor/sedna/kernel/common/mmgr/Makefile +11 -0
- data/vendor/sedna/kernel/common/mmgr/aset.c +1185 -0
- data/vendor/sedna/kernel/common/mmgr/mcxt.c +741 -0
- data/vendor/sedna/kernel/common/mmgr/memnodes.h +70 -0
- data/vendor/sedna/kernel/common/mmgr/memutils.h +145 -0
- data/vendor/sedna/kernel/common/mmgr/se_alloc.h +321 -0
- data/vendor/sedna/kernel/common/mmgr/track.c +214 -0
- data/vendor/sedna/kernel/common/pping.cpp +672 -0
- data/vendor/sedna/kernel/common/pping.h +119 -0
- data/vendor/sedna/kernel/common/rcv_test.cpp +273 -0
- data/vendor/sedna/kernel/common/rcv_test.h +19 -0
- data/vendor/sedna/kernel/common/sedna.c +128 -0
- data/vendor/sedna/kernel/common/sedna.h +49 -0
- data/vendor/sedna/kernel/common/sedna_ef.h +52 -0
- data/vendor/sedna/kernel/common/sm_vmm_data.h +144 -0
- data/vendor/sedna/kernel/common/sp.c +93 -0
- data/vendor/sedna/kernel/common/sp.h +36 -0
- data/vendor/sedna/kernel/common/st/Makefile +20 -0
- data/vendor/sedna/kernel/common/st/os_linux/stacktrace.c +213 -0
- data/vendor/sedna/kernel/common/st/os_nt/stacktrace.c +338 -0
- data/vendor/sedna/kernel/common/st/os_other/stacktrace.c +39 -0
- data/vendor/sedna/kernel/common/st/stacktrace.h +72 -0
- data/vendor/sedna/kernel/common/st/stacktrfmt.c +64 -0
- data/vendor/sedna/kernel/common/tr_debug.cpp +112 -0
- data/vendor/sedna/kernel/common/tr_debug.h +22 -0
- data/vendor/sedna/kernel/common/u/Makefile +14 -0
- data/vendor/sedna/kernel/common/u/u.c +268 -0
- data/vendor/sedna/kernel/common/u/u.h +715 -0
- data/vendor/sedna/kernel/common/u/uatomic.h +12 -0
- data/vendor/sedna/kernel/common/u/udl.h +31 -0
- data/vendor/sedna/kernel/common/u/uevent.c +406 -0
- data/vendor/sedna/kernel/common/u/uevent.h +71 -0
- data/vendor/sedna/kernel/common/u/ugnames.cpp +330 -0
- data/vendor/sedna/kernel/common/u/ugnames.h +134 -0
- data/vendor/sedna/kernel/common/u/uhash_map.h +77 -0
- data/vendor/sedna/kernel/common/u/uhdd.c +1018 -0
- data/vendor/sedna/kernel/common/u/uhdd.h +206 -0
- data/vendor/sedna/kernel/common/u/ummap.cpp +268 -0
- data/vendor/sedna/kernel/common/u/ummap.h +60 -0
- data/vendor/sedna/kernel/common/u/umutex.c +145 -0
- data/vendor/sedna/kernel/common/u/umutex.h +65 -0
- data/vendor/sedna/kernel/common/u/upipe.cpp +244 -0
- data/vendor/sedna/kernel/common/u/upipe.h +74 -0
- data/vendor/sedna/kernel/common/u/uprocess.c +767 -0
- data/vendor/sedna/kernel/common/u/uprocess.h +91 -0
- data/vendor/sedna/kernel/common/u/usafesync.h +41 -0
- data/vendor/sedna/kernel/common/u/usecurity.c +150 -0
- data/vendor/sedna/kernel/common/u/usecurity.h +55 -0
- data/vendor/sedna/kernel/common/u/usem.c +891 -0
- data/vendor/sedna/kernel/common/u/usem.h +83 -0
- data/vendor/sedna/kernel/common/u/ushm.c +222 -0
- data/vendor/sedna/kernel/common/u/ushm.h +46 -0
- data/vendor/sedna/kernel/common/u/usocket.c +541 -0
- data/vendor/sedna/kernel/common/u/usocket.h +118 -0
- data/vendor/sedna/kernel/common/u/usystem.c +57 -0
- data/vendor/sedna/kernel/common/u/usystem.h +46 -0
- data/vendor/sedna/kernel/common/u/uthread.c +259 -0
- data/vendor/sedna/kernel/common/u/uthread.h +95 -0
- data/vendor/sedna/kernel/common/u/utime.c +65 -0
- data/vendor/sedna/kernel/common/u/utime.h +40 -0
- data/vendor/sedna/kernel/common/u/uutils.c +142 -0
- data/vendor/sedna/kernel/common/u/uutils.h +65 -0
- data/vendor/sedna/kernel/common/ugc.cpp +156 -0
- data/vendor/sedna/kernel/common/ugc.h +15 -0
- data/vendor/sedna/kernel/common/utils.cpp +156 -0
- data/vendor/sedna/kernel/common/utils.h +133 -0
- data/vendor/sedna/kernel/common/version.c +16 -0
- data/vendor/sedna/kernel/common/version.h +21 -0
- data/vendor/sedna/kernel/common/wustructures.h +18 -0
- data/vendor/sedna/kernel/common/wutypes.h +34 -0
- data/vendor/sedna/kernel/common/xptr.cpp +17 -0
- data/vendor/sedna/kernel/common/xptr.h +211 -0
- data/vendor/sedna/ver +1 -0
- metadata +142 -14
@@ -0,0 +1,199 @@
|
|
1
|
+
/*
|
2
|
+
* File: libsedna.h
|
3
|
+
* Copyright (C) 2004 The Institute for System Programming of the Russian Academy of Sciences (ISP RAS)
|
4
|
+
*/
|
5
|
+
#ifndef _LIBBASE_H
|
6
|
+
#define _LIBBASE_H
|
7
|
+
|
8
|
+
#ifdef __cplusplus
|
9
|
+
extern "C"
|
10
|
+
{
|
11
|
+
#endif
|
12
|
+
|
13
|
+
#ifdef _WIN32
|
14
|
+
#include <windows.h>
|
15
|
+
#else
|
16
|
+
#endif
|
17
|
+
|
18
|
+
#include <stdio.h>
|
19
|
+
#include "sp_defs.h"
|
20
|
+
|
21
|
+
|
22
|
+
#define QUERY_EXECUTION_TIME 1024
|
23
|
+
#define BULK_LOAD_PORTION (SE_SOCKET_MSG_BUF_SIZE-5)
|
24
|
+
|
25
|
+
|
26
|
+
#define SEDNA_OPERATION_SUCCEEDED (-1)
|
27
|
+
|
28
|
+
#define SEDNA_SESSION_OPEN 1
|
29
|
+
#define SEDNA_SESSION_CLOSED 2
|
30
|
+
#define SEDNA_AUTHENTICATION_FAILED (-3)
|
31
|
+
#define SEDNA_OPEN_SESSION_FAILED (-4)
|
32
|
+
#define SEDNA_CLOSE_SESSION_FAILED (-5)
|
33
|
+
|
34
|
+
#define SEDNA_QUERY_SUCCEEDED 6
|
35
|
+
#define SEDNA_QUERY_FAILED (-7)
|
36
|
+
|
37
|
+
#define SEDNA_UPDATE_SUCCEEDED 8
|
38
|
+
#define SEDNA_UPDATE_FAILED (-9)
|
39
|
+
|
40
|
+
#define SEDNA_BULK_LOAD_SUCCEEDED 10
|
41
|
+
#define SEDNA_BULK_LOAD_FAILED (-11)
|
42
|
+
|
43
|
+
#define SEDNA_BEGIN_TRANSACTION_SUCCEEDED 12
|
44
|
+
#define SEDNA_BEGIN_TRANSACTION_FAILED (-13)
|
45
|
+
|
46
|
+
#define SEDNA_ROLLBACK_TRANSACTION_SUCCEEDED 14
|
47
|
+
#define SEDNA_ROLLBACK_TRANSACTION_FAILED (-15)
|
48
|
+
|
49
|
+
#define SEDNA_COMMIT_TRANSACTION_SUCCEEDED 16
|
50
|
+
#define SEDNA_COMMIT_TRANSACTION_FAILED (-17)
|
51
|
+
|
52
|
+
#define SEDNA_NEXT_ITEM_SUCCEEDED 18
|
53
|
+
#define SEDNA_NEXT_ITEM_FAILED (-19)
|
54
|
+
|
55
|
+
#define SEDNA_NO_ITEM (-20)
|
56
|
+
#define SEDNA_RESULT_END (-21)
|
57
|
+
|
58
|
+
#define SEDNA_DATA_CHUNK_LOADED 23
|
59
|
+
|
60
|
+
#define SEDNA_ERROR (-24)
|
61
|
+
|
62
|
+
|
63
|
+
#define SEDNA_TRANSACTION_ACTIVE 25
|
64
|
+
#define SEDNA_NO_TRANSACTION 26
|
65
|
+
|
66
|
+
#define SEDNA_CONNECTION_OK 27
|
67
|
+
#define SEDNA_CONNECTION_CLOSED 28
|
68
|
+
#define SEDNA_CONNECTION_FAILED (-29)
|
69
|
+
|
70
|
+
#define SEDNA_AUTOCOMMIT_OFF 30
|
71
|
+
#define SEDNA_AUTOCOMMIT_ON 31
|
72
|
+
|
73
|
+
#define SEDNA_SET_ATTRIBUTE_SUCCEEDED 32
|
74
|
+
#define SEDNA_GET_ATTRIBUTE_SUCCEEDED 33
|
75
|
+
|
76
|
+
#define SEDNA_RESET_ATTRIBUTES_SUCCEEDED 34
|
77
|
+
|
78
|
+
#define SEDNA_BOUNDARY_SPACE_PRESERVE_OFF 35
|
79
|
+
#define SEDNA_BOUNDARY_SPACE_PRESERVE_ON 36
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
enum SEattr {SEDNA_ATTR_AUTOCOMMIT,
|
84
|
+
SEDNA_ATTR_SESSION_DIRECTORY,
|
85
|
+
SEDNA_ATTR_DEBUG,
|
86
|
+
SEDNA_ATTR_BOUNDARY_SPACE_PRESERVE_WHILE_LOAD,
|
87
|
+
SEDNA_ATTR_CONCURRENCY_TYPE,
|
88
|
+
SEDNA_ATTR_QUERY_EXEC_TIMEOUT,
|
89
|
+
SEDNA_ATTR_LOG_AMMOUNT,
|
90
|
+
SEDNA_ATTR_MAX_RESULT_SIZE};
|
91
|
+
|
92
|
+
typedef void (*debug_handler_t)(enum se_debug_info_type, const char *msg_body);
|
93
|
+
|
94
|
+
struct conn_bulk_load
|
95
|
+
{
|
96
|
+
char bulk_load_started;
|
97
|
+
char doc_name[SE_MAX_DOCUMENT_NAME_LENGTH+1];
|
98
|
+
char col_name[SE_MAX_COLLECTION_NAME_LENGTH+1];
|
99
|
+
};
|
100
|
+
|
101
|
+
struct SednaConnection
|
102
|
+
{
|
103
|
+
char url[SE_HOSTNAMELENGTH + 1];
|
104
|
+
char db_name[SE_MAX_DB_NAME_LENGTH + 1];
|
105
|
+
char login[SE_MAX_LOGIN_LENGTH + 1];
|
106
|
+
char password[SE_MAX_PASSWORD_LENGTH + 1];
|
107
|
+
char session_directory[SE_MAX_DIR_LENGTH+1];
|
108
|
+
#ifdef _WIN32
|
109
|
+
SOCKET socket;
|
110
|
+
#else
|
111
|
+
int socket;
|
112
|
+
#endif
|
113
|
+
int last_error;
|
114
|
+
char last_error_msg[SE_SOCKET_MSG_BUF_SIZE];
|
115
|
+
char query_time[QUERY_EXECUTION_TIME];
|
116
|
+
|
117
|
+
char socket_keeps_data;
|
118
|
+
char first_next;
|
119
|
+
char result_end;
|
120
|
+
char in_query;
|
121
|
+
struct conn_bulk_load cbl;
|
122
|
+
|
123
|
+
int isInTransaction;
|
124
|
+
int isConnectionOk;
|
125
|
+
|
126
|
+
char autocommit;
|
127
|
+
|
128
|
+
int local_data_length;
|
129
|
+
int local_data_offset;
|
130
|
+
char local_data_buf[SE_SOCKET_MSG_BUF_SIZE];
|
131
|
+
|
132
|
+
struct msg_struct msg;
|
133
|
+
|
134
|
+
debug_handler_t debug_handler;
|
135
|
+
|
136
|
+
char boundary_space_preserve;
|
137
|
+
int query_timeout;
|
138
|
+
int max_result_size;
|
139
|
+
};
|
140
|
+
|
141
|
+
#ifdef _WIN32
|
142
|
+
#define SEDNA_CONNECTION_INITIALIZER {"", "", "", "", "", INVALID_SOCKET, -1, "", "", 0, 0, 0, 0, {0, "", ""}, SEDNA_NO_TRANSACTION, SEDNA_CONNECTION_CLOSED, 1, 0, 0, "", {0, 0, ""}, NULL, 0, 0, 0}
|
143
|
+
#else
|
144
|
+
#define SEDNA_CONNECTION_INITIALIZER {"", "", "", "", "", -1, -1, "", "", 0, 0, 0, 0, {0, "", ""}, SEDNA_NO_TRANSACTION, SEDNA_CONNECTION_CLOSED, 1, 0, 0, "", {0, 0, ""}, NULL, 0, 0, 0}
|
145
|
+
#endif
|
146
|
+
|
147
|
+
int SEconnect(struct SednaConnection *conn, const char *host, const char *db_name, const char *login, const char *password);
|
148
|
+
|
149
|
+
int SEclose(struct SednaConnection *conn);
|
150
|
+
|
151
|
+
int SEbegin(struct SednaConnection *conn);
|
152
|
+
|
153
|
+
int SErollback(struct SednaConnection *conn);
|
154
|
+
|
155
|
+
int SEcommit(struct SednaConnection *conn);
|
156
|
+
|
157
|
+
/*query_file - file with a query*/
|
158
|
+
int SEexecuteLong(struct SednaConnection *conn, const char* query_file_path);
|
159
|
+
|
160
|
+
int SEexecute(struct SednaConnection *conn, const char *query);
|
161
|
+
|
162
|
+
/*returns number of bytes actually read to the buffer*/
|
163
|
+
/* 0 - if there is no data to read*/
|
164
|
+
/* negative if error (use SEgetLastErrorMsg then))*/
|
165
|
+
|
166
|
+
int SEgetData(struct SednaConnection *conn, char *buf, int bytes_to_read);
|
167
|
+
|
168
|
+
/* returns SEDNA_DATA_SENT if chunk of data was sent successfully*/
|
169
|
+
/* SEDNA_ERROR if there was errors*/
|
170
|
+
int SEloadData(struct SednaConnection *conn, const char *buf, int bytes_to_load, const char *doc_name, const char *col_name);
|
171
|
+
|
172
|
+
/* returns SEDNA_BULK_LOAD_FAILED or SEDNA_BULK_LOAD_SUCCEEDED (or SEDNA_ERROR)*/
|
173
|
+
int SEendLoadData(struct SednaConnection *conn);
|
174
|
+
|
175
|
+
int SEnext(struct SednaConnection *conn);
|
176
|
+
|
177
|
+
int SEgetLastErrorCode(struct SednaConnection *conn);
|
178
|
+
|
179
|
+
const char *SEgetLastErrorMsg(struct SednaConnection *conn);
|
180
|
+
|
181
|
+
int SEconnectionStatus(struct SednaConnection *conn);
|
182
|
+
|
183
|
+
int SEtransactionStatus(struct SednaConnection *conn);
|
184
|
+
|
185
|
+
const char *SEshowTime(struct SednaConnection *conn);
|
186
|
+
|
187
|
+
int SEsetConnectionAttr(struct SednaConnection *conn, enum SEattr attr, const void* attrValue, int attrValueLength);
|
188
|
+
|
189
|
+
int SEgetConnectionAttr(struct SednaConnection *conn, enum SEattr attr, void* attrValue, int* attrValueLength);
|
190
|
+
|
191
|
+
int SEresetAllConnectionAttr(struct SednaConnection *conn);
|
192
|
+
|
193
|
+
void SEsetDebugHandler(struct SednaConnection *conn, debug_handler_t _debug_handler_);
|
194
|
+
|
195
|
+
#ifdef __cplusplus
|
196
|
+
}
|
197
|
+
#endif
|
198
|
+
|
199
|
+
#endif
|
@@ -0,0 +1,21 @@
|
|
1
|
+
EXPORTS
|
2
|
+
SEconnect
|
3
|
+
SEclose
|
4
|
+
SEbegin
|
5
|
+
SErollback
|
6
|
+
SEcommit
|
7
|
+
SEexecuteLong
|
8
|
+
SEexecute
|
9
|
+
SEgetData
|
10
|
+
SEloadData
|
11
|
+
SEendLoadData
|
12
|
+
SEnext
|
13
|
+
SEgetLastErrorCode
|
14
|
+
SEgetLastErrorMsg
|
15
|
+
SEconnectionStatus
|
16
|
+
SEtransactionStatus
|
17
|
+
SEshowTime
|
18
|
+
SEsetConnectionAttr
|
19
|
+
SEgetConnectionAttr
|
20
|
+
SEresetAllConnectionAttr
|
21
|
+
SEsetDebugHandler
|
@@ -0,0 +1,186 @@
|
|
1
|
+
/*
|
2
|
+
* File: sp_defs.h
|
3
|
+
* Copyright (C) 2009 The Institute for System Programming of the Russian Academy of Sciences (ISP RAS)
|
4
|
+
*/
|
5
|
+
|
6
|
+
#ifndef _SP_DEFS_H
|
7
|
+
#define _SP_DEFS_H
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
#define SE_MAX_LOGIN_LENGTH 511
|
12
|
+
#define SE_MAX_PASSWORD_LENGTH 511
|
13
|
+
#define SE_MAX_DB_NAME_LENGTH 511
|
14
|
+
#define SE_MAX_DOCUMENT_NAME_LENGTH 511
|
15
|
+
#define SE_MAX_COLLECTION_NAME_LENGTH 511
|
16
|
+
#define SE_MAX_DIR_LENGTH 255
|
17
|
+
#define SE_HOSTNAMELENGTH 255
|
18
|
+
|
19
|
+
#define SE_SOCKET_MSG_BUF_SIZE 10240
|
20
|
+
#define SE_MAX_QUERY_SIZE 2097152 // Maximum query size 2 Mb
|
21
|
+
|
22
|
+
#define SE_CURRENT_SOCKET_PROTOCOL_VERSION_MAJOR 3
|
23
|
+
#define SE_CURRENT_SOCKET_PROTOCOL_VERSION_MINOR 0
|
24
|
+
|
25
|
+
#define SEDNA_DEBUG_OFF 0
|
26
|
+
#define SEDNA_DEBUG_ON 1
|
27
|
+
|
28
|
+
#define SEDNA_READONLY_TRANSACTION 2
|
29
|
+
#define SEDNA_UPDATE_TRANSACTION 3
|
30
|
+
|
31
|
+
#define SEDNA_QUERY_EXEC_TIMEOUT 4
|
32
|
+
#define SEDNA_MAX_RESULT_SIZE 5
|
33
|
+
|
34
|
+
#define SEDNA_LOG_AMMOUNT 6
|
35
|
+
#define SEDNA_LOG_LESS 7
|
36
|
+
#define SEDNA_LOG_FULL 8
|
37
|
+
|
38
|
+
|
39
|
+
typedef int sp_int32;
|
40
|
+
|
41
|
+
enum se_debug_info_type
|
42
|
+
{
|
43
|
+
se_QueryTrace,
|
44
|
+
se_QueryDebug
|
45
|
+
};
|
46
|
+
|
47
|
+
enum se_item_class
|
48
|
+
{
|
49
|
+
se_atomic = 1,
|
50
|
+
se_document = 2,
|
51
|
+
se_element = 3,
|
52
|
+
se_attribute = 4,
|
53
|
+
se_namespace = 5,
|
54
|
+
se_pi = 6,
|
55
|
+
se_comment = 7,
|
56
|
+
se_text = 8
|
57
|
+
};
|
58
|
+
|
59
|
+
enum se_item_type
|
60
|
+
{
|
61
|
+
/* Abstract base types */
|
62
|
+
se_anyType = 0,
|
63
|
+
se_anySimpleType = 1,
|
64
|
+
se_anyAtomicType = 2,
|
65
|
+
/* Built-in simple, non-atomic types */
|
66
|
+
se_IDREFS = 3,
|
67
|
+
se_NMTOKENS = 4,
|
68
|
+
se_ENTITIES = 5,
|
69
|
+
/* Built-in complex types */
|
70
|
+
se_untyped = 6,
|
71
|
+
/* Built-in atomic types (Primitive types) */
|
72
|
+
se_dateTime = 10,
|
73
|
+
se_date = 11,
|
74
|
+
se_time = 12,
|
75
|
+
se_duration = 13,
|
76
|
+
se_yearMonthDuration = 14,
|
77
|
+
se_dayTimeDuration = 15,
|
78
|
+
se_gYearMonth = 16,
|
79
|
+
se_gYear = 17,
|
80
|
+
se_gMonthDay = 18,
|
81
|
+
se_gDay = 19,
|
82
|
+
se_gMonth = 20,
|
83
|
+
se_float = 21,
|
84
|
+
se_double = 22,
|
85
|
+
se_decimal = 23,
|
86
|
+
se_integer = 24,
|
87
|
+
se_boolean = 25,
|
88
|
+
se_untypedAtomic = 26,
|
89
|
+
se_string = 27,
|
90
|
+
se_base64Binary = 28,
|
91
|
+
se_hexBinary = 29,
|
92
|
+
se_anyURI = 30,
|
93
|
+
se_QName = 31,
|
94
|
+
se_NOTATION = 32,
|
95
|
+
/* Types derived from xs:string */
|
96
|
+
se_normalizedString = 41,
|
97
|
+
se_token = 42,
|
98
|
+
se_language = 43,
|
99
|
+
se_NMTOKEN = 44,
|
100
|
+
se_Name = 45,
|
101
|
+
se_NCName = 46,
|
102
|
+
se_ID = 47,
|
103
|
+
se_IDREF = 48,
|
104
|
+
se_ENTITY = 49,
|
105
|
+
/* Types derived from xs:integer */
|
106
|
+
se_nonPositiveInteger = 50,
|
107
|
+
se_negativeInteger = 51,
|
108
|
+
se_long = 52,
|
109
|
+
se_int = 53,
|
110
|
+
se_short = 54,
|
111
|
+
se_byte = 55,
|
112
|
+
se_nonNegativeInteger = 56,
|
113
|
+
se_unsignedLong = 57,
|
114
|
+
se_unsignedInt = 58,
|
115
|
+
se_unsignedShort = 59,
|
116
|
+
se_unsignedByte = 60,
|
117
|
+
se_positiveInteger = 61
|
118
|
+
};
|
119
|
+
|
120
|
+
|
121
|
+
enum se_sp_instructions
|
122
|
+
{
|
123
|
+
se_ErrorResponse = 100,
|
124
|
+
se_StartUp = 110,
|
125
|
+
se_SessionParameters = 120,
|
126
|
+
se_AuthenticationParameters = 130,
|
127
|
+
se_SendSessionParameters = 140,
|
128
|
+
se_SendAuthParameters = 150,
|
129
|
+
se_AuthenticationOK = 160,
|
130
|
+
se_AuthenticationFailed = 170,
|
131
|
+
se_BeginTransaction = 210,
|
132
|
+
se_CommitTransaction = 220,
|
133
|
+
se_RollbackTransaction = 225,
|
134
|
+
se_BeginTransactionOk = 230,
|
135
|
+
se_BeginTransactionFailed = 240,
|
136
|
+
se_CommitTransactionOk = 250,
|
137
|
+
se_CommitTransactionFailed = 260,
|
138
|
+
se_RollbackTransactionOk = 255,
|
139
|
+
se_RollbackTransactionFailed = 265,
|
140
|
+
se_Execute = 300,
|
141
|
+
se_ExecuteLong = 301,
|
142
|
+
se_LongQueryEnd = 302,
|
143
|
+
se_GetNextItem = 310,
|
144
|
+
se_QuerySucceeded = 320,
|
145
|
+
se_DebugInfo = 325,
|
146
|
+
se_QueryFailed = 330,
|
147
|
+
se_UpdateSucceeded = 340,
|
148
|
+
se_UpdateFailed = 350,
|
149
|
+
se_ItemStart = 355,
|
150
|
+
se_ItemPart = 360,
|
151
|
+
se_ItemEnd = 370,
|
152
|
+
se_ResultEnd = 375,
|
153
|
+
se_BulkLoadError = 400,
|
154
|
+
se_BulkLoadPortion = 410,
|
155
|
+
se_BulkLoadEnd = 420,
|
156
|
+
se_BulkLoadFileName = 430,
|
157
|
+
se_BulkLoadFromStream = 431,
|
158
|
+
se_BulkLoadSucceeded = 440,
|
159
|
+
se_BulkLoadFailed = 450,
|
160
|
+
se_ShowTime = 451,
|
161
|
+
se_LastQueryTime = 452,
|
162
|
+
se_CloseConnection = 500,
|
163
|
+
se_CloseConnectionOk = 510,
|
164
|
+
se_TransactionRollbackBeforeClose = 520,
|
165
|
+
se_Authenticate = 90,
|
166
|
+
se_ExecuteSchemeProgram = 95,
|
167
|
+
se_SetSessionOptions = 530,
|
168
|
+
se_SetSessionOptionsOk = 540,
|
169
|
+
se_ResetSessionOptions = 550,
|
170
|
+
se_ResetSessionOptionsOk = 560
|
171
|
+
};
|
172
|
+
|
173
|
+
struct msg_struct
|
174
|
+
{
|
175
|
+
sp_int32 instruction;
|
176
|
+
sp_int32 length;
|
177
|
+
char body[SE_SOCKET_MSG_BUF_SIZE];
|
178
|
+
};
|
179
|
+
|
180
|
+
struct protocol_version{
|
181
|
+
char major_version;
|
182
|
+
char minor_version;
|
183
|
+
};
|
184
|
+
|
185
|
+
|
186
|
+
#endif /* _SP_DEFS_H */
|
@@ -0,0 +1,101 @@
|
|
1
|
+
|
2
|
+
#include "common/FastXptrHash.h"
|
3
|
+
|
4
|
+
#define MAGIC_NUMBER 2654435761UL
|
5
|
+
#define CS_CELL_COUNT 256
|
6
|
+
#define CS_CELL_SIN_BITS 8
|
7
|
+
|
8
|
+
#define hashSize 1024
|
9
|
+
//const uint16_t hashSize = 32;
|
10
|
+
|
11
|
+
struct SecondLayer {
|
12
|
+
SecondLayer * next;
|
13
|
+
const xptr block;
|
14
|
+
void * values[CS_CELL_COUNT];
|
15
|
+
|
16
|
+
inline uint32_t hash(const xptr &a) {
|
17
|
+
return (uint32_t) ((a.to_uint64() >> CS_CELL_SIN_BITS) & CS_CELL_COUNT);
|
18
|
+
}
|
19
|
+
|
20
|
+
inline SecondLayer(const xptr &a) : block(a), next(NULL) {
|
21
|
+
memset(&(this->values), 0, sizeof(void *) * CS_CELL_COUNT);
|
22
|
+
};
|
23
|
+
|
24
|
+
inline ~SecondLayer() { };
|
25
|
+
|
26
|
+
inline void * get(const xptr &a) const {
|
27
|
+
return values[hash(a)];
|
28
|
+
};
|
29
|
+
|
30
|
+
inline void set(const xptr &a, void * v) {
|
31
|
+
values[hash(a)] = v;
|
32
|
+
};
|
33
|
+
};
|
34
|
+
|
35
|
+
class RealHashTable {
|
36
|
+
private:
|
37
|
+
SecondLayer * buckets[hashSize];
|
38
|
+
|
39
|
+
inline uint32_t hash(const xptr &a) {
|
40
|
+
return ((uint32_t) ((a.to_uint64() >> PAGE_BIT_SIZE) & 0xffffffff) * MAGIC_NUMBER) % hashSize;
|
41
|
+
}
|
42
|
+
public :
|
43
|
+
inline RealHashTable() {
|
44
|
+
memset(&(this->buckets), 0, sizeof(SecondLayer *) * hashSize);
|
45
|
+
};
|
46
|
+
|
47
|
+
inline ~RealHashTable() {
|
48
|
+
for (int i = 0; i < hashSize; i++) {
|
49
|
+
while (buckets[i] != NULL) {
|
50
|
+
SecondLayer * b = buckets[i];
|
51
|
+
buckets[i] = b->next;
|
52
|
+
b->~SecondLayer();
|
53
|
+
free(b);
|
54
|
+
}
|
55
|
+
}
|
56
|
+
};
|
57
|
+
|
58
|
+
inline void * get(const xptr &a) const {
|
59
|
+
SecondLayer * b = buckets[hash(a)];
|
60
|
+
while ((b != NULL) && (b->block != BLOCKXPTR(a))) { b = b->next; }
|
61
|
+
|
62
|
+
if (b == NULL) { return NULL; }
|
63
|
+
else { return b->get(a); }
|
64
|
+
};
|
65
|
+
|
66
|
+
inline void set(const xptr &a, void * v) {
|
67
|
+
uint32_t bi = hash(a);
|
68
|
+
SecondLayer * b = buckets[bi];
|
69
|
+
while ((b != NULL) && (b->block != BLOCKXPTR(a))) { b = b->next; }
|
70
|
+
|
71
|
+
if (b == NULL) {
|
72
|
+
|
73
|
+
b = new (malloc(sizeof(SecondLayer))) RealHashTable;
|
74
|
+
|
75
|
+
b->next = buckets[bi];
|
76
|
+
buckets[bi] = b;
|
77
|
+
};
|
78
|
+
|
79
|
+
b->set(a, v);
|
80
|
+
};
|
81
|
+
};
|
82
|
+
|
83
|
+
|
84
|
+
FastCatalogXptrHash::FastCatalogXptrHash() {
|
85
|
+
this->topLayer = new (malloc(sizeof(RealHashTable))) RealHashTable(BLOCKXPTR(a));
|
86
|
+
};
|
87
|
+
|
88
|
+
FastCatalogXptrHash::~FastCatalogXptrHash() {
|
89
|
+
this->topLayer::~RealHashTable();
|
90
|
+
free(this->topLayer);
|
91
|
+
};
|
92
|
+
|
93
|
+
void * FastCatalogXptrHash::get(const xptr &a) const
|
94
|
+
{
|
95
|
+
return this->topLayer->get(a);
|
96
|
+
};
|
97
|
+
|
98
|
+
void FastCatalogXptrHash::set(const xptr &a, const void *v)
|
99
|
+
{
|
100
|
+
this->topLayer->set(a, v);
|
101
|
+
};
|