summaryrefslogtreecommitdiff
path: root/sql/sql_view.cc
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2004-10-28 19:37:25 +0300
committerunknown <bell@sanja.is.com.ua>2004-10-28 19:37:25 +0300
commit4f553314edfc04e2551fed2dc94d72f060b722e2 (patch)
tree9ac9d13e53158ee30952aed1d7b5c187e9725380 /sql/sql_view.cc
parent17cf3c633eb1db29457cbd62c5fc022d07d5dd6d (diff)
downloadmariadb-git-4f553314edfc04e2551fed2dc94d72f060b722e2.tar.gz
VIEW support for CHECK TABLE command (WL#1984)
mysql-test/r/view.result: test of CHECK TABLE for VIEW mysql-test/t/view.test: test of CHECK TABLE for VIEW sql/handler.h: new check message sql/sql_table.cc: view support for admin table sql/sql_view.cc: check of view MD5 added sql/sql_view.h: check of view MD5 added
Diffstat (limited to 'sql/sql_view.cc')
-rw-r--r--sql/sql_view.cc29
1 files changed, 28 insertions, 1 deletions
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 7894287aee4..361771cd04e 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -21,6 +21,8 @@
#include "parse_file.h"
#include "sp.h"
+#define MD5_BUFF_LENGTH 33
+
static int mysql_register_view(THD *thd, TABLE_LIST *view,
enum_view_create_mode mode);
@@ -381,7 +383,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
{
char buff[4096];
String str(buff,(uint32) sizeof(buff), system_charset_info);
- char md5[33];
+ char md5[MD5_BUFF_LENGTH];
bool can_be_merged;
char dir_buff[FN_REFLEN], file_buff[FN_REFLEN];
LEX_STRING dir, file;
@@ -1036,3 +1038,28 @@ void insert_view_fields(List<Item> *list, TABLE_LIST *view)
}
DBUG_VOID_RETURN;
}
+
+/*
+ checking view md5 check suum
+
+ SINOPSYS
+ view_checksum()
+ thd threar handler
+ view view for check
+
+ RETUIRN
+ HA_ADMIN_OK OK
+ HA_ADMIN_NOT_IMPLEMENTED it is not VIEW
+ HA_ADMIN_WRONG_CHECKSUM check sum is wrong
+*/
+
+int view_checksum(THD *thd, TABLE_LIST *view)
+{
+ char md5[MD5_BUFF_LENGTH];
+ if (!view->view || view->md5.length != 32)
+ return HA_ADMIN_NOT_IMPLEMENTED;
+ view->calc_md5(md5);
+ return (strncmp(md5, view->md5.str, 32) ?
+ HA_ADMIN_WRONG_CHECKSUM :
+ HA_ADMIN_OK);
+}