diff --git a/app/DataBase/merge.py b/app/DataBase/merge.py index 7679821..c3aa63a 100644 --- a/app/DataBase/merge.py +++ b/app/DataBase/merge.py @@ -13,7 +13,7 @@ def merge_databases(source_paths, target_path): if not os.path.exists(source_path): break db = sqlite3.connect(source_path) - db.text_factory = bytes + # db.text_factory = bytes cursor = db.cursor() sql = ''' SELECT TalkerId,MsgsvrID,Type,SubType,IsSender,CreateTime,Sequence,StrTalker,StrContent,DisplayContent,BytesExtra diff --git a/app/DataBase/msg.py b/app/DataBase/msg.py index 915efa7..6d8c66d 100644 --- a/app/DataBase/msg.py +++ b/app/DataBase/msg.py @@ -58,7 +58,7 @@ class Msg: sql = ''' select localId,TalkerId,Type,SubType,IsSender,CreateTime,Status,StrContent,strftime('%Y-%m-%d %H:%M:%S',CreateTime,'unixepoch','localtime') as StrTime,MsgSvrID from MSG - where StrTalker=? + where TRIM(StrTalker)=? order by CreateTime ''' try: @@ -109,7 +109,7 @@ class Msg: sql = ''' select localId,TalkerId,Type,SubType,IsSender,CreateTime,Status,StrContent,strftime('%Y-%m-%d %H:%M:%S',CreateTime,'unixepoch','localtime') as StrTime from MSG - where StrTalker = ? and localId < ? + where TRIM(StrTalker) = ? and localId < ? order by CreateTime desc limit 10 ''' @@ -133,7 +133,7 @@ class Msg: sql = ''' select localId,TalkerId,Type,SubType,IsSender,CreateTime,Status,StrContent,strftime('%Y-%m-%d %H:%M:%S',CreateTime,'unixepoch','localtime') as StrTime,MsgSvrID from MSG - where StrTalker=? and Type=? + where TRIM(StrTalker)=? and Type=? order by CreateTime ''' try: @@ -150,7 +150,7 @@ class Msg: sql = ''' select localId,TalkerId,Type,SubType,IsSender,CreateTime,Status,StrContent,strftime('%Y-%m-%d %H:%M:%S',CreateTime,'unixepoch','localtime') as StrTime,MsgSvrID from MSG - where StrTalker=? and Type=1 and LENGTH(StrContent)