英文:
How to copy SQL in Java and paste it in Dbeaver
问题
DBeaver是一个访问数据库的优秀工具。但在版本23(我的电脑上是23.1.1),出现了一些问题。
在升级之前,我使用的是版本20到21。有一个令人钦佩的功能,可以通过一些字符串处理函数在Java代码中复制SQL,但当粘贴到DBeaver时,它会变成纯SQL。
例如:
StringBuilder sb = new StringBuilder();
sb.append(" select * from myTable ");
sb.append(" where name is null or lastName = 'Jake' ");
您可以从第一个引号复制到最后一个引号,包括sb.append()
它将是:
select * from myTable
where name is null or lastName = 'Jake'
在最新版本中是否有实现这个功能的方法?
我希望这个功能没有被故意移除,当编写大型SQL时,它真的很有帮助。
英文:
Dbeaver is a great tool for accessing database. But in ver.23 (23.1.1 in my PC), something goes wrong.
Before upgrading it, I'm using ver.20~21. There's a admirable function makes you be able to copy SQL in java code with some String processing function, but when it be paste to DBeaver, it'll be pure SQL.
As an example :
StringBuilder sb = new StringBuilder();
sb.append(" select * from myTable ");
sb.append(" where name is null or lastName = 'Jake' ");
You can copy from the first quote to the last one, including "sb.append()"
" select * from myTable ");
sb.append(" where name is null or lastName = 'Jake' "
And it will be :
select * from myTable
where name is null or lastName = 'Jake'
Is there any way to achieve this in the latest version?
I hope this function isn't removed by purpose, it really hepls when writing huge sql.
答案1
得分: 1
去到 Window -> Preferences -> Editors -> SQL Editor -> Code Editor
勾选选项 '从源代码提取 SQL'
链接:https://github.com/dbeaver/dbeaver/issues/240#issuecomment-198987695
英文:
Had the same problem, this helped me.
Go to Window -> Preferences -> Editors -> SQL Editor -> Code Editor
Check the option 'Extract SQL from Source'
https://github.com/dbeaver/dbeaver/issues/240#issuecomment-198987695
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论