-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
#23 estrutura do projeto merjando pois temos todas as models
- Loading branch information
Showing
71 changed files
with
1,906 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Apresentação de Entrega 02 | ||
|
||
<img src ="https://raw.githubusercontent.com/SBD1/2023.2-Hora-de-Aventura/main/Apresenta%C3%A7%C3%B5es/img/HoraDeAventura.jpeg" > | ||
|
||
## Introdução | ||
Apresentação da entrega 02 da disciplina Sistemas de Banco de 01, ministrada pelo prof Mauricio Serrano.Apresentamos a entrega 0 contendo: | ||
|
||
- Normalização | ||
- DDL | ||
- DML | ||
- DQL | ||
- Algebra Relacional | ||
|
||
|
||
## Participantes: | ||
|
||
- Arthur Miranda | ||
- Davi Nobre | ||
- Doan Filho | ||
- Henrique Batalha | ||
|
||
## Video | ||
Apresentação 02: | ||
<https://youtu.be/6ktuKswGC6Y> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import psycopg2 | ||
from .Database import Database | ||
|
||
class Armadura: | ||
def __init__(self): | ||
self.db = Database() | ||
pass | ||
|
||
def inserirArmadura(self, item: int, nome: str, durabilidade: int, defesa: int): | ||
try: | ||
conexao = self.db.conexao | ||
cursor = conexao.cursor() | ||
|
||
cursor.execute("INSERT INTO armadura VALUES(%s, %s, %s, %s);", (item, nome, durabilidade, defesa)) | ||
insercaoArmamento = conexao.commit() | ||
return print("Armadura inserida com sucesso!\n") | ||
|
||
except psycopg2.IntegrityError as e: | ||
print(f"Encontramos problemas ao fazer a insercao. Erro: {e}\n") | ||
|
||
finally: | ||
cursor.close() | ||
|
||
def deletarArmadura(self, item: int): | ||
try: | ||
conexao = self.db.conexao | ||
cursor = conexao.cursor() | ||
|
||
cursor.execute(f"DELETE FROM armadura WHERE item = '{item}';") | ||
delecaoArmamento = conexao.commit() | ||
return print("Armadura deletada com sucesso!\n") | ||
|
||
except psycopg2.IntegrityError as e: | ||
print(f"Encontramos problemas ao fazer a delecao. Erro: {e}\n") | ||
|
||
finally: | ||
cursor.close() | ||
|
||
def consultarArmaduraId(self, item: int): | ||
try: | ||
conexao = self.db.conexao | ||
cursor = conexao.cursor() | ||
|
||
cursor.execute(f"SELECT * FROM armadura WHERE item = '{item}';") | ||
consulta = cursor.fetchall() | ||
|
||
if not consulta: | ||
print("Não foi há itens cadastrados\n") | ||
else: | ||
for i in consulta: | ||
print(i) | ||
return i | ||
|
||
except psycopg2.IntegrityError as e: | ||
print(f"Encontramos problemas ao fazer a consulta. Erro: {e}\n") | ||
|
||
finally: | ||
cursor.close() | ||
|
||
def consultarArmadura(self): | ||
try: | ||
conexao = self.db.conexao | ||
cursor = conexao.cursor() | ||
|
||
cursor.execute(f"SELECT * FROM armadura;") | ||
consulta = cursor.fetchall() | ||
|
||
if not consulta: | ||
print("Não foi há itens cadastrados\n") | ||
else: | ||
for i in consulta: | ||
print(i) | ||
return i | ||
|
||
except psycopg2.IntegrityError as e: | ||
print(f"Encontramos problemas ao fazer a consulta. Erro: {e}\n") | ||
|
||
finally: | ||
cursor.close() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import psycopg2 | ||
from .Database import Database | ||
|
||
class Armamento: | ||
def __init__(self, item: int, nome: str, dano: int, elemento: str): | ||
self.item = item | ||
self.nome = nome | ||
self.dano = dano | ||
self.elemento = elemento | ||
pass | ||
|
||
def __init__(self): | ||
self.db = Database() | ||
pass | ||
|
||
def inserirArmamento(self, item: int, nome: str, dano: int, elemento: str): | ||
try: | ||
conexao = self.db.conexao | ||
cursor = conexao.cursor() | ||
|
||
cursor.execute("INSERT INTO armamento VALUES(%s, %s, %s, %s);", (item, nome, dano, elemento)) | ||
insercaoArmamento = conexao.commit() | ||
return print("Arma inserida com sucesso!\n") | ||
|
||
except psycopg2.IntegrityError as e: | ||
print(f"Encontramos problemas ao fazer a insercao. Erro: {e}\n") | ||
|
||
finally: | ||
cursor.close() | ||
|
||
def deletarArmamento(self, item: int): | ||
try: | ||
conexao = self.db.conexao | ||
cursor = conexao.cursor() | ||
|
||
cursor.execute(f"DELETE FROM armamento WHERE item = '{item}';") | ||
delecaoArmamento = conexao.commit() | ||
return print("Arma deletada com sucesso!\n") | ||
|
||
except psycopg2.IntegrityError as e: | ||
print(f"Encontramos problemas ao fazer a delecao. Erro: {e}\n") | ||
|
||
finally: | ||
cursor.close() | ||
|
||
def consultarArmamentoId(self, item: int): | ||
try: | ||
conexao = self.db.conexao | ||
cursor = conexao.cursor() | ||
cursor.execute(f"SELECT * FROM armamento WHERE item = '{item}';") | ||
consulta = cursor.fetchall() | ||
|
||
if not consulta: | ||
print("Não foi há armas cadastradas\n") | ||
else: | ||
for i in consulta: | ||
print(i) | ||
return i | ||
|
||
except psycopg2.IntegrityError as e: | ||
print(f"Encontramos problemas ao fazer a consulta. Erro: {e}\n") | ||
|
||
finally: | ||
cursor.close() | ||
|
||
def consultarArmamento(self): | ||
try: | ||
conexao = self.db.conexao | ||
cursor = conexao.cursor() | ||
cursor.execute(f"SELECT * FROM armamento;") | ||
consulta = cursor.fetchall() | ||
|
||
if not consulta: | ||
print("Não foi há armas cadastradas\n") | ||
else: | ||
for i in consulta: | ||
print(i) | ||
return i | ||
|
||
except psycopg2.IntegrityError as e: | ||
print(f"Encontramos problemas ao fazer a consulta. Erro: {e}\n") | ||
|
||
finally: | ||
cursor.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import psycopg2 | ||
from .Database import Database | ||
|
||
class Chefe: | ||
def __init__(self): | ||
self.db=Database() | ||
|
||
def inserirChefe(self, Numero:int, nomeMissao:str, Personagem:int): | ||
try: | ||
conexao=self.db.conexao | ||
cursor=conexao.cursor() | ||
cursor.execute(f"""INSERT INTO Chefe VALUES({Numero}, '{nomeMissao}', {Personagem});""") | ||
conexao.commit() | ||
return print("Chefe Inserido") | ||
except psycopg2.Error as e: | ||
print("Erro ao inserir Chefe", e) | ||
finally: | ||
cursor.close() | ||
|
||
def consultarChefe(self): | ||
try: | ||
conexao=self.db.conexao | ||
cursor=conexao.cursor() | ||
cursor.execute(f"""SELECT * FROM Chefe;""") | ||
conexao.commit() | ||
resultado=cursor.fetchall() | ||
for i in resultado: | ||
print(i) | ||
except psycopg2.Error as e: | ||
print("Erro ao consultar Chefe", e) | ||
finally: | ||
cursor.close() | ||
|
||
def deletarChefe(self, Numero:int, nomeMissao:str, Personagem:int): | ||
try: | ||
conexao=self.db.conexao | ||
cursor=conexao.cursor() | ||
cursor.execute(f"""DELETE FROM Chefe WHERE Numero = {Numero} AND nomeMissao = '{nomeMissao}' AND Personagem = {Personagem};""") | ||
conexao.commit() | ||
return print("Chefe Deletado") | ||
except psycopg2.Error as e: | ||
print("Erro ao deletar Chefe", e) | ||
finally: | ||
cursor.close() | ||
|
||
def consultarChefeEspecifico(self, Numero:int, nomeMissao:str, Personagem:int): | ||
try: | ||
conexao=self.db.conexao | ||
cursor=conexao.cursor() | ||
cursor.execute(f"""SELECT * FROM Chefe WHERE Numero = {Numero} AND nomeMissao = '{nomeMissao}' AND Personagem = {Personagem};""") | ||
conexao.commit() | ||
resultado=cursor.fetchall() | ||
if resultado: | ||
print(resultado[0]) | ||
except psycopg2.Error as e: | ||
print("Erro ao consultar Chefe", e) | ||
finally: | ||
cursor.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import psycopg2 | ||
from .Database import Database | ||
|
||
class Consumivel: | ||
|
||
def __init__(self): | ||
self.db = Database() | ||
pass | ||
|
||
def inserirConsumivel(self, item: int, nome: str, cura: int, usos: int): | ||
try: | ||
conexao = self.db.conexao | ||
cursor = conexao.cursor() | ||
|
||
cursor.execute("INSERT INTO consumivel VALUES(%s, %s, %s, %s);", (item, nome, cura, usos)) | ||
conexao.commit() | ||
return print("Consumivel inserido com sucesso!\n") | ||
|
||
except psycopg2.IntegrityError as e: | ||
print(f"Encontramos problemas ao fazer a insercao. Erro: {e}\n") | ||
|
||
finally: | ||
cursor.close() | ||
|
||
def deletarConsumivel(self, item: int): | ||
try: | ||
conexao = self.db.conexao | ||
cursor = conexao.cursor() | ||
|
||
cursor.execute(f"DELETE FROM consumivel WHERE item = '{item}';") | ||
delecaoArmamento = conexao.commit() | ||
return print("Consumivel deletado com sucesso!\n") | ||
|
||
except psycopg2.IntegrityError as e: | ||
print(f"Encontramos problemas ao fazer a delecao. Erro: {e}\n") | ||
|
||
finally: | ||
cursor.close() | ||
|
||
def consultarConsumivelId(self, item: int): | ||
try: | ||
conexao = self.db.conexao | ||
cursor = conexao.cursor() | ||
cursor.execute(f"SELECT * FROM consumivel WHERE item = '{item}';") | ||
consulta = cursor.fetchall() | ||
|
||
if not consulta: | ||
print("Não tem consumiveis cadastradas\n") | ||
else: | ||
for i in consulta: | ||
print(i) | ||
return i | ||
|
||
except psycopg2.IntegrityError as e: | ||
print(f"Encontramos problemas ao fazer a consulta. Erro: {e}\n") | ||
|
||
finally: | ||
cursor.close() | ||
|
||
def consultarConsumivel(self): | ||
try: | ||
conexao = self.db.conexao | ||
cursor = conexao.cursor() | ||
cursor.execute(f"SELECT * FROM consumivel;") | ||
consulta = cursor.fetchall() | ||
|
||
if not consulta: | ||
print("Não tem cosnsumiveis cadastradas\n") | ||
else: | ||
for i in consulta: | ||
print(i) | ||
return i | ||
|
||
except psycopg2.IntegrityError as e: | ||
print(f"Encontramos problemas ao fazer a consulta. Erro: {e}\n") | ||
|
||
finally: | ||
cursor.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import psycopg2 | ||
from .Database import Database | ||
|
||
class Contem: | ||
def __init__(self): | ||
self.db=Database() | ||
|
||
def inserirContem(self, local:int, missao:str): | ||
try: | ||
conexao=self.db.conexao | ||
cursor=conexao.cursor() | ||
cursor.execute(f"""INSERT INTO Contem VALUES({local}, '{missao}';""") | ||
conexao.commit() | ||
return print("Contem Inserido") | ||
except psycopg2.Error as e: | ||
print("Erro ao inserir Contem", e) | ||
finally: | ||
cursor.close() | ||
|
||
def consultarContem(self): | ||
try: | ||
conexao=self.db.conexao | ||
cursor=conexao.cursor() | ||
cursor.execute(f"""SELECT * FROM Contem;""") | ||
conexao.commit() | ||
resultado=cursor.fetchall() | ||
for i in resultado: | ||
print(i) | ||
except psycopg2.Error as e: | ||
print("Erro ao consultar Contem", e) | ||
finally: | ||
cursor.close() | ||
|
||
def deletarContem(self, local:int, missao:str): | ||
try: | ||
conexao=self.db.conexao | ||
cursor=conexao.cursor() | ||
cursor.execute(f"""DELETE FROM Contem WHERE LOCAL = '{local}' AND MISSAO = '{missao}';""") | ||
conexao.commit() | ||
return print("Contem Deletada") | ||
except psycopg2.Error as e: | ||
print("Erro ao deletar Contem", e) | ||
finally: | ||
cursor.close() | ||
|
||
def consultarContemEspecifico(self, local:int, missao:str): | ||
try: | ||
conexao=self.db.conexao | ||
cursor=conexao.cursor() | ||
cursor.execute(f"""SELECT * FROM Contem WHERE LOCAL = '{local}' AND MISSAO = '{missao}';""") | ||
conexao.commit() | ||
resultado=cursor.fetchall() | ||
if resultado: | ||
print(resultado[0]) | ||
except psycopg2.Error as e: | ||
print("Erro ao consultar Contem", e) | ||
finally: | ||
cursor.close() |
Oops, something went wrong.