admin 管理员组

文章数量: 887021


2024年1月13日发(作者:matlab eval)

def __getitem__(self,key):if type(key)==type('abc'):return ueByName(key)if type(key)==type(1):theFld = elds[key]return ueByName(theFld)return None#设置属性值,key可以是索引,也可以是属性名.def __setitem__(self,key,value):if type(key)==type('abc'):ueByName(key,value)if type(key)==type(1):theFld = elds[key]ueByName(theFld,value)#获取实体的表名.def GetTableName(self):theType = type(self)if hasattr(theType,'TableName'):return getattr(theType,'TableName')return ''#获取关键字段名def GetKeyField(self):theType = type(self)if hasattr(theType,'KeyField'):return getattr(theType,'KeyField')return ''#获取字段名集合def GetFields(self):theType = type(self)if hasattr(theType,'Fields'):return getattr(theType,'Fields')return []InsertCondition = ion()InsertLockSign = False

if (theSQL==None or theSQL==''):theTableName=leName()theFields=lds()if theTableName=='' or theFields==[]:raise CustomError('表名或字段为空!')theSQL='INSERT INTO '+ theTableNametheFlds=''theVals=''theFldParams = ldParams()for theF in theFields:if theFlds=='':theFlds += theFtheVals += theFldParams[theF]['DSFmt']else:theFlds += ','+theFtheVals +=','+theFldParams[theF]['DSFmt']theSQL+='('+theFlds+') values('+theVals+')'self._SetClassValue(SqlName,theSQL)return theSQLfinally:InsertLockSign=()e()else:return theSQL#获取根据主键删除SQLdef GetDelByPKSQL(self):theSQL =self._GetClassValue(KSqlName)if (theSQL==None or theSQL==''):e()try:if LockSign:()DeleteLockSign = True

theSQL =self._GetClassValue(KSqlName)if (theSQL==None or theSQL==''):theTableName=leName()theKeyField=Field()if theTableName=='' or theKeyField=='':raise CustomError('表名或主键为空!')theFldParams = ldParams()theSQL='DELETE FROM '+ theTableName+' WHERE'+theKeyField+'='+theFldParams[theKeyField]['DSFmt']self._SetClassValue(KSqlName,theSQL)return theSQLfinally:DeleteLockSign=()e()else:return theSQL#获取更新所有字段的SQL语句(根据主键更新)def GetUpdateAllSQL(self):theSQL =self._GetClassValue(AllSqlName)if (theSQL==None or theSQL==''):e()try:if AllLockSign:()UpdateAllLockSign = TruetheSQL =self._GetClassValue(AllSqlName)if (theSQL==None or theSQL==''):theTableName=leName()theFields=lds()theKeyField=Field()if theTableName=='' or theFields==[] or theKeyField=='':raise CustomError('表名、主键或字段为空!')theSQL='UPDATE '+ theTableName +' SET '

'DataType':'varchar','Length':50,'Precision':0,'Scale':0},'USR_PWD':{'DSFmt':'%s','DataType':'varchar','Length':50,'Precision':0,'Scale':0}}


本文标签: 获取 主键 表名 字段 字段名