Skip to content

Commit

Permalink
[TOOLS-4325] [CM] When a user uses SQL Code Autocompletion function, …
Browse files Browse the repository at this point in the history
…CM flag needs to be appended to Connection string (#160)
  • Loading branch information
win777c authored Nov 20, 2019
1 parent 3bdd3da commit 23d27ea
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import com.cubrid.common.ui.query.control.jface.text.contentassist.IContextInformation;
import com.cubrid.common.ui.query.control.jface.text.contentassist.IContextInformationValidator;
import com.cubrid.common.ui.spi.persist.RecentlyUsedSQLContentPersistUtils;
import com.cubrid.cubridmanager.core.CubridManagerCorePlugin;
import com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo;

/**
Expand Down Expand Up @@ -81,6 +82,7 @@ public boolean isRunning() {

public void setRunning(boolean running) {
this.running = running;
CubridManagerCorePlugin.getDefault().setSQLCodeAutocompletionMode(running);
}

public boolean isTableLowercase() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,13 @@ public class CubridManagerCorePlugin extends
// The plug-in ID
public static final String PLUGIN_ID = "com.cubrid.cubridmanager.core";

public static final String CM_SQL_CODE_AUTOCOMPLETION = "cmSqlCodeAutocompletion";

// The shared instance
private static CubridManagerCorePlugin plugin;

private boolean isSQLCodeAutocompletionMode = false;

/**
* @param context BundleContext
* @throws Exception exception
Expand Down Expand Up @@ -73,4 +77,19 @@ public static CubridManagerCorePlugin getDefault() {
return plugin;
}

/**
* setSQLCodeAutocompletionMode
* @param flag
*/
public void setSQLCodeAutocompletionMode(boolean flag) {
this.isSQLCodeAutocompletionMode = flag;
}

/**
* isSQLCodeAutocompletionMode
* @return
*/
public boolean isSQLCodeAutocompletionMode() {
return isSQLCodeAutocompletionMode;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

import com.cubrid.common.core.util.LogUtil;
import com.cubrid.common.core.util.QueryUtil;
import com.cubrid.cubridmanager.core.CubridManagerCorePlugin;
import com.cubrid.cubridmanager.core.common.loader.CubridClassLoaderPool;
import com.cubrid.cubridmanager.core.common.model.ServerInfo;
import com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo;
Expand Down Expand Up @@ -133,6 +134,15 @@ public static Connection getConnection(String brokerIP, String brokerPort,
hasCharset = true;
}

// check SQL Code autocompletion mode
if (CubridManagerCorePlugin.getDefault().isSQLCodeAutocompletionMode()) {
url = new StringBuffer(url)
.append("?")
.append(CubridManagerCorePlugin.CM_SQL_CODE_AUTOCOMPLETION)
.append("=")
.append(String.valueOf(Boolean.TRUE)).toString();
}

// advanced jdbc settings
Properties tmpProps = parseJdbcOptions(jdbcAttrs, hasCharset);
for (Enumeration<Object> e = tmpProps.keys(); e.hasMoreElements();) {
Expand Down

0 comments on commit 23d27ea

Please sign in to comment.