コード例 #1
0
def testeConnexBD():
    '''
        Envia algum dado de teste para o banco de dados
    '''
    banco = mySQL(True)
    banco.execModQuery("INSERT INTO Teste VALUES (0, 0)")
    pass
コード例 #2
0
ファイル: Personagem.py プロジェクト: Arudacip/Cloud
 def buscarNoBanco(self, ID: int):
     banco = mySQL(False)
     query = f" SELECT NomeJogador, StartGameTime FROM StartGame WHERE ID = {ID}"
     resultTuple = banco.execReadQuery(query)
     for result in resultTuple:
         self.NomeJogador = result[0]
         self.StartGameTime = result[1]
         self.ID = ID
     return self
コード例 #3
0
ファイル: Personagem.py プロジェクト: Arudacip/Cloud
    def inserirNoBancoStartGame(self) -> int:
        banco = mySQL(True)
        time = str(datetime.datetime.now())[:19]
        query = " INSERT INTO StartGame (NomeJogador, StartGameTime) VALUES "
        query += f" ( '{self.NomeJogador}', '{time}' )"

        x = banco.execModQuery(query)

        query = f"SELECT ID FROM StartGame WHERE NomeJogador = '{self.NomeJogador}' AND StartGameTime = '{time}'"
        resultTuple = banco.execReadQuery(query)
        for result in resultTuple:
            self.ID = result[0]
コード例 #4
0
    def buscarNoBanco(self, codeFaseAtual: int) -> list:

        banco = mySQL(False)

        ligacoes = list()
        query = f" SELECT ID, CodeProximaFase FROM FaseLigacoes WHERE CodeFaseAtual = {codeFaseAtual}"

        resultTuple = banco.execReadQuery(query)

        for result in resultTuple:
            ligacoes.append(result[0], result[1], codeFaseAtual)

        return ligacoes
コード例 #5
0
 def buscarTodos(self) -> list:
     fases = list()
     banco = mySQL(False)
     query = f" SELECT CorFase, ShapeFase, NomeFase, LabelFase, texto, Code FROM Fases"
     resultTuple = banco.execReadQuery(query)
     for result in resultTuple:
         fase = faseModel()
         fase.CorFase = result[0]
         fase.ShapeFase = result[1]
         fase.NomeFase = result[2]
         fase.LabelFase = result[3]
         fase.Texto = result[4]
         fase.Code = result[5]
         fases.append(fase)
     return fases
コード例 #6
0
    def buscarNoBanco(self, code: int):
        try:
            banco = mySQL(False)
            query = f" SELECT CorFase, ShapeFase, NomeFase, LabelFase, texto FROM Fases WHERE Code = {code}"
            resultTuple = banco.execReadQuery(query)
            for result in resultTuple:
                self.CorFase = result[0]
                self.ShapeFase = result[1]
                self.NomeFase = result[2]
                self.LabelFase = result[3]
                self.Texto = result[4]
                self.Code = code

            self.btnsList = buttonModel().buscarNoBancoPorFase(code)
        except Exception:
            self.Code = -1
コード例 #7
0
    def buscarNoBancoPorFase(self, codeFase: int) -> list:
        
        listBtns = list()

        banco = mySQL(False)
        query = f" SELECT Code, ButtonDescription, proximaFase FROM Buttons WHERE CodeFase = {codeFase}"
        resultTuple = banco.execReadQuery(query)

        for result in resultTuple:
            btn = buttonModel()
            btn.Code = result[0]
            btn.ButtonDescription = result[1]
            btn.proximaFase = result[2]
            btn.CodeFase = codeFase

            listBtns.append(btn)
        return listBtns