pymensago/userinfo.py
def load_user_list_field(db: sqlite3.Connection, fieldname: str) -> RetVal:
	'''Loads a field which is a list and returns it as such'''
	if not fieldname:
		return ErrBadValue
	
	cursor = db.cursor()
	cursor.execute("""SELECT fieldname,fieldvalue FROM userinfo WHERE fieldname LIKE ? 
		ORDER BY fieldname""", (fieldname + '.%',))
	results = cursor.fetchone()
	if not results or not results[0]:
		return RetVal(ErrNotFound)
	
	out = list()
	while results and results[0]:
		out.append(results[1])
		results = cursor.fetchone()
		
	return RetVal().set_value('values', out)
Loads a field which is a list and returns it as such
Loads a field which is a list and returns it as such
Loads a field which is a list and returns it as such
def load_user_list_field(db: sqlite3.Connection, fieldname: str) -> RetVal:
	if not fieldname:
		return ErrBadValue
	cursor = db.cursor()
	cursor.execute("""SELECT fieldname,fieldvalue FROM userinfo WHERE fieldname LIKE ? 
		ORDER BY fieldname""", (fieldname + '.%',))
	results = cursor.fetchone()
	if not results or not results[0]:
		return RetVal(ErrNotFound)
	out = list()
	while results and results[0]:
		out.append(results[1])
		results = cursor.fetchone()
	return RetVal().set_value('values', out)
def load_user_list_field ( db : sqlite3 . Connection , fieldname : str ) -> RetVal : if not fieldname : return ErrBadValue cursor = db . cursor ( ) cursor . execute ( """SELECT fieldname,fieldvalue FROM userinfo WHERE fieldname LIKE ? 
		ORDER BY fieldname""" , ( fieldname + '.%' , ) ) results = cursor . fetchone ( ) if not results or not results [ 0 ] : return RetVal ( ErrNotFound ) out = list ( ) while results and results [ 0 ] : out . append ( results [ 1 ] ) results = cursor . fetchone ( ) return RetVal ( ) . set_value ( 'values' , out )
Loads a field which is a list and returns it as such
Loads a field which is a list and returns it as such
'''Loads a field which is a list and returns it as such'''
db
sqlite3.Connection
fieldname
str