nandHyf 11 bulan lalu
induk
melakukan
09872806d4
2 mengubah file dengan 13 tambahan dan 7 penghapusan
  1. 2 0
      kbc.py
  2. 11 7
      kbc_sqlite.py

+ 2 - 0
kbc.py

@@ -57,6 +57,8 @@ class kbc_controller():
         kbc_sqlite.oc['dt'] = app_config['DBType']
         kbc_sqlite.oc['dp'] = app_config['DBPath']
 
+        # if start_as_llmserver == True:
+        
         kbc_sqlite.oc['cp'] = ['home']
 
 

+ 11 - 7
kbc_sqlite.py

@@ -104,16 +104,20 @@ def exec(dbPath:str="", sqls:str=""):
 
 def exec_fetchall(dbPath:str="", sqls:str="", fetchAll:bool=True):
     if dbPath != "" and sqls != "":
-        con = sqlite3.connect(dbPath)
-        cur = con.cursor()
+        try:
+            con = sqlite3.connect(dbPath)
+            cur = con.cursor()
 
-        cur.execute(sqls)
-        con.commit()
+            cur.execute(sqls)
+            con.commit()
 
-        if fetchAll == True:
-            return cur.fetchall()
+            if fetchAll == True:
+                return cur.fetchall()
 
-        con.close()
+            con.close()
+
+        except sqlite3.OperationalError:
+            print(sqlite3.OperationalError.__name__)
 
 
 def recordExist(dbPath:str, tableName:str, capitalize:bool=False, itemName:str="", returnBool:bool=True):