Ledger Style changes
This commit is contained in:
20
Ledger.py
20
Ledger.py
@@ -12,18 +12,18 @@ class Ledger():
|
||||
LOSSES integer DEFAULT 0
|
||||
); """)
|
||||
|
||||
def readLedger(self, ID):
|
||||
def read(self, ID):
|
||||
self.data.execute("""SELECT USERID, MONEY, WINS, LOSSES FROM ledger WHERE USERID = ?""", (ID,))
|
||||
data = self.data.fetchone()
|
||||
return data
|
||||
|
||||
def writeLedger(self, ID):
|
||||
def write(self, ID):
|
||||
query = """ INSERT INTO ledger(USERID)
|
||||
VALUES(?) """
|
||||
self.data.execute(query, (ID,))
|
||||
self.db.commit()
|
||||
|
||||
def updateLedger(self, data, newData):
|
||||
def update(self, data, newData):
|
||||
query = """ UPDATE ledger
|
||||
SET MONEY = ?,
|
||||
WINS = ?,
|
||||
@@ -33,19 +33,7 @@ class Ledger():
|
||||
self.data.execute(query, data)
|
||||
|
||||
def main():
|
||||
ledger = Ledger()
|
||||
ledger.writeLedger(10121)
|
||||
ID = 10121
|
||||
data = ledger.readLedger(ID)
|
||||
|
||||
ID = 2
|
||||
playerStats = ledger.readLedger(ID)
|
||||
if playerStats is None:
|
||||
print("Not real")
|
||||
ledger.writeLedger(ID)
|
||||
playerStats = ledger.readLedger(ID)
|
||||
|
||||
print(playerStats)
|
||||
pass
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user