~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/pbms/src/defs_ms.h

  • Committer: Brian Aker
  • Date: 2011-12-13 03:21:35 UTC
  • mto: This revision was merged to the branch mainline in revision 2475.
  • Revision ID: brian@tangent.org-20111213032135-8dta0336wn38uok9
Rmove PBMS (deprecated)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2008 PrimeBase Technologies GmbH, Germany
2
 
 *
3
 
 * PrimeBase Media Stream for MySQL
4
 
 *
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.
9
 
 *
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.
14
 
 *
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
18
 
 *
19
 
 * Original author: Paul McCullagh (H&G2JCtL)
20
 
 * Continued development: Barry Leslie
21
 
 *
22
 
 * 2007-07-04
23
 
 *
24
 
 * Global definitions.
25
 
 *
26
 
 */
27
 
 
28
 
#pragma once
29
 
#ifndef __DEFS_MS_H__
30
 
#define __DEFS_MS_H__
31
 
 
32
 
#include "cslib/CSDefs.h"
33
 
 
34
 
#define MS_IDENTIFIER_CHAR_COUNT        64
35
 
 
36
 
#define MS_IDENTIFIER_NAME_SIZE         ((MS_IDENTIFIER_CHAR_COUNT * 3) + 1)    // The identifier length as UTF-8
37
 
 
38
 
#define MS_TABLE_NAME_SIZE                      MS_IDENTIFIER_NAME_SIZE                                 // The maximum length of a table name 
39
 
#define MS_DATABASE_NAME_SIZE           MS_IDENTIFIER_NAME_SIZE
40
 
 
41
 
#define MS_TABLE_URL_SIZE                       (MS_DATABASE_NAME_SIZE + MS_TABLE_NAME_SIZE)
42
 
 
43
 
#define MS_CONNECTION_THREAD            1000
44
 
#define MS_TEMP_LOG_THREAD                      1001
45
 
#define MS_COMPACTOR_THREAD                     1002
46
 
 
47
 
#ifdef DEBUG
48
 
#define MS_DEFAULT_TEMP_LOG_WAIT        (200*60)
49
 
 
50
 
// Set MS_DEFAULT_TEMP_LOG_WAIT high to prevent 
51
 
// BLOBs from being deleted while walking through 
52
 
// the code in the debugger.
53
 
//#define MS_DEFAULT_TEMP_LOG_WAIT      (200*60) 
54
 
#else
55
 
#define MS_DEFAULT_TEMP_LOG_WAIT        (10*60)
56
 
#endif
57
 
 
58
 
/* Default compactor wait time in seconds! */
59
 
#define MS_COMPACTOR_POLLS
60
 
#ifdef MS_COMPACTOR_POLLS
61
 
#ifdef DEBUG
62
 
#define MS_COMPACTOR_POLL_FREQ          1000            // milli-seconds
63
 
#else
64
 
#define MS_COMPACTOR_POLL_FREQ          3000
65
 
#endif
66
 
#else
67
 
#ifdef DEBUG
68
 
#define MS_DEFAULT_COMPACTOR_WAIT       120
69
 
#else
70
 
#define MS_DEFAULT_COMPACTOR_WAIT       30
71
 
#endif
72
 
#endif
73
 
 
74
 
#ifdef DEBUG
75
 
//#define MS_DEFAULT_GARBAGE_LEVEL      1
76
 
#define MS_DEFAULT_GARBAGE_LEVEL        10
77
 
#else
78
 
#define MS_DEFAULT_GARBAGE_LEVEL        50
79
 
#endif
80
 
 
81
 
#ifdef DEBUG
82
 
#define MS_REPO_THRESHOLD_DEF           "20MB"
83
 
//#define MS_REPO_THRESHOLD_DEF         "32K"
84
 
#else
85
 
#define MS_REPO_THRESHOLD_DEF           "128MB"
86
 
#endif
87
 
 
88
 
#ifdef DEBUG
89
 
#define MS_TEMP_LOG_THRESHOLD_DEF       "32K"
90
 
#else
91
 
#define MS_TEMP_LOG_THRESHOLD_DEF       "32MB"
92
 
#endif
93
 
 
94
 
#define MS_HTTP_METADATA_HEADERS_DEF "Content-Type"
95
 
 
96
 
#ifdef DEBUG
97
 
#define MS_COMPACTOR_BUFFER_SIZE        (4*1024)
98
 
#else
99
 
#define MS_COMPACTOR_BUFFER_SIZE        (64*1024)
100
 
#endif
101
 
 
102
 
#define MS_BACKUP_BUFFER_SIZE MS_COMPACTOR_BUFFER_SIZE
103
 
 
104
 
/*
105
 
 * The time (in seconds) that a connection thread will stay alive, when it is idle:
106
 
 */
107
 
#ifdef DEBUG
108
 
#define MS_IDLE_THREAD_TIMEOUT          (10)
109
 
