2016-10-18 6 views
0

Я понятия не имею, какой язык программирования это или что делает этот метод, любая помощь?Код для изменения БД?

Это может быть код для изменения некоторых таблиц БД?

ClassMethod CreateNewConfiguration(pintInsTypeConf As %Integer) As %Integer 
{ 
    Set objRecord = ##class(Table.tInsTypeConfigurations).%OpenId(pintInsTypeConf) 
    Set objNewRecord = ##class(Table.tInsTypeConfigurations).%New() 

    Set objClassDef = ##class(%Dictionary.ClassDefinition).%OpenId("Table.tInsTypeConfigurations") 

    Set intTotal = objClassDef.Properties.Count() 
    For intCount = 1:1:intTotal 
    { 
     If (((objClassDef.Properties.GetAt(intCount).Relationship = 0) && 
      (objClassDef.Properties.GetAt(intCount).Calculated = 0)) || 
      ((objClassDef.Properties.GetAt(intCount).Relationship = 1) && 
      (objClassDef.Properties.GetAt(intCount).Cardinality = "one"))) 
     { 
      Set strName = objClassDef.Properties.GetAt(intCount).Name 

      Set $zobjproperty(objNewRecord,strName) = $zobjproperty(objRecord,strName) 
     } 
    } 

    Set objNewRecord.Name = objNewRecord.rInstrumentTypes.%Id() _ " Config B “ 
    Set intResult = objNewRecord.%Save() 
    If ((intResult '= 1) || ($ZERROR '= "")) 
    { 
     Quit 0 
    } 

    Quit objNewRecord.%Id() 
} 

ответ

3

Да, @duskwuff является правильным, это код Cache ObjectScript.
И в этом коде просто создайте свойства копирования для некоторого объекта, начиная с класса Table.tInsTypeConfigurations с id pintInsTypeConf, на новый объект. Это не оптимизированный код, но в любом случае он должен выполнять эту задачу.

Смежные вопросы