本文整理匯總了PHP中DedeSql::IsTable方法的典型用法代碼示例。如果您正苦於以下問題:PHP DedeSql::IsTable方法的具體用法?PHP DedeSql::IsTable怎麽用?PHP DedeSql::IsTable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DedeSql
的用法示例。
在下文中一共展示了DedeSql::IsTable方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: foreach
foreach($row as $k=>$v) ${strtolower($k)} = addslashes($v);
$inquery = " INSERT INTO `#@__channeltype`(`ID` , `nid` , `typename` , `maintable` , `addtable` , `addcon` ,
`mancon` , `editcon` , `useraddcon` , `usermancon` , `usereditcon` , `fieldset` , `listadd` ,
`issystem` , `isshow` , `issend` , `arcsta` , `sendrank` , `sendmember`)
VALUES('$newid' , '$newnid' , '$newtypename' , '$newmaintable' , '$newaddtable' , '$addcon' ,
'$mancon' , '$editcon' , '$useraddcon' , '$usermancon' , '$usereditcon' , '$fieldset' , '$listadd' ,
'0' , '$isshow' , '$issend' , '$arcsta' , '$sendrank' , '$sendmember');
";
$mysql_version = $dsql->GetVersion();
$mysql_versions = explode(".",trim($mysql_version));
$mysql_version = $mysql_versions[0].".".$mysql_versions[1];
$narrs1 = array('maintalbe'=>$newmaintable,'addtalbe'=>$newaddtable);
$narrs2 = array('maintalbe'=>$maintable,'addtalbe'=>$addtable);
foreach($narrs1 as $f=>$fn)
{
if(!$dsql->IsTable($fn))
{
$tb = $narrs2[$f];
$dsql->SetQuery("SHOW CREATE TABLE {$dsql->dbName}.{$tb}");
$dsql->Execute();
$row = $dsql->GetArray();
/*
//根據數據庫版本備份表結構,由於主表取消了自動遞增字段,因此可以省略此選項
$eng1 = "ENGINE=MyISAM DEFAULT CHARSET=".$cfg_db_language;
$eng2 = "ENGINE=MyISAM AUTO_INCREMENT=([0-9]{1,}) DEFAULT CHARSET=".$cfg_db_language;
if($datatype==4.0 && $mysql_version > 4.0){
$tableStruct = eregi_replace($eng1,"TYPE=MyISAM",$row[1]);
$tableStruct = eregi_replace($eng2,"TYPE=MyISAM",$row[1]);
}
else if($datatype==4.1 && $mysql_version < 4.1){
$tableStruct = eregi_replace("TYPE=MyISAM",$eng1,$row[1]);
示例2: explode
$trueTable1 = str_replace("#@__",$cfg_dbprefix,$maintable);
$trueTable2 = str_replace("#@__",$cfg_dbprefix,$addtable);
//檢查ID是否重複
//--------------------------
$row = $dsql->GetOne("Select * from #@__channeltype where ID='$ID' Or nid like '$nid' Or typename like '$typename' ");
if(is_array($row)){
$dsql->Close();
ShowMsg("可能‘頻道ID’、‘頻道名稱/標識’在數據庫已存在,不能重複使用!","-1");
exit();
}
$mysql_version = $dsql->GetVersion();
$mysql_versions = explode(".",trim($mysql_version));
$mysql_version = $mysql_versions[0].".".$mysql_versions[1];
//複製並創建索引表
//--------------------
$istb = $dsql->IsTable($trueTable1);
if(!$istb || ($isdel1==1 && strtolower($trueTable1)!="{$cfg_dbprefix}archives") )
{
$dsql->SetQuery("SHOW CREATE TABLE {$dsql->dbName}.#@__archives");
$dsql->Execute();
$row2 = $dsql->GetArray();
$dftable = $row2[1];
$dsql->ExecuteNoneQuery("DROP TABLE IF EXISTS `{$trueTable1}`;");
$dftable = str_replace("{$cfg_dbprefix}archives",$trueTable1,$dftable);
$rs = $dsql->ExecuteNoneQuery($dftable);
if(!$rs){
$dsql->Close();
ShowMsg("創建主索引表副本失敗!","-1");
exit();
}
}