#else
110
 
#define MS_IDLE_THREAD_TIMEOUT          (40)
111
 
#endif
112
 
 
113
 
/*
114
 
 * The timeout, in milli-seconds, before the HTTP server will close an inactive HTTP connection.
115
 
*/
116
 
#define MS_DEFAULT_KEEP_ALIVE           (10) 
117
 
 
118
 
#ifdef DRIZZLED
119
 
#include <boost/dynamic_bitset.hpp>
120
 
/* Drizzle is stuck at this level: */
121
 
#define MYSQL_VERSION_ID                                        60005
122
 
 
123
 
#define TABLE_LIST                                                      TableList
124
 
#define TABLE                                                           drizzled::Table
125
 
#define Field                                                           drizzled::Field
126
 
//#define enum_field_types                                      drizzled::enum_field_types
127
 
 
128
 
#define my_charset_bin                                          drizzled::my_charset_bin
129
 
#define THR_LOCK                                                        drizzled::THR_LOCK
130
 
 
131
 
#define TABLE_SHARE                                                     TableShare
132
 
#define THD                                                                     drizzled::Session
133
 
#define MYSQL_THD                                                       Session *
134
 
#define THR_THD                                                         THR_Session
135
 
#define STRUCT_TABLE                                            class Table
136
 
#define MY_BITMAP                                                       boost::dynamic_bitset<>
137
 
 
138
 
#define MYSQL_TYPE_TIMESTAMP                            DRIZZLE_TYPE_TIMESTAMP
139
 
#define MYSQL_TYPE_LONG                                         DRIZZLE_TYPE_LONG
140
 
#define MYSQL_TYPE_SHORT                                        DRIZZLE_TYPE_LONG
141
 
#define MYSQL_TYPE_STRING                                       DRIZZLE_TYPE_VARCHAR
142
 
#define MYSQL_TYPE_VARCHAR                                      DRIZZLE_TYPE_VARCHAR
143
 
#define MYSQL_TYPE_LONGLONG                                     DRIZZLE_TYPE_LONGLONG
144
 
#define MYSQL_TYPE_BLOB                                         DRIZZLE_TYPE_BLOB
145
 
#define MYSQL_TYPE_LONG_BLOB                            DRIZZLE_TYPE_BLOB
146
 
#define MYSQL_TYPE_ENUM                                         DRIZZLE_TYPE_ENUM
147
 
#define MYSQL_PLUGIN_VAR_HEADER                         DRIZZLE_PLUGIN_VAR_HEADER
148
 
#define MYSQL_STORAGE_ENGINE_PLUGIN                     DRIZZLE_STORAGE_ENGINE_PLUGIN
149
 
#define MYSQL_INFORMATION_SCHEMA_PLUGIN         DRIZZLE_INFORMATION_SCHEMA_PLUGIN
150
 
#define memcpy_fixed                                            memcpy
151
 
#define bfill(m, len, ch)                                       memset(m, ch, len)
152
 
 
153
 
#define mx_tmp_use_all_columns(x, y)            (x)->use_all_columns(y)
154
 
#define mx_tmp_restore_column_map(x, y)         (x)->restore_column_map(y)
155
 
 
156
 
#define MX_TABLE_TYPES_T                                        handler::Table_flags
157
 
#define MX_UINT8_T                                                      uint8_t
158
 
#define MX_ULONG_T                                                      uint32_t
159
 
#define MX_ULONGLONG_T                                          uint64_t
160
 
#define MX_LONGLONG_T                                           uint64_t
161
 
#define MX_CHARSET_INFO                                         struct charset_info_st
162
 
#define MX_CONST_CHARSET_INFO                           const struct charset_info_st                    
163
 
#define MX_CONST                                                        const
164
 
#define my_bool                                                         bool
165
 
#define int16                                                           int16_t
166
 
#define int32                                                           int32_t
167
 
#define uint16                                                          uint16_t
168
 
#define uint32                                                          uint32_t
169
 
#define uchar                                                           unsigned char
170
 
#define longlong                                                        int64_t
171
 
#define ulonglong                                                       uint64_t
172
 
 
173
 
#define HAVE_LONG_LONG
174
 
 
175
 
#define my_malloc(x, y)                                         malloc(x)
176
 
#define my_free(x, y)                                           free(x)
177
 
 
178
 
#define HA_CAN_SQL_HANDLER                                      0
179
 
#define HA_CAN_INSERT_DELAYED                           0
180
 
#define HA_BINLOG_ROW_CAPABLE                           0
181
 
 
182
 
#define max                                                                     cmax
183
 
#define min                                                                     cmin
184
 
 
185
 
#define NullS                                                           NULL
186
 
 
187
 
#define current_thd                                                     current_session
188
 
#define thd_charset                                                     session_charset
189
 
#define thd_query                                                       session_query
190
 
#define thd_slave_thread                                        session_slave_thread
191
 
#define thd_non_transactional_update            session_non_transactional_update
192
 
#define thd_binlog_format                                       session_binlog_format
193
 
#define thd_mark_transaction_to_rollback        session_mark_transaction_to_rollback
194
 
#define current_thd                                                     current_session
195
 
#define thd_sql_command(x)                                              ((x)->getSqlCommand())
196
 
#define thd_test_options                                        session_test_options
197
 
#define thd_killed                                                      session_killed
198
 
#define thd_tx_isolation(x)                                     ((x)->getTxIsolation())
199
 
#define thd_in_lock_tables                                      session_in_lock_tables
200
 
#define thd_tablespace_op(x)                                    ((x)->doingTablespaceOperation())
201
 
#define thd_alloc                                                       session_alloc
202
 
#define thd_make_lex_string                                     session_make_lex_string
203
 
 
204
 
#define my_pthread_setspecific_ptr(T, V)        pthread_setspecific(T, (void*) (V))
205
 
 
206
 
#define mysql_real_data_home                            drizzle_real_data_home
207
 
 
208
 
#define mi_int4store(T,A)   { uint32_t def_temp= (uint32_t) (A);\
209
 
                              ((unsigned char*) (T))[3]= (unsigned char) (def_temp);\
210
 
                              ((unsigned char*) (T))[2]= (unsigned char) (def_temp >> 8);\
211
 
                              ((unsigned char*) (T))[1]= (unsigned char) (def_temp >> 16);\
212
 
                              ((unsigned char*) (T))[0]= (unsigned char) (def_temp >> 24); }
213
 
 
214
 
#define mi_uint4korr(A) ((uint32_t) (((uint32_t) (((const unsigned char*) (A))[3])) +\
215
 
                                   (((uint32_t) (((const unsigned char*) (A))[2])) << 8) +\
216
 
                                   (((uint32_t) (((const unsigned char*) (A))[1])) << 16) +\
217
 
                                   (((uint32_t) (((const unsigned char*) (A))[0])) << 24)))
218
 
                                                                   
219
 
#define mi_int8store(T,A)   { uint64_t def_temp= (uint64_t) (A);\
220
 
                              ((unsigned char*) (T))[7]= (unsigned char) (def_temp);\
221
 
                              ((unsigned char*) (T))[6]= (unsigned char) (def_temp >> 8);\
222
 
                              ((unsigned char*) (T))[5]= (unsigned char) (def_temp >> 16);\
223
 
                              ((unsigned char*) (T))[4]= (unsigned char) (def_temp >> 24);\
224
 
                              ((unsigned char*) (T))[3]= (unsigned char) (def_temp >> 32);\
225
 
                              ((unsigned char*) (T))[2]= (unsigned char) (def_temp >> 40);\
226
 
                              ((unsigned char*) (T))[1]= (unsigned char) (def_temp >> 48);\
227
 
                              ((unsigned char*) (T))[0]= (unsigned char) (def_temp >> 56); }
228
 
 
229
 
#define mi_uint8korr(A) ((uint64_t) (((uint64_t) (((const unsigned char*) (A))[7])) +\
230
 
                                   (((uint64_t) (((const unsigned char*) (A))[6])) << 8) +\
231
 
                                   (((uint64_t) (((const unsigned char*) (A))[5])) << 16) +\
232
 
                                   (((uint64_t) (((const unsigned char*) (A))[4])) << 24) +\
233
 
                                   (((uint64_t) (((const unsigned char*) (A))[3])) << 32) +\
234
 
                                   (((uint64_t) (((const unsigned char*) (A))[2])) << 40) +\
235
 
                                   (((uint64_t) (((const unsigned char*) (A))[1])) << 48) +\
236
 
                                   (((uint64_t) (((const unsigned char*) (A))[0])) << 56)))
237
 
                                                                   
238
 
#else // DRIZZLED
239
 
/* The MySQL case: */
240
 
#define STRUCT_TABLE                                            struct st_table
241
 
 
242
 
#define mx_tmp_use_all_columns                          dbug_tmp_use_all_columns
243
 
#define mx_tmp_restore_column_map(x, y)         dbug_tmp_restore_column_map((x)->read_set, y)
244
 
 
245
 
#define MX_TABLE_TYPES_T                                        ulonglong
246
 
#define MX_UINT8_T                                                      uint8
247
 
#define MX_ULONG_T                                                      ulong
248
 
#define MX_ULONGLONG_T                                          ulonglong
249
 
#define MX_LONGLONG_T                                           longlong
250
 
#define MX_CHARSET_INFO                                         CHARSET_INFO
251
 
#define MX_CONST_CHARSET_INFO                           struct charset_info_st                  
252
 
#define MX_CONST                                                        
253
 
 
254
 
#endif // DRIZZLED
255
 
 
256
 
#endif