def get_name(cursor): cursor.execute("SELECT name FROM metadata LIMIT 1") row = cursor.fetchone() return row['name'] if row else None def set_name(cursor, value): cursor.execute("UPDATE metadata SET name = %s", (value,)) def get_comment(cursor): cursor.execute("SELECT comment FROM metadata LIMIT 1") row = cursor.fetchone() return row['comment'] if row else None def set_comment(cursor, value): cursor.execute("UPDATE metadata SET comment = %s", (value,)) def get_public_key(cursor): cursor.execute("SELECT public_key FROM metadata LIMIT 1") row = cursor.fetchone() return row['public_key'] if row else None def get_private_key(cursor): cursor.execute("SELECT private_key FROM metadata LIMIT 1") row = cursor.fetchone() return row['private_key'] if row else None def set_keys(cursor, public_key, private_key): """ Sets both public and private keys together """ cursor.execute(""" UPDATE metadata SET public_key = %s, private_key = %s """, (public_key, private_key))