sqlitedict icon indicating copy to clipboard operation
sqlitedict copied to clipboard

bug while trying to insert or read records. [code inside]

Open ashuezy opened this issue 4 years ago • 0 comments

image

sql_operation(0, oneId, twoId, threeId, fc)

def sql_operation(w, oneId, twoId, threeId, fc):
	global code_folder
	fc2=0
	try:
		if w==0:
			try:
				mydict = SqliteDict(code_folder+'core.sqlite', autocommit=True)
				uid = str(oneId)+"_"+str(twoId)+"_"+str(threeId)
				mydict[uid] = fc
			except Exception as e0:
				logger.error(e0)
			finally:
				mydict.close()
		elif w==1:
			try:
				logger.info('Acquiring Lock by fetchRow')
				lock.acquire(timeout=5)
				logger.info('Lock Taken by fetchRow')
				mydict = SqliteDict(code_folder+'core.sqlite', autocommit=True)
				uid = str(oneId)+"_"+str(twoId)+"_"+str(threeId)
				fc2 = mydict[uid]
			except Exception as e1:
				logger.error(e1)
			finally:
				mydict.close()
				logger.info('Releasing Lock by fetchRow')
				lock.release()
				logger.info('Lock Released by fetchRow')
	except Exception as e:
		logger.error(e)
	return fc2

ashuezy avatar Jul 09 '21 07:07 ashuezy