zoukankan      html  css  js  c++  java
  • Rename primary key by code

    Way 1:

    static void CustAccountRename(Args _args)
    {
      CustTable custTable;
      ;
    
      select firstOnly custTable
        where custTable.AccountNum == '1103';
      if (custTable.RecId)
      {
        custTable.AccountNum = '1103_';
        custTable.renamePrimaryKey();
      }
    }

    Way 2:

     1 void renamePrimaryKey(Common _common)
     2 {
     3     Common     common;
     4     FieldId    fieldId;
     5     DictTable  dictTable;
     6     DictField  dictField;
     7     ;
     8     common = _common;
     9     dictTable = new SysDictTable(common.TableId);
    10     dictField = new SysDictField(dictTable.id(), dictTable.primaryKeyField());
    11 
    12     if (isConfigurationkeyEnabled(configurationkeynum(SIG)))
    13     {
    14         SIGBaseDocument::checkAndCacheRename(common,dictField.id(),newValue);
    15     }
    16 
    17     startLengthyOperation();
    18     fieldId = dictField.id();
    19     try
    20     {
    21         ttsbegin;
    22         // CC Start
    23         CCPrimaryKey::renamePrimaryKey(common, dialogField.value(), fieldId);
    24         // CC End
    25 
    26         common.(fieldId) = dialogField.value();
    27 
    28         common.renamePrimaryKey();
    29         if (common.TableId == tablenum(UserInfo))
    30         {
    31             common.update();
    32         }
    33         ttscommit;
    34     }
    35     catch (Exception::Error)
    36     {
    37         ttsabort;
    38     }
    39 }
  • 相关阅读:
    SpringMVC文件下载
    Servlet3.0文件上传
    SpringMVC拦截器的使用(入门)
    SpringMVC文件上传
    SpringMVC后台数据校验
    SpringMVC@InitBinder使用方法
    C++ this指针
    C++ 析构函数
    C++ 构造函数
    C++ 成员函数的实现
  • 原文地址:https://www.cnblogs.com/Jinnchu/p/2659699.html
Copyright © 2011-2022 走看看