本文整理汇总了PHP中DoliDB::DDLDescTable方法的典型用法代码示例。如果您正苦于以下问题:PHP DoliDB::DDLDescTable方法的具体用法?PHP DoliDB::DDLDescTable怎么用?PHP DoliDB::DDLDescTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DoliDB
的用法示例。
在下文中一共展示了DoliDB::DDLDescTable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: migrate_actioncomm_element
/**
* Migrate link stored into fk_xxxx into fk_element and elementtype
*
* @param DoliDB $db Database handler
* @param Translate $langs Object langs
* @param Conf $conf Object conf
* @return void
*/
function migrate_actioncomm_element($db, $langs, $conf)
{
print '<tr><td colspan="4">';
print '<br>';
print '<b>' . $langs->trans('MigrationActioncommElement') . "</b><br>\n";
$elements = array('propal' => 'propalrowid', 'order' => 'fk_commande', 'invoice' => 'fk_facture', 'contract' => 'fk_contract', 'order_supplier' => 'fk_supplier_order', 'invoice_supplier' => 'fk_supplier_invoice');
foreach ($elements as $type => $field) {
$result = $db->DDLDescTable(MAIN_DB_PREFIX . "actioncomm", $field);
$obj = $db->fetch_object($result);
if ($obj) {
dolibarr_install_syslog("upgrade2::migrate_actioncomm_element field=" . $field);
$db->begin();
$sql = "UPDATE " . MAIN_DB_PREFIX . "actioncomm SET ";
$sql .= "fk_element = " . $field . ", elementtype = '" . $type . "'";
$sql .= " WHERE " . $field . " IS NOT NULL";
$sql .= " AND fk_element IS NULL";
$sql .= " AND elementtype IS NULL";
$resql = $db->query($sql);
if ($resql) {
$db->commit();
// DDL commands must not be inside a transaction
// We will drop at next version because a migrate should be runnable several times if it fails.
//$sqlDrop = "ALTER TABLE ".MAIN_DB_PREFIX."actioncomm DROP COLUMN ".$field;
//$db->query($sqlDrop);
//print ". ";
} else {
dol_print_error($db);
$db->rollback();
}
} else {
print $langs->trans('AlreadyDone') . "<br>\n";
}
}
print '</td></tr>';
}