|
@@ -61,7 +61,7 @@ def MatchTomlKeys(tomlName, keys, table=None) -> list:
|
|
|
return rl
|
|
|
|
|
|
|
|
|
-# ----- Sqlite -----
|
|
|
+# ----- Sqlite Methods -----
|
|
|
def Exec_one(dbPath, commands):
|
|
|
con = sqlite3.connect(dbPath)
|
|
|
cur = con.cursor()
|
|
@@ -97,7 +97,73 @@ def IsExist(exec_commands, returnBool=True):
|
|
|
|
|
|
|
|
|
class command():
|
|
|
- pass
|
|
|
+ def __init__(self, dbPath, tableName, columnName, newColumnName) -> None:
|
|
|
+ self.dp = dbPath
|
|
|
+
|
|
|
+ self.table = tableName
|
|
|
+ self.name = columnName
|
|
|
+ self.newName = newColumnName
|
|
|
+
|
|
|
+
|
|
|
+ def select(self, aliveOnly=True):
|
|
|
+ if aliveOnly == True:
|
|
|
+ sqls = "SELECT name FROM {table} WHERE name='{name}' AND status='alive';".format(table=self.table, name=self.name)
|
|
|
+ elif aliveOnly == False:
|
|
|
+ sqls = "SELECT name FROM {table} WHERE name='{name}';".format(table=self.table, name=self.name)
|
|
|
+
|
|
|
+ res = Exec_one(self.dp, sqls)
|
|
|
+
|
|
|
+ # 也许需要一个后处理res = [('a'),('b')]这样的格式问题
|
|
|
+ return res
|
|
|
+
|
|
|
+
|
|
|
+ def add(self, values, addObj="board", addType="new"):
|
|
|
+ # insert
|
|
|
+ # add board: insert into Board
|
|
|
+ # add class(className, usingBoard):
|
|
|
+ # add event(className)
|
|
|
+ pass
|
|
|
+
|
|
|
+ def delete(self):
|
|
|
+ sqls = "UPDATE {table} SET status='deleted' WHERE name='{name}';".format(table=self.table, name=self.name)
|
|
|
+ res = Exec_one(self.dp, sqls)
|
|
|
+
|
|
|
+
|
|
|
+ def edit(self):
|
|
|
+ # edit boardName
|
|
|
+
|
|
|
+ # edit className
|
|
|
+
|
|
|
+ # edit eventName
|
|
|
+
|
|
|
+ # edit event dscrp
|
|
|
+
|
|
|
+ # edit event blabla
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+ def move(self, moveObj):
|
|
|
+ if moveObj == "KB":
|
|
|
+ pass
|
|
|
+
|
|
|
+ elif moveObj == "CL":
|
|
|
+ pass
|
|
|
+
|
|
|
+ elif moveObj == "EV":
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+ def backPrevious(self):
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+ def backHome(self):
|
|
|
+ sqls = "SELECT name FROM sqlite_master WHERE type='table' AND name is NOT 'sqlite_sequence';"
|
|
|
+ Exec_one(dbPath, sqls)
|
|
|
+
|
|
|
+
|
|
|
+ def back(self, ):
|
|
|
+ pass
|
|
|
|
|
|
class objBoard():
|
|
|
pass
|
|
@@ -106,4 +172,12 @@ class objClass():
|
|
|
pass
|
|
|
|
|
|
class objEvent():
|
|
|
- pass
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def Handler():
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+if __name__ == "__main__":
|
|
|
+ dbPath = "dev.db"
|