Search in sources :

Example 1 with SqlFormatManager

use of org.cubrid.sqlformatter.SqlFormatManager in project cubrid-manager by CUBRID.

the class SqlFormattingStrategy method format.

/**
	 * Format the SQL content
	 *
	 * @param content String
	 * @return String
	 */
public String format(String content) {
    if (StringUtil.isEmpty(content)) {
        return "";
    }
    ServerInfo serverInfo = databaseProvider == null ? null : databaseProvider.getServerInfo();
    boolean isLowerCase = QueryOptions.getKeywordLowercase(serverInfo);
    SqlFormatOptions options = new SqlFormatOptions();
    options.setUpperCaseKeyword(!isLowerCase);
    SqlFormatManager formattingManager = new SqlFormatManager();
    return formattingManager.format(content, options);
}
Also used : ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) SqlFormatOptions(org.cubrid.sqlformatter.SqlFormatOptions) SqlFormatManager(org.cubrid.sqlformatter.SqlFormatManager)

Aggregations

ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)1 SqlFormatManager (org.cubrid.sqlformatter.SqlFormatManager)1 SqlFormatOptions (org.cubrid.sqlformatter.SqlFormatOptions)1