Java Code Examples for org.hibernate.dialect.Dialect#openQuote()
The following examples show how to use
org.hibernate.dialect.Dialect#openQuote() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Table.java From Knowage-Server with GNU Affero General Public License v3.0 | 4 votes |
public String getQuotedSchema(Dialect dialect) { return schemaQuoted ? dialect.openQuote() + schema + dialect.closeQuote() : schema; }
Example 2
Source File: Table.java From cacheonix-core with GNU Lesser General Public License v2.1 | 4 votes |
public String getQuotedSchema(Dialect dialect) { return schemaQuoted ? dialect.openQuote() + schema + dialect.closeQuote() : schema; }
Example 3
Source File: Table.java From cacheonix-core with GNU Lesser General Public License v2.1 | 4 votes |
public String getQuotedName(Dialect dialect) { return quoted ? dialect.openQuote() + name + dialect.closeQuote() : name; }
Example 4
Source File: Table.java From Knowage-Server with GNU Affero General Public License v3.0 | 4 votes |
public String getQuotedCatalog(Dialect dialect) { return catalogQuoted ? dialect.openQuote() + catalog + dialect.closeQuote() : catalog; }
Example 5
Source File: Template.java From cacheonix-core with GNU Lesser General Public License v2.1 | 4 votes |
/** * Takes order by clause provided in the mapping attribute and interpolates the alias. * Handles asc, desc, SQL functions, quoted identifiers. */ public static String renderOrderByStringTemplate(String sqlOrderByString, Dialect dialect, SQLFunctionRegistry functionRegistry) { //TODO: make this a bit nicer String symbols = new StringBuffer() .append("=><!+-*/()',|&`") .append(StringHelper.WHITESPACE) .append( dialect.openQuote() ) .append( dialect.closeQuote() ) .toString(); StringTokenizer tokens = new StringTokenizer(sqlOrderByString, symbols, true); StringBuffer result = new StringBuffer(); boolean quoted = false; boolean quotedIdentifier = false; boolean hasMore = tokens.hasMoreTokens(); String nextToken = hasMore ? tokens.nextToken() : null; while (hasMore) { String token = nextToken; String lcToken = token.toLowerCase(); hasMore = tokens.hasMoreTokens(); nextToken = hasMore ? tokens.nextToken() : null; boolean isQuoteCharacter = false; if ( !quotedIdentifier && "'".equals(token) ) { quoted = !quoted; isQuoteCharacter = true; } if ( !quoted ) { boolean isOpenQuote; if ( "`".equals(token) ) { isOpenQuote = !quotedIdentifier; token = lcToken = isOpenQuote ? new Character( dialect.openQuote() ).toString() : new Character( dialect.closeQuote() ).toString(); quotedIdentifier = isOpenQuote; isQuoteCharacter = true; } else if ( !quotedIdentifier && ( dialect.openQuote()==token.charAt(0) ) ) { isOpenQuote = true; quotedIdentifier = true; isQuoteCharacter = true; } else if ( quotedIdentifier && ( dialect.closeQuote()==token.charAt(0) ) ) { quotedIdentifier = false; isQuoteCharacter = true; isOpenQuote = false; } else { isOpenQuote = false; } if (isOpenQuote) { result.append(TEMPLATE).append('.'); } } boolean quotedOrWhitespace = quoted || quotedIdentifier || isQuoteCharacter || Character.isWhitespace( token.charAt(0) ); if (quotedOrWhitespace) { result.append(token); } else if ( isIdentifier(token, dialect) && !isFunctionOrKeyword(lcToken, nextToken, dialect, functionRegistry) ) { result.append(TEMPLATE) .append('.') .append( dialect.quote(token) ); } else { result.append(token); } } return result.toString(); }
Example 6
Source File: Table.java From Knowage-Server with GNU Affero General Public License v3.0 | 4 votes |
public String getQuotedName(Dialect dialect) { return quoted ? dialect.openQuote() + name + dialect.closeQuote() : name; }
Example 7
Source File: Table.java From Knowage-Server with GNU Affero General Public License v3.0 | 4 votes |
public String getQuotedCatalog(Dialect dialect) { return catalogQuoted ? dialect.openQuote() + catalog + dialect.closeQuote() : catalog; }
Example 8
Source File: Table.java From Knowage-Server with GNU Affero General Public License v3.0 | 4 votes |
public String getQuotedSchema(Dialect dialect) { return schemaQuoted ? dialect.openQuote() + schema + dialect.closeQuote() : schema; }
Example 9
Source File: Table.java From Knowage-Server with GNU Affero General Public License v3.0 | 4 votes |
public String getQuotedName(Dialect dialect) { return quoted ? dialect.openQuote() + name + dialect.closeQuote() : name; }
Example 10
Source File: Table.java From Knowage-Server with GNU Affero General Public License v3.0 | 4 votes |
public String getQuotedCatalog(Dialect dialect) { return catalogQuoted ? dialect.openQuote() + catalog + dialect.closeQuote() : catalog; }
Example 11
Source File: Column.java From lams with GNU General Public License v2.0 | 4 votes |
public String getQuotedName(Dialect d) { return quoted ? d.openQuote() + name + d.closeQuote() : name; }
Example 12
Source File: Table.java From Knowage-Server with GNU Affero General Public License v3.0 | 4 votes |
public String getQuotedName(Dialect dialect) { return quoted ? dialect.openQuote() + name + dialect.closeQuote() : name; }
Example 13
Source File: Table.java From Knowage-Server with GNU Affero General Public License v3.0 | 4 votes |
public String getQuotedCatalog(Dialect dialect) { return catalogQuoted ? dialect.openQuote() + catalog + dialect.closeQuote() : catalog; }
Example 14
Source File: Table.java From Knowage-Server with GNU Affero General Public License v3.0 | 4 votes |
public String getQuotedSchema(Dialect dialect) { return schemaQuoted ? dialect.openQuote() + schema + dialect.closeQuote() : schema; }
Example 15
Source File: Table.java From Knowage-Server with GNU Affero General Public License v3.0 | 4 votes |
public String getQuotedName(Dialect dialect) { return quoted ? dialect.openQuote() + name + dialect.closeQuote() : name; }
Example 16
Source File: Table.java From Knowage-Server with GNU Affero General Public License v3.0 | 4 votes |
public String getQuotedCatalog(Dialect dialect) { return catalogQuoted ? dialect.openQuote() + catalog + dialect.closeQuote() : catalog; }
Example 17
Source File: Table.java From Knowage-Server with GNU Affero General Public License v3.0 | 4 votes |
public String getQuotedSchema(Dialect dialect) { return schemaQuoted ? dialect.openQuote() + schema + dialect.closeQuote() : schema; }
Example 18
Source File: Table.java From Knowage-Server with GNU Affero General Public License v3.0 | 4 votes |
public String getQuotedName(Dialect dialect) { return quoted ? dialect.openQuote() + name + dialect.closeQuote() : name; }
Example 19
Source File: Column.java From cacheonix-core with GNU Lesser General Public License v2.1 | 4 votes |
public String getQuotedName(Dialect d) { return quoted ? d.openQuote() + name + d.closeQuote() : name; }
Example 20
Source File: StringHelper.java From lams with GNU General Public License v2.0 | 3 votes |
/** * Determine if the given name is quoted. It is considered quoted if either: * <ol> * <li>starts AND ends with backticks (`)</li> * <li>starts with dialect-specified {@link org.hibernate.dialect.Dialect#openQuote() open-quote} * AND ends with dialect-specified {@link org.hibernate.dialect.Dialect#closeQuote() close-quote}</li> * </ol> * * @param name The name to check * @param dialect The dialect (to determine the "real" quoting chars). * * @return True if quoted, false otherwise */ public static boolean isQuoted(String name, Dialect dialect) { return name != null && name.length() != 0 && ( ( name.charAt( 0 ) == '`' && name.charAt( name.length() - 1 ) == '`' ) || ( name.charAt( 0 ) == '"' && name.charAt( name.length() - 1 ) == '"' ) || ( name.charAt( 0 ) == dialect.openQuote() && name.charAt( name.length() - 1 ) == dialect.closeQuote() ) ); }