Example #1
0
function batchImportColumnList($splField, $listStr, $nOK, $tableName)
{
    $splstr = '';
    $splxx = '';
    $isColumn = '';
    $columnName = '';
    $s = '';
    $c = '';
    $nLen = '';
    $id = '';
    $parentIdArray = aspArray(99);
    $columntypeArray = aspArray(99);
    $flagsArray = aspArray(99);
    $nIndex = '';
    $fieldStr = '';
    $fieldName = '';
    $valueStr = '';
    $nCount = '';
    $isColumn = false;
    $nCount = 0;
    $listStr = replace($listStr, vbTab(), '    ');
    $splstr = aspSplit($listStr, vbCrlf());
    foreach ($splstr as $key => $s) {
        if ($s == '【#sub#】') {
            $isColumn = true;
        } else {
            if ($isColumn == true) {
                $columnName = $s;
                if (inStr($columnName, '【|】') > 0) {
                    $columnName = mid($columnName, 1, inStr($columnName, '【|】') - 1);
                }
                $columnName = aspRTrim($columnName);
                $nLen = len($columnName);
                $columnName = aspLTrim($columnName);
                $nlen = $nLen - len($columnName);
                $nIndex = cint($nLen / 4);
                if ($columnName != '') {
                    $parentIdArray[$nIndex] = $columnName;
                    $c = $c . '【columnname】' . $columnName . vbCrlf();
                    foreach ($splField as $key => $fieldStr) {
                        $splxx = aspSplit($fieldStr . '|', '|');
                        $fieldName = $splxx[0];
                        if ($fieldName != '' && $fieldName != 'columnname' && inStr($s, $fieldName . '=\'') > 0) {
                            $valueStr = getStrCut($s, $fieldName . '=\'', '\'', 2);
                            $c = $c . '【' . $fieldName . '】' . $valueStr . vbCrlf();
                            if ($fieldName == 'columntype') {
                                $columntypeArray[$nIndex] = $valueStr;
                            } else {
                                if ($fieldName == 'flags') {
                                    $flagsArray[$nIndex] = $valueStr;
                                }
                            }
                        }
                    }
                    if ($nIndex != 0) {
                        $c = $c . '【parentid】' . $parentIdArray[$nIndex - 1] . vbCrlf();
                        $c = $c . '【columntype】' . $columntypeArray[$nIndex - 1] . vbCrlf();
                        $c = $c . '【flags】' . $flagsArray[$nIndex - 1] . vbCrlf();
                    } else {
                        $c = $c . '【parentid】-1' . vbCrlf();
                    }
                    $c = $c . '【sortrank】' . $nCount . vbCrlf();
                    $nCount = $nCount + 1;
                    $c = $c . '-------------------------------' . vbCrlf();
                }
            }
        }
    }
    //call die(createfile("1.txt",c))
    //继续导入
    if ($c != '') {
        importTXTData($c, $tableName, '添加');
    }
}
Example #2
0
function aspTrim($content)
{
    return aspRTrim(aspLTrim($content));
}