def RequestParamBlockContent(dbConn, strObjName, iEachBlockCount): retParamContentArray = [] strRetParamSignID = '' iObjRecID = CSkLBDB_dest_operate.GetRecID_By_Name(dbConn, strObjName) if (iObjRecID > 0): strExecObjName, strExecPwdHash, strExecDbName, strExecTableName, strExecFieldName, strExecSignIDField, \ iExecLastExID = CSkLBDB_dest_operate.ReadByRecID( dbConn, iObjRecID) dbExecConn = ConnectToMidExecExecDb(strExecDbName) strReqClause = '%s>%d' % (strExecSignIDField, iExecLastExID) retParamContentArray, idSignFieldArray, tmpArray = CSkLBDB_CommFuncShare.Read3Fields_Array_WithClause_limit( dbExecConn.s_DbConn, strExecTableName, strExecFieldName, strExecSignIDField, '', strReqClause, iEachBlockCount) # 将id格式化,写入内容。 if (len(idSignFieldArray) > 0): strIDValueArray = [] for iEachID in idSignFieldArray: strIDValueArray.append(str(iEachID)) strIDCollectTotal = ' '.join(strIDValueArray) # 将本记录写入表 sk_dest_param_status iLastID = CSkLBDB_CommFuncShare.GetRecCount( dbConn, CSkLBDB_dest_param_status.s_strTableName) strRetParamSignID = '%s_%d' % (strObjName, iLastID) CSkLBDB_dest_param_status.AddNewdRec(dbConn, iObjRecID, strIDCollectTotal, strRetParamSignID, 0, datetime.now()) # 更新最大的id值 iMaxIDValue = max(idSignFieldArray) CSkLBDB_dest_operate.Update_LastIDValue( dbConn, iObjRecID, iMaxIDValue) return strRetParamSignID, retParamContentArray
def AddNewdRec(dbConn, strObjName, strPwdHash, strDbName, strTableName, strFieldName, strSignIDField, iLastExID): strObjName = CTYLB_MainSys_MiscFunc.SafeGetUnicode(strObjName) strPwdHash = CTYLB_MainSys_MiscFunc.SafeGetUnicode(strPwdHash) strDbName = CTYLB_MainSys_MiscFunc.SafeGetUnicode(strDbName) strTableName = CTYLB_MainSys_MiscFunc.SafeGetUnicode(strTableName) strFieldName = CTYLB_MainSys_MiscFunc.SafeGetUnicode(strFieldName) strSignIDField = CTYLB_MainSys_MiscFunc.SafeGetUnicode(strSignIDField) iOrigRecID = CSkLBDB_dest_operate.GetRecID_By_Name(dbConn, strObjName) if (iOrigRecID == 0): iRetNewRecID = CSkLBDB_CommFuncShare.ExecInsertRecField7( dbConn, CSkLBDB_dest_operate.s_strTableName, "obj_name", strObjName, "pwd_hash", strPwdHash, "database_name", strDbName, "table_name", strTableName, "read_field_name_array", strFieldName, "sign_field_id", strSignIDField, "last_ex_id_value", str(iLastExID)) else: # 更新字段 strClause = 'id=%d' % (iOrigRecID) CSkLBDB_CommFuncShare.ExecUpdateRecField4( dbConn, CSkLBDB_dest_operate.s_strTableName, strClause, "pwd_hash", strPwdHash, "database_name", strDbName, "table_name", strTableName, "read_field_name_array", strFieldName) CSkLBDB_CommFuncShare.ExecUpdateRecField1( dbConn, CSkLBDB_dest_operate.s_strTableName, strClause, "sign_field_id", strSignIDField) iRetNewRecID = iOrigRecID return iRetNewRecID
def AddNewdRec(dbConn, iBelongDestOPID, strSignIDFieldValue, strParamBlockID, iStatus, operateTime, createTime=None): strSignIDFieldValue = CTYLB_MainSys_MiscFunc.SafeGetUnicode( strSignIDFieldValue) strParamBlockID = CTYLB_MainSys_MiscFunc.SafeGetUnicode( strParamBlockID) iRetNewRecID = CSkLBDB_CommFuncShare.ExecInsertRecField4( dbConn, CSkLBDB_dest_param_status.s_strTableName, "belong_dest_operate_id", str(iBelongDestOPID), "sign_id_field_value", strSignIDFieldValue, "param_block_id", strParamBlockID, "status", str(iStatus)) if ((iRetNewRecID > 0) and (operateTime)): CSkLBDB_CommFuncShare.ExecUpdateRecField_To_DateTime( dbConn, CSkLBDB_dest_param_status.s_strTableName, "operate_time", operateTime, "id", str(iRetNewRecID)) if (not createTime): createTime = datetime.now() if ((iRetNewRecID > 0) and (createTime)): CSkLBDB_CommFuncShare.ExecUpdateRecField_To_DateTime( dbConn, CSkLBDB_dest_param_status.s_strTableName, "create_time", createTime, "id", str(iRetNewRecID)) return iRetNewRecID
def GetUnHandleRecID(dbConn, strObjName): iRetNotExecedRecCount, iRetTotalRecCount = 0, 0 iObjRecID = CSkLBDB_dest_operate.GetRecID_By_Name(dbConn, strObjName) if (iObjRecID > 0): strExecObjName, strExecPwdHash, strExecDbName, strExecTableName, strExecFieldName, strExecSignIDField, \ iExecLastExID = CSkLBDB_dest_operate.ReadByRecID( dbConn, iObjRecID) dbExecConn = ConnectToMidExecExecDb(strExecDbName) strNotExecClause = '%s>%d' % (strExecSignIDField, iExecLastExID) iRetNotExecedRecCount = CSkLBDB_CommFuncShare.GetRecCount( dbExecConn.s_DbConn, strExecTableName, strNotExecClause) iRetTotalRecCount = CSkLBDB_CommFuncShare.GetRecCount( dbExecConn.s_DbConn, strExecTableName) return iRetNotExecedRecCount, iRetTotalRecCount
def GetRecID_By_Name(dbConn, strObjName): strClause = "obj_name='%s'" % (strObjName) iRetID = CSkLBDB_CommFuncShare.ReadField_Single_WithClause( dbConn, CSkLBDB_dest_operate.s_strTableName, "id", strClause) if (not iRetID): iRetID = 0 return iRetID
def AddNewdRec(dbConn, iBelongParamID, strTitleName, strResultContent, createTime=None): iRetNewRecID = CSkLBDB_CommFuncShare.ExecInsertRecField3( dbConn, CSkLBDB_result_content.s_strTableName, "belong_param_id", str(iBelongParamID), "title_name", strTitleName, "result_content", strResultContent) if (not createTime): createTime = datetime.now() if ((iRetNewRecID > 0) and (createTime)): CSkLBDB_CommFuncShare.ExecUpdateRecField_To_DateTime( dbConn, CSkLBDB_result_content.s_strTableName, "create_time", createTime, "id", str(iRetNewRecID)) return iRetNewRecID
def Update_Status_OpTime(dbConn, iRecID, iNewStatus, operateTime): strClause = 'id=%d' % (iRecID) CSkLBDB_CommFuncShare.ExecUpdateRecField1( dbConn, CSkLBDB_dest_param_status.s_strTableName, strClause, "status", str(iNewStatus)) CSkLBDB_dest_param_status.UpdateRecOperateTime(dbConn, iRecID, operateTime)
def AddNewdRec(dbConn, strAppName, strSubTaskName): iRetNewRecID = CSkLBDB_result_app_task_name.GetRecID_By_App_SubTask_Name( dbConn, strAppName, strSubTaskName) if (iRetNewRecID == 0): iRetNewRecID = CSkLBDB_CommFuncShare.ExecInsertRecField2( dbConn, CSkLBDB_result_app_task_name.s_strTableName, "app_name", strAppName, "sub_task_name", strSubTaskName) return iRetNewRecID
def GetRecID_By_AppTaskNameID_ParamID(dbConn, iBelongAppTaskNameID, strParamID): strClause = "belong_app_task_name_id=%d and param_id='%s'" % ( iBelongAppTaskNameID, strParamID) iRetID = CSkLBDB_CommFuncShare.ReadField_Single_WithClause( dbConn, CSkLBDB_result_param_block.s_strTableName, "id", strClause) if (not iRetID): iRetID = 0 return iRetID
def AddNewdRec(dbConn, iBelongAppTaskNameID, strParamID): iRetNewRecID = CSkLBDB_result_param_block.GetRecID_By_AppTaskNameID_ParamID( dbConn, iBelongAppTaskNameID, strParamID) if (iRetNewRecID == 0): iRetNewRecID = CSkLBDB_CommFuncShare.ExecInsertRecField2( dbConn, CSkLBDB_result_param_block.s_strTableName, "belong_app_task_name_id", str(iBelongAppTaskNameID), "param_id", strParamID) return iRetNewRecID
def GetRecID_By_App_SubTask_Name(dbConn, strAppName, strSubTaskName): strClause = "app_name='%s' and sub_task_name='%s'" % (strAppName, strSubTaskName) iRetID = CSkLBDB_CommFuncShare.ReadField_Single_WithClause( dbConn, CSkLBDB_result_app_task_name.s_strTableName, "id", strClause) if (not iRetID): iRetID = 0 return iRetID
def GetRecID_By_OperateID_ParamBlockID(dbConn, iBelongOperateID, strParamBlockID): strClause = "belong_dest_operate_id=%d and param_block_id='%s'" % ( iBelongOperateID, strParamBlockID) iRetID = CSkLBDB_CommFuncShare.ReadField_Single_WithClause( dbConn, CSkLBDB_dest_param_status.s_strTableName, "id", strClause) if (not iRetID): iRetID = 0 return iRetID
def AddNewdRec(dbConn, strAppName, strSubTaskName): strAppName = CTYLB_MainSys_MiscFunc.SafeGetUnicode(strAppName) strSubTaskName = CTYLB_MainSys_MiscFunc.SafeGetUnicode(strSubTaskName) iRetNewRecID = CSkLBDB_result_app_task_name.GetRecID_By_App_SubTask_Name( dbConn, strAppName, strSubTaskName) if (iRetNewRecID == 0): iRetNewRecID = CSkLBDB_CommFuncShare.ExecInsertRecField2( dbConn, CSkLBDB_result_app_task_name.s_strTableName, "app_name", strAppName, "sub_task_name", strSubTaskName) return iRetNewRecID
def AddNewdRec(dbConn, strObjName, strPwdHash, strDbName, strTableName, strFieldName, strSignIDField, iLastExID): iOrigRecID = CSkLBDB_dest_operate.GetRecID_By_Name(dbConn, strObjName) if (iOrigRecID == 0): iRetNewRecID = CSkLBDB_CommFuncShare.ExecInsertRecField7( dbConn, CSkLBDB_dest_operate.s_strTableName, "obj_name", strObjName, "pwd_hash", strPwdHash, "database_name", strDbName, "table_name", strTableName, "read_field_name_array", strFieldName, "sign_field_id", strSignIDField, "last_ex_id_value", str(iLastExID)) else: iRetNewRecID = iOrigRecID return iRetNewRecID
def Update_LastIDValue(dbConn, iRecID, iLastIDValue): strClause = "id=%d" % (iRecID) CSkLBDB_CommFuncShare.ExecUpdateRecField1( dbConn, CSkLBDB_dest_operate.s_strTableName, strClause, "last_ex_id_value", str(iLastIDValue))
def UpdateRecOperateTime(dbConn, iRecID, operateTime): CSkLBDB_CommFuncShare.ExecUpdateRecField_To_DateTime( dbConn, CSkLBDB_dest_param_status.s_strTableName, "operate_time", operateTime, "id", str(iRecID))