fix: use single quotes in SQL query to support ANSI_QUOTES mode#92
Open
prathamesh04 wants to merge 1 commit into
Open
fix: use single quotes in SQL query to support ANSI_QUOTES mode#92prathamesh04 wants to merge 1 commit into
prathamesh04 wants to merge 1 commit into
Conversation
The SQL query in HeatWaveCheckTask.on_connected() used double quotes for string literals, which causes Error 1054 when ANSI_QUOTES is enabled in sql_mode. Changed to single quotes which work in all sql_mode settings. Also fixed a secondary TypeError in DbSession.terminate_thread() where _message_callback was called with 2 arguments but on_session_message expects 3 positional arguments. Added None as the result parameter. Closes mysql#88
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes two bugs in the MySQL Shell for VS Code plugin that cause connection failures when
ANSI_QUOTESis enabled insql_mode.Bug 1: SQL Query Uses Double Quotes (Error 1054)
In
DbMySQLSessionSetupTasks.py, theHeatWaveCheckTask.on_connected()method executes a SQL query to check if thesys.EXPLAIN_ERRORprocedure is available. The query uses double quotes for string literals:When
ANSI_QUOTESis enabled insql_mode, MySQL interprets double-quoted values as identifiers (column names) rather than string literals, causingError 1054: Unknown column 'sys' in 'where clause'.Fix: Changed double quotes to single quotes:
Bug 2: TypeError in Error Handling
When the above error occurs,
DbSession.terminate_thread()callsself._message_callback("ERROR", self.thread_error). However,DbModuleSession.on_session_message()expects 3 positional arguments:The
resultargument is not passed, causing:Fix: Added
Noneas the result parameter:Related Issue
Closes #88
Changes
gui/backend/gui_plugin/core/dbms/DbMySQLSessionSetupTasks.py: Changed double quotes to single quotes in SQL querygui/backend/gui_plugin/core/dbms/DbSession.py: Added missingresultparameter in terminate_thread()