def index(request, productId): sqlite.connect( "database/data/products.sqlite3", raiseError=False, ) paytmParams = { "MID": "WorldP64425807474247", "ORDER_ID": hashlib.sha1( str(productId).encode("utf-8") + str(time.time()).encode("utf-8")).hexdigest()[-15:], "TXN_AMOUNT": str( sqlite.execute( f'SELECT price FROM PRODUCT WHERE id="{productId}"', "database/data/products.sqlite3", )[0][0][0]), "CUST_ID": "*****@*****.**", "INDUSTRY_TYPE_ID": "Retail", "WEBSITE": "WEBSTAGING", "CHANNEL_ID": "WEB", "CALLBACK_URL": "http://127.0.0.1:8000/payment/pay/", } print(paytmParams["ORDER_ID"]) paytmParams["CHECKSUMHASH"] = checksum.generate_checksum( paytmParams, "kbzk1DSbJiV_O3p5") # sqlite.execute(f'SELECT price FROM PRODUCT WHERE id="{productId}"')[0][0][0] return render(request, "payment/index.html", paytmParams)
def contact(request): if request.method == "POST": name = request.POST.get("fullName") email = request.POST.get("email") issue = request.POST.get("issue") print(name, email, issue) sqlite.connect("contacts.sqlite3", validateDatabase=False, raiseError=False) # INSERT DATA INTO DATABASE return render(request, "contact/index.html")
def index(request): query = request.GET.get("query") print(query) sqlite.connect( "/media/yogesh/Development/Python/django/mediumCart/database/data/products.sqlite3", raiseError=False, ) result = [] # Perform search functionality here attributes = {"query": query, "result": result} if query is not "": return render(request, "search/index.html", attributes) else: return HttpResponseRedirect("/")
def __init__(self): sqlite.constants.__databPath__ = [] sqlite.connect("database/data/users.sqlite3")
def fetchDatabase(kind="Product"): sqlite.constants.__databPath__ = [] sqlite.connect("database/data/products.sqlite3") return sqlite.execute(f"SELECT * FROM {kind.upper()}")
from sql_tools import sqlite # sqlite.connect(r"data/database/services.db") # sqlite.connect(r"data/database/history.db") sqlite.connect(r"data/database/programInstallData.db") # result = sqlite.getTableNames() # result = sqlite.execute("SELECT * FROM engines") # result = sqlite.getColumnNames("MUSIC_SERVICES") # result = sqlite.execute("SELECT * FROM MUSIC_SERVICES") # result = sqlite.execute("UPDATE MUSIC_SERVICES SET scrapMethod='requests' WHERE rank=1") # result = sqlite.execute("SELECT * FROM MUSIC_SERVICES") # result = sqlite.execute("INSERT INTO MUSIC_SERVICES VALUES ('YouTube music', 'https://music.youtube.com', '/search?q=', '/watch?v=', '3', 'bs4', 'RUN')") # result = sqlite.getColumnNames("engines") # result = sqlite.execute("SELECT * FROM PROGRAMS_DATA_WIN32") result = sqlite.execute("SELECT * FROM history") # result = sqlite.execute("SELECT * FROM history WHERE solved='false'") # result = sqlite.getNoOfRecords(["history", "history"]) print(result)
from tools_lib import bprint databases = [ "services.db", "attributes.db", "programInstallData.db", # "history.db" ] query = [ "services.sql", "attributes.sql", "programInstallData.sql", # "history.sql" ] for i in range(len(databases)): sqlite.connect(fr"data/database/{databases[i]}") with open(f"data/query/{query[i]}") as f: read = f.readlines() for command in read: sqlite.execute(command) bprint(f"Done for {databases[i]}", bg="red") sqlite.disconnect(fr"data/database/{databases[i]}") print() bprint("---> Databases updated successfully ✅ <---", bg="red")
from sql_tools import sqlite # PRODUCT ''' # Connecting database sqlite.connect("data/products.sqlite3") commands = [ """ CREATE TABLE IF NOT EXISTS PRODUCT ( id INT NOT NULL PRIMARY KEY, endId VARCHAR(70) NOT NULL UNIQUE, name TEXT, shortDesc TEXT, description TEXT, images TEXT, rating FLOAT, owners TEXT, categories TEXT, reviews TEXT, assets TEXT, quantity FLOAT, sale TEXT, price FLOAT ); """, """ CREATE TABLE IF NOT EXISTS OWNER ( id INT NOT NULL PRIMARY KEY, username TEXT,
from sql_tools import sqlite sqlite.connect("sample.db") sqlite.execute("CREATE TABLE TEST1 (C1 TEXT);") sqlite.execute("CREATE TABLE TEST2 (C2 TEXT);") sqlite.execute("CREATE TABLE TEST3 (C3 TEXT);") sqlite.execute("CREATE TABLE TEST4 (C4 TEXT);")
def force(path): try: sqlite.connect(path, validateDatabase=False) except Exception as e: raiseError(e)
def connect(path): try: sqlite.connect(path) except Exception as e: raiseError(e)