From e8285e533c8ed7ff3e68f72b0bbac04b478f19c9 Mon Sep 17 00:00:00 2001 From: jwansek Date: Sun, 6 Feb 2022 16:55:00 +0000 Subject: added linux ISO CD form --- database.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'database.py') diff --git a/database.py b/database.py index bb870b8..3dd2d9a 100644 --- a/database.py +++ b/database.py @@ -183,6 +183,21 @@ class Database: cursor.execute("SELECT link FROM headerLinks WHERE name = 'twitter';") return cursor.fetchone()[0] + def get_iso_cd_options(self): + with self.__connection.cursor() as cursor: + cursor.execute("SELECT name FROM isocds;") + return [i[0] for i in cursor.fetchall()] + + def append_cd_orders(self, iso, email, house, street, city, county, postcode, name): + with self.__connection.cursor() as cursor: + cursor.execute(""" + INSERT INTO cd_orders (cd_id, email, house, street, city, county, postcode, name) + VALUES ((SELECT cd_id FROM isocds WHERE name = %s), %s, %s, %s, %s, %s, %s, %s); + """, (iso, email, house, street, city, county, postcode, name)) + id_ = cursor.lastrowid + self.__connection.commit() + return id_ + def update_cache(): # print("updating cache...") with Database() as db: @@ -233,4 +248,5 @@ def request_recent_commits(since = datetime.datetime.now() - datetime.timedelta( if __name__ == "__main__": with Database() as db: - print(db.get_similar_thoughts("about me", 5)) \ No newline at end of file + # print(db.get_similar_thoughts("about me", 5)) + print(db.get_iso_cd_options()) \ No newline at end of file -- cgit v1.2.3