com.im.commons 5.9

com.im.commons.db
Class TermEncoder

java.lang.Object
  extended by com.im.commons.db.TermEncoder

public abstract class TermEncoder
extends Object

Service, that encodes a value into a String literal suitable for the database type. Implemented by individual DB providers to provide DB-specific syntax.


Constructor Summary
TermEncoder()
           
 
Method Summary
 boolean canEncode(int sqlType)
          Whether it can encode something as String
 String encodeColumnRef(String columnName)
          Encodes reference to a column name
abstract  String encodeIdentifier(String id)
          Encodes an identifier
abstract  String encodeLiteral(Object value, int colType)
          Encodes the literal 'value' in a form suitable for the desired column type (colType)
 String encodeParamReference(String paramName, int sqlType)
           
 String encodeTableColumnRef(String tableName, String columnName, String identifierQuoteString)
           
 String encodeTableRef(String tableName)
          Encodes reference to a table name
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TermEncoder

public TermEncoder()
Method Detail

encodeLiteral

public abstract String encodeLiteral(Object value,
                                     int colType)
                              throws IllegalArgumentException
Encodes the literal 'value' in a form suitable for the desired column type (colType)

Parameters:
value - The literal value, possibly null
colType -
Throws:
IllegalArgumentException

encodeIdentifier

public abstract String encodeIdentifier(String id)
                                 throws IllegalArgumentException
Encodes an identifier

Parameters:
id -
Throws:
IllegalArgumentException

encodeTableRef

public String encodeTableRef(String tableName)
Encodes reference to a table name

Parameters:
tableName -
Returns:
The valid identifier (table reference)

encodeColumnRef

public String encodeColumnRef(String columnName)
Encodes reference to a column name

Parameters:
columnName -
Returns:
The valid identifier (column reference)

encodeTableColumnRef

public String encodeTableColumnRef(String tableName,
                                   String columnName,
                                   String identifierQuoteString)

encodeParamReference

public String encodeParamReference(String paramName,
                                   int sqlType)

canEncode

public boolean canEncode(int sqlType)
Whether it can encode something as String

Parameters:
sqlType -

com.im.commons 5.9