summaryrefslogtreecommitdiff
path: root/storage/myisam
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2010-10-14 15:46:20 -0700
committerIgor Babaev <igor@askmonty.org>2010-10-14 15:46:20 -0700
commit3c9dcf9da70361eb6f2acd8e04929713d7856a9c (patch)
treecb60d590bc4dd80039c800aa4d75d202ac3cbeea /storage/myisam
parent00a2f36bbf22a4d8b2367724e7919c0603cf6f71 (diff)
parentf0c6576b85a57ec82fd911f73cce7c99683b378c (diff)
downloadmariadb-git-3c9dcf9da70361eb6f2acd8e04929713d7856a9c.tar.gz
Merge
Diffstat (limited to 'storage/myisam')
-rw-r--r--storage/myisam/ha_myisam.cc38
1 files changed, 28 insertions, 10 deletions
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
index 748c65f334b..39791ff254c 100644
--- a/storage/myisam/ha_myisam.cc
+++ b/storage/myisam/ha_myisam.cc
@@ -797,10 +797,13 @@ int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt)
{
if (!file) return HA_ADMIN_INTERNAL_ERROR;
int error;
- HA_CHECK param;
+ HA_CHECK &param= *(HA_CHECK*) thd->alloc(sizeof(param));
MYISAM_SHARE* share = file->s;
const char *old_proc_info=thd->proc_info;
+ if (!&param)
+ return HA_ADMIN_INTERNAL_ERROR;
+
thd_proc_info(thd, "Checking table");
myisamchk_init(&param);
param.thd = thd;
@@ -889,9 +892,12 @@ int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt)
int ha_myisam::analyze(THD *thd, HA_CHECK_OPT* check_opt)
{
int error=0;
- HA_CHECK param;
+ HA_CHECK &param= *(HA_CHECK*) thd->alloc(sizeof(param));
MYISAM_SHARE* share = file->s;
+ if (!&param)
+ return HA_ADMIN_INTERNAL_ERROR;
+
myisamchk_init(&param);
param.thd = thd;
param.op_name= "analyze";
@@ -1019,7 +1025,9 @@ int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt)
err:
{
- HA_CHECK param;
+ HA_CHECK &param= *(HA_CHECK*) thd->alloc(sizeof(param));
+ if (!&param)
+ return HA_ADMIN_INTERNAL_ERROR;
myisamchk_init(&param);
param.thd= thd;
param.op_name= "backup";
@@ -1035,10 +1043,10 @@ int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt)
int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt)
{
int error;
- HA_CHECK param;
+ HA_CHECK &param= *(HA_CHECK*) thd->alloc(sizeof(param));
ha_rows start_records;
- if (!file) return HA_ADMIN_INTERNAL_ERROR;
+ if (!file || !&param) return HA_ADMIN_INTERNAL_ERROR;
myisamchk_init(&param);
param.thd = thd;
@@ -1086,8 +1094,9 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt)
int ha_myisam::optimize(THD* thd, HA_CHECK_OPT *check_opt)
{
int error;
- if (!file) return HA_ADMIN_INTERNAL_ERROR;
- HA_CHECK param;
+ HA_CHECK &param= *(HA_CHECK*) thd->alloc(sizeof(param));
+
+ if (!file || !&param) return HA_ADMIN_INTERNAL_ERROR;
myisamchk_init(&param);
param.thd = thd;
@@ -1281,7 +1290,10 @@ int ha_myisam::assign_to_keycache(THD* thd, HA_CHECK_OPT *check_opt)
if (error != HA_ADMIN_OK)
{
/* Send error to user */
- HA_CHECK param;
+ HA_CHECK &param= *(HA_CHECK*) thd->alloc(sizeof(param));
+ if (!&param)
+ return HA_ADMIN_INTERNAL_ERROR;
+
myisamchk_init(&param);
param.thd= thd;
param.op_name= "assign_to_keycache";
@@ -1345,7 +1357,9 @@ int ha_myisam::preload_keys(THD* thd, HA_CHECK_OPT *check_opt)
err:
{
- HA_CHECK param;
+ HA_CHECK &param= *(HA_CHECK*) thd->alloc(sizeof(param));
+ if (!&param)
+ return HA_ADMIN_INTERNAL_ERROR;
myisamchk_init(&param);
param.thd= thd;
param.op_name= "preload_keys";
@@ -1455,8 +1469,12 @@ int ha_myisam::enable_indexes(uint mode)
else if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE)
{
THD *thd=current_thd;
- HA_CHECK param;
+ HA_CHECK &param= *(HA_CHECK*) thd->alloc(sizeof(param));
const char *save_proc_info=thd->proc_info;
+
+ if (!&param)
+ return HA_ADMIN_INTERNAL_ERROR;
+
thd_proc_info(thd, "Creating index");
myisamchk_init(&param);
param.op_name= "recreating_index";