1
/* Copyright (c) 2008 PrimeBase Technologies GmbH, Germany
3
* PrimeBase Media Stream for MySQL
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
* Original author: Paul McCullagh (H&G2JCtL)
20
* Continued development: Barry Leslie
31
#include "cslib/CSDefs.h"
33
#define MS_IDENTIFIER_CHAR_COUNT 64
35
#define MS_IDENTIFIER_NAME_SIZE ((MS_IDENTIFIER_CHAR_COUNT * 3) + 1) // The identifier length as UTF-8
37
#define MS_TABLE_NAME_SIZE MS_IDENTIFIER_NAME_SIZE // The maximum length of a table name
38
#define MS_DATABASE_NAME_SIZE MS_IDENTIFIER_NAME_SIZE
40
#define MS_TABLE_URL_SIZE (MS_DATABASE_NAME_SIZE + MS_TABLE_NAME_SIZE)
42
#define MS_CONNECTION_THREAD 1000
43
#define MS_TEMP_LOG_THREAD 1001
44
#define MS_COMPACTOR_THREAD 1002
47
#define MS_DEFAULT_TEMP_LOG_WAIT (200*60)
49
// Set MS_DEFAULT_TEMP_LOG_WAIT high to prevent
50
// BLOBs from being deleted while walking through
51
// the code in the debugger.
52
//#define MS_DEFAULT_TEMP_LOG_WAIT (200*60)
54
#define MS_DEFAULT_TEMP_LOG_WAIT (10*60)
57
/* Default compactor wait time in seconds! */
58
#define MS_COMPACTOR_POLLS
59
#ifdef MS_COMPACTOR_POLLS
61
#define MS_COMPACTOR_POLL_FREQ 1000 // milli-seconds
63
#define MS_COMPACTOR_POLL_FREQ 3000
67
#define MS_DEFAULT_COMPACTOR_WAIT 120
69
#define MS_DEFAULT_COMPACTOR_WAIT 30
74
//#define MS_DEFAULT_GARBAGE_LEVEL 1
75
#define MS_DEFAULT_GARBAGE_LEVEL 10
77
#define MS_DEFAULT_GARBAGE_LEVEL 50
81
#define MS_REPO_THRESHOLD_DEF "20MB"
82
//#define MS_REPO_THRESHOLD_DEF "32K"
84
#define MS_REPO_THRESHOLD_DEF "128MB"
88
#define MS_TEMP_LOG_THRESHOLD_DEF "32K"
90
#define MS_TEMP_LOG_THRESHOLD_DEF "32MB"
93
#define MS_HTTP_METADATA_HEADERS_DEF "Content-Type"
96
#define MS_COMPACTOR_BUFFER_SIZE (4*1024)
98
#define MS_COMPACTOR_BUFFER_SIZE (64*1024)
101
#define MS_BACKUP_BUFFER_SIZE MS_COMPACTOR_BUFFER_SIZE
104
* The time (in seconds) that a connection thread will stay alive, when it is idle:
107
#define MS_IDLE_THREAD_TIMEOUT (10)
109
#define MS_IDLE_THREAD_TIMEOUT (40)
113
* The timeout, in milli-seconds, before the HTTP server will close an inactive HTTP connection.
115
#define MS_DEFAULT_KEEP_ALIVE (10)
118
#include <boost/dynamic_bitset.hpp>
119
/* Drizzle is stuck at this level: */
120
#define MYSQL_VERSION_ID 60005
122
#define TABLE_LIST TableList
123
#define TABLE drizzled::Table
124
#define Field drizzled::Field
125
//#define enum_field_types drizzled::enum_field_types
127
#define my_charset_bin drizzled::my_charset_bin
128
#define THR_LOCK drizzled::THR_LOCK
130
#define TABLE_SHARE TableShare
131
#define THD drizzled::Session
132
#define MYSQL_THD Session *
133
#define THR_THD THR_Session
134
#define STRUCT_TABLE class Table
135
#define MY_BITMAP boost::dynamic_bitset<>
137
#define MYSQL_TYPE_TIMESTAMP DRIZZLE_TYPE_TIMESTAMP
138
#define MYSQL_TYPE_LONG DRIZZLE_TYPE_LONG
139
#define MYSQL_TYPE_SHORT DRIZZLE_TYPE_LONG
140
#define MYSQL_TYPE_STRING DRIZZLE_TYPE_VARCHAR
141
#define MYSQL_TYPE_VARCHAR DRIZZLE_TYPE_VARCHAR
142
#define MYSQL_TYPE_LONGLONG DRIZZLE_TYPE_LONGLONG
143
#define MYSQL_TYPE_BLOB DRIZZLE_TYPE_BLOB
144
#define MYSQL_TYPE_LONG_BLOB DRIZZLE_TYPE_BLOB
145
#define MYSQL_TYPE_ENUM DRIZZLE_TYPE_ENUM
146
#define MYSQL_PLUGIN_VAR_HEADER DRIZZLE_PLUGIN_VAR_HEADER
147
#define MYSQL_SYSVAR_STR DRIZZLE_SYSVAR_STR
148
#define MYSQL_SYSVAR_INT DRIZZLE_SYSVAR_INT
149
#define MYSQL_SYSVAR_UINT DRIZZLE_SYSVAR_UINT
150
#define MYSQL_SYSVAR DRIZZLE_SYSVAR
151
#define MYSQL_SYSVAR_ULONG DRIZZLE_SYSVAR_ULONG
152
#define MYSQL_SYSVAR_ULONGLONG DRIZZLE_SYSVAR_ULONGLONG
153
#define MYSQL_SYSVAR_BOOL DRIZZLE_SYSVAR_BOOL
154
#define MYSQL_STORAGE_ENGINE_PLUGIN DRIZZLE_STORAGE_ENGINE_PLUGIN
155
#define MYSQL_INFORMATION_SCHEMA_PLUGIN DRIZZLE_INFORMATION_SCHEMA_PLUGIN
156
#define memcpy_fixed memcpy
157
#define bfill(m, len, ch) memset(m, ch, len)
159
#define mx_tmp_use_all_columns(x, y) (x)->use_all_columns(y)
160
#define mx_tmp_restore_column_map(x, y) (x)->restore_column_map(y)
162
#define MX_TABLE_TYPES_T handler::Table_flags
163
#define MX_UINT8_T uint8_t
164
#define MX_ULONG_T uint32_t
165
#define MX_ULONGLONG_T uint64_t
166
#define MX_LONGLONG_T uint64_t
167
#define MX_CHARSET_INFO struct charset_info_st
168
#define MX_CONST_CHARSET_INFO const struct charset_info_st
169
#define MX_CONST const
171
#define int16 int16_t
172
#define int32 int32_t
173
#define uint16 uint16_t
174
#define uint32 uint32_t
175
#define uchar unsigned char
176
#define longlong int64_t
177
#define ulonglong uint64_t
179
#define HAVE_LONG_LONG
181
#define my_malloc(x, y) malloc(x)
182
#define my_free(x, y) free(x)
184
#define HA_CAN_SQL_HANDLER 0
185
#define HA_CAN_INSERT_DELAYED 0
186
#define HA_BINLOG_ROW_CAPABLE 0
193
#define current_thd current_session
194
#define thd_charset session_charset
195
#define thd_query session_query
196
#define thd_slave_thread session_slave_thread
197
#define thd_non_transactional_update session_non_transactional_update
198
#define thd_binlog_format session_binlog_format
199
#define thd_mark_transaction_to_rollback session_mark_transaction_to_rollback
200
#define current_thd current_session
201
#define thd_sql_command session_sql_command
202
#define thd_test_options session_test_options
203
#define thd_killed session_killed
204
#define thd_tx_isolation session_tx_isolation
205
#define thd_in_lock_tables session_in_lock_tables
206
#define thd_tablespace_op session_tablespace_op
207
#define thd_alloc session_alloc
208
#define thd_make_lex_string session_make_lex_string
210
#define my_pthread_setspecific_ptr(T, V) pthread_setspecific(T, (void*) (V))
212
#define mysql_real_data_home drizzle_real_data_home
214
#define mi_int4store(T,A) { uint32_t def_temp= (uint32_t) (A);\
215
((unsigned char*) (T))[3]= (unsigned char) (def_temp);\
216
((unsigned char*) (T))[2]= (unsigned char) (def_temp >> 8);\
217
((unsigned char*) (T))[1]= (unsigned char) (def_temp >> 16);\
218
((unsigned char*) (T))[0]= (unsigned char) (def_temp >> 24); }
220
#define mi_uint4korr(A) ((uint32_t) (((uint32_t) (((const unsigned char*) (A))[3])) +\
221
(((uint32_t) (((const unsigned char*) (A))[2])) << 8) +\
222
(((uint32_t) (((const unsigned char*) (A))[1])) << 16) +\
223
(((uint32_t) (((const unsigned char*) (A))[0])) << 24)))
225
#define mi_int8store(T,A) { uint64_t def_temp= (uint64_t) (A);\
226
((unsigned char*) (T))[7]= (unsigned char) (def_temp);\
227
((unsigned char*) (T))[6]= (unsigned char) (def_temp >> 8);\
228
((unsigned char*) (T))[5]= (unsigned char) (def_temp >> 16);\
229
((unsigned char*) (T))[4]= (unsigned char) (def_temp >> 24);\
230
((unsigned char*) (T))[3]= (unsigned char) (def_temp >> 32);\
231
((unsigned char*) (T))[2]= (unsigned char) (def_temp >> 40);\
232
((unsigned char*) (T))[1]= (unsigned char) (def_temp >> 48);\
233
((unsigned char*) (T))[0]= (unsigned char) (def_temp >> 56); }
235
#define mi_uint8korr(A) ((uint64_t) (((uint64_t) (((const unsigned char*) (A))[7])) +\
236
(((uint64_t) (((const unsigned char*) (A))[6])) << 8) +\
237
(((uint64_t) (((const unsigned char*) (A))[5])) << 16) +\
238
(((uint64_t) (((const unsigned char*) (A))[4])) << 24) +\
239
(((uint64_t) (((const unsigned char*) (A))[3])) << 32) +\
240
(((uint64_t) (((const unsigned char*) (A))[2])) << 40) +\
241
(((uint64_t) (((const unsigned char*) (A))[1])) << 48) +\
242
(((uint64_t) (((const unsigned char*) (A))[0])) << 56)))
245
/* The MySQL case: */
246
#define STRUCT_TABLE struct st_table
248
#define mx_tmp_use_all_columns dbug_tmp_use_all_columns
249
#define mx_tmp_restore_column_map(x, y) dbug_tmp_restore_column_map((x)->read_set, y)
251
#define MX_TABLE_TYPES_T ulonglong
252
#define MX_UINT8_T uint8
253
#define MX_ULONG_T ulong
254
#define MX_ULONGLONG_T ulonglong
255
#define MX_LONGLONG_T longlong
256
#define MX_CHARSET_INFO CHARSET_INFO
257
#define MX_CONST_CHARSET_INFO struct charset_info_st