我不知道这是什么类型的编程语言,或者该方法有什么帮助?
可能是一些用于修改某些数据库表的代码?
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()
}
答案 0 :(得分:3)
Table.tInsTypeConfigurations
的类pintInsTypeConf
到新对象。它不是优化代码,但无论如何,它应该完成这项任务。