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

SQLLINE-239: Add extra confirmation step for destructive commands like e Drop/Delete to avoid accidental executions. #263

Closed
wants to merge 1 commit into from

Conversation

swaroopak
Copy link

@swaroopak swaroopak commented Jan 16, 2019

Please discard the previous PR(#249) . Something got messed up and I could not see the changes as expected.

Copy link
Collaborator

@snuyanzin snuyanzin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general it looks ok, however I mentioned some issues which I think are better to be fixed.
+ Could you please fix indentations according to style in files you have updated

src/main/java/sqlline/BuiltInProperty.java Outdated Show resolved Hide resolved
src/main/java/sqlline/SqlLineOpts.java Outdated Show resolved Hide resolved
src/main/java/sqlline/SqlLineOpts.java Show resolved Hide resolved
src/main/resources/sqlline/SqlLine.properties Outdated Show resolved Hide resolved
src/test/java/sqlline/SqlLineArgsTest.java Outdated Show resolved Hide resolved
src/test/java/sqlline/SqlLineArgsTest.java Show resolved Hide resolved
src/test/java/sqlline/SqlLineArgsTest.java Outdated Show resolved Hide resolved
src/test/java/sqlline/SqlLineArgsTest.java Outdated Show resolved Hide resolved
src/test/java/sqlline/SqlLineArgsTest.java Outdated Show resolved Hide resolved
@swaroopak
Copy link
Author

@snuyanzin @julianhyde I have tried fixing all the comments. Feel free to be specific in case I am missing something.

Copy link

@dbwong dbwong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Teammate of Swaroopa here. Took a brief look at this, not too familiar with the code base but a few questions/comments.

src/main/resources/sqlline/SqlLine.properties Outdated Show resolved Hide resolved
src/main/resources/sqlline/manual.txt Show resolved Hide resolved
src/main/resources/sqlline/manual.txt Outdated Show resolved Hide resolved
src/main/resources/sqlline/SqlLine.properties Outdated Show resolved Hide resolved
src/test/java/sqlline/SqlLineArgsTest.java Outdated Show resolved Hide resolved
if (Pattern.compile(pattern).matcher(sql).find()
&& sqlLine.getOpts().getConfirm()) {
String question = sqlLine.loc("really-perform-action");
final int userResponse = getUserAnswer(question, 'y', 'n');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential answers can be 'Y' and 'N' (uppercase only)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not clear why uppercase only, for instance in Linux there could be lowercase answers for similar questions.
May be it makes sense to specify both upper and lowercase

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing specific, its just that it introduces a small delay since we need to put a thought for upper case letters. Its a good to have thing, I am fine with either.

@karanmehta93
Copy link

Can we configure it using command line?
How can we set this property grammatically when SqlLine is launched?

@snuyanzin
Copy link
Collaborator

snuyanzin commented Feb 1, 2019

Yes it is possible for any property like --propertyName=propertyValue
e.g. (Windows)

bin\sqlline --fastConnect=true --verbose=true --isolation=TRANSACTION_READ_COMMITTED

or it also could be specified inside %USER_HOME%\sqlline\sqlline.properties (the similar in Linux) which is read while start. However properties from command line have higher priority.

@swaroopak
Copy link
Author

Thank you @dbwong @karanmehta93 @snuyanzin @julianhyde for reviewing my PR. Per me, I have fixed the comments.

@swaroopak
Copy link
Author

@julianhyde @snuyanzin @jongyeol @arina-ielchiieva Can one of you please merge this? Thanks.

@snuyanzin
Copy link
Collaborator

@swaroopak thank you for your corrections. Now it looks much better.
Unfortunately I'm out of time for the nearest 1-2 months to have closer look.
The thing which could be improved is usage of the same style of indentations in files with tests.

@swaroopak
Copy link
Author

swaroopak commented Feb 15, 2019

@snuyanzin Thanks for your reply. I fail to see what you mentioned as indentations in SqlLineArgsTest.java. I opened the file with vim, sublime and IntelliJ. It opens properly indented. Please help me understand.

@snuyanzin
Copy link
Collaborator

@swaroopak sorry for the delay.
I mean lines 2257, 2266-2270, 2272-2273, 2277-2278, 2291, 2294, 2299, 2313, 2314 where there are 4 more spaces than in most other places in the file like

…e Drop/Delete to avoid accidental executions.
@swaroopak
Copy link
Author

@snuyanzin Thanks for your detailed review about spaces. Is there a template file that can be included in intellij/eclipse? I have manually fixed those spaces for now, but it would be nice to have that which can save someone from missing such indentations.

@swaroopak
Copy link
Author

@snuyanzin I wonder how changing spaces failed the build? I checked it says some java doc error!?
Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.0.1:javadoc Could you please help me?

@masayuki038
Copy link
Contributor

@swaroopak This problem seems JDK issue.

https://bugs.openjdk.java.net/browse/JDK-8219474
https://issues.apache.org/jira/browse/MJAVADOC-555

I see the same error when mvn clean pakcage sqlline/master on adoptopenjdk/openjdk11.
This workaround works for me.

diff --git a/pom.xml b/pom.xml
index b8ff859..4001e77 100644
--- a/pom.xml
+++ b/pom.xml
@@ -215,6 +215,12 @@
         <configuration>
           <additionalOptions>${maven-javadoc-plugin.additionalOptions}</additionalOptions>
           <show>public</show>
+          <javaApiLinks>
+            <property>
+              <name>api_12</name>
+              <value>https://download.java.net/java/early_access/jdk12/docs/api/</value>
+            </property>
+          </javaApiLinks>
         </configuration>
         <executions>
           <execution>

@masayuki038
Copy link
Contributor

I also confirmed that this change works for me. This one is better.

root@e6c75c575b52:/work/sqlline# git diff
diff --git a/pom.xml b/pom.xml
index b8ff859..5992824 100644
--- a/pom.xml
+++ b/pom.xml
@@ -215,6 +215,7 @@
         <configuration>
           <additionalOptions>${maven-javadoc-plugin.additionalOptions}</additionalOptions>
           <show>public</show>
+          <source>${maven.compiler.source}</source>
         </configuration>
         <executions>
           <execution>

@julianhyde
Copy link
Owner

Merged as c83414f, fixes #239.

@julianhyde julianhyde closed this Mar 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants