question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve "sql to java code" feature

See original GitHub issue

Hi there, When we use copy sql as java code feature in “Choose Format” panel, Java code results something like this:

"select\n" + 
"*\n" + 
"from\n" + 
"table;\n";

May we improve this feature with StringBuilder instead of using “+”?

query.append("select");
query.append("*");
query.append("from");
query.append("table;")

Or may we add customization options in this panel?

plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/convert/impl/JavaSQLConverter.java

for (int i = 0; i < sourceLines.length; i++) {
            String line = sourceLines[i];
            result.append('"').append(CommonUtils.escapeJavaString(line)).append(lineDelimiter).append('"');
            if (i < sourceLines.length - 1) {
                result.append(" + \n");
            } else {
                result.append(";");
            }
        }
 

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
loro2commented, Aug 1, 2019

Hi there, I’m looking forward to contribute some code to this project, and this issue one seems like an ideal starting point. I’d be happy to take it.

1reaction
serge-ridercommented, Jul 30, 2019

This can be improved by adding extra config options (in additions to existing two options). E.g. “Use StringBuilder”.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SQL Features and Tuning - jOOQ blog
SQL Features and Tuning · Top SQL Posts · SQL syntax explained · Window functions · JOIN · LATERAL · Arrays, XML, JSON...
Read more >
10 Ways to Improve SQL Query Performance - Developer.com
Try to remove cursors from the query and use set-based query; set-based query is more efficient than cursor-based. If there is a need...
Read more >
Java Database Performance Tuning - eG Innovations
Learn best practices and tips to tune Java database accesses to enhance the performance of your Java applications.
Read more >
11 Tuning PL/SQL Applications for Performance
This chapter shows you how to write efficient PL/SQL code, and speed up ... Some PL/SQL features also help improve the performance of...
Read more >
Top 10 SQL Query Optimization Tips to Improve Database ...
Here are the 10 most effective ways to optimize your SQL queries. ... Coding SQL queries in loops slows down the entire sequence....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found