Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Prova_db_presepe
- class PRESEPE_SALVA():
- def presepe_salva(self,dati):
- self.dati = dati
- import sqlite3
- conn = sqlite3.connect('presepe.db')
- c = conn.cursor()
- # Crea Tabella
- c.execute('''CREATE TABLE IF NOT EXISTS scheda_1 (evento TEXT, time TEXT, rele_8 TEXT, rele_7 TEXT, rele_6 TEXT,rele_5 TEXT,rele_4 TEXT,rele_3 TEXT,rele_2 TEXT,rele_1 TEXT)''')
- c.execute('''CREATE TABLE IF NOT EXISTS scheda_2 (evento INTEGER, time INTEGER, rele_8 INTEGER, rele_7 INTEGER, rele_6 INTEGER,rele_5 INTEGER,rele_4 INTEGER,rele_3 INTEGER,rele_2 INTEGER,rele_1 INTEGER)''')
- c.execute('''CREATE TABLE IF NOT EXISTS scheda_3(evento INTEGER, time INTEGER, rele_8 INTEGER, rele_7 INTEGER, rele_6 INTEGER,rele_5 INTEGER,rele_4 INTEGER,rele_3 INTEGER,rele_2 INTEGER,rele_1 INTEGER)''')
- c.execute('''Create TABLE IF NOT EXISTS scheda_4 (evento INTEGER, time INTEGER, rele_8 INTEGER, rele_7 INTEGER, rele_6 INTEGER,rele_5 INTEGER,rele_4 INTEGER,rele_3 INTEGER,rele_2 INTEGER,rele_1 INTEGER)''')
- # Inserisce una riga di dati
- c.executemany("INSERT INTO scheda_1 VALUES (?,?,?,?,?,?,?,?,?,?)",self.dati) #(1,20,61,61,61,60,60,61,60,60)")
- c.execute("INSERT INTO scheda_2 VALUES (1,50,60,61,60,61,61,60,61,61)")
- c.execute("INSERT INTO scheda_3 VALUES (1,70,60,60,61,60,61,61,60,61)")
- c.execute("INSERT INTO scheda_4 VALUES (1,90,61,61,60,61,60,60,61,60)")
- #purchases = [('2006-03-28','BUY','IBM',1000,45.00),
- # ('2006-04-05','BUY','MSFT',1000,72.00),
- # ('2006-04-06','SELL','IBM',500,53.00),
- # ]
- #c.executemany('INSERT INTO stocks VALUES (?,?,?,?,?)',purchases)
- # Salva (commit) i cambiamenti
- conn.commit()
- for row in c.execute('SELECT * FROM scheda_2 ORDER BY time'):
- print (row)
- pos = PRESEPE_SALVA()
- #for articolo in dati:
- # a=a+1
- # print(a)
- # print(articolo[0],articolo[1],articolo[2],articolo[3],articolo[4],articolo[5],articolo[6],articolo[7])
- #
- # purchases1 = [(articolo[0],articolo[1],articolo[2],articolo[3],articolo[4],articolo[5],articolo[6],articolo[7])]
- # c.executemany('INSERT INTO FSCCDET VALUES (?,?,?,?,?,?,?,?)',purchases1)
- # conn.commit()
- #print(purchases1.index)
- #for row in c.execute('SELECT * FROM FSCCDET ORDER BY data_start'):
- # print (row)
- # tolta per il momento c.execute('''CREATE TABLE IF NOT EXISTS tim (date text, trans text, symbol text, qty real, price real)''')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement