Merge pull request #145 from KoenigMjr/bugfix/mysql

(bugfix/mysql): Change: Remove whitespace and check for empty strings
This commit is contained in:
Bastian Schroll 2025-11-26 08:10:32 +01:00 committed by GitHub
commit 71fc7c52c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -57,8 +57,11 @@ class BoswatchPlugin(PluginBase):
if self.cursor.fetchone() is None:
with open('init_db.sql') as f:
for stmnt in f.read().split(';'):
self.cursor.execute(stmnt)
self.connection.commit()
# Change: Remove whitespace and check for empty strings
clean_stmnt = stmnt.strip()
if clean_stmnt: # only if the string is not empty
self.cursor.execute(clean_stmnt)
self.connection.commit()
self.cursor.close()