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()
}
4

1 回答 1

3

是的,@duskwuff 是对的,它是 Caché ObjectScript 代码。
在这段代码中,只需将某个对象的属性从Table.tInsTypeConfigurations具有 id的类复制pintInsTypeConf到新对象。它不是优化的代码,但无论如何,它应该完成这项任务。

于 2016-10-18T20:59:25.890 回答