Extend objects browsing and add feature to get definitions#1541
Extend objects browsing and add feature to get definitions#1541
Conversation
|
Thanks for your PR. I have started looking at it. It seems to have broken the existing "Generate Insert Query" feature. For example, on the COMPANY test table and using the MySQL driver this now generates the following: INSERT INTO COMPANY (COLUMNS, INDEXES, Triggers)
VALUES (
'Columns:undefined',
'Indexes:undefined',
'Triggers:undefined'
);Previously it generated this: INSERT INTO COMPANY (ID, NAME, AGE, ADDRESS, SALARY)
VALUES (
ID:int,
'NAME:text',
AGE:int,
'ADDRESS:char',
'SALARY:double'
); |
|
@gjsjohnmurray thanks for review. I have fixed it. |
2099fa7 to
12d376b
Compare
|
Thanks for fixing this. My next observation is that when I expand the Indexes node of a MySQL table that has no indexes I get this error notification: Request connection/GetChildrenForTreeItemRequest failed with message: Expression #1 of ORDER BY clause is not in SELECT list, references column 'information_schema.ix.INDEX_NAME' which is not in SELECT list; this is incompatible with DISTINCT |
|
That's very strange. I just tested this for MySQL 5.7, 8.0 and 9.5, but no such notification appeared. Can you describe this case in more detail? |
|
I'm testing with the test-vscode-sqltools.code-workspace that's in the test folder of the codebase. Some doc about using it is at https://vscode-sqltools.mteixeira.dev/en/contributing/testing After opening the workspace I use the From the SQLTools view I activate that connection. Then I use the script starting at line 5 of test/docker/mysql/1.create-some-stuff.sql to create two tables: DROP TABLE IF EXISTS DEPARTMENT;
DROP TABLE IF EXISTS COMPANY;
CREATE TABLE COMPANY(
ID INT PRIMARY KEY NOT NULL,
NAME TEXT NOT NULL,
AGE INT NOT NULL,
ADDRESS CHAR(50),
SALARY REAL
);
CREATE TABLE DEPARTMENT(
ID INT PRIMARY KEY NOT NULL,
DEPT CHAR(50) NOT NULL,
EMP_ID INT NOT NULL,
COMPANY_ID INT NOT NULL,
FOREIGN KEY (COMPANY_ID) REFERENCES COMPANY(ID)
);When I expand the Indexes subfolder of either table I get the error. Running |
For compatibility with ONLY_FULL_GROUP_BY sql mode
|
It seems to be a feature of the default settings for MySQL versions 8.0.30 to 8.0.33. Since 8.0.34 everything is ok. I made a simple fix. |
|
Thanks for fixing this. Please bump the maintenance part of the version number of the 4 drivers you have changed, and also append a Please also update docs/src/pages/en/contributing/support-new-drivers.mdx with information to help driver authors leverage the new capabilities. |
Just noticed that packages/drivers.sqlite/package.json is already at a -SNAPSHOT version so it's only the other 3 drivers you need to make the change in. |
@sqltools/driver.mssql to 0.4.11-SNAPSHOT @sqltools/driver.mysql to 0.6.7-SNAPSHOT @sqltools/driver.pg to 0.5.8-SNAPSHOT
|
done |
This PR solves at least three opened issues (#728, #875, #1390).
It changes connection tree and provides functionality for browsing procedures, functions, indexes and triggers.
It also adds a control for obtaining DDL scripts for all of these objects, as well as for tables and views.
Third-party driver developers can add this functionality by implementing the appropriate basic methods.