function check_table($table){
require dirname(__FILE__) .'/connection.php';
mysql_select_db("news",$db);
$ret = mysql_query("SHOW TABLE STATUS WHERE `name` = '".$table."'");
while($row = mysql_fetch_array($ret)){
if($row['Engine']!='MyISAM'){
$wrong=1;
}
}
if($wrong){
mysql_query("REPAIR TABLE ".$table);
}
mysql_close($db);
$wrong=$ret=$row=NULL;
}
上面的代码是不是可以检查数据表是否crashed?
crashed的数据表是不是 $row['Engine'] = null?
没找到相关的文章,求助各位前辈。mysqlcrashed
require dirname(__FILE__) .'/connection.php';
mysql_select_db("news",$db);
$ret = mysql_query("SHOW TABLE STATUS WHERE `name` = '".$table."'");
while($row = mysql_fetch_array($ret)){
if($row['Engine']!='MyISAM'){
$wrong=1;
}
}
if($wrong){
mysql_query("REPAIR TABLE ".$table);
}
mysql_close($db);
$wrong=$ret=$row=NULL;
}
上面的代码是不是可以检查数据表是否crashed?
crashed的数据表是不是 $row['Engine'] = null?
没找到相关的文章,求助各位前辈。mysqlcrashed
REPAIR [LOCAL | NO_WRITE_TO_BINLOG] TABLE
tbl_name [, tbl_name] ... [QUICK] [EXTENDED] [USE_FRM]
REPAIR TABLE用于修复被破坏的表。默认情况下,REPAIR TABLE与myisamchk --recover tbl_name具有相同的效果。REPAIR TABLE对MyISAM和ARCHIVE表起作用。
而你却是在 !='MyISAM' 的条件下执行 REPAIR TABLE
那么,怎么样的mysql语句,可以检查数据表错误,然后执行REPAIR TABLE语句?
谢谢。
if($row["Collation"]=='in use'){
对吗?