v1.8.53: fix Redis and MariaDB GUI tabs — wrong client API calls
- redis_tab: fix RedisClient constructor (pass server dict, not alias+store) - redis_tab: add connect() call, add disconnect on server switch - redis_tab: remove non-existent db= parameter from execute(), use select_db() - redis_client: add select_db() method for runtime DB switching - query_tab: fix use_database() → switch_database(), close() → disconnect() - query_tab: fix execute() → execute_query() with dict unpacking - query_tab: add missing connect() call after SQLClient creation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -105,6 +105,11 @@ class RedisTab(ctk.CTkFrame):
|
||||
|
||||
def set_server(self, alias: str | None):
|
||||
"""Called when user selects a server in sidebar."""
|
||||
if self._client:
|
||||
try:
|
||||
self._client.disconnect()
|
||||
except Exception:
|
||||
pass
|
||||
self._current_alias = alias
|
||||
self._client = None
|
||||
self._command_history.clear()
|
||||
@@ -143,7 +148,8 @@ class RedisTab(ctk.CTkFrame):
|
||||
def _do():
|
||||
try:
|
||||
client = self._get_client()
|
||||
result = client.execute(cmd, db=db)
|
||||
client.select_db(db)
|
||||
result = client.execute(cmd)
|
||||
formatted = self._format_result(result)
|
||||
self.after(0, lambda: self._append_output(formatted))
|
||||
except Exception as e:
|
||||
@@ -162,7 +168,13 @@ class RedisTab(ctk.CTkFrame):
|
||||
|
||||
def _get_client(self) -> RedisClient:
|
||||
if self._client is None:
|
||||
self._client = RedisClient(self._current_alias, self.store)
|
||||
server = self.store.get_server(self._current_alias)
|
||||
if not server:
|
||||
raise ConnectionError(f"Server '{self._current_alias}' not found")
|
||||
self._client = RedisClient(server)
|
||||
if not self._client.connect():
|
||||
self._client = None
|
||||
raise ConnectionError(f"Cannot connect to Redis '{self._current_alias}'")
|
||||
return self._client
|
||||
|
||||
# ── Stats refresh ──
|
||||
@@ -175,8 +187,9 @@ class RedisTab(ctk.CTkFrame):
|
||||
try:
|
||||
client = self._get_client()
|
||||
db = int(self._db_var.get())
|
||||
keys_count = client.execute("DBSIZE", db=db)
|
||||
info = client.execute("INFO memory", db=db)
|
||||
client.select_db(db)
|
||||
keys_count = client.execute("DBSIZE")
|
||||
info = client.execute("INFO memory")
|
||||
|
||||
# Parse memory from INFO output
|
||||
memory = "—"
|
||||
|
||||
Reference in New Issue
Block a user