Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 61db0634

Přidáno uživatelem David Friesecký před asi 4 roky(ů)

Re #8471 - Edited arguments in headers of functions

Zobrazit rozdíly:

src/dao/repository.py
1 1
class IRepository:
2
    def create(self, sql: str, *args) -> bool:
2
    def create(self, *args) -> bool:
3 3
        pass
4 4

  
5
    def read(self, sql: str, item_id: int = None):
5
    def read(self, *args):
6 6
        pass
7 7

  
8
    def update(self, sql: str, item_id: int, *args) -> bool:
8
    def update(self, *args) -> bool:
9 9
        pass
10 10

  
11
    def delete(self, sql: str, item_id: int) -> bool:
11
    def delete(self, *args) -> bool:
12 12
        pass
src/impl/db_manager.py
26 26
                conn.close()
27 27
        return True
28 28

  
29
    def read(self, sql: str, item_id: int = None) -> list:
29
    def read(self, sql: str, item_id: int = None):
30 30
        conn = None
31 31
        try:
32 32
            conn = sqlite3.connect(DATABASE_FILE)
......
47 47
                conn.close()
48 48
        return records
49 49

  
50
    def update(self, sql: str, item_id: int, *args) -> bool:
50
    def update(self, sql: str, *args) -> bool:
51 51
        conn = None
52 52
        try:
53
            values = list(args)
54
            values.append(item_id)
55

  
56 53
            conn = sqlite3.connect(DATABASE_FILE)
57 54
            c = conn.cursor()
58
            c.execute(sql, values)
55
            c.execute(sql, args)
59 56
            conn.commit()
60 57
            c.close()
61 58
        except Error as e:

Také k dispozici: Unified diff