summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <monty@mishka.local>2005-07-31 12:49:55 +0300
committerunknown <monty@mishka.local>2005-07-31 12:49:55 +0300
commit6b3478ec1248825122f837411704ab387651b715 (patch)
treec4df327e7bc6c594e03c6454dddbc63a93203c6a /sql
parent90b2daa7133cfab02017ff9ffc44d5e8089c0c31 (diff)
downloadmariadb-git-6b3478ec1248825122f837411704ab387651b715.tar.gz
Fixes during review of new pushed code
Change bool in C code to my_bool Added to mysqltest --enable_parsning and --disable_parsing to avoid to have to comment parts of tests Added comparison of LEX_STRING's and use this to compare file types for view and trigger files. client/client_priv.h: Added OPT_TRIGGERS (to get rid of compiler warning) client/mysql.cc: Added cast to get rid of compiler warning client/mysqldump.c: Added OPT_TRIGGERS (to get rid of compiler warning) Abort if we can't write to outfile (even if --ignore-errors is given) client/mysqltest.c: Added --enable_parsning and --disable_parsing to avoid to have to comment parts of tests include/my_sys.h: Make my_progname const include/my_time.h: Avoid using 'bool' in C programs mysql-test/lib/init_db.sql: Align with mysql_create_system_tables (Ideally this file should be auto-generated from the above script) mysql-test/r/mysqltest.result: Test for --enable_parsing mysql-test/r/variables.result: Update results after fix for overflow checking of max_heap_table_size mysql-test/t/information_schema.test: USe --enable/disable parsing instead of comments mysql-test/t/mysqltest.test: Test for --enable_parsing mysql-test/t/sp.test: USe --enable/disable parsing instead of comments mysql-test/t/variables.test: Portability fix for 64 bit systems mysql-test/t/view.test: USe --enable/disable parsing instead of comments mysys/my_init.c: May my_progname const mysys/my_static.c: May my_progname const mysys/thr_lock.c: Remove not needed casts sql-common/my_time.c: Change bool -> my_bool as bool is not portable in C programs sql/field.cc: Test number_to_datetime() for -1 instead of < 0 (Safety fix) New prototype for TIME_to_timestamp() sql/item.h: Don't have prototypes for both uint32 and ulong as these 'may' be the same thing sql/item_timefunc.cc: New prototype for TIME_to_timestamp() sql/log.cc: Remove compiler warnings sql/mysql_priv.h: New prototype for TIME_to_timestamp() Added function for comparing LEX_STRING sql/set_var.cc: Added overflow checking when setting ulong variable sql/sql_base.cc: Added function is_equal() Changed strncmp -> is_equal() as strncmp() to not match "V" (instead of "VIEW") sql/sql_class.cc: Added comment sql/sql_select.cc: Portability fixes After review fixes sql/sql_trigger.cc: Use 'tables_alias_charset' for comparing database name Use 'is_equal()' to compare file type. (Old code didn't do the comparison correctly) sql/sql_view.cc: Use 'is_equal()' to compare file type. (Old code didn't do the comparison correctly) sql/time.cc: New prototype for TIME_to_timestamp() to allow easyer mapping to C function sql/tztime.cc: bool -> my_bool (to allow calling C code from C++ code) sql/tztime.h: bool -> my_bool (to allow calling C code from C++ code)
Diffstat (limited to 'sql')
-rw-r--r--sql/field.cc22
-rw-r--r--sql/item.h3
-rw-r--r--sql/item_timefunc.cc4
-rw-r--r--sql/log.cc6
-rw-r--r--sql/mysql_priv.h6
-rw-r--r--sql/set_var.cc10
-rw-r--r--sql/sql_base.cc8
-rw-r--r--sql/sql_class.cc4
-rw-r--r--sql/sql_select.cc45
-rw-r--r--sql/sql_trigger.cc22
-rw-r--r--sql/sql_view.cc9
-rw-r--r--sql/time.cc2
-rw-r--r--sql/tztime.cc34
-rw-r--r--sql/tztime.h2
14 files changed, 102 insertions, 75 deletions
diff --git a/sql/field.cc b/sql/field.cc
index 61c0a71b742..224b6c279f3 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -4468,7 +4468,7 @@ int Field_timestamp::store(const char *from,uint len,CHARSET_INFO *cs)
my_time_t tmp= 0;
int error;
bool have_smth_to_conv;
- bool in_dst_time_gap;
+ my_bool in_dst_time_gap;
THD *thd= table->in_use;
/* We don't want to store invalid or fuzzy datetime values in TIMESTAMP */
@@ -4539,14 +4539,14 @@ int Field_timestamp::store(longlong nr)
TIME l_time;
my_time_t timestamp= 0;
int error;
- bool in_dst_time_gap;
+ my_bool in_dst_time_gap;
THD *thd= table->in_use;
/* We don't want to store invalid or fuzzy datetime values in TIMESTAMP */
longlong tmp= number_to_datetime(nr, &l_time, (thd->variables.sql_mode &
MODE_NO_ZERO_DATE) |
MODE_NO_ZERO_IN_DATE, &error);
- if (tmp < 0)
+ if (tmp == LL(-1))
{
error= 2;
}
@@ -5215,7 +5215,7 @@ int Field_date::store(longlong nr)
MODE_NO_ZERO_DATE |
MODE_INVALID_DATES))), &error);
- if (nr < 0)
+ if (nr == LL(-1))
{
nr= 0;
error= 2;
@@ -5391,12 +5391,12 @@ int Field_newdate::store(longlong nr)
TIME l_time;
longlong tmp;
int error;
- if ((tmp= number_to_datetime(nr, &l_time,
- (TIME_FUZZY_DATE |
- (table->in_use->variables.sql_mode &
- (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
- MODE_INVALID_DATES))),
- &error) < 0))
+ if (number_to_datetime(nr, &l_time,
+ (TIME_FUZZY_DATE |
+ (table->in_use->variables.sql_mode &
+ (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
+ MODE_INVALID_DATES))),
+ &error) == LL(-1))
{
tmp= 0L;
error= 2;
@@ -5593,7 +5593,7 @@ int Field_datetime::store(longlong nr)
MODE_NO_ZERO_DATE |
MODE_INVALID_DATES))), &error);
- if (nr < 0)
+ if (nr == LL(-1))
{
nr= 0;
error= 2;
diff --git a/sql/item.h b/sql/item.h
index d3e920faa68..f0ffb160553 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -1150,8 +1150,7 @@ class Item_uint :public Item_int
{
public:
Item_uint(const char *str_arg, uint length);
- Item_uint(uint32 i) :Item_int((ulonglong) i, 10) {}
- Item_uint(ulong i) :Item_int((ulonglong) i, 10) {}
+ Item_uint(ulonglong i) :Item_int((ulonglong) i, 10) {}
Item_uint(const char *str_arg, longlong i, uint length);
double val_real()
{ DBUG_ASSERT(fixed == 1); return ulonglong2double((ulonglong)value); }
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index aa377d0bdd8..a6fbbee6f23 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -1070,7 +1070,7 @@ longlong Item_func_year::val_int()
longlong Item_func_unix_timestamp::val_int()
{
TIME ltime;
- bool not_used;
+ my_bool not_used;
DBUG_ASSERT(fixed == 1);
if (arg_count == 0)
@@ -1798,7 +1798,6 @@ bool Item_func_convert_tz::get_date(TIME *ltime,
uint fuzzy_date __attribute__((unused)))
{
my_time_t my_time_tmp;
- bool not_used;
String str;
if (!from_tz_cached)
@@ -1824,6 +1823,7 @@ bool Item_func_convert_tz::get_date(TIME *ltime,
ltime->year==TIMESTAMP_MAX_YEAR && ltime->month==1 && ltime->day==1 ||
ltime->year==TIMESTAMP_MIN_YEAR && ltime->month==12 && ltime->day==31)
{
+ my_bool not_used;
my_time_tmp= from_tz->TIME_to_gmt_sec(ltime, &not_used);
if (my_time_tmp >= TIMESTAMP_MIN_VALUE && my_time_tmp <= TIMESTAMP_MAX_VALUE)
to_tz->gmt_sec_to_TIME(ltime, my_time_tmp);
diff --git a/sql/log.cc b/sql/log.cc
index 540e482f578..5ad8ec818ef 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -58,7 +58,11 @@ static handlerton binlog_hton = {
binlog_prepare,
NULL, /* recover */
NULL, /* commit_by_xid */
- NULL /* rollback_by_xid */
+ NULL, /* rollback_by_xid */
+ NULL, /* create_cursor_read_view */
+ NULL, /* set_cursor_read_view */
+ NULL, /* close_cursor_read_view */
+ HTON_NO_FLAGS
};
/*
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index cafb15971b5..2190c4a1b24 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -823,8 +823,6 @@ bool mysqld_show_column_types(THD *thd);
bool mysqld_help (THD *thd, const char *text);
void calc_sum_of_all_status(STATUS_VAR *to);
-
-
/* information schema */
extern LEX_STRING information_schema_name;
LEX_STRING *make_lex_string(THD *thd, LEX_STRING *lex_str,
@@ -952,6 +950,7 @@ bool rename_temporary_table(THD* thd, TABLE *table, const char *new_db,
const char *table_name);
void remove_db_from_cache(const char *db);
void flush_tables();
+bool is_equal(const LEX_STRING *a, const LEX_STRING *b);
/* bits for last argument to remove_table_from_cache() */
#define RTFC_NO_FLAG 0x0000
@@ -1191,6 +1190,7 @@ extern TABLE *unused_tables;
extern I_List<i_string> binlog_do_db, binlog_ignore_db;
extern const char* any_db;
extern struct my_option my_long_options[];
+extern const LEX_STRING view_type;
/* optional things, have_* variables */
@@ -1273,7 +1273,7 @@ ulong convert_period_to_month(ulong period);
ulong convert_month_to_period(ulong month);
void get_date_from_daynr(long daynr,uint *year, uint *month,
uint *day);
-my_time_t TIME_to_timestamp(THD *thd, const TIME *t, bool *not_exist);
+my_time_t TIME_to_timestamp(THD *thd, const TIME *t, my_bool *not_exist);
bool str_to_time_with_warn(const char *str,uint length,TIME *l_time);
timestamp_type str_to_datetime_with_warn(const char *str, uint length,
TIME *l_time, uint flags);
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 5cdd4081614..68bd9654df0 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -1426,6 +1426,12 @@ bool sys_var_thd_ulong::update(THD *thd, set_var *var)
if ((ulong) tmp > max_system_variables.*offset)
tmp= max_system_variables.*offset;
+#if SIZEOF_LONG == 4
+ /* Avoid overflows on 32 bit systems */
+ if (tmp > (ulonglong) ~(ulong) 0)
+ tmp= ((ulonglong) ~(ulong) 0);
+#endif
+
if (option_limits)
tmp= (ulong) getopt_ull_limit_value(tmp, option_limits);
if (var->type == OPT_GLOBAL)
@@ -1679,7 +1685,7 @@ Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base)
pthread_mutex_lock(&LOCK_global_system_variables);
value= *(uint*) value_ptr(thd, var_type, base);
pthread_mutex_unlock(&LOCK_global_system_variables);
- return new Item_uint((uint32) value);
+ return new Item_uint((ulonglong) value);
}
case SHOW_LONG:
{
@@ -1687,7 +1693,7 @@ Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base)
pthread_mutex_lock(&LOCK_global_system_variables);
value= *(ulong*) value_ptr(thd, var_type, base);
pthread_mutex_unlock(&LOCK_global_system_variables);
- return new Item_uint(value);
+ return new Item_uint((ulonglong) value);
}
case SHOW_LONGLONG:
{
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 45b99bfee1b..b79748c18e2 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -4258,7 +4258,7 @@ open_new_frm(const char *path, const char *alias,
if ((parser= sql_parse_prepare(&pathstr, mem_root, 1)))
{
- if (!strncmp("VIEW", parser->type()->str, parser->type()->length))
+ if (is_equal(&view_type, parser->type()))
{
if (table_desc == 0 || table_desc->required_type == FRMTYPE_TABLE)
{
@@ -4281,3 +4281,9 @@ err:
bzero(outparam, sizeof(TABLE)); // do not run repair
DBUG_RETURN(1);
}
+
+
+bool is_equal(const LEX_STRING *a, const LEX_STRING *b)
+{
+ return a->length == b->length && !strncmp(a->str, b->str, a->length);
+}
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 89d5b543dfc..512c6bd71d4 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -523,6 +523,10 @@ bool THD::store_globals()
if this is the slave SQL thread.
*/
variables.pseudo_thread_id= thread_id;
+ /*
+ We have to call thr_lock_info_init() again here as THD may have been
+ created in another thread
+ */
thr_lock_info_init(&lock_info);
return 0;
}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 8aced3c1da6..000fa0790b7 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1762,7 +1762,7 @@ Cursor::init_from_thd(THD *thd)
for (handlerton **pht= thd->transaction.stmt.ht; *pht; pht++)
{
const handlerton *ht= *pht;
- close_at_commit|= (ht->flags & HTON_CLOSE_CURSORS_AT_COMMIT);
+ close_at_commit|= test(ht->flags & HTON_CLOSE_CURSORS_AT_COMMIT);
if (ht->create_cursor_read_view)
{
info->ht= ht;
@@ -8033,11 +8033,13 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
bool table_cant_handle_bit_fields,
uint convert_blob_length)
{
- Item *org_item= item;
- if (item->real_item()->type() == Item::FIELD_ITEM)
+ if (type != Item::FIELD_ITEM &&
+ item->real_item()->type() == Item::FIELD_ITEM &&
+ (item->type() != Item::REF_ITEM ||
+ !((Item_ref *) item)->depended_from))
{
item= item->real_item();
- type= item->type();
+ type= Item::FIELD_ITEM;
}
switch (type) {
case Item::SUM_FUNC_ITEM:
@@ -8051,23 +8053,18 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
case Item::FIELD_ITEM:
case Item::DEFAULT_VALUE_ITEM:
{
- if (org_item->type() != Item::REF_ITEM ||
- !((Item_ref *)org_item)->depended_from)
- {
- Item_field *field= (Item_field*) item;
- if (table_cant_handle_bit_fields &&
- field->field->type() == FIELD_TYPE_BIT)
- return create_tmp_field_from_item(thd, item, table, copy_func,
- modify_item, convert_blob_length);
- return create_tmp_field_from_field(thd, (*from_field= field->field),
- item->name, table,
- modify_item ? (Item_field*) item :
- NULL,
- convert_blob_length);
- }
- else
- item= org_item;
- }
+ Item_field *field= (Item_field*) item;
+ if (table_cant_handle_bit_fields &&
+ field->field->type() == FIELD_TYPE_BIT)
+ return create_tmp_field_from_item(thd, item, table, copy_func,
+ modify_item, convert_blob_length);
+ return create_tmp_field_from_field(thd, (*from_field= field->field),
+ item->name, table,
+ modify_item ? (Item_field*) item :
+ NULL,
+ convert_blob_length);
+ }
+ /* Fall through */
case Item::FUNC_ITEM:
case Item::COND_ITEM:
case Item::FIELD_AVG_ITEM:
@@ -10910,13 +10907,13 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
usable_keys.set_all();
for (ORDER *tmp_order=order; tmp_order ; tmp_order=tmp_order->next)
{
- if ((*tmp_order->item)->real_item()->type() != Item::FIELD_ITEM)
+ Item *item= (*tmp_order->item)->real_item();
+ if (item->type() != Item::FIELD_ITEM)
{
usable_keys.clear_all();
DBUG_RETURN(0);
}
- usable_keys.intersect(((Item_field*) (*tmp_order->item)->real_item())->
- field->part_of_sortkey);
+ usable_keys.intersect(((Item_field*) item)->field->part_of_sortkey);
if (usable_keys.is_clear_all())
DBUG_RETURN(0); // No usable keys
}
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index 976fac3d9c9..34bd0eababe 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -226,7 +226,7 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables)
/* Trigger must be in the same schema as target table. */
- if (my_strcasecmp(system_charset_info, table->s->db,
+ if (my_strcasecmp(table_alias_charset, table->s->db,
lex->spname->m_db.str ? lex->spname->m_db.str :
thd->db))
{
@@ -396,7 +396,7 @@ bool Table_triggers_list::drop_trigger(THD *thd, TABLE_LIST *tables)
{
it_def++;
- if (my_strcasecmp(system_charset_info, lex->spname->m_name.str,
+ if (my_strcasecmp(table_alias_charset, lex->spname->m_name.str,
name->str) == 0)
{
/*
@@ -541,8 +541,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
if ((parser= sql_parse_prepare(&path, &table->mem_root, 1)))
{
- if (!strncmp(triggers_file_type.str, parser->type()->str,
- parser->type()->length))
+ if (is_equal(&triggers_file_type, parser->type()))
{
Table_triggers_list *triggers=
new (&table->mem_root) Table_triggers_list(table);
@@ -601,7 +600,8 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
triggers->bodies[lex.trg_chistics.event]
[lex.trg_chistics.action_time]= lex.sphead;
- if (triggers->names_list.push_back(&lex.sphead->m_name, &table->mem_root))
+ if (triggers->names_list.push_back(&lex.sphead->m_name,
+ &table->mem_root))
goto err_with_lex_cleanup;
if (names_only)
@@ -615,8 +615,9 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
in old/new versions of row in trigger to Field objects in table being
opened.
- We ignore errors here, because if even something is wrong we still will
- be willing to open table to perform some operations (e.g. SELECT)...
+ We ignore errors here, because if even something is wrong we still
+ will be willing to open table to perform some operations
+ (e.g. SELECT)...
Anyway some things can be checked only during trigger execution.
*/
for (Item_trigger_field *trg_field=
@@ -647,7 +648,7 @@ err_with_lex_cleanup:
be merged into .FRM anyway.
*/
my_error(ER_WRONG_OBJECT, MYF(0),
- table_name, triggers_file_ext, "TRIGGER");
+ table_name, triggers_file_ext+1, "TRIGGER");
DBUG_RETURN(1);
}
@@ -726,10 +727,9 @@ static TABLE_LIST *add_table_for_trigger(THD *thd, sp_name *trig)
if (!(parser= sql_parse_prepare(&path, thd->mem_root, 1)))
DBUG_RETURN(0);
- if (strncmp(trigname_file_type.str, parser->type()->str,
- parser->type()->length))
+ if (!is_equal(&trigname_file_type, parser->type()))
{
- my_error(ER_WRONG_OBJECT, MYF(0), trig->m_name.str, trigname_file_ext,
+ my_error(ER_WRONG_OBJECT, MYF(0), trig->m_name.str, trigname_file_ext+1,
"TRIGGERNAME");
DBUG_RETURN(0);
}
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index a60bf80a6d8..c7f2047aac6 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -24,6 +24,8 @@
#define MD5_BUFF_LENGTH 33
+const LEX_STRING view_type= { (char*) STRING_WITH_LEN("VIEW") };
+
static int mysql_register_view(THD *thd, TABLE_LIST *view,
enum_view_create_mode mode);
@@ -431,7 +433,7 @@ static File_option view_parameters[]=
FILE_OPTIONS_STRING}
};
-static LEX_STRING view_file_type[]= {{(char*)"VIEW", 4}};
+static LEX_STRING view_file_type[]= {{(char*) STRING_WITH_LEN("VIEW") }};
/*
@@ -470,7 +472,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
thd->variables.sql_mode|= sql_mode;
}
str.append('\0');
- DBUG_PRINT("VIEW", ("View: %s", str.ptr()));
+ DBUG_PRINT("info", ("View: %s", str.ptr()));
/* print file name */
(void) my_snprintf(dir_buff, FN_REFLEN, "%s/%s/",
@@ -507,8 +509,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
if (!(parser= sql_parse_prepare(&path, thd->mem_root, 0)))
DBUG_RETURN(1);
- if (!parser->ok() ||
- strncmp("VIEW", parser->type()->str, parser->type()->length))
+ if (!parser->ok() || !is_equal(&view_type, parser->type()))
{
my_error(ER_WRONG_OBJECT, MYF(0),
(view->db ? view->db : thd->db), view->table_name, "VIEW");
diff --git a/sql/time.cc b/sql/time.cc
index a3ec2283860..5069031081d 100644
--- a/sql/time.cc
+++ b/sql/time.cc
@@ -223,7 +223,7 @@ str_to_datetime_with_warn(const char *str, uint length, TIME *l_time,
0 - t contains datetime value which is out of TIMESTAMP range.
*/
-my_time_t TIME_to_timestamp(THD *thd, const TIME *t, bool *in_dst_time_gap)
+my_time_t TIME_to_timestamp(THD *thd, const TIME *t, my_bool *in_dst_time_gap)
{
my_time_t timestamp;
diff --git a/sql/tztime.cc b/sql/tztime.cc
index f5111459da2..5a907f0d170 100644
--- a/sql/tztime.cc
+++ b/sql/tztime.cc
@@ -880,12 +880,12 @@ sec_since_epoch(int year, int mon, int mday, int hour, int min ,int sec)
0 in case of error.
*/
static my_time_t
-TIME_to_gmt_sec(const TIME *t, const TIME_ZONE_INFO *sp, bool *in_dst_time_gap)
+TIME_to_gmt_sec(const TIME *t, const TIME_ZONE_INFO *sp,
+ my_bool *in_dst_time_gap)
{
my_time_t local_t;
uint saved_seconds;
uint i;
-
DBUG_ENTER("TIME_to_gmt_sec");
/* We need this for correct leap seconds handling */
@@ -962,7 +962,7 @@ class Time_zone_system : public Time_zone
{
public:
virtual my_time_t TIME_to_gmt_sec(const TIME *t,
- bool *in_dst_time_gap) const;
+ my_bool *in_dst_time_gap) const;
virtual void gmt_sec_to_TIME(TIME *tmp, my_time_t t) const;
virtual const String * get_name() const;
};
@@ -994,7 +994,7 @@ public:
Corresponding my_time_t value or 0 in case of error
*/
my_time_t
-Time_zone_system::TIME_to_gmt_sec(const TIME *t, bool *in_dst_time_gap) const
+Time_zone_system::TIME_to_gmt_sec(const TIME *t, my_bool *in_dst_time_gap) const
{
long not_used;
return my_system_gmt_sec(t, &not_used, in_dst_time_gap);
@@ -1055,7 +1055,7 @@ class Time_zone_utc : public Time_zone
{
public:
virtual my_time_t TIME_to_gmt_sec(const TIME *t,
- bool *in_dst_time_gap) const;
+ my_bool *in_dst_time_gap) const;
virtual void gmt_sec_to_TIME(TIME *tmp, my_time_t t) const;
virtual const String * get_name() const;
};
@@ -1081,7 +1081,7 @@ public:
0
*/
my_time_t
-Time_zone_utc::TIME_to_gmt_sec(const TIME *t, bool *in_dst_time_gap) const
+Time_zone_utc::TIME_to_gmt_sec(const TIME *t, my_bool *in_dst_time_gap) const
{
/* Should be never called */
DBUG_ASSERT(0);
@@ -1144,7 +1144,7 @@ class Time_zone_db : public Time_zone
public:
Time_zone_db(TIME_ZONE_INFO *tz_info_arg, const String * tz_name_arg);
virtual my_time_t TIME_to_gmt_sec(const TIME *t,
- bool *in_dst_time_gap) const;
+ my_bool *in_dst_time_gap) const;
virtual void gmt_sec_to_TIME(TIME *tmp, my_time_t t) const;
virtual const String * get_name() const;
private:
@@ -1193,7 +1193,7 @@ Time_zone_db::Time_zone_db(TIME_ZONE_INFO *tz_info_arg,
Corresponding my_time_t value or 0 in case of error
*/
my_time_t
-Time_zone_db::TIME_to_gmt_sec(const TIME *t, bool *in_dst_time_gap) const
+Time_zone_db::TIME_to_gmt_sec(const TIME *t, my_bool *in_dst_time_gap) const
{
return ::TIME_to_gmt_sec(t, tz_info, in_dst_time_gap);
}
@@ -1240,7 +1240,7 @@ class Time_zone_offset : public Time_zone
public:
Time_zone_offset(long tz_offset_arg);
virtual my_time_t TIME_to_gmt_sec(const TIME *t,
- bool *in_dst_time_gap) const;
+ my_bool *in_dst_time_gap) const;
virtual void gmt_sec_to_TIME(TIME *tmp, my_time_t t) const;
virtual const String * get_name() const;
/*
@@ -1292,7 +1292,7 @@ Time_zone_offset::Time_zone_offset(long tz_offset_arg):
Corresponding my_time_t value or 0 in case of error
*/
my_time_t
-Time_zone_offset::TIME_to_gmt_sec(const TIME *t, bool *in_dst_time_gap) const
+Time_zone_offset::TIME_to_gmt_sec(const TIME *t, my_bool *in_dst_time_gap) const
{
return sec_since_epoch(t->year, t->month, t->day,
t->hour, t->minute, t->second) -
@@ -2549,8 +2549,6 @@ main(int argc, char **argv)
time_t t, t1, t2;
char fullname[FN_REFLEN+1];
char *str_end;
- long not_used;
- bool not_used_2;
MEM_ROOT tz_storage;
MY_INIT(argv[0]);
@@ -2660,14 +2658,21 @@ main(int argc, char **argv)
dates.
*/
for (time_tmp.year= 1980; time_tmp.year < 2010; time_tmp.year++)
+ {
for (time_tmp.month= 1; time_tmp.month < 13; time_tmp.month++)
+ {
for (time_tmp.day= 1;
time_tmp.day < mon_lengths[isleap(time_tmp.year)][time_tmp.month-1];
time_tmp.day++)
+ {
for (time_tmp.hour= 0; time_tmp.hour < 24; time_tmp.hour++)
+ {
for (time_tmp.minute= 0; time_tmp.minute < 60; time_tmp.minute+= 5)
+ {
for (time_tmp.second=0; time_tmp.second<60; time_tmp.second+=25)
{
+ long not_used;
+ my_bool not_used_2;
t= (time_t)my_system_gmt_sec(&time_tmp, &not_used, &not_used_2);
t1= (time_t)TIME_to_gmt_sec(&time_tmp, &tz_info, &not_used_2);
if (t != t1)
@@ -2699,6 +2704,11 @@ main(int argc, char **argv)
return 1;
}
}
+ }
+ }
+ }
+ }
+ }
printf("TIME_to_gmt_sec = my_system_gmt_sec for test range\n");
diff --git a/sql/tztime.h b/sql/tztime.h
index cbf359e8961..a168fe4fb73 100644
--- a/sql/tztime.h
+++ b/sql/tztime.h
@@ -37,7 +37,7 @@ public:
falls into spring time-gap (or lefts it untouched otherwise).
*/
virtual my_time_t TIME_to_gmt_sec(const TIME *t,
- bool *in_dst_time_gap) const = 0;
+ my_bool *in_dst_time_gap) const = 0;
/*
Converts time in my_time_t representation to local time in
broken down TIME representation.