Class IdentifierEscaper

  extended by com.univocity.api.entity.jdbc.IdentifierEscaper
Direct Known Subclasses:

public abstract class IdentifierEscaper
extends Object

A class responsible for escaping table and column names that can be reserved words in SQL statements.

For example, a column named max must be escaped so it doesn't conflict with the max function provided by most (if not all) databases.
Additionally a table might have columns whose names contain white spaces such as "purchase date", or even repeated column names in different case: "Max", "mAx".
For these cases, most databases require enclosing the column name within quotes. A valid select statement will then be:

SELECT "Max", "mAx, "purchase date" FROM table

Before producing an SQL statement, uniVocity will identify whether a table or column name requires escaping. If it is required, the escape(String) method will be called to obtain a column name.

uniVocity will escape most common reserved words used by different database vendors, but you might want to provide additional identifiers.
Use JdbcDataStoreConfiguration.addReservedWordsToEscape(String...) to provide any additional reserved words to be escaped in your JDBC data store.

If alwaysEscape() returns true, then the SQL statements produced by uniVocity for this JDBC data store will always escape column and table names.

uniVocity Software Pty Ltd -
See Also:
JdbcDataStoreConfiguration, SqlProducer, DefaultEscaper

Constructor Summary
Method Summary
abstract  boolean alwaysEscape()
          Should uniVocity always escape all identifiers in SQL statements?
abstract  String escape(String identifier)
          Escapes identifier names to avoid producing SQL statements with conflicting names.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public IdentifierEscaper()
Method Detail


public abstract String escape(String identifier)
Escapes identifier names to avoid producing SQL statements with conflicting names.

identifier - The table or column name that must be escaped
the escaped version of the identifier


public abstract boolean alwaysEscape()
Should uniVocity always escape all identifiers in SQL statements?

true if all identifiers must be escaped by default, otherwise false.

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