summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <Sinisa@sinisa.nasamreza.org>2003-03-12 14:48:00 +0200
committerunknown <Sinisa@sinisa.nasamreza.org>2003-03-12 14:48:00 +0200
commit40a781a6d638d7b1685772057fd4cae22e7cb887 (patch)
tree6440530d8b740aab525e77abca868ad58bab4808 /sql
parentcbbe5e8e2b45d20fbf06c3110e86d3faa5ba5542 (diff)
parent4976cd5529fb0fe19891a7ef3bc7ff68146bf6a3 (diff)
downloadmariadb-git-40a781a6d638d7b1685772057fd4cae22e7cb887.tar.gz
Merge sinisa@bk-internal.mysql.com:/home/bk/mysql-4.0
into sinisa.nasamreza.org:/mnt/work/mysql-4.0 sql/sql_parse.cc: Auto merged
Diffstat (limited to 'sql')
-rw-r--r--sql/field.cc25
-rw-r--r--sql/field.h3
-rw-r--r--sql/mysqld.cc2
-rw-r--r--sql/slave.cc16
-rw-r--r--sql/sql_class.cc2
-rw-r--r--sql/sql_insert.cc5
-rw-r--r--sql/sql_parse.cc3
-rw-r--r--sql/sql_select.cc6
8 files changed, 45 insertions, 17 deletions
diff --git a/sql/field.cc b/sql/field.cc
index b8c63db6708..ce5e240aba8 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -2421,6 +2421,14 @@ void Field_double::sql_type(String &res) const
** by handler.cc. The form->timestamp points at the automatic timestamp.
****************************************************************************/
+enum Item_result Field_timestamp::result_type() const
+{
+ return (!current_thd->variables.new_mode &&
+ (field_length == 8 || field_length == 14) ? INT_RESULT :
+ STRING_RESULT);
+}
+
+
Field_timestamp::Field_timestamp(char *ptr_arg, uint32 len_arg,
enum utype unireg_check_arg,
const char *field_name_arg,
@@ -2783,6 +2791,23 @@ void Field_timestamp::set_time()
longstore(ptr,tmp);
}
+/*
+ This is an exact copy of Field_num except that 'length' is depending
+ on --new mode
+*/
+
+void Field_timestamp::make_field(Send_field *field)
+{
+ field->table_name=table_name;
+ field->col_name=field_name;
+ /* If --new, then we are using "YYYY-MM-DD HH:MM:SS" format */
+ field->length= current_thd->variables.new_mode ? 19 : field_length;
+ field->type=type();
+ field->flags=table->maybe_null ? (flags & ~NOT_NULL_FLAG) : flags;
+ field->decimals=dec;
+}
+
+
/****************************************************************************
** time type
** In string context: HH:MM:SS
diff --git a/sql/field.h b/sql/field.h
index 29c185505c7..842bbb89988 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -541,7 +541,7 @@ public:
Field_timestamp(char *ptr_arg, uint32 len_arg,
enum utype unireg_check_arg, const char *field_name_arg,
struct st_table *table_arg);
- enum Item_result result_type () const { return field_length == 8 || field_length == 14 ? INT_RESULT : STRING_RESULT; }
+ enum Item_result result_type () const;
enum_field_types type() const { return FIELD_TYPE_TIMESTAMP;}
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
void store(const char *to,uint length);
@@ -575,6 +575,7 @@ public:
void fill_and_store(char *from,uint len);
bool get_date(TIME *ltime,bool fuzzydate);
bool get_time(TIME *ltime);
+ void make_field(Send_field *field);
};
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index daa5bfcc7ff..411c9778c3e 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -4225,7 +4225,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
if (!mysqld_user)
mysqld_user= argument;
else
- fprintf(stderr, "Warning: Ignoring user change to '%s' becasue the user is set to '%s' earlier on the command line\n", argument, mysqld_user);
+ fprintf(stderr, "Warning: Ignoring user change to '%s' because the user was set to '%s' earlier on the command line\n", argument, mysqld_user);
break;
case 'L':
strmake(language, argument, sizeof(language)-1);
diff --git a/sql/slave.cc b/sql/slave.cc
index daca8fe1cf6..5ddea7501e4 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -401,9 +401,9 @@ int terminate_slave_threads(MASTER_INFO* mi,int thread_mask,bool skip_lock)
DBUG_PRINT("info",("Terminating IO thread"));
mi->abort_slave=1;
if ((error=terminate_slave_thread(mi->io_thd,io_lock,
- io_cond_lock,
- &mi->stop_cond,
- &mi->slave_running)) &&
+ io_cond_lock,
+ &mi->stop_cond,
+ &mi->slave_running)) &&
!force_all)
DBUG_RETURN(error);
}
@@ -443,12 +443,10 @@ int terminate_slave_thread(THD* thd, pthread_mutex_t* term_lock,
be referening freed memory trying to kick it
*/
THD_CHECK_SENTRY(thd);
- if (*slave_running)
+
+ while (*slave_running) // Should always be true
{
KICK_SLAVE(thd);
- }
- while (*slave_running)
- {
/*
There is a small chance that slave thread might miss the first
alarm. To protect againts it, resend the signal until it reacts
@@ -456,10 +454,6 @@ int terminate_slave_thread(THD* thd, pthread_mutex_t* term_lock,
struct timespec abstime;
set_timespec(abstime,2);
pthread_cond_timedwait(term_cond, cond_lock, &abstime);
- if (*slave_running)
- {
- KICK_SLAVE(thd);
- }
}
if (term_lock)
pthread_mutex_unlock(term_lock);
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index a99d17b0ec4..a481b365182 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -419,12 +419,14 @@ CHANGED_TABLE_LIST* THD::changed_table_dup(const char *key, long key_length)
#ifdef SIGNAL_WITH_VIO_CLOSE
void THD::close_active_vio()
{
+ DBUG_ENTER("close_active_vio");
safe_mutex_assert_owner(&LOCK_delete);
if (active_vio)
{
vio_close(active_vio);
active_vio = 0;
}
+ DBUG_RETURN;
}
#endif
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 5bf852afc32..9f1a0e93cb9 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -139,9 +139,8 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
*/
if ((lock_type == TL_WRITE_DELAYED &&
((specialflag & (SPECIAL_NO_NEW_FUNC | SPECIAL_SAFE_MODE)) ||
- thd->slave_thread)) ||
- (lock_type == TL_WRITE_CONCURRENT_INSERT && duplic == DUP_REPLACE) ||
- !max_insert_delayed_threads)
+ thd->slave_thread || !max_insert_delayed_threads)) ||
+ (lock_type == TL_WRITE_CONCURRENT_INSERT && duplic == DUP_REPLACE))
lock_type=TL_WRITE;
if (lock_type == TL_WRITE_DELAYED)
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index b01800ee61a..24643f18ac7 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1595,6 +1595,7 @@ mysql_execute_command(void)
for (table = tables->next ; table ; table=table->next)
table->lock_type= lex->lock_option;
}
+ select_lex->options|= SELECT_NO_UNLOCK;
thd->offset_limit=select_lex->offset_limit;
thd->select_limit=select_lex->select_limit+select_lex->offset_limit;
if (thd->select_limit < select_lex->select_limit)
@@ -1928,6 +1929,8 @@ mysql_execute_command(void)
if ((res=check_table_access(thd, SELECT_ACL, save_next)))
goto error;
}
+ /* Don't unlock tables until command is written to binary log */
+ select_lex->options|= SELECT_NO_UNLOCK;
select_result *result;
thd->offset_limit=select_lex->offset_limit;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index d3934fbd620..ffe20095963 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -4469,7 +4469,11 @@ do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure)
error=0;
if (!table) // If sending data to client
{
- join_free(join); // Unlock all cursors
+ /*
+ The following will unlock all cursors if the command wasn't an
+ update command
+ */
+ join_free(join);
if (join->result->send_eof())
error= 1; // Don't send error
}