summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <igor@rurik.mysql.com>2005-11-04 15:03:29 -0800
committerunknown <igor@rurik.mysql.com>2005-11-04 15:03:29 -0800
commit19b733aad07f6bd0f34fdc4b85d0276169cb289c (patch)
treececfcbb6476157e81e6ee2a544a2cc932011efc6 /sql
parent61b86c599168338632c17c243fcd65ae5f91f022 (diff)
parent2b1652046d1e1a4d2046fce919461aadf5f08be4 (diff)
downloadmariadb-git-19b733aad07f6bd0f34fdc4b85d0276169cb289c.tar.gz
Merge rurik.mysql.com:/home/igor/mysql-5.0
into rurik.mysql.com:/home/igor/dev/mysql-5.0-0 sql/handler.h: Auto merged sql/sql_table.cc: Auto merged
Diffstat (limited to 'sql')
-rw-r--r--sql/handler.h1
-rw-r--r--sql/share/errmsg.txt2
-rw-r--r--sql/sql_table.cc33
3 files changed, 26 insertions, 10 deletions
diff --git a/sql/handler.h b/sql/handler.h
index e16c428954c..e317f95b990 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -45,6 +45,7 @@
#define HA_ADMIN_REJECT -6
#define HA_ADMIN_TRY_ALTER -7
#define HA_ADMIN_WRONG_CHECKSUM -8
+#define HA_ADMIN_NOT_BASE_TABLE -9
/* Bits in table_flags() to show what database can do */
diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt
index f85bda90e81..24e1d4b6b81 100644
--- a/sql/share/errmsg.txt
+++ b/sql/share/errmsg.txt
@@ -5421,3 +5421,5 @@ ER_NO_REFERENCED_ROW_2 23000
eng "Cannot add or update a child row: a foreign key constraint fails (%.192s)"
ER_SP_BAD_VAR_SHADOW 42000
eng "Variable '%-.64s' must be quoted with `...`, or renamed"
+ER_CHECK_NOT_BASE_TABLE 42000
+ eng "You cannot apply %s to a view"
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 94c2f0d5585..b339e6a81e9 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -2196,7 +2196,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
/* if view are unsupported */
if (table->view && view_operator_func == NULL)
{
- result_code= HA_ADMIN_NOT_IMPLEMENTED;
+ result_code= HA_ADMIN_NOT_BASE_TABLE;
goto send_result;
}
thd->open_options&= ~extra_open_options;
@@ -2331,6 +2331,16 @@ send_result_message:
}
break;
+ case HA_ADMIN_NOT_BASE_TABLE:
+ {
+ char buf[ERRMSGSIZE+20];
+ uint length= my_snprintf(buf, ERRMSGSIZE,
+ ER(ER_CHECK_NOT_BASE_TABLE), operator_name);
+ protocol->store("note", 4, system_charset_info);
+ protocol->store(buf, length, system_charset_info);
+ }
+ break;
+
case HA_ADMIN_OK:
protocol->store("status", 6, system_charset_info);
protocol->store("OK",2, system_charset_info);
@@ -2431,16 +2441,19 @@ send_result_message:
break;
}
}
- if (fatal_error)
- table->table->s->version=0; // Force close of table
- else if (open_for_modify)
+ if (table->table)
{
- pthread_mutex_lock(&LOCK_open);
- remove_table_from_cache(thd, table->table->s->db,
- table->table->s->table_name, RTFC_NO_FLAG);
- pthread_mutex_unlock(&LOCK_open);
- /* May be something modified consequently we have to invalidate cache */
- query_cache_invalidate3(thd, table->table, 0);
+ if (fatal_error)
+ table->table->s->version=0; // Force close of table
+ else if (open_for_modify)
+ {
+ pthread_mutex_lock(&LOCK_open);
+ remove_table_from_cache(thd, table->table->s->db,
+ table->table->s->table_name, RTFC_NO_FLAG);
+ pthread_mutex_unlock(&LOCK_open);
+ /* Something may be modified, that's why we have to invalidate cache */
+ query_cache_invalidate3(thd, table->table, 0);
+ }
}
close_thread_tables(thd);
table->table=0; // For query cache