t.py 805 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import Stateful
  2. def MatchTomlTable(tomlName, tableName, returnType="list"):
  3. d = Stateful.GetTomlDoc(tomlName).unwrap()
  4. if returnType == "list":
  5. return list(d.get(tableName).values())
  6. elif returnType == "dict":
  7. return d
  8. # [todo 4] rebuild
  9. def add(cp, addType, contents):
  10. if addType == "board":
  11. sqls = "INSERT INTO Board VALUES(null, '{name}', 'alive');".format(name=self.name)
  12. elif addType == "class":
  13. sqls = "INSERT INTO Class VALUES(null, '{name}', )"
  14. elif addType == "event":
  15. pass
  16. sqls = ""
  17. Stateful.Exec_one(dp, sqls)
  18. if __name__ == "__main__":
  19. tomlName = "dev_config.toml"
  20. dp = "dev.db"
  21. # res = MatchTomlTable(tomlName, "Board")
  22. contents = []
  23. cp = ""
  24. res = add(cp, "class", )