Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
import sqlite3
from tools import email_client
conn = sqlite3.connect(':memory:') #creating database in memory
e = conn.cursor() #declaring cousor
e.execute("""CREATE TABLE email_client (
email_id text,
options text,
subf integer
)""") #creating table
def ins_usr(usr): #function for inserting user
with conn:
e.execute("INSERT INTO email_client "
"VALUES (:email_id, :options, :subf)",
{'email_id': usr.email_id, 'options': usr.options, 'subf': usr.subf})
return 0
def user_info (email_id): #function for selecting user
e.execute("SELECT * "
"FROM email_client "
"WHERE email_id=:email_id",
{'email_id': email_id})
return e.fetchall()
def Alluser_info(): #function for all selecting users
e.execute("SELECT * "
"FROM email_client ")
return e.fetchall()
def upd_options(email_id, options): #function for upadting user's options
with conn:
e.execute("""UPDATE email_client
SET options = :options
WHERE email_id = :email_id""",
{'email_id': email_id, 'options': options})
return 0
def remove_usr(usr): # functiob for removing user
with conn:
e.execute("DELETE from email_client "
"WHERE email_id = :email_id ",
{'email_id': usr.email_id})
return 0
def upd_subf(email_id, subf): #function for upadting user's subf
with conn:
e.execute("""UPDATE email_client
SET subf = :subf
WHERE email_id = :email_id""",
{'email_id': email_id, 'subf': subf})
#def send_all(usr):
# with conn:
# c.execute("SELECT * "
# "FROM email_client ")
#def run_background1():
# with conn:
# c.execute("SELECT * "
# "FROM email_client ")
# return c.fetchall()