当前位置: 首页>>代码示例>>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;未经允许,请勿转载。