def db_insert_accessKey(key,allocUserId): myconn = db_getConn() sqlstr = "INSERT INTO ACCESSKEY (KEY,ALLOC_USER,CREATE_TIME,ACCESS_DEVICES) " \ "VALUES (?,?,?,?)" import time timeNow = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) try: myconn.execute(sqlstr,(key, allocUserId, timeNow, None)) myconn.commit() except Exception,e: log.logWarning("db_insert_accessKey fail,exception:"+e.message) return error.ERR_CODE_ERR_
def db_insert_privilege(master, masterId, masterRole, obj, objId, operList): myconn = db_getConn() sqlstr = "INSERT INTO PRIVILEGE (PRIVILEGE_MASTER,PRIVILEGE_MASTER_ID,PRIVILEGE_MASTER_ROLE," \ "OBJ_TYPE, OBJ_ID, OPERATION_LIST, CREATE_TIME, LAST_UPDATE_TIME) "\ "VALUES (?,?,?,?,?,?,?,?)" import time timeNow = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) try: myconn.execute(sqlstr,(master, masterId, masterRole, obj, objId, operList, timeNow, timeNow)) myconn.commit() except Exception,e: log.logWarning("db_insert_privilege fail,exception:"+e.message) return error.ERR_CODE_ERR_