com.univocity.api.entity.jdbc
Class DefaultEscaper

java.lang.Object
  extended by com.univocity.api.entity.jdbc.IdentifierEscaper
      extended by com.univocity.api.entity.jdbc.DefaultEscaper

public class DefaultEscaper
extends IdentifierEscaper

A default implementation of an IdentifierEscaper

Author:
uniVocity Software Pty Ltd - dev@univocity.com
See Also:
JdbcDataStoreConfiguration, SqlProducer, IdentifierEscaper

Constructor Summary
DefaultEscaper()
          Creates an IdentifierEscaper that encloses identifiers within double quotes.
DefaultEscaper(char escape)
          Creates an IdentifierEscaper that encloses identifiers within a given escape character.
DefaultEscaper(String escape)
          Creates an IdentifierEscaper that encloses identifiers within a given escape sequence.
DefaultEscaper(String escapeStart, String escapeEnd)
          Creates an IdentifierEscaper that encloses identifiers in a specific escape sequence (possibly an escape function).
 
Method Summary
 boolean alwaysEscape()
          Should uniVocity always escape all identifiers in SQL statements?
 String escape(String reservedWord)
          Escapes identifier names to avoid producing SQL statements with conflicting names.
 void setAlwaysEscape(boolean escapeAlways)
          Configures this IdentifierEscaper to escape non-reserved words as well as reserved words in SQL statements.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultEscaper

public DefaultEscaper()
Creates an IdentifierEscaper that encloses identifiers within double quotes.


DefaultEscaper

public DefaultEscaper(char escape)
Creates an IdentifierEscaper that encloses identifiers within a given escape character.

Parameters:
escape - The escape character that will enclose identifiers in SQL statements generated by uniVocity

DefaultEscaper

public DefaultEscaper(String escape)
Creates an IdentifierEscaper that encloses identifiers within a given escape sequence.

Parameters:
escape - The escape sequence that will enclose identifiers in SQL statements generated by uniVocity

DefaultEscaper

public DefaultEscaper(String escapeStart,
                      String escapeEnd)
Creates an IdentifierEscaper that encloses identifiers in a specific escape sequence (possibly an escape function).

Parameters:
escapeStart - The prefix of the escape sequence that will enclose identifiers in SQL statements generated by uniVocity
escapeEnd - The suffix of the escape sequence that will enclose identifiers in SQL statements generated by uniVocity
Method Detail

alwaysEscape

public boolean alwaysEscape()
Description copied from class: IdentifierEscaper
Should uniVocity always escape all identifiers in SQL statements?

Specified by:
alwaysEscape in class IdentifierEscaper
Returns:
true if all identifiers must be escaped by default, otherwise false.

setAlwaysEscape

public void setAlwaysEscape(boolean escapeAlways)
Configures this IdentifierEscaper to escape non-reserved words as well as reserved words in SQL statements.

Parameters:
escapeAlways - a flag indicating whether or not all identifiers should be enclosed within the configured escape sequence in SQL statements generated by uniVocity.

escape

public String escape(String reservedWord)
Description copied from class: IdentifierEscaper
Escapes identifier names to avoid producing SQL statements with conflicting names.

Specified by:
escape in class IdentifierEscaper
Parameters:
reservedWord - The table or column name that must be escaped
Returns:
the escaped version of the identifier


Copyright © 2015 uniVocity Software Pty Ltd. All rights reserved.