summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2000-11-27 02:44:41 +0200
committerunknown <monty@narttu.mysql.fi>2000-11-27 02:44:41 +0200
commit2700d28319bf29ee3957a357eaa102bcc72e1ac4 (patch)
tree8a737a53b89e213741053e2d7b14013c4f8609a3 /sql/sql_parse.cc
parentd164cbf20770565dc8674e5266beb2a8d88f748a (diff)
parent1b337e01d5d0a97b3a66eb98bcad658cfecb65b6 (diff)
downloadmariadb-git-2700d28319bf29ee3957a357eaa102bcc72e1ac4.tar.gz
merge
sql/slave.cc: Auto merged Docs/manual.texi: Merge
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc27
1 files changed, 16 insertions, 11 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 8e9584bc9d7..195a7a4f525 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -73,13 +73,12 @@ static void init_signals(void)
static inline bool end_active_trans(THD *thd)
{
- if (!(thd->options & OPTION_AUTO_COMMIT) ||
- (thd->options & OPTION_BEGIN))
+ if (thd->options & (OPTION_NOT_AUTO_COMMIT | OPTION_BEGIN))
{
+ thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE);
+ thd->server_status&= ~SERVER_STATUS_IN_TRANS;
if (ha_commit(thd))
return 1;
- thd->options&= ~(ulong) (OPTION_BEGIN);
- thd->server_status&= ~SERVER_STATUS_IN_TRANS;
}
return 0;
}
@@ -576,6 +575,7 @@ bool do_command(THD *thd)
thread_running++;
VOID(pthread_mutex_unlock(&LOCK_thread_count));
thd->set_time();
+ thd->lex.options=0; // We store status here
switch(command) {
case COM_INIT_DB:
if (!mysql_change_db(thd,packet+1))
@@ -827,7 +827,7 @@ bool do_command(THD *thd)
{
if ((ulong) (thd->start_time - thd->time_after_lock) > long_query_time ||
((thd->lex.options &
- (OPTION_NO_INDEX_USED | OPTION_NO_GOOD_INDEX_USED)) &&
+ (QUERY_NO_INDEX_USED | QUERY_NO_GOOD_INDEX_USED)) &&
(specialflag & SPECIAL_LONG_LOG_FORMAT)))
{
long_query_count++;
@@ -1560,12 +1560,12 @@ mysql_execute_command(void)
thd->options,(long) thd->default_select_limit));
/* Check if auto_commit mode changed */
- if ((org_options ^ lex->options) & OPTION_AUTO_COMMIT)
+ if ((org_options ^ lex->options) & OPTION_NOT_AUTO_COMMIT)
{
- if (!(org_options & OPTION_AUTO_COMMIT))
+ if ((org_options & OPTION_NOT_AUTO_COMMIT))
{
/* We changed to auto_commit mode */
- thd->options&= ~(ulong) (OPTION_BEGIN);
+ thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE);
thd->server_status|= SERVER_STATUS_AUTOCOMMIT;
if (ha_commit(thd))
{
@@ -1750,7 +1750,7 @@ mysql_execute_command(void)
even if there is a problem with the OPTION_AUTO_COMMIT flag
(Which of course should never happen...)
*/
- thd->options&= ~(ulong) (OPTION_BEGIN);
+ thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE);
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
if (!ha_commit(thd))
send_ok(&thd->net);
@@ -1758,12 +1758,17 @@ mysql_execute_command(void)
res= -1;
break;
case SQLCOM_ROLLBACK:
- thd->options&= ~(ulong) (OPTION_BEGIN);
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
if (!ha_rollback(thd))
- send_ok(&thd->net);
+ {
+ if (thd->options & OPTION_STATUS_NO_TRANS_UPDATE)
+ send_warning(&thd->net,ER_WARNING_NOT_COMPLETE_ROLLBACK,0);
+ else
+ send_ok(&thd->net);
+ }
else
res= -1;
+ thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE);
break;
default: /* Impossible */
send_ok(&thd->net);