修改metadata中的一处恶性bug已修复
This commit is contained in:
parent
f616484a94
commit
4e6e636dc7
|
|
@ -901,8 +901,8 @@ def ImportMetadata(db,metadatafilepath): #metadata自动修改, 根据字段自
|
||||||
forceusageappendinDB(db,pending_item[0])
|
forceusageappendinDB(db,pending_item[0])
|
||||||
|
|
||||||
|
|
||||||
sql = f"SELECT id FROM logs WHERE %s > {startdate} OR %s = {startdate} AND %s >= {starttime};"
|
sql = f"SELECT id FROM logs WHERE DATE > %s OR DATE = %s AND TIME >= %s;"
|
||||||
val = (GetDate(),GetDate(),GetTime())
|
val = (startdate,startdate,starttime)
|
||||||
mycursor.execute(sql,val)
|
mycursor.execute(sql,val)
|
||||||
changed_id_list = [item[0] for item in mycursor.fetchall()]
|
changed_id_list = [item[0] for item in mycursor.fetchall()]
|
||||||
return changed_id_list # 已在数据库中修改, 之后需要将数据库写入一次, 返回1表示字段名有误, 返回其他表示成功进行了修改
|
return changed_id_list # 已在数据库中修改, 之后需要将数据库写入一次, 返回1表示字段名有误, 返回其他表示成功进行了修改
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ mydb = connect(hostname = "wwylss.synology.me", port = "13306", username="tikuus
|
||||||
|
|
||||||
|
|
||||||
changedids = ImportMetadata(mydb,metadatafilepath)
|
changedids = ImportMetadata(mydb,metadatafilepath)
|
||||||
|
print(changedids)
|
||||||
|
|
||||||
if len(changedids) > 0:
|
if len(changedids) > 0:
|
||||||
mycursor = mydb.cursor()
|
mycursor = mydb.cursor()
|
||||||
|
|
|
||||||
Reference in New Issue