|
@@ -3,18 +3,22 @@ import sqlite3
|
|
|
|
|
|
# ----- Record_main(DB record as a class) -----
|
|
# ----- Record_main(DB record as a class) -----
|
|
class RM():
|
|
class RM():
|
|
- def __init__(self, type:str="", name:str="", dscrp:str="", creator:str="", relatedBoard:str="", relatedClass:str="", state:int=-10) -> None:
|
|
|
|
|
|
+ def __init__(self, type:str="", name:str="", dscrp:str="", creator:str="", createdTime:str="datetime('now')", relatedBoard:str="", relatedClass:str="", state:int=-10) -> None:
|
|
self.id = "null"
|
|
self.id = "null"
|
|
self.type = type
|
|
self.type = type
|
|
self.name = name
|
|
self.name = name
|
|
self.dscrp = dscrp
|
|
self.dscrp = dscrp
|
|
self.creator = creator
|
|
self.creator = creator
|
|
- self.createdTime = "datetime('now')"
|
|
|
|
|
|
+ self.createdTime = createdTime
|
|
self.relatedBoard = relatedBoard
|
|
self.relatedBoard = relatedBoard
|
|
self.relatedClass = relatedClass
|
|
self.relatedClass = relatedClass
|
|
self.state = state
|
|
self.state = state
|
|
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ def direct():
|
|
|
|
+ pass
|
|
|
|
+
|
|
|
|
+
|
|
def select(self, selectColumn:str="name"):
|
|
def select(self, selectColumn:str="name"):
|
|
return "SELECT {sc} FROM compact_main WHERE type='{s.type}' AND name='{s.name}' AND realatedBoard='{s.relatedBoard}' AND relatedClass='{s.relatedClass}' AND state={s.state};".format(sc=selectColumn, s=self)
|
|
return "SELECT {sc} FROM compact_main WHERE type='{s.type}' AND name='{s.name}' AND realatedBoard='{s.relatedBoard}' AND relatedClass='{s.relatedClass}' AND state={s.state};".format(sc=selectColumn, s=self)
|
|
|
|
|
|
@@ -53,14 +57,20 @@ class RM():
|
|
|
|
|
|
# ----- Record_log_action(DB record as a class) -----
|
|
# ----- Record_log_action(DB record as a class) -----
|
|
class RLA():
|
|
class RLA():
|
|
- pass
|
|
|
|
|
|
+ def __init__(self) -> None:
|
|
|
|
+ pass
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ def direct():
|
|
|
|
+ pass
|
|
|
|
|
|
|
|
|
|
-# ----- Auto generate DB from config.toml -----
|
|
|
|
|
|
+# ----- DB as a class -----
|
|
class DB():
|
|
class DB():
|
|
def __init__(self) -> None:
|
|
def __init__(self) -> None:
|
|
pass
|
|
pass
|
|
|
|
|
|
|
|
+
|
|
def dbExist():
|
|
def dbExist():
|
|
pass
|
|
pass
|
|
|
|
|
|
@@ -89,7 +99,7 @@ oc = {
|
|
# def get_oc(), def move_oc()
|
|
# def get_oc(), def move_oc()
|
|
|
|
|
|
|
|
|
|
-# ----- Sqlite Methods -----
|
|
|
|
|
|
+# ----- Execute Methods -----
|
|
def execute(dbPath):
|
|
def execute(dbPath):
|
|
def dec(origin_func):
|
|
def dec(origin_func):
|
|
pass
|
|
pass
|
|
@@ -126,7 +136,7 @@ def recordExist(dbPath:str, tableName:str, capitalize:bool=False, itemName:str="
|
|
if capitalize == True:
|
|
if capitalize == True:
|
|
tableName = tableName.capitalize()
|
|
tableName = tableName.capitalize()
|
|
|
|
|
|
- sqls = "SELECT name FROM {table} WHERE name='{name}'".format(table=tableName, name=itemName)
|
|
|
|
|
|
+ sqls = "SELECT name FROM {table} WHERE name='{name}';".format(table=tableName, name=itemName)
|
|
ie = exec_one(dbPath, sqls)
|
|
ie = exec_one(dbPath, sqls)
|
|
|
|
|
|
if ie != [] and returnBool == False:
|
|
if ie != [] and returnBool == False:
|
|
@@ -143,5 +153,6 @@ def recordExist(dbPath:str, tableName:str, capitalize:bool=False, itemName:str="
|
|
print("err <Code>: unexpected error in existence check")
|
|
print("err <Code>: unexpected error in existence check")
|
|
|
|
|
|
|
|
|
|
|
|
+# ----- Master process -----
|
|
def master():
|
|
def master():
|
|
pass
|
|
pass
|