Ejemplo n.º 1
0
    def findById(self, id):
        db = self.learnXdB.openDataBase()
        c = db.cursor()
        
        t = (id,)
        c.execute("Select * From Decks Where id = ?", t)
        
        deck = None
        for row in c:
            deck = Deck(row[1], row[2], row[3], row[4], row[5], row[6], row[0], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16])
            if deck.fields:
                deck.fields = pickle.loads(str(deck.fields))
            if deck.posOptions:
                deck.posOptions = pickle.loads(str(deck.posOptions))
            
        db.commit()
        c.close()

        return deck
Ejemplo n.º 2
0
 def list(self):
     db = self.learnXdB.openDataBase()
     
     c = db.cursor()
     c.execute("select * from Decks")
     
     decks = []
     for row in c:
         deck = Deck(row[1], row[2], row[3], row[4], row[5], row[6], row[0], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16])
         if deck.fields:
             deck.fields = pickle.loads(str(deck.fields))
         if deck.posOptions:
             deck.posOptions = pickle.loads(str(deck.posOptions))
         
         decks.append(deck)
     
     c.close()
     
     return decks