41
41
#include <drizzled/session.h>
42
42
#include <drizzled/db.h>
43
43
#include <drizzled/item/create.h>
44
#include <drizzled/function/time/get_format.h>
45
44
#include <drizzled/errmsg.h>
46
45
#include <drizzled/unireg.h>
47
46
#include <drizzled/plugin_scheduling.h>
361
360
const key_map key_map_empty(0);
362
361
key_map key_map_full(0); // Will be initialized later
364
const char *opt_date_time_formats[3];
366
363
uint32_t drizzle_data_home_len;
367
364
char drizzle_data_home_buff[2], *drizzle_data_home=drizzle_real_data_home;
368
365
char server_version[SERVER_VERSION_LENGTH];
668
665
multi_keycache_free();
669
666
free_status_vars();
670
667
my_free_open_file_info();
671
free((char*) global_system_variables.date_format);
672
free((char*) global_system_variables.time_format);
673
free((char*) global_system_variables.datetime_format);
674
668
if (defaults_argv)
675
669
free_defaults(defaults_argv);
676
670
free(sys_init_connect.value);
1360
1354
static const char *load_default_groups[]= {
1361
1355
DRIZZLE_CONFIG_NAME,"server", DRIZZLE_BASE_VERSION, 0, 0};
1365
Initialize one of the global date/time format variables.
1367
@param format_type What kind of format should be supported
1368
@param var_ptr Pointer to variable that should be updated
1371
The default value is taken from either opt_date_time_formats[] or
1372
the ISO format (ANSI SQL)
1380
static bool init_global_datetime_format(enum enum_drizzle_timestamp_type format_type,
1381
DATE_TIME_FORMAT **var_ptr)
1383
/* Get command line option */
1384
const char *str= opt_date_time_formats[format_type];
1386
if (!str) // No specified format
1388
str= get_date_time_format_str(&known_date_time_formats[ISO_FORMAT],
1391
Set the "command line" option to point to the generated string so
1392
that we can set global formats back to default
1394
opt_date_time_formats[format_type]= str;
1396
if (!(*var_ptr= date_time_format_make(format_type, str, strlen(str))))
1398
fprintf(stderr, _("Wrong date/time format specifier: %s\n"), str);
1404
1357
SHOW_VAR com_status_vars[]= {
1405
1358
{"admin_commands", (char*) offsetof(STATUS_VAR, com_other), SHOW_LONG_STATUS},
1406
1359
{"assign_to_keycache", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_ASSIGN_TO_KEYCACHE]), SHOW_LONG_STATUS},
1501
1454
strncpy(glob_hostname, STRING_WITH_LEN("localhost"));
1502
1455
errmsg_printf(ERRMSG_LVL_WARN, _("gethostname failed, using '%s' as hostname"),
1503
1456
glob_hostname);
1504
strncpy(pidfile_name, STRING_WITH_LEN("mysql"));
1457
strncpy(pidfile_name, STRING_WITH_LEN("drizzle"));
1507
1460
strncpy(pidfile_name, glob_hostname, sizeof(pidfile_name)-5);
2164
2117
OPT_SORT_BUFFER, OPT_TABLE_OPEN_CACHE, OPT_TABLE_DEF_CACHE,
2165
2118
OPT_TMP_TABLE_SIZE, OPT_THREAD_STACK,
2166
2119
OPT_WAIT_TIMEOUT,
2167
OPT_DEFAULT_WEEK_FORMAT,
2168
2120
OPT_RANGE_ALLOC_BLOCK_SIZE,
2169
2121
OPT_QUERY_ALLOC_BLOCK_SIZE, OPT_QUERY_PREALLOC_SIZE,
2170
2122
OPT_TRANS_ALLOC_BLOCK_SIZE, OPT_TRANS_PREALLOC_SIZE,
2439
2388
"packet before responding with 'Bad handshake'."),
2440
2389
(char**) &connect_timeout, (char**) &connect_timeout,
2441
2390
0, GET_ULONG, REQUIRED_ARG, CONNECT_TIMEOUT, 2, LONG_TIMEOUT, 0, 1, 0 },
2442
{ "date_format", OPT_DATE_FORMAT,
2443
N_("The DATE format (For future)."),
2444
(char**) &opt_date_time_formats[DRIZZLE_TIMESTAMP_DATE],
2445
(char**) &opt_date_time_formats[DRIZZLE_TIMESTAMP_DATE],
2446
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
2447
{ "datetime_format", OPT_DATETIME_FORMAT,
2448
N_("The DATETIME/TIMESTAMP format (for future)."),
2449
(char**) &opt_date_time_formats[DRIZZLE_TIMESTAMP_DATETIME],
2450
(char**) &opt_date_time_formats[DRIZZLE_TIMESTAMP_DATETIME],
2451
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
2452
2391
{ "div_precision_increment", OPT_DIV_PRECINCREMENT,
2453
2392
N_("Precision of the result of '/' operator will be increased on that "
2698
2637
(char**) &my_thread_stack_size, 0, GET_ULONG,
2699
2638
REQUIRED_ARG,DEFAULT_THREAD_STACK,
2700
2639
UINT32_C(1024*128), SIZE_MAX, 0, 1024, 0},
2701
{ "time_format", OPT_TIME_FORMAT,
2702
N_("The TIME format (for future)."),
2703
(char**) &opt_date_time_formats[DRIZZLE_TIMESTAMP_TIME],
2704
(char**) &opt_date_time_formats[DRIZZLE_TIMESTAMP_TIME],
2705
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
2706
2640
{"tmp_table_size", OPT_TMP_TABLE_SIZE,
2707
2641
N_("If an internal in-memory temporary table exceeds this size, Drizzle will"
2708
2642
" automatically convert it to an on-disk MyISAM table."),
2948
2882
table_alias_charset= &my_charset_bin;
2949
2883
character_set_filesystem= &my_charset_bin;
2951
opt_date_time_formats[0]= opt_date_time_formats[1]= opt_date_time_formats[2]= 0;
2953
2885
/* Things with default values that are not zero */
2954
2886
delay_key_write_options= (uint32_t) DELAY_KEY_WRITE_ON;
2955
2887
drizzle_home_ptr= drizzle_home;
3282
3214
my_default_record_cache_size=global_system_variables.read_buff_size;
3283
3215
myisam_max_temp_length= INT32_MAX;
3285
if (init_global_datetime_format(DRIZZLE_TIMESTAMP_DATE,
3286
&global_system_variables.date_format) ||
3287
init_global_datetime_format(DRIZZLE_TIMESTAMP_TIME,
3288
&global_system_variables.time_format) ||
3289
init_global_datetime_format(DRIZZLE_TIMESTAMP_DATETIME,
3290
&global_system_variables.datetime_format))
3296
3219
Create version name for running drizzled version
3297
3220
We automaticly add suffixes -debug, -embedded and -log to the version