Database.py 719 B

123456789101112131415161718
  1. import sqlite3
  2. class Banco():
  3. def __init__(self):
  4. self.conexao = sqlite3.connect('banco.db')
  5. self.criarTabela()
  6. def criarTabela(self):
  7. c = self.conexao.cursor()
  8. c.execute("""CREATE TABLE IF NOT EXISTS funcionario(idfunc INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, nome TEXT NOT NULL, cpf INTEGER NOT NULL, cargo TEXT NOT NULL, login UNIQUE NOT NULL, senha TEXT NOT NULL)""")
  9. c.execute("""CREATE TABLE IF NOT EXISTS clientes(idcliente INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, nome TEXT NOT NULL, cpf INTEGER NOT NULL, carro TEXT NOT NULL, telefone TEXT NOT NULL, email TEXT NOT NULL, endereco TEXT NOT NULL)""")
  10. self.conexao.commit()
  11. c.close()