Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLITE_MISUSE error only when using "run on active connection" because of comments #1324

Open
Albro3459 opened this issue Apr 19, 2024 · 1 comment
Labels
sqlite SQLite driver triage

Comments

@Albro3459
Copy link

Describe the bug
Simply clicking "run on active connection" with sqltools and sqtools sqllite gives SQLITE_MISUSE error in the SQL console. Also in Output tab for SQL Tools:
[1713520001212] INFO (ext): EXECUTING COMMAND => sqltools.executeQuery
[1713520001212] INFO (ext): EXECUTING COMMAND => sqltools.getConnections
[1713520001213] INFO (ls): REQUEST RECEIVED => connection/GetConnectionsRequest
[1713520001213] INFO (ext): EXECUTING COMMAND => sqltools.getConnections
[1713520001213] INFO (ls): REQUEST RECEIVED => connection/GetConnectionsRequest
[1713520001716] INFO (ext): EXECUTING COMMAND => sqltools.getConnections
[1713520001717] INFO (ls): REQUEST RECEIVED => connection/GetConnectionsRequest
[1713520001719] INFO (ls): REQUEST RECEIVED => connection/RunCommandRequest
[1713520001722] ERROR (ls): {"code":-32001,"data":{"driver":"SQLite","driverOptions":{}},"name":"Error"}
ns: "conn"

To Reproduce
Literally just have comments in your .sql file.
That's it.
When you "run on active connection"
You get SQL Misuse

Expected behavior
Ignore the comments and give the correct output

Screenshots

Comments
image

No Comments
image

Another No comments example
image

###MaxBook Air M3 24 gb ram 1tb disk:

SQLTools Version v0.28.3
SQLite Version v0.5.1
VS Code Version: 1.88.1
OS: Mac Sonoma 14.4.1
Driver:
SQLite v0.5.1
Database version: Sqlite idk what version

@Albro3459
Copy link
Author

From Sqlite's documentation:
link

(21) SQLITE_MISUSE
The SQLITE_MISUSE return code might be returned if the application uses any SQLite interface in a way that is undefined or unsupported. For example, using a prepared statement after that prepared statement has been finalized might result in an SQLITE_MISUSE error.

SQLite tries to detect misuse and report the misuse using this result code. However, there is no guarantee that the detection of misuse will be successful. Misuse detection is probabilistic. Applications should never depend on an SQLITE_MISUSE return value.

If SQLite ever returns SQLITE_MISUSE from any interface, that means that the application is incorrectly coded and needs to be fixed. Do not ship an application that sometimes returns SQLITE_MISUSE from a standard SQLite interface because that application contains potentially serious bugs.

@gjsjohnmurray gjsjohnmurray added the sqlite SQLite driver label Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sqlite SQLite driver triage
Projects
None yet
Development

No branches or pull requests

2 participants