當前位置: 首頁>>代碼示例>>PHP>>正文


PHP testproject::getDBTables方法代碼示例

本文整理匯總了PHP中testproject::getDBTables方法的典型用法代碼示例。如果您正苦於以下問題:PHP testproject::getDBTables方法的具體用法?PHP testproject::getDBTables怎麽用?PHP testproject::getDBTables使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在testproject的用法示例。


在下文中一共展示了testproject::getDBTables方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: tree

 *
 * Migrate Custom field data from item to item version (1.9 RC1 and up)
*/
require_once "../../config.inc.php";
require_once "common.php";
testlinkInitPage($db);
// Check if user has right role to execute
if (!($_SESSION['currentUser']->globalRole->name == 'admin')) {
    echo 'You need to have admin role in order to use this page <b> ';
    die;
}
$treeMgr = new tree($db);
$nodeTypes = $treeMgr->get_available_node_types();
unset($treeMgr);
$tprojectMgr = new testproject($db);
$tables = $tprojectMgr->getDBTables(array('nodes_hierarchy', 'cfield_design_values'));
unset($tprojectSet);
$sql = " SELECT CFDV.*, NHITEM.node_type_id, NHVERSION.id AS version_node_id" . " FROM {$tables['cfield_design_values']} CFDV " . " JOIN {$tables['nodes_hierarchy']} NHITEM ON NHITEM.id = CFDV.node_id " . " JOIN {$tables['nodes_hierarchy']} NHVERSION ON NHVERSION.parent_id = NHITEM.id " . " WHERE NHITEM.node_type_id IN ({$nodeTypes['testcase']},{$nodeTypes['requirement']}) ";
$workingSet = $db->get_recordset($sql);
echo 'Records to process: ' . count($workingSet) . '<br>';
if (!is_null($workingSet)) {
    foreach ($workingSet as $target) {
        $values[] = "( {$target['field_id']}, {$target['version_node_id']}, '{$target['value']}' )";
        $victims[$target['node_id']] = $target['node_type_id'];
    }
    $sql = " INSERT INTO {$tables['cfield_design_values']} (field_id,node_id,value) VALUES ";
    $vSet = implode(',', $values);
    $sql .= $vSet;
    $db->exec_query($sql);
    foreach ($victims as $node_id => $node_type_id) {
        $sql = " DELETE FROM {$tables['cfield_design_values']} WHERE node_id = {$node_id} ";
開發者ID:atisne,項目名稱:testlink-code,代碼行數:31,代碼來源:migrate_cf_links.php


注:本文中的testproject::getDBTables方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。