Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ Features
* Allow styling prompts with HTML-like tags.


Bug Fixes
---------
* Gracefully fail on background completion-refresh connection issues.


Documentation
---------
* Document the `\g` special command to send a query.
Expand Down
37 changes: 21 additions & 16 deletions mycli/completion_refresher.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import threading
from typing import Callable

import pymysql

from mycli.packages.special.main import COMMANDS
from mycli.packages.sqlresult import SQLResult
from mycli.sqlcompleter import SQLCompleter
Expand Down Expand Up @@ -58,22 +60,25 @@ def _bg_refresh(

# Create a new sqlexecute method to populate the completions.
e = sqlexecute
executor = SQLExecute(
e.dbname,
e.user,
e.password,
e.host,
e.port,
e.socket,
e.character_set,
e.local_infile,
e.ssl,
e.ssh_user,
e.ssh_host,
e.ssh_port,
e.ssh_password,
e.ssh_key_filename,
)
try:
executor = SQLExecute(
e.dbname,
e.user,
e.password,
e.host,
e.port,
e.socket,
e.character_set,
e.local_infile,
e.ssl,
e.ssh_user,
e.ssh_host,
e.ssh_port,
e.ssh_password,
e.ssh_key_filename,
)
except pymysql.err.OperationalError:
return

# If callbacks is a single function then push it into a list.
if callable(callbacks):
Expand Down
Loading