mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-03-30 23:03:03 -07:00
Update config.json files to add 'ordeable' option and refactor cacheStrings function for consistency
This commit is contained in:
@@ -817,7 +817,7 @@ def migrate_to_camelcase(sql) -> bool:
|
||||
|
||||
for table, column_map in _CAMELCASE_COLUMN_MAP.items():
|
||||
# Check table exists
|
||||
sql.execute(f"SELECT name FROM sqlite_master WHERE type='table' AND name=?", (table,))
|
||||
sql.execute("SELECT name FROM sqlite_master WHERE type='table' AND name=?", (table,))
|
||||
if not sql.fetchone():
|
||||
mylog("verbose", [f"[db_upgrade] Table '{table}' does not exist — skipping"])
|
||||
continue
|
||||
|
||||
@@ -865,6 +865,10 @@ _column_replacements = {
|
||||
# Session columns
|
||||
r"\bses_MAC\b": "sesMac",
|
||||
r"\bses_IP\b": "sesIp",
|
||||
r"\bses_DateTimeConnection\b": "sesDateTimeConnection",
|
||||
r"\bses_DateTimeDisconnection\b": "sesDateTimeDisconnection",
|
||||
r"\bses_EventTypeConnection\b": "sesEventTypeConnection",
|
||||
r"\bses_EventTypeDisconnection\b": "sesEventTypeDisconnection",
|
||||
r"\bses_StillConnected\b": "sesStillConnected",
|
||||
r"\bses_AdditionalInfo\b": "sesAdditionalInfo",
|
||||
# Plugin columns (templates + WATCH values)
|
||||
|
||||
@@ -23,10 +23,10 @@ class NameResolver:
|
||||
nameNotFound = ResolvedName()
|
||||
|
||||
# Check by MAC
|
||||
sql.execute(f"""
|
||||
sql.execute("""
|
||||
SELECT watchedValue2 FROM Plugins_Objects
|
||||
WHERE plugin = '{plugin}' AND objectPrimaryId = '{pMAC}'
|
||||
""")
|
||||
WHERE plugin = ? AND objectPrimaryId = ?
|
||||
""", (plugin, pMAC))
|
||||
result = sql.fetchall()
|
||||
# self.db.commitDB() # Issue #1251: Optimize name resolution lookup
|
||||
if result:
|
||||
@@ -36,10 +36,10 @@ class NameResolver:
|
||||
# Check name by IP if enabled
|
||||
if get_setting_value('NEWDEV_IP_MATCH_NAME'):
|
||||
|
||||
sql.execute(f"""
|
||||
sql.execute("""
|
||||
SELECT watchedValue2 FROM Plugins_Objects
|
||||
WHERE plugin = '{plugin}' AND objectSecondaryId = '{pIP}'
|
||||
""")
|
||||
WHERE plugin = ? AND objectSecondaryId = ?
|
||||
""", (plugin, pIP))
|
||||
result = sql.fetchall()
|
||||
# self.db.commitDB() # Issue #1251: Optimize name resolution lookup
|
||||
if result:
|
||||
|
||||
Reference in New Issue
Block a user