From 7b108f7ddcefdae6f968869ac8814df8c35805a3 Mon Sep 17 00:00:00 2001 From: westernmeadow Date: Sun, 4 Feb 2024 23:31:50 +0000 Subject: [PATCH] increased character length limit of table columns --- Forums/DB_Connection/db_connection.py | 20 ++++++++++---------- MarketPlaces/DB_Connection/db_connection.py | 10 +++++----- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Forums/DB_Connection/db_connection.py b/Forums/DB_Connection/db_connection.py index 1409082..271e1e7 100644 --- a/Forums/DB_Connection/db_connection.py +++ b/Forums/DB_Connection/db_connection.py @@ -607,10 +607,10 @@ def create_image(cur, base64Image, date): imageId = verifyImage(cur, decImage) if not imageId: - imageId = int(getLastImage(cur) + 1) - newImage = True + imageId = int(getLastImage(cur) + 1) + newImage = True else: - newImage = False + newImage = False if newImage: @@ -660,8 +660,8 @@ def create_database(cur, con): try: - sql = "create table forum_images(image_id integer not null, hash_image character varying(64) not null, base64_image character varying(10000000) not null, " \ - "resnet50_image character varying(1000000) null, siftkey_image character varying(1000000) null, siftdesc_image character varying(1000000) null, " \ + sql = "create table forum_images(image_id integer not null, hash_image character varying(64) not null, base64_image text not null, " \ + "resnet50_image text null, siftkey_image text null, siftdesc_image text null, " \ "dateinserted_image timestamp(6) with time zone not null, " \ "constraint forum_images_pk primary key (image_id))" cur.execute(sql) @@ -685,7 +685,7 @@ def create_database(cur, con): sql = "create table users (user_id integer NOT NULL, forum_id integer NOT NULL, name_user character varying(" \ "255) NOT NULL, status_user character varying(255) null, reputation_user character varying(255) null, " \ - "interest_user character varying(5000) null, signature_user character varying(1000) null, " \ + "interest_user character varying(10000) null, signature_user character varying(10000) null, " \ "image_user integer null, dateinserted_user timestamp(6) with time zone NOT NULL, " \ "constraint users_pk primary key (user_id), " \ "constraint users_forum_id_fk foreign key (forum_id) references forums (forum_id), " \ @@ -697,8 +697,8 @@ def create_database(cur, con): sql = "create table users_history(user_id integer NOT NULL, version_user integer not null, forum_id integer NOT NULL, " \ "name_user character varying(255) NOT NULL, status_user character varying(255) null, " \ - "reputation_user character varying(255) null, interest_user character varying(5000) null, " \ - "signature_user character varying(1000) null, image_user integer null, " \ + "reputation_user character varying(255) null, interest_user character varying(10000) null, " \ + "signature_user character varying(10000) null, image_user integer null, " \ "dateinserted_user timestamp(6) with time zone NOT NULL, " \ "constraint users_history_pk primary key (user_id, version_user), " \ "constraint users_history_user_id_fk foreign key (user_id) references users (user_id), " \ @@ -730,7 +730,7 @@ def create_database(cur, con): cur.execute(sql) sql = "create table posts(post_id integer NOT NULL, topic_id integer NOT NULL, " \ - "user_id integer NOT NULL, content_post character varying(100000) NOT null, feedback_post integer null, " \ + "user_id integer NOT NULL, content_post character varying(1000000) NOT null, feedback_post integer null, " \ "image_post integer null, dateadded_post timestamp(6) with time zone NOT NULL, " \ "dateinserted_post timestamp(6) with time zone NOT NULL, " \ "constraint posts_pk primary key (post_id), " \ @@ -744,7 +744,7 @@ def create_database(cur, con): cur.execute(sql) sql = "create table posts_history(post_id integer NOT NULL, version_post integer not null, topic_id integer NOT NULL, " \ - "user_id integer NOT NULL, content_post character varying(100000) NOT null, feedback_post integer null, " \ + "user_id integer NOT NULL, content_post character varying(1000000) NOT null, feedback_post integer null, " \ "image_post integer null, dateadded_post timestamp(6) with time zone NOT NULL, " \ "dateinserted_post timestamp(6) with time zone NOT NULL, " \ "constraint posts_history_pk primary key (post_id, version_post), " \ diff --git a/MarketPlaces/DB_Connection/db_connection.py b/MarketPlaces/DB_Connection/db_connection.py index 7dd9028..da98a95 100644 --- a/MarketPlaces/DB_Connection/db_connection.py +++ b/MarketPlaces/DB_Connection/db_connection.py @@ -313,10 +313,10 @@ def create_items(cur, row, marketId, vendorId): itemId = verifyItem(cur, marketId, hrefItem) if not itemId: - itemId = int(getLastItem(cur) + 1) - newItem = True + itemId = int(getLastItem(cur) + 1) + newItem = True else: - newItem = False + newItem = False if newItem: @@ -554,8 +554,8 @@ def create_database(cur, con): try: - sql = "create table market_images(image_id integer not null, hash_image character varying(64) not null, base64_image character varying(10000000) not null, " \ - "resnet50_image character varying(1000000) null, siftkey_image character varying(1000000) null, siftdesc_image character varying(1000000) null, " \ + sql = "create table market_images(image_id integer not null, hash_image character varying(64) not null, base64_image text not null, " \ + "resnet50_image text null, siftkey_image text null, siftdesc_image text null, " \ "dateinserted_image timestamp(6) with time zone not null, " \ "constraint market_images_pk primary key (image_id))" cur.execute(sql)