-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
disabled promo popup showing at start by default (i forgot)
- Loading branch information
1 parent
6f95534
commit da9ae05
Showing
3 changed files
with
64 additions
and
2 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,62 @@ | ||
import json | ||
import sqlite3 | ||
|
||
|
||
class ClubManager(): | ||
def __init__(self): | ||
self.conn = sqlite3.connect("Database/club.sqlite") | ||
self.cursor = self.conn.cursor() | ||
try: | ||
self.cursor.execute("""CREATE TABLE main (LowID integer, Data json)""") | ||
except: | ||
pass | ||
|
||
def createClub(self, lowID, data): | ||
try: | ||
self.cursor.execute("INSERT INTO main (LowID, Data) VALUES (?, ?)", | ||
(lowID, json.dumps(data, ensure_ascii=0))) | ||
self.conn.commit() | ||
except Exception as e: | ||
print(e) | ||
|
||
def deleteClub(self, lowID): | ||
try: | ||
self.cursor.execute("DELETE FROM main where LowID=?", (lowID,)) | ||
self.conn.commit() | ||
except Exception as e: | ||
print(e) | ||
|
||
|
||
def GetAllDb(self): | ||
self.playersId = [] | ||
try: | ||
self.cursor.execute("SELECT * from main") | ||
self.db = self.cursor.fetchall() | ||
for i in range(len(self.db)): | ||
self.playersId.append(self.db[i][0]) | ||
return self.playersId | ||
except Exception as e: | ||
print(e) | ||
|
||
def getClubWithLowID(self, low): | ||
try: | ||
self.cursor.execute("SELECT * from main where LowID=?", (low,)) | ||
return self.cursor.fetchall() | ||
except Exception as e: | ||
print(e) | ||
|
||
def LoadAccount(self, low, player): | ||
try: | ||
self.player = player | ||
self.cursor.execute("SELECT * from main where LowID=?", (low,)) | ||
self.players = self.cursor.fetchall() | ||
self.players = json.loads(self.players[0][2]) | ||
except Exception as e: | ||
print(e) | ||
|
||
def update_player_data(self, data, lowID): | ||
try: | ||
self.cursor.execute("UPDATE main SET Data=? WHERE LowID=?", (json.dumps(data, ensure_ascii=0), lowID)) | ||
self.conn.commit() | ||
except Exception as e: | ||
print(e) |
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
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