|
|
@ -34,7 +34,7 @@ def verifyMarketPlace(cur, nameMarket): |
|
|
|
recset = cur.fetchall() |
|
|
|
|
|
|
|
if recset: |
|
|
|
return recset[0][0] |
|
|
|
return recset[0]['market_id'] |
|
|
|
else: |
|
|
|
return 0 |
|
|
|
|
|
|
@ -54,7 +54,7 @@ def verifyVendor(cur, nameVendor, marketId): |
|
|
|
recset = cur.fetchall() |
|
|
|
|
|
|
|
if recset: |
|
|
|
return recset[0][0] |
|
|
|
return recset[0]['vendor_id'] |
|
|
|
else: |
|
|
|
return 0 |
|
|
|
|
|
|
@ -73,7 +73,7 @@ def verifyItem(cur, marketId, vendorId, nameItem): |
|
|
|
recset = cur.fetchall() |
|
|
|
|
|
|
|
if recset: |
|
|
|
return recset[0][0] |
|
|
|
return recset[0]['item_id'] |
|
|
|
else: |
|
|
|
return 0 |
|
|
|
|
|
|
@ -91,7 +91,7 @@ def getLastMarketPlace(cur): |
|
|
|
recset = cur.fetchall() |
|
|
|
|
|
|
|
if recset: |
|
|
|
return recset[0][0] |
|
|
|
return recset[0]['market_id'] |
|
|
|
else: |
|
|
|
return 0 |
|
|
|
|
|
|
@ -110,7 +110,7 @@ def getLastVendor(cur): |
|
|
|
recset = cur.fetchall() |
|
|
|
|
|
|
|
if recset: |
|
|
|
return recset[0][0] |
|
|
|
return recset[0]['vendor_id'] |
|
|
|
else: |
|
|
|
return 0 |
|
|
|
|
|
|
@ -128,7 +128,7 @@ def getLastVendorVersion(cur, vendorId): |
|
|
|
recset = cur.fetchall() |
|
|
|
|
|
|
|
if recset: |
|
|
|
return recset[0][0] |
|
|
|
return recset[0]['version_vendor'] |
|
|
|
else: |
|
|
|
return 0 |
|
|
|
|
|
|
@ -146,7 +146,7 @@ def getLastItem(cur): |
|
|
|
recset = cur.fetchall() |
|
|
|
|
|
|
|
if recset: |
|
|
|
return recset[0][0] |
|
|
|
return recset[0]['item_id'] |
|
|
|
else: |
|
|
|
return 0 |
|
|
|
|
|
|
@ -165,7 +165,7 @@ def getLastItemVersion(cur, itemId): |
|
|
|
recset = cur.fetchall() |
|
|
|
|
|
|
|
if recset: |
|
|
|
return recset[0][0] |
|
|
|
return recset[0]['version_item'] |
|
|
|
else: |
|
|
|
return 0 |
|
|
|
|
|
|
@ -225,9 +225,9 @@ def create_vendor(cur, row, marketId): |
|
|
|
|
|
|
|
# decode_decrypt_image_in_base64(recset[0][5]) |
|
|
|
|
|
|
|
if (str(recset[0][3]) != str(row[2] if row[2] != '-1' else None) or # there was a change in the vendor information |
|
|
|
str(recset[0][4]) != str(row[3] if row[3] != '-1' else None) or |
|
|
|
str(recset[0][5]) != str(row[21] if row[21] != '-1' else None)): |
|
|
|
if (str(recset[0]['rating_vendor']) != str(row[2] if row[2] != '-1' else None) or # there was a change in the vendor information |
|
|
|
str(recset[0]['successfultransactions_vendor']) != str(row[3] if row[3] != '-1' else None) or |
|
|
|
str(recset[0]['image_vendor']) != str(row[21] if row[21] != '-1' else None)): |
|
|
|
|
|
|
|
vendorVersionId = int(getLastVendorVersion(cur, vendorId) + 1) |
|
|
|
|
|
|
@ -236,11 +236,11 @@ def create_vendor(cur, row, marketId): |
|
|
|
"Values (%s, %s, %s, %s, %s, %s, %s, %s)" |
|
|
|
|
|
|
|
recset = [vendorId, vendorVersionId, marketId, |
|
|
|
recset[0][2], |
|
|
|
recset[0][3], |
|
|
|
recset[0][4], |
|
|
|
recset[0][5], |
|
|
|
recset[0][6]] |
|
|
|
recset[0]['name_vendor'], |
|
|
|
recset[0]['rating_vendor'], |
|
|
|
recset[0]['successfultransactions_vendor'], |
|
|
|
recset[0]['image_vendor'], |
|
|
|
recset[0]['dateinserted_vendor']] |
|
|
|
|
|
|
|
cur.execute(sql, recset) |
|
|
|
|
|
|
@ -308,14 +308,22 @@ def create_items(cur, row, marketId, vendorId): |
|
|
|
|
|
|
|
# decode_decrypt_image_in_base64(recset[0][20]) |
|
|
|
|
|
|
|
if (str(recset[0][4]) != str(row[5] if row[5] != '-1' else None) or str(recset[0][5]) != str(row[6] if row[6] != '-1' else None) or |
|
|
|
str(recset[0][6]) != str(row[7] if row[7] != '-1' else None) or str(recset[0][7]) != str(row[8] if row[8] != '-1' else None) or |
|
|
|
str(recset[0][8]) != str(row[9] if row[9] != '-1' else None) or str(recset[0][9]) != str(row[10] if row[10] != '-1' else None) or |
|
|
|
str(recset[0][10]) != str(row[11] if row[11] != '-1' else None) or str(recset[0][11]) != str(row[12] if row[12] != '-1' else None) or |
|
|
|
str(recset[0][12]) != str(row[13] if row[13] != '-1' else None) or str(recset[0][13]) != str(row[14] if row[14] != '-1' else None) or |
|
|
|
str(recset[0][14]) != str(row[15] if row[15] != '-1' else None) or str(recset[0][15]) != str(row[16] if row[16] != '-1' else None) or |
|
|
|
str(recset[0][16]) != str(row[17] if row[17] != '-1' else None) or str(recset[0][17]) != str(row[18] if row[18] != '-1' else None) or |
|
|
|
str(recset[0][18]) != str(row[19] if row[19] != '-1' else None) or str(recset[0][20]) != str(row[20] if row[20] != '-1' else None)): |
|
|
|
if (str(recset[0]['description_item']) != str(row[5] if row[5] != '-1' else None) or |
|
|
|
str(recset[0]['cve_item']) != str(row[6] if row[6] != '-1' else None) or |
|
|
|
str(recset[0]['ms_item']) != str(row[7] if row[7] != '-1' else None) or |
|
|
|
str(recset[0]['category_item']) != str(row[8] if row[8] != '-1' else None) or |
|
|
|
str(recset[0]['views_item']) != str(row[9] if row[9] != '-1' else None) or |
|
|
|
str(recset[0]['reviews_item']) != str(row[10] if row[10] != '-1' else None) or |
|
|
|
str(recset[0]['rating_item']) != str(row[11] if row[11] != '-1' else None) or |
|
|
|
str(recset[0]['dateadded_item']) != str(row[12] if row[12] != '-1' else None) or |
|
|
|
str(recset[0]['btc_item']) != str(row[13] if row[13] != '-1' else None) or |
|
|
|
str(recset[0]['usd_item']) != str(row[14] if row[14] != '-1' else None) or |
|
|
|
str(recset[0]['euro_item']) != str(row[15] if row[15] != '-1' else None) or |
|
|
|
str(recset[0]['quantitysold_item']) != str(row[16] if row[16] != '-1' else None) or |
|
|
|
str(recset[0]['quantityleft_item']) != str(row[17] if row[17] != '-1' else None) or |
|
|
|
str(recset[0]['shippedfrom_item']) != str(row[18] if row[18] != '-1' else None) or |
|
|
|
str(recset[0]['shippedto_item']) != str(row[19] if row[19] != '-1' else None) or |
|
|
|
str(recset[0]['image_item']) != str(row[20] if row[20] != '-1' else None)): |
|
|
|
|
|
|
|
itemVersionId = int(getLastItemVersion(cur, itemId) + 1) |
|
|
|
|
|
|
@ -326,27 +334,27 @@ def create_items(cur, row, marketId, vendorId): |
|
|
|
"%s, %s, %s, %s, %s, %s)" |
|
|
|
|
|
|
|
recset = [itemId, itemVersionId, marketId, vendorId, |
|
|
|
recset[0][3], |
|
|
|
recset[0][4], |
|
|
|
recset[0][5], |
|
|
|
recset[0][6], |
|
|
|
recset[0][7], |
|
|
|
recset[0][8], |
|
|
|
recset[0][9], |
|
|
|
recset[0][10], |
|
|
|
recset[0][11], |
|
|
|
recset[0][12], |
|
|
|
recset[0][13], |
|
|
|
recset[0][14], |
|
|
|
recset[0][15], |
|
|
|
recset[0][16], |
|
|
|
recset[0][17], |
|
|
|
recset[0][18], |
|
|
|
recset[0][19], |
|
|
|
recset[0][20], |
|
|
|
recset[0][21], |
|
|
|
recset[0][22], |
|
|
|
recset[0][23]] |
|
|
|
recset[0]['name_item'], |
|
|
|
recset[0]['description_item'], |
|
|
|
recset[0]['cve_item'], |
|
|
|
recset[0]['ms_item'], |
|
|
|
recset[0]['category_item'], |
|
|
|
recset[0]['views_item'], |
|
|
|
recset[0]['reviews_item'], |
|
|
|
recset[0]['rating_item'], |
|
|
|
recset[0]['dateadded_item'], |
|
|
|
recset[0]['btc_item'], |
|
|
|
recset[0]['usd_item'], |
|
|
|
recset[0]['euro_item'], |
|
|
|
recset[0]['quantitysold_item'], |
|
|
|
recset[0]['quantityleft_item'], |
|
|
|
recset[0]['shippedfrom_item'], |
|
|
|
recset[0]['shippedto_item'], |
|
|
|
recset[0]['lastseen_item'], |
|
|
|
recset[0]['image_item'], |
|
|
|
recset[0]['href_item'], |
|
|
|
recset[0]['dateinserted_item'], |
|
|
|
recset[0]['classification_item']] |
|
|
|
|
|
|
|
cur.execute(sql, recset) |
|
|
|
|
|
|
@ -401,7 +409,7 @@ def create_database(cur, con): |
|
|
|
|
|
|
|
sql = "create table vendors(vendor_id integer not null, market_id integer not null, name_vendor character " \ |
|
|
|
"varying(255) not null, rating_vendor character varying(255), successfultransactions_vendor integer " \ |
|
|
|
"null, image_vendor character varying(1000000) null, dateinserted_vendor timestamp(6) with time zone not null, " \ |
|
|
|
"null, image_vendor character varying(10000000) null, dateinserted_vendor timestamp(6) with time zone not null, " \ |
|
|
|
"constraint vendors_pk primary key (vendor_id), constraint vendors_market_id_fkey foreign key (market_id) references marketplaces (" \ |
|
|
|
"market_id))" |
|
|
|
cur.execute(sql) |
|
|
@ -411,7 +419,7 @@ def create_database(cur, con): |
|
|
|
|
|
|
|
sql = "create table vendors_history(vendor_id integer not null, version_vendor integer not null, market_id integer not null, name_vendor " \ |
|
|
|
"character varying(255) not null, rating_vendor character varying(255), successfultransactions_vendor " \ |
|
|
|
"integer null, image_vendor character varying(1000000) null, dateinserted_vendor timestamp(6) with time zone not null, " \ |
|
|
|
"integer null, image_vendor character varying(10000000) null, dateinserted_vendor timestamp(6) with time zone not null, " \ |
|
|
|
"constraint vendors_history_pk primary key (vendor_id, version_vendor), constraint vendors_history_vendor_id_fkey foreign key (" \ |
|
|
|
"vendor_id) references vendors (vendor_id), constraint vendors_history_market_id_fkey foreign key (" \ |
|
|
|
"market_id) references marketplaces (market_id))" |
|
|
@ -424,7 +432,7 @@ def create_database(cur, con): |
|
|
|
"character varying(25) null, btc_item character varying(255) null, usd_item character varying(255) " \ |
|
|
|
"null, euro_item character varying(255) null, quantitysold_item integer null, quantityleft_item " \ |
|
|
|
"character varying(255) null, shippedfrom_item character varying(255) null, shippedto_item character " \ |
|
|
|
"varying(255) null, lastseen_item timestamp(6) with time zone not null, image_item character varying(1000000) null, " \ |
|
|
|
"varying(255) null, lastseen_item timestamp(6) with time zone not null, image_item character varying(10000000) null, " \ |
|
|
|
"href_item character varying(255) not null, dateinserted_item timestamp(6) with time zone not null, " \ |
|
|
|
"classification_item double precision not null, constraint items_pk primary key (item_id), constraint " \ |
|
|
|
"items_market_id_fkey foreign key (market_id) references marketplaces (market_id),constraint " \ |
|
|
@ -441,7 +449,7 @@ def create_database(cur, con): |
|
|
|
"character varying(25) null, btc_item character varying(255) null, usd_item character varying(255) " \ |
|
|
|
"null, euro_item character varying(255) null, quantitysold_item integer null, quantityleft_item " \ |
|
|
|
"character varying(255) null, shippedfrom_item character varying(255) null, shippedto_item character " \ |
|
|
|
"varying(255) null, lastseen_item timestamp(6) with time zone not null, image_item character varying(1000000) null, " \ |
|
|
|
"varying(255) null, lastseen_item timestamp(6) with time zone not null, image_item character varying(10000000) null, " \ |
|
|
|
"href_item character varying(255) not null, dateinserted_item timestamp(6) with time zone not null, " \ |
|
|
|
"classification_item double precision not null, constraint items_history_pk primary key (item_id, version_item), " \ |
|
|
|
"constraint items_history_market_id_fkey foreign key (market_id) references marketplaces (market_id), " \ |
|
|
|