dev.toml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. # ----- App Configuration -----
  2. [app_config]
  3. StrictMode = true
  4. DBType = "sqlite3"
  5. DBPath = "dev.db"
  6. Lang = "en"
  7. ListStyle = "tree"
  8. DisplayTimeZone = "utc+8"
  9. Start_as_LLM_server = false
  10. # ----- DB Configuration -----
  11. # Just a better reference for dev.db, no functional use(yet)
  12. # ↓ DB name("dev".db)
  13. # ↓ Table name
  14. [dev.compact_main]
  15. c1_pk = "id INTEGER PRIMARY KEY ASC"
  16. c2 = "type"
  17. c3 = "name"
  18. c4 = "dscrp"
  19. # .style = {position : [(x1,y1), (x2, y2), z], bgcolor, radius, border, }
  20. c5 = "creator"
  21. c6 = "createdTime"
  22. c7 = "relatedBoard"
  23. c8 = "relatedClass"
  24. c9 = "state"
  25. createSqls = '''
  26. CREATE TABLE "compact_main" (
  27. "id" INTEGER NOT NULL,
  28. "type" INTEGER NOT NULL,
  29. "name" TEXT NOT NULL,
  30. "dscrp" TEXT NOT NULL,
  31. "creator" TEXT NOT NULL,
  32. "createdTime" TEXT NOT NULL,
  33. "relatedBoard" TEXT NOT NULL,
  34. "relatedClass" TEXT NOT NULL,
  35. "state" INTEGER NOT NULL,
  36. PRIMARY KEY("id" AUTOINCREMENT)
  37. );
  38. '''
  39. [dev.log_action]
  40. c1_pk = "id INTEGER PRIMARY KEY ASC"
  41. c2 = "uid" # UNIQUE
  42. c3 = "commitTime"
  43. c4 = "type"
  44. c5 = "commitedAction"
  45. c6 = "operator"
  46. c7 = "status"
  47. createSqls = '''
  48. CREATE TABLE "log_action" (
  49. "id" INTEGER NOT NULL,
  50. "uid" TEXT NOT NULL,
  51. "commitTime" TEXT NOT NULL,
  52. "type" TEXT NOT NULL,
  53. "action" TEXT NOT NULL,
  54. "operator" TEXT NOT NULL,
  55. "status" TEXT NOT NULL,
  56. PRIMARY KEY("id" AUTOINCREMENT)
  57. );
  58. '''
  59. # ----- Some Notes -----
  60. [notes]
  61. compact_main.type = '''
  62. 0 = Board
  63. 1 = Class
  64. 2 = Event
  65. '''
  66. compact_main.state = '''
  67. -10 = deleted
  68. 10 = alive
  69. '''
  70. log_action.status = '''
  71. '''
  72. # ----- used sqls -----
  73. # Set integer prime key: <columnName> INTEGER PRIMARY KEY ASC
  74. # INSERT INTO compact_main VALUES(null, 'class', 'CL1', 'dscrp', 'n.HE', datetime('now'), 'KB1, KB2', '', 'alive');
  75. # SELECT name FROM compact_main WHERE belongBoard like '%KB1%'
  76. # SELECT name, dscrp FROM compact_main WHERE dscrp like '%KB1%'
  77. # SELECT name, dscrp FROM compact_main WHERE dscrp like '%_%KB1%'
  78. # INSERT INTO compact_main VALUES(null, 'class', 'CL2', '_usingBoard:KB1, KB2', 'n.HE', datetime('now'), '', '', 'alive');
  79. # UPDATE main SET relatedBoard='KB1, KB2' WHERE type='class' AND name='CL2'
  80. # SELECT name FROM main WHERE type='class' AND relatedBoard like '%KB2%'
  81. # delete class 3 combo:
  82. # UPDATE compact_main SET relatedBoard = replace(relatedBoard, 'KB2, ', '') WHERE type='class' AND relatedBoard like '%KB2, %';
  83. # UPDATE compact_main SET relatedBoard = replace(relatedBoard, ', KB2', '') WHERE type='class' AND relatedBoard like '%, KB2%';
  84. # UPDATE compact_main SET relatedBoard = replace(relatedBoard, 'KB2', '') WHERE type='class' AND relatedBoard like '%KB2%';
  85. a ='''
  86. sqls = str(func)
  87. con = sqlite3.connect(dbPath)
  88. cur = con.cursor()
  89. cur.execute(sqls)
  90. con.commit()
  91. res = cur.fetchall()
  92. if fetchAll == True:
  93. return res
  94. con.close()
  95. '''