SAP-archive / sap-hana-driver-for-sqltools

A Visual Studio Code extension which extends the SQLTools extension, with a driver to work with the SAP HANA Database. It supports tables and views, as well as running queries on an SAP HANA Database.
Apache License 2.0
20 stars 11 forks source link

Unable to execute multiline sql #201

Closed raymondyao closed 2 years ago

raymondyao commented 2 years ago

When I run query like drop table TEST; create table TEST(A int); insert int TEST select 1 from dummy; select * from TEST;

It gives the message Query with errors. sql syntax error: incorrect syntax near "create": line 2 col 1 (at pos 19)

Same for the Anonymous Block execution.

I think the sql parser cannot handle multiple statements.

dirkseidel commented 2 years ago

Is there any chance this will be fixed soon? The need to execute all the statements one by one makes the whole driver kind of unusable. Everything else seems to work fine for me.

ariel-bentu commented 2 years ago

I strongly believe this is indeed a HANA driver for node.js limitation and not the VSCode SQL Tools's HANA Driver's issue (the latter uses the former). I suggest to open an issue in the HANA Driver's project: https://github.com/SAP/node-hdb/issues

dirkseidel commented 2 years ago

Either HANA driver for node.js or VSCode SQL Tools's HANA Driver has to do the parsing for multiple statements. Wouldn't it be more natural to do the parsing in this extension and execute one statement at the time via HANA driver for node.js? Like this SQL Tools could easily open multiple tabs for the different results.

dirkseidel commented 2 years ago

According do an issue opened for node-hdb: https://github.com/SAP/node-hdb/issues/62 the problem should actually be solved within this extention.

Any chance this will be done soon?

ariel-bentu commented 2 years ago

Hi, the issue you linked refer to HANA Studio. This is the good old eclipse based HANA tools. not VS code. Sorry… Closing the issue as I am not planning to implement it in the driver, and no control of the sql tools extension itself.

dirkseidel commented 2 years ago

I just noticed that I didn't state it clearly what is said in the referred issue. Of course they did not say that it should be implemented in sap-hana-driver-for-sqltools. What is said is: "Using semi-colons to run multiple queries is not actually part of HANA's syntax (or most databases out there)". This seems to be the reason they will not implement it in node-hdb and it should be implemented in the higher-level application which is then e.g. HANA studio. So if you say you won't implement it, where does the implementation belong then?

We in our group would like to use the feature within VS Code. But the current implementation is completely useless in the current form without the ability to execute multiple statements.

iggycoder commented 2 years ago

I do like the extension as well and supporting multiline sql would be even better. What prevents the plugin to do the parsing itself? Does the SQLTools extension prevent multiline in its implementation